From 9def867b975eece6e6df05c22cc907da5d1d965d Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 23 Feb 2010 21:09:51 +0000 Subject: [rdc] add preliminary 2.6.32 support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19826 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../rdc/patches-2.6.32/001-rdc3210_flash_map.patch | 63 ++++++++ .../rdc/patches-2.6.32/002-platform_support.patch | 12 ++ .../rdc/patches-2.6.32/004-yenta_mystery.patch | 20 +++ .../rdc/patches-2.6.32/005-fix_amit_breakage.patch | 40 +++++ .../rdc/patches-2.6.32/008-r8610_flash_map.patch | 25 +++ .../009-rdc321x_select_embedded.patch | 11 ++ .../rdc/patches-2.6.32/010-rdc_cpu_ident.patch | 176 +++++++++++++++++++++ 7 files changed, 347 insertions(+) create mode 100644 target/linux/rdc/patches-2.6.32/001-rdc3210_flash_map.patch create mode 100644 target/linux/rdc/patches-2.6.32/002-platform_support.patch create mode 100644 target/linux/rdc/patches-2.6.32/004-yenta_mystery.patch create mode 100644 target/linux/rdc/patches-2.6.32/005-fix_amit_breakage.patch create mode 100644 target/linux/rdc/patches-2.6.32/008-r8610_flash_map.patch create mode 100644 target/linux/rdc/patches-2.6.32/009-rdc321x_select_embedded.patch create mode 100644 target/linux/rdc/patches-2.6.32/010-rdc_cpu_ident.patch (limited to 'target/linux/rdc/patches-2.6.32') diff --git a/target/linux/rdc/patches-2.6.32/001-rdc3210_flash_map.patch b/target/linux/rdc/patches-2.6.32/001-rdc3210_flash_map.patch new file mode 100644 index 000000000..01b416260 --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/001-rdc3210_flash_map.patch @@ -0,0 +1,63 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -114,6 +114,50 @@ config MTD_SUN_UFLASH + Sun Microsystems boardsets. This driver will require CFI support + in the kernel, so if you did not enable CFI previously, do that now. + ++config MTD_RDC3210 ++ tristate "CFI Flash device mapped on RDC3210" ++ depends on X86 && MTD_CFI && MTD_PARTITIONS ++ help ++ RDC-3210 is the flash device we find on Ralink reference board. ++ ++config MTD_RDC3210_STATIC_MAP ++ bool "Partitions on RDC3210 mapped statically" if MTD_RDC3210 ++ select MTD_RDC3210_FACTORY_PRESENT ++ help ++ The mapping driver will use the static partition map for the ++ RDC-3210 flash device. ++ ++config MTD_RDC3210_FACTORY_PRESENT ++ bool "Reserve a partition on RDC3210 for factory presets" ++ depends on MTD_RDC3210 ++ default y ++ help ++ The mapping driver will reserve a partition on the RDC-3210 flash ++ device for resetting flash contents to factory defaults. ++ ++config MTD_RDC3210_ALLOW_JFFS2 ++ bool "JFFS2 filesystem usable in a partition on RDC3210" ++ depends on MTD_RDC3210 && !MTD_RDC3210_STATIC_MAP ++ help ++ The mapping driver will align a partition on the RDC-3210 flash ++ device to an erase-block boundary so that a JFFS2 filesystem may ++ reside on it. ++ ++config MTD_RDC3210_SIZE ++ hex "Amount of flash memory on RDC3210" ++ depends on MTD_RDC3210 ++ default "0x400000" ++ help ++ Total size in bytes of the RDC-3210 flash device ++ ++config MTD_RDC3210_BUSWIDTH ++ int "Width of CFI Flash device mapped on RDC3210" ++ depends on MTD_RDC3210 ++ default "2" ++ help ++ Number of bytes addressed on the RDC-3210 flash device before ++ addressing the same chip again ++ + config MTD_SC520CDP + tristate "CFI Flash device mapped on AMD SC520 CDP" + depends on X86 && MTD_CFI && MTD_CONCAT +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_MTD_PHYSMAP) += physmap.o + obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o + obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o + obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o ++obj-$(CONFIG_MTD_RDC3210) += rdc3210.o + obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o + obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o + obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o diff --git a/target/linux/rdc/patches-2.6.32/002-platform_support.patch b/target/linux/rdc/patches-2.6.32/002-platform_support.patch new file mode 100644 index 000000000..26b732a3f --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/002-platform_support.patch @@ -0,0 +1,12 @@ +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -125,6 +125,9 @@ libs-y += arch/x86/lib/ + # See arch/x86/Kbuild for content of core part of the kernel + core-y += arch/x86/ + ++# RDC R-321X support ++core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ ++ + # drivers-y are linked after core-y + drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ + drivers-$(CONFIG_PCI) += arch/x86/pci/ diff --git a/target/linux/rdc/patches-2.6.32/004-yenta_mystery.patch b/target/linux/rdc/patches-2.6.32/004-yenta_mystery.patch new file mode 100644 index 000000000..92589ea54 --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/004-yenta_mystery.patch @@ -0,0 +1,20 @@ +--- a/drivers/pcmcia/yenta_socket.c ++++ b/drivers/pcmcia/yenta_socket.c +@@ -1174,6 +1174,17 @@ static int __devinit yenta_probe (struct + + /* We must finish initialization here */ + ++#ifdef CONFIG_X86_RDC321X ++/* #define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0044f044 */ ++#define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0844b060 ++/* #define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0044d044 */ ++ ++ config_writel(socket, 32*4, YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK); ++ config_writel(socket, 35*4, 0x00000022); ++ config_writel(socket, 36*4, 0x60200000); ++ config_writel(socket, 40*4, 0x7e020000); ++#endif ++ + if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket)) { + /* No IRQ or request_irq failed. Poll */ + socket->cb_irq = 0; /* But zero is a valid IRQ number. */ diff --git a/target/linux/rdc/patches-2.6.32/005-fix_amit_breakage.patch b/target/linux/rdc/patches-2.6.32/005-fix_amit_breakage.patch new file mode 100644 index 000000000..decaf8c44 --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/005-fix_amit_breakage.patch @@ -0,0 +1,40 @@ +--- a/arch/x86/boot/boot.h ++++ b/arch/x86/boot/boot.h +@@ -64,7 +64,7 @@ static inline void outl(u32 v, u16 port) + { + asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); + } +-static inline u32 inl(u32 port) ++static inline u32 inl(u16 port) + { + u32 v; + asm volatile("inl %1,%0" : "=a" (v) : "dN" (port)); +--- a/arch/x86/boot/pm.c ++++ b/arch/x86/boot/pm.c +@@ -14,6 +14,9 @@ + + #include "boot.h" + #include ++#ifdef CONFIG_X86_RDC321X ++#include ++#endif + + /* + * Invoke the realmode switch hook if present; otherwise +@@ -112,6 +115,16 @@ void go_to_protected_mode(void) + die(); + } + ++#ifdef CONFIG_X86_RDC321X ++ { ++ u32 bootctl; ++ ++ outl(0x80003840, RDC3210_CFGREG_ADDR); ++ bootctl = inl(RDC3210_CFGREG_DATA) | 0x07ff0000; ++ outl(bootctl, RDC3210_CFGREG_DATA); ++ } ++#endif ++ + /* Reset coprocessor (IGNNE#) */ + reset_coprocessor(); + diff --git a/target/linux/rdc/patches-2.6.32/008-r8610_flash_map.patch b/target/linux/rdc/patches-2.6.32/008-r8610_flash_map.patch new file mode 100644 index 000000000..0f06beb09 --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/008-r8610_flash_map.patch @@ -0,0 +1,25 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -158,6 +158,12 @@ config MTD_RDC3210_BUSWIDTH + Number of bytes addressed on the RDC-3210 flash device before + addressing the same chip again + ++config MTD_R8610 ++ tristate "CFI flash device mapped on R8610" ++ depends on X86 && MTD_CFI && MTD_PARTITIONS ++ help ++ Flash support for the RDC R8610 evaluation board. ++ + config MTD_SC520CDP + tristate "CFI Flash device mapped on AMD SC520 CDP" + depends on X86 && MTD_CFI && MTD_CONCAT +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -27,6 +27,7 @@ obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_ + obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o + obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o + obj-$(CONFIG_MTD_RDC3210) += rdc3210.o ++obj-$(CONFIG_MTD_R8610) += r8610.o + obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o + obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o + obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o diff --git a/target/linux/rdc/patches-2.6.32/009-rdc321x_select_embedded.patch b/target/linux/rdc/patches-2.6.32/009-rdc321x_select_embedded.patch new file mode 100644 index 000000000..625dc6531 --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/009-rdc321x_select_embedded.patch @@ -0,0 +1,11 @@ +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -400,6 +400,8 @@ config X86_RDC321X + depends on X86_EXTENDED_PLATFORM + select M486 + select X86_REBOOTFIXUPS ++ select EMBEDDED ++ select ARCH_REQUIRE_GPIOLIB + ---help--- + This option is needed for RDC R-321x system-on-chip, also known + as R-8610-(G). diff --git a/target/linux/rdc/patches-2.6.32/010-rdc_cpu_ident.patch b/target/linux/rdc/patches-2.6.32/010-rdc_cpu_ident.patch new file mode 100644 index 000000000..918daf10d --- /dev/null +++ b/target/linux/rdc/patches-2.6.32/010-rdc_cpu_ident.patch @@ -0,0 +1,176 @@ +--- /dev/null ++++ b/Documentation/x86/rdc.txt +@@ -0,0 +1,69 @@ ++ ++Introduction ++============ ++ ++RDC (http://www.rdc.com.tw) have been manufacturing x86-compatible SoC ++(system-on-chips) for a number of years. They are not the fastest of ++CPUs (clock speeds ranging from 133-150MHz) but 486SX compatibility ++coupled with very low power consumption[1] and low cost make them ideal ++for embedded applications. ++ ++ ++Where to find ++============= ++ ++RDC chips show up in numerous embedded devices, but be careful since ++many of them will not run Linux 2.6 without significant expertise. ++ ++There are several variants of what the linux kernel refers to generically ++as RDC321X: R8610, R321x, S3282 and AMRISC20000. ++ ++R321x: Found in various routers, see the OpenWrt project for details, ++ http://wiki.openwrt.org/oldwiki/rdcport ++ ++R8610: Found on the RDC evaluation board ++ http://www.ivankuten.com/system-on-chip-soc/rdc-r8610/ ++ ++AMRISC20000: Found in the MGB-100 wireless hard disk ++ http://tintuc.no-ip.com/linux/tipps/mgb100/ ++ ++S3282: Found in various NAS devices, including the Bifferboard ++ http://www.bifferos.com ++ ++ ++Kernel Configuration ++==================== ++ ++Add support for this CPU with CONFIG_X86_RDC321X. Ensure that maths ++emulation is included (CONFIG_MATH_EMULATION selected) and avoid MCE ++(CONFIG_X86_MCE not selected). ++ ++ ++CPU detection ++============= ++ ++None of these chips support the cpuid instruction, so as with some ++other x86 compatible SoCs, we must check the north bridge and look ++for specific 'signature' PCI device config. ++ ++The current detection code has been tested only on the Bifferboard ++(S3282 CPU), please send bug reports or success stories with ++other devices to bifferos@yahoo.co.uk. ++ ++ ++Credits ++======= ++ ++Many thanks to RDC for providing the customer codes to allow ++detection of all known variants, without which this detection code ++would have been very hard to ascertain. ++ ++ ++References ++========== ++ ++[1] S3282 in certain NAS solutions consumes less than 1W ++ ++ ++mark@bifferos.com 2009 ++ +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -398,6 +398,7 @@ config X86_RDC321X + bool "RDC R-321x SoC" + depends on X86_32 + depends on X86_EXTENDED_PLATFORM ++ select PCI + select M486 + select X86_REBOOTFIXUPS + select EMBEDDED +--- a/arch/x86/include/asm/processor.h ++++ b/arch/x86/include/asm/processor.h +@@ -122,7 +122,8 @@ struct cpuinfo_x86 { + #define X86_VENDOR_CENTAUR 5 + #define X86_VENDOR_TRANSMETA 7 + #define X86_VENDOR_NSC 8 +-#define X86_VENDOR_NUM 9 ++#define X86_VENDOR_RDC 9 ++#define X86_VENDOR_NUM 10 + + #define X86_VENDOR_UNKNOWN 0xff + +--- a/arch/x86/kernel/cpu/Makefile ++++ b/arch/x86/kernel/cpu/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix + obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o + obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o + obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o ++obj-$(CONFIG_X86_RDC321X) += rdc.o + + obj-$(CONFIG_PERF_EVENTS) += perf_event.o + +--- /dev/null ++++ b/arch/x86/kernel/cpu/rdc.c +@@ -0,0 +1,69 @@ ++/* ++ * See Documentation/x86/rdc.txt ++ * ++ * mark@bifferos.com ++ */ ++ ++#include ++#include ++#include "cpu.h" ++ ++ ++static void __cpuinit rdc_identify(struct cpuinfo_x86 *c) ++{ ++ u16 vendor, device; ++ u32 customer_id; ++ ++ if (!early_pci_allowed()) ++ return; ++ ++ /* RDC CPU is SoC (system-on-chip), Northbridge is always present */ ++ vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID); ++ device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID); ++ ++ if (vendor != PCI_VENDOR_ID_RDC || device != PCI_DEVICE_ID_RDC_R6020) ++ return; /* not RDC */ ++ /* ++ * NB: We could go on and check other devices, e.g. r6040 NIC, but ++ * that's probably overkill ++ */ ++ ++ customer_id = read_pci_config(0, 0, 0, 0x90); ++ ++ switch (customer_id) { ++ /* id names are from RDC */ ++ case 0x00321000: ++ strcpy(c->x86_model_id, "R3210/R3211"); ++ break; ++ case 0x00321001: ++ strcpy(c->x86_model_id, "AMITRISC20000/20010"); ++ break; ++ case 0x00321002: ++ strcpy(c->x86_model_id, "R3210X/Edimax"); ++ break; ++ case 0x00321003: ++ strcpy(c->x86_model_id, "R3210/Kcodes"); ++ break; ++ case 0x00321004: /* tested */ ++ strcpy(c->x86_model_id, "S3282/CodeTek"); ++ break; ++ case 0x00321007: ++ strcpy(c->x86_model_id, "R8610"); ++ break; ++ default: ++ pr_info("RDC CPU: Unrecognised Customer ID (0x%x) please report to linux-kernel@vger.kernel.org\n", customer_id); ++ return; ++ } ++ ++ strcpy(c->x86_vendor_id, "RDC"); ++ c->x86_vendor = X86_VENDOR_RDC; ++} ++ ++static const struct cpu_dev __cpuinitconst rdc_cpu_dev = { ++ .c_vendor = "RDC", ++ .c_ident = { "RDC" }, ++ .c_identify = rdc_identify, ++ .c_x86_vendor = X86_VENDOR_RDC, ++}; ++ ++cpu_dev_register(rdc_cpu_dev); -- cgit v1.2.3