aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/rbtx4939/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9/rbtx4939/setup.c')
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c43
1 files changed, 43 insertions, 0 deletions
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