]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
m68knommu: merge common ColdFire FEC platform setup code
authorGreg Ungerer <gerg@uclinux.org>
Sat, 24 Dec 2011 00:30:36 +0000 (10:30 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Sun, 4 Mar 2012 23:43:08 +0000 (09:43 +1000)
The ColdFire FEC is common to quite a few ColdFire CPUs. No need to duplicate
its platform setup code for every CPU family member that has it. Merge all the
setup code into a single shared file.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
arch/m68k/platform/520x/config.c
arch/m68k/platform/523x/config.c
arch/m68k/platform/5272/config.c
arch/m68k/platform/527x/config.c
arch/m68k/platform/528x/config.c
arch/m68k/platform/532x/config.c
arch/m68k/platform/coldfire/device.c

index 5111902cb274d3c60e8f3c9d2a201f973dcc4924..5746fa52ed56d1a587d0559057dc12ae9802568b 100644 (file)
 
 /***************************************************************************/
 
-static struct resource m520x_fec_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FEXRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m520x_fec = {
-       .name                   = "fec",
-       .id                     = 0,
-       .num_resources          = ARRAY_SIZE(m520x_fec_resources),
-       .resource               = m520x_fec_resources,
-};
-
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
 static struct resource m520x_qspi_resources[] = {
        {
@@ -196,7 +166,6 @@ static void __init m520x_qspi_init(void)
 
 
 static struct platform_device *m520x_devices[] __initdata = {
-       &m520x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m520x_qspi,
 #endif
index 2a1dcade0c0293b2dfc3cfb2e212754a47ae6d40..900d35c49ebf7ec4e556522e1ad0ced13f92e3d2 100644 (file)
 
 /***************************************************************************/
 
-static struct resource m523x_fec_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m523x_fec = {
-       .name                   = "fec",
-       .id                     = 0,
-       .num_resources          = ARRAY_SIZE(m523x_fec_resources),
-       .resource               = m523x_fec_resources,
-};
-
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
 static struct resource m523x_qspi_resources[] = {
        {
@@ -258,7 +228,6 @@ void __init config_BSP(char *commandp, int size)
 
 static int __init init_BSP(void)
 {
-       m523x_fec_init();
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        m523x_qspi_init();
 #endif
index 4b6bc60baee3aa21fee3fabea4b9df924d1adf0b..e68bc7a148eb1b15f3b511fbfaf1e94bbc9eca77 100644 (file)
@@ -30,42 +30,6 @@ unsigned char ledbank = 0xff;
 
 /***************************************************************************/
 
-static struct resource m5272_fec_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m5272_fec = {
-       .name                   = "fec",
-       .id                     = 0,
-       .num_resources          = ARRAY_SIZE(m5272_fec_resources),
-       .resource               = m5272_fec_resources,
-};
-
-static struct platform_device *m5272_devices[] __initdata = {
-       &m5272_fec,
-};
-
-/***************************************************************************/
-
 static void __init m5272_uarts_init(void)
 {
        u32 v;
@@ -138,7 +102,6 @@ static int __init init_BSP(void)
 {
        m5272_uarts_init();
        fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
-       platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
        return 0;
 }
 
index 461325a3af94b88f2e86387a6556f23105a43526..018ac69ef24296a90edfb3801c90ecc33c0f8f35 100644 (file)
 
 /***************************************************************************/
 
-static struct resource m527x_fec0_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource m527x_fec1_resources[] = {
-       {
-               .start          = MCFFEC_BASE1,
-               .end            = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX1,
-               .end            = MCF_IRQ_FECRX1,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX1,
-               .end            = MCF_IRQ_FECTX1,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC1,
-               .end            = MCF_IRQ_FECENTC1,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m527x_fec[] = {
-       {
-               .name           = "fec",
-               .id             = 0,
-               .num_resources  = ARRAY_SIZE(m527x_fec0_resources),
-               .resource       = m527x_fec0_resources,
-       },
-       {
-               .name           = "fec",
-               .id             = 1,
-               .num_resources  = ARRAY_SIZE(m527x_fec1_resources),
-               .resource       = m527x_fec1_resources,
-       },
-};
-
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
 static struct resource m527x_qspi_resources[] = {
        {
@@ -261,10 +200,6 @@ static void __init m527x_qspi_init(void)
 #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
 
 static struct platform_device *m527x_devices[] __initdata = {
-       &m527x_fec[0],
-#ifdef CONFIG_FEC2
-       &m527x_fec[1],
-#endif
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m527x_qspi,
 #endif
index 39fc3c16388d523c91c69763111d6f7e06affc52..3e015dc00c8edf7d8168b7159fde5ec709aaeb60 100644 (file)
 
 /***************************************************************************/
 
-static struct resource m528x_fec_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m528x_fec = {
-       .name                   = "fec",
-       .id                     = 0,
-       .num_resources          = ARRAY_SIZE(m528x_fec_resources),
-       .resource               = m528x_fec_resources,
-};
-
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
 static struct resource m528x_qspi_resources[] = {
        {
@@ -187,7 +157,6 @@ static void __init m528x_qspi_init(void)
 #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
 
 static struct platform_device *m528x_devices[] __initdata = {
-       &m528x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m528x_qspi,
 #endif
index 4831f7a6b8dcf4ceda52e8142996f23243a7dc2d..13157ae3190551082f51ab39e80b2f8c9679c5df 100644 (file)
 
 /***************************************************************************/
 
-static struct resource m532x_fec_resources[] = {
-       {
-               .start          = MCFFEC_BASE0,
-               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = MCF_IRQ_FECRX0,
-               .end            = MCF_IRQ_FECRX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECTX0,
-               .end            = MCF_IRQ_FECTX0,
-               .flags          = IORESOURCE_IRQ,
-       },
-       {
-               .start          = MCF_IRQ_FECENTC0,
-               .end            = MCF_IRQ_FECENTC0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device m532x_fec = {
-       .name                   = "fec",
-       .id                     = 0,
-       .num_resources          = ARRAY_SIZE(m532x_fec_resources),
-       .resource               = m532x_fec_resources,
-};
-
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
 static struct resource m532x_qspi_resources[] = {
        {
@@ -179,7 +149,6 @@ static void __init m532x_qspi_init(void)
 
 
 static struct platform_device *m532x_devices[] __initdata = {
-       &m532x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m532x_qspi,
 #endif
index b9301920afbf89f8ebb8b92daceccd261a2cbb2e..24b0d5e5350a05a011c2290c0bb9ff18d3480748 100644 (file)
@@ -16,6 +16,9 @@
 #include <asm/mcfsim.h>
 #include <asm/mcfuart.h>
 
+/*
+ *     All current ColdFire parts contain from 2, 3 or 4 UARTS.
+ */
 static struct mcf_platform_uart mcf_uart_platform_data[] = {
        {
                .mapbase        = MCFUART_BASE0,
@@ -46,8 +49,83 @@ static struct platform_device mcf_uart = {
        .dev.platform_data      = mcf_uart_platform_data,
 };
 
+#ifdef CONFIG_FEC
+/*
+ *     Some ColdFire cores contain the Fast Ethernet Controller (FEC)
+ *     block. It is Freescale's own hardware block. Some ColdFires
+ *     have 2 of these.
+ */
+static struct resource mcf_fec0_resources[] = {
+       {
+               .start          = MCFFEC_BASE0,
+               .end            = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = MCF_IRQ_FECRX0,
+               .end            = MCF_IRQ_FECRX0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = MCF_IRQ_FECTX0,
+               .end            = MCF_IRQ_FECTX0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = MCF_IRQ_FECENTC0,
+               .end            = MCF_IRQ_FECENTC0,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device mcf_fec0 = {
+       .name                   = "fec",
+       .id                     = 0,
+       .num_resources          = ARRAY_SIZE(mcf_fec0_resources),
+       .resource               = mcf_fec0_resources,
+};
+
+#ifdef MCFFEC_BASE1
+static struct resource mcf_fec1_resources[] = {
+       {
+               .start          = MCFFEC_BASE1,
+               .end            = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = MCF_IRQ_FECRX1,
+               .end            = MCF_IRQ_FECRX1,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = MCF_IRQ_FECTX1,
+               .end            = MCF_IRQ_FECTX1,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = MCF_IRQ_FECENTC1,
+               .end            = MCF_IRQ_FECENTC1,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device mcf_fec1 = {
+       .name                   = "fec",
+       .id                     = 0,
+       .num_resources          = ARRAY_SIZE(mcf_fec1_resources),
+       .resource               = mcf_fec1_resources,
+};
+#endif /* MCFFEC_BASE1 */
+#endif /* CONFIG_FEC */
+
 static struct platform_device *mcf_devices[] __initdata = {
        &mcf_uart,
+#ifdef CONFIG_FEC
+       &mcf_fec0,
+#ifdef MCFFEC_BASE1
+       &mcf_fec1,
+#endif
+#endif
 };