aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/mach-tx49xx/mangle-port.h26
-rw-r--r--arch/mips/txx9/generic/setup.c15
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c43
3 files changed, 84 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-tx49xx/mangle-port.h b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
new file mode 100644
index 000000000000..5e6912fdd0ed
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_MACH_TX49XX_MANGLE_PORT_H
2#define __ASM_MACH_TX49XX_MANGLE_PORT_H
3
4#define __swizzle_addr_b(port) (port)
5#define __swizzle_addr_w(port) (port)
6#define __swizzle_addr_l(port) (port)
7#define __swizzle_addr_q(port) (port)
8
9#define ioswabb(a, x) (x)
10#define __mem_ioswabb(a, x) (x)
11#if defined(CONFIG_TOSHIBA_RBTX4939) && \
12 (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) && \
13 defined(__BIG_ENDIAN)
14#define NEEDS_TXX9_IOSWABW
15extern u16 (*ioswabw)(volatile u16 *a, u16 x);
16extern u16 (*__mem_ioswabw)(volatile u16 *a, u16 x);
17#else
18#define ioswabw(a, x) le16_to_cpu(x)
19#define __mem_ioswabw(a, x) (x)
20#endif
21#define ioswabl(a, x) le32_to_cpu(x)
22#define __mem_ioswabl(a, x) (x)
23#define ioswabq(a, x) le64_to_cpu(x)
24#define __mem_ioswabq(a, x) (x)
25
26#endif /* __ASM_MACH_TX49XX_MANGLE_PORT_H */
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;
622EXPORT_SYMBOL(__swizzle_addr_b); 622EXPORT_SYMBOL(__swizzle_addr_b);
623#endif 623#endif
624 624
625#ifdef NEEDS_TXX9_IOSWABW
626static u16 ioswabw_default(volatile u16 *a, u16 x)
627{
628 return le16_to_cpu(x);
629}
630static u16 __mem_ioswabw_default(volatile u16 *a, u16 x)
631{
632 return x;
633}
634u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default;
635EXPORT_SYMBOL(ioswabw);
636u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default;
637EXPORT_SYMBOL(__mem_ioswabw);
638#endif
639
625void __init txx9_physmap_flash_init(int no, unsigned long addr, 640void __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))
43static u16 rbtx4939_ioswabw(volatile u16 *a, u16 x)
44{
45 return IS_CE1_ADDR(a) ? x : le16_to_cpu(x);
46}
47static 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
36static void __init rbtx4939_pci_setup(void) 53static 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
273static void __init rbtx4939_device_init(void) 290static 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