Hi All,

Below is a patch that gets the smc91c111 ethernet controller on
the M5249 board running. It is reasonably simple, but this code
does rely on the ColdFire interrupt changes I am working on as well
to be applied first. So this is really just for example purposes
at the moment.

There is one additional change needed on this to properly
acknowledge the interrupts from the smc91c111. And I have some
up-coming interrupt controller changes that will actually clean
this up properly - so I haven't included that change here now.

Note: this patch was generated against linux-2.6.30-rc5.

Regards
Greg



--- git.linux-2.6.x.4/drivers/net/smc91x.h 2009-04-17 22:53:23.000000000 +1000
+++ linux-2.6.x/drivers/net/smc91x.h    2009-05-20 14:59:45.000000000 +1000
@@ -371,6 +371,34 @@ static inline void LPD7_SMC_outsw (unsig

 #include <unit/smc91111.h>

+#elif defined(CONFIG_COLDFIRE)
+
+#define SMC_CAN_USE_8BIT       0
+#define SMC_CAN_USE_16BIT      1
+#define SMC_CAN_USE_32BIT      0
+#define SMC_NOWAIT             1
+
+static inline void mcf_insw(void *a, unsigned char *p, int l)
+{
+       u16 *wp = (u16 *) p;
+       while (l-- > 0)
+               *wp++ = readw(a);
+}
+
+static inline void mcf_outsw(void *a, unsigned char *p, int l)
+{
+       u16 *wp = (u16 *) p;
+       while (l-- > 0)
+               writew(*wp++, a);
+}
+
+#define SMC_inw(a, r)          _swapw(readw((a) + (r)))
+#define SMC_outw(v, a, r)      writew(_swapw(v), (a) + (r))
+#define SMC_insw(a, r, p, l)   mcf_insw(a + r, p, l)
+#define SMC_outsw(a, r, p, l)  mcf_outsw(a + r, p, l)
+
+#define SMC_IRQ_FLAGS          (IRQF_DISABLED)
+
 #else

 /*
--- git.linux-2.6.x.4/arch/m68knommu/platform/5249/config.c 2009-05-19 11:45:50.000000000 +1000 +++ linux-2.6.x/arch/m68knommu/platform/5249/config.c 2009-05-21 14:11:00.000000000 +1000
@@ -42,8 +42,35 @@ static struct platform_device m5249_uart
        .dev.platform_data      = m5249_uart_platform,
 };

+#ifdef CONFIG_M5249
+
+static struct resource m5249_smc91x_resources[] = {
+       {
+               .start          = 0xe0000300,
+               .end            = 0xe0000300 + 0x100,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = 166,
+               .end            = 166,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device m5249_smc91x = {
+       .name                   = "smc91x",
+       .id                     = 0,
+       .num_resources          = ARRAY_SIZE(m5249_smc91x_resources),
+       .resource               = m5249_smc91x_resources,
+};
+
+#endif /* CONFIG_M5249 */
+
 static struct platform_device *m5249_devices[] __initdata = {
        &m5249_uart,
+#ifdef CONFIG_M5249
+       &m5249_smc91x,
+#endif
 };


/***************************************************************************/
@@ -72,6 +99,24 @@ static void __init m5249_uarts_init(void


/***************************************************************************/

+#ifdef CONFIG_M5249
+
+static void __init m5249_smc91x_init(void)
+{
+       u32  gpio;
+
+       /* Set the GPIO line as interrupt source for smc91x device */
+       gpio = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE);
+       writel(gpio | 0x40, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE);
+
+       gpio = readl(MCF_MBAR2 + MCFSIM2_INTLEVEL5);
+       writel(gpio | 0x04000000, MCF_MBAR2 + MCFSIM2_INTLEVEL5);
+}
+
+#endif /* CONFIG_M5249 */
+
+/***************************************************************************/
+
 static void __init m5249_timers_init(void)
 {
        /* Timer1 is always used as system timer */
@@ -98,6 +143,9 @@ void __init config_BSP(char *commandp, i
 static int __init init_BSP(void)
 {
        m5249_uarts_init();
+#ifdef CONFIG_M5249
+       m5249_smc91x_init();
+#endif
        platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices));
        return 0;
 }



------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to