diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2008-10-20 11:01:06 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-10-27 12:18:27 -0400 |
commit | 1ba5a1767416cfa4fa37096e160e764c56e1460a (patch) | |
tree | 8feceebc290143f5fc4e77700836a93a155178be /arch/mips/txx9 | |
parent | bc89b2bdefa5f56133d0b19a220880d4ada62560 (diff) |
MIPS: RBTX4939: Add smc91x support
Add smc91x platform device to RBTX4939 board and some hacks for big endian.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/txx9')
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 15 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4939/setup.c | 43 |
2 files changed, 58 insertions, 0 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 5526375010f8..18086c549573 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -622,6 +622,21 @@ unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; | |||
622 | EXPORT_SYMBOL(__swizzle_addr_b); | 622 | EXPORT_SYMBOL(__swizzle_addr_b); |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | #ifdef NEEDS_TXX9_IOSWABW | ||
626 | static u16 ioswabw_default(volatile u16 *a, u16 x) | ||
627 | { | ||
628 | return le16_to_cpu(x); | ||
629 | } | ||
630 | static u16 __mem_ioswabw_default(volatile u16 *a, u16 x) | ||
631 | { | ||
632 | return x; | ||
633 | } | ||
634 | u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default; | ||
635 | EXPORT_SYMBOL(ioswabw); | ||
636 | u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default; | ||
637 | EXPORT_SYMBOL(__mem_ioswabw); | ||
638 | #endif | ||
639 | |||
625 | void __init txx9_physmap_flash_init(int no, unsigned long addr, | 640 | void __init txx9_physmap_flash_init(int no, unsigned long addr, |
626 | unsigned long size, | 641 | unsigned long size, |
627 | const struct physmap_flash_data *pdata) | 642 | const struct physmap_flash_data *pdata) |
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c index c88517774910..6daee9b1cd5e 100644 --- a/arch/mips/txx9/rbtx4939/setup.c +++ b/arch/mips/txx9/rbtx4939/setup.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/leds.h> | 16 | #include <linux/leds.h> |
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/smc91x.h> | ||
17 | #include <asm/reboot.h> | 19 | #include <asm/reboot.h> |
18 | #include <asm/txx9/generic.h> | 20 | #include <asm/txx9/generic.h> |
19 | #include <asm/txx9/pci.h> | 21 | #include <asm/txx9/pci.h> |
@@ -33,6 +35,21 @@ static void __init rbtx4939_time_init(void) | |||
33 | tx4939_time_init(0); | 35 | tx4939_time_init(0); |
34 | } | 36 | } |
35 | 37 | ||
38 | #if defined(__BIG_ENDIAN) && \ | ||
39 | (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) | ||
40 | #define HAVE_RBTX4939_IOSWAB | ||
41 | #define IS_CE1_ADDR(addr) \ | ||
42 | ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) | ||
43 | static u16 rbtx4939_ioswabw(volatile u16 *a, u16 x) | ||
44 | { | ||
45 | return IS_CE1_ADDR(a) ? x : le16_to_cpu(x); | ||
46 | } | ||
47 | static u16 rbtx4939_mem_ioswabw(volatile u16 *a, u16 x) | ||
48 | { | ||
49 | return !IS_CE1_ADDR(a) ? x : le16_to_cpu(x); | ||
50 | } | ||
51 | #endif /* __BIG_ENDIAN && CONFIG_SMC91X */ | ||
52 | |||
36 | static void __init rbtx4939_pci_setup(void) | 53 | static void __init rbtx4939_pci_setup(void) |
37 | { | 54 | { |
38 | #ifdef CONFIG_PCI | 55 | #ifdef CONFIG_PCI |
@@ -272,6 +289,22 @@ static void __init rbtx4939_arch_init(void) | |||
272 | 289 | ||
273 | static void __init rbtx4939_device_init(void) | 290 | static void __init rbtx4939_device_init(void) |
274 | { | 291 | { |
292 | unsigned long smc_addr = RBTX4939_ETHER_ADDR - IO_BASE; | ||
293 | struct resource smc_res[] = { | ||
294 | { | ||
295 | .start = smc_addr, | ||
296 | .end = smc_addr + 0x10 - 1, | ||
297 | .flags = IORESOURCE_MEM, | ||
298 | }, { | ||
299 | .start = RBTX4939_IRQ_ETHER, | ||
300 | /* override default irq flag defined in smc91x.h */ | ||
301 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
302 | }, | ||
303 | }; | ||
304 | struct smc91x_platdata smc_pdata = { | ||
305 | .flags = SMC91X_USE_16BIT, | ||
306 | }; | ||
307 | struct platform_device *pdev; | ||
275 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) | 308 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) |
276 | int i, j; | 309 | int i, j; |
277 | unsigned char ethaddr[2][6]; | 310 | unsigned char ethaddr[2][6]; |
@@ -288,6 +321,12 @@ static void __init rbtx4939_device_init(void) | |||
288 | } | 321 | } |
289 | tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); | 322 | tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); |
290 | #endif | 323 | #endif |
324 | pdev = platform_device_alloc("smc91x", -1); | ||
325 | if (!pdev || | ||
326 | platform_device_add_resources(pdev, smc_res, ARRAY_SIZE(smc_res)) || | ||
327 | platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) || | ||
328 | platform_device_add(pdev)) | ||
329 | platform_device_put(pdev); | ||
291 | rbtx4939_led_setup(); | 330 | rbtx4939_led_setup(); |
292 | tx4939_wdt_init(); | 331 | tx4939_wdt_init(); |
293 | tx4939_ata_init(); | 332 | tx4939_ata_init(); |
@@ -304,6 +343,10 @@ static void __init rbtx4939_setup(void) | |||
304 | if (txx9_master_clock == 0) | 343 | if (txx9_master_clock == 0) |
305 | txx9_master_clock = 20000000; | 344 | txx9_master_clock = 20000000; |
306 | tx4939_setup(); | 345 | tx4939_setup(); |
346 | #ifdef HAVE_RBTX4939_IOSWAB | ||
347 | ioswabw = rbtx4939_ioswabw; | ||
348 | __mem_ioswabw = rbtx4939_mem_ioswabw; | ||
349 | #endif | ||
307 | 350 | ||
308 | _machine_restart = rbtx4939_machine_restart; | 351 | _machine_restart = rbtx4939_machine_restart; |
309 | 352 | ||