]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
m68knommu: merge common ColdFire UART platform setup code
authorGreg Ungerer <gerg@uclinux.org>
Fri, 23 Dec 2011 15:17:10 +0000 (01:17 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Sun, 4 Mar 2012 23:43:08 +0000 (09:43 +1000)
The ColdFire UART is common to all ColdFire CPU's. No need to duplicate
its platform setup code for every CPU family member. Merge all the setup
code into a single shared file.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
13 files changed:
arch/m68k/platform/5206/config.c
arch/m68k/platform/520x/config.c
arch/m68k/platform/523x/config.c
arch/m68k/platform/5249/config.c
arch/m68k/platform/5272/config.c
arch/m68k/platform/527x/config.c
arch/m68k/platform/528x/config.c
arch/m68k/platform/5307/config.c
arch/m68k/platform/532x/config.c
arch/m68k/platform/5407/config.c
arch/m68k/platform/54xx/config.c
arch/m68k/platform/coldfire/Makefile
arch/m68k/platform/coldfire/device.c [new file with mode: 0644]

index a8ba8106cbc8271c7e2b9d852a2ef543e7a69bc9..fdef300a152c34a09a89e7223e2eae62e0d5bcf4 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m5206_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       { },
-};
-
-static struct platform_device m5206_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m5206_uart_platform,
-};
-
-static struct platform_device *m5206_devices[] __initdata = {
-       &m5206_uart,
-};
-
-/***************************************************************************/
-
 static void __init m5206_uarts_init(void)
 {
        /* UART0 interrupt setup */
@@ -107,13 +83,3 @@ void __init config_BSP(char *commandp, int size)
 }
 
 /***************************************************************************/
-
-static int __init init_BSP(void)
-{
-       platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
-       return 0;
-}
-
-arch_initcall(init_BSP);
-
-/***************************************************************************/
index fe203bd7a56bf200e2c755732c75bbe49787db9a..3af397262115e1de71a6ba1c185880403d25f994 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m520x_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       { },
-};
-
-static struct platform_device m520x_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m520x_uart_platform,
-};
-
 static struct resource m520x_fec_resources[] = {
        {
                .start          = MCFFEC_BASE,
@@ -218,7 +196,6 @@ static void __init m520x_qspi_init(void)
 
 
 static struct platform_device *m520x_devices[] __initdata = {
-       &m520x_uart,
        &m520x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m520x_qspi,
index 49502a32efb178e3a3c07bd407f763185bba4527..ef46009540e5e63a319ab18be07a3b9321d77bc1 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m523x_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       { },
-};
-
-static struct platform_device m523x_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m523x_uart_platform,
-};
-
 static struct resource m523x_fec_resources[] = {
        {
                .start          = MCFFEC_BASE,
@@ -240,7 +218,6 @@ static void __init m523x_qspi_init(void)
 #endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */
 
 static struct platform_device *m523x_devices[] __initdata = {
-       &m523x_uart,
        &m523x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m523x_qspi,
index 913160c3f46c225cc4c21bf4dfe1bfd908de1c66..afcdbfc6edaf83ac490c47bb49df5be96e1cf03f 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m5249_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       { },
-};
-
-static struct platform_device m5249_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m5249_uart_platform,
-};
-
 #ifdef CONFIG_M5249C3
 
 static struct resource m5249_smc91x_resources[] = {
@@ -223,7 +205,6 @@ static void __init m5249_qspi_init(void)
 
 
 static struct platform_device *m5249_devices[] __initdata = {
-       &m5249_uart,
 #ifdef CONFIG_M5249C3
        &m5249_smc91x,
 #endif
index a99a6893a57ad9c1a6e36afaac401f44c0d5f10d..c7c2c422a1fc420c4af19ed2a0b7ea58cb842e7d 100644 (file)
@@ -30,24 +30,6 @@ unsigned char ledbank = 0xff;
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m5272_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       { },
-};
-
-static struct platform_device m5272_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m5272_uart_platform,
-};
-
 static struct resource m5272_fec_resources[] = {
        {
                .start          = MCF_MBAR + 0x840,
@@ -79,7 +61,6 @@ static struct platform_device m5272_fec = {
 };
 
 static struct platform_device *m5272_devices[] __initdata = {
-       &m5272_uart,
        &m5272_fec,
 };
 
index 74dab0248b62bfe9e2b2f6ca1e3ab1631752ad1e..f05fbe01e7403e424a8f5f36786c930b4769c641 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m527x_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       { },
-};
-
-static struct platform_device m527x_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m527x_uart_platform,
-};
-
 static struct resource m527x_fec0_resources[] = {
        {
                .start          = MCFFEC_BASE0,
@@ -283,7 +261,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_uart,
        &m527x_fec[0],
 #ifdef CONFIG_FEC2
        &m527x_fec[1],
index 82af5d883603135161f621ed649cdaed90702243..f75ee8bf5e3583735e6e67356684f11ecbe2047e 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m528x_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       { },
-};
-
-static struct platform_device m528x_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m528x_uart_platform,
-};
-
 static struct resource m528x_fec_resources[] = {
        {
                .start          = MCFFEC_BASE,
@@ -209,7 +187,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_uart,
        &m528x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m528x_qspi,
index bad3c27a8a4e1e439895afef6a1fdd20bca04a23..74852a3dadf91704d3dbc94ce760ace5d30b3650 100644 (file)
@@ -29,30 +29,6 @@ unsigned char ledbank = 0xff;
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m5307_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       { },
-};
-
-static struct platform_device m5307_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m5307_uart_platform,
-};
-
-static struct platform_device *m5307_devices[] __initdata = {
-       &m5307_uart,
-};
-
-/***************************************************************************/
-
 static void __init m5307_uarts_init(void)
 {
        /* UART0 interrupt setup */
@@ -127,13 +103,3 @@ void __init config_BSP(char *commandp, int size)
 }
 
 /***************************************************************************/
-
-static int __init init_BSP(void)
-{
-       platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));
-       return 0;
-}
-
-arch_initcall(init_BSP);
-
-/***************************************************************************/
index 5b106839f9b673086e1acbefd9c878f8db559080..24b4c0de628bd069d5c4c843af4861f0a421d649 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m532x_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       { },
-};
-
-static struct platform_device m532x_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m532x_uart_platform,
-};
-
 static struct resource m532x_fec_resources[] = {
        {
                .start          = 0xfc030000,
@@ -201,7 +179,6 @@ static void __init m532x_qspi_init(void)
 
 
 static struct platform_device *m532x_devices[] __initdata = {
-       &m532x_uart,
        &m532x_fec,
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
        &m532x_qspi,
index ae2689d246e33fab88f25558ec5f8fc4bf5fb4be..e66ef85637175785f07bd5cac663fc433551f1d0 100644 (file)
 
 /***************************************************************************/
 
-static struct mcf_platform_uart m5407_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       { },
-};
-
-static struct platform_device m5407_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m5407_uart_platform,
-};
-
-static struct platform_device *m5407_devices[] __initdata = {
-       &m5407_uart,
-};
-
-/***************************************************************************/
-
 static void __init m5407_uarts_init(void)
 {
        /* UART0 interrupt setup */
@@ -102,13 +78,3 @@ void __init config_BSP(char *commandp, int size)
 }
 
 /***************************************************************************/
-
-static int __init init_BSP(void)
-{
-       platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices));
-       return 0;
-}
-
-arch_initcall(init_BSP);
-
-/***************************************************************************/
index 4083f50682c635e9bf33ed5859ebb6e219393eae..2081c6cbb3de95f6c5b182e878067dc1952e97bf 100644 (file)
 #include <asm/mmu_context.h>
 #endif
 
-/***************************************************************************/
-
-static struct mcf_platform_uart m54xx_uart_platform[] = {
-       {
-               .mapbase        = MCFUART_BASE0,
-               .irq            = MCF_IRQ_UART0,
-       },
-       {
-               .mapbase        = MCFUART_BASE1,
-               .irq            = MCF_IRQ_UART1,
-       },
-       {
-               .mapbase        = MCFUART_BASE2,
-               .irq            = MCF_IRQ_UART2,
-       },
-       {
-               .mapbase        = MCFUART_BASE3,
-               .irq            = MCF_IRQ_UART3,
-       },
-};
-
-static struct platform_device m54xx_uart = {
-       .name                   = "mcfuart",
-       .id                     = 0,
-       .dev.platform_data      = m54xx_uart_platform,
-};
-
-static struct platform_device *m54xx_devices[] __initdata = {
-       &m54xx_uart,
-};
-
-
 /***************************************************************************/
 
 static void __init m54xx_uarts_init(void)
@@ -135,14 +103,3 @@ void __init config_BSP(char *commandp, int size)
 }
 
 /***************************************************************************/
-
-static int __init init_BSP(void)
-{
-
-       platform_add_devices(m54xx_devices, ARRAY_SIZE(m54xx_devices));
-       return 0;
-}
-
-arch_initcall(init_BSP);
-
-/***************************************************************************/
index a8967baabd72098235dd2a21979e9e16f64197b7..4572af29b6b7dd83a82f3892bf33e9ddf962d52a 100644 (file)
@@ -14,7 +14,7 @@
 
 asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
 
-obj-$(CONFIG_COLDFIRE) += cache.o clk.o dma.o entry.o vectors.o
+obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o
 obj-$(CONFIG_M5206)    += timers.o intc.o
 obj-$(CONFIG_M5206e)   += timers.o intc.o
 obj-$(CONFIG_M520x)    += pit.o intc-simr.o
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
new file mode 100644 (file)
index 0000000..c950690
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * device.c  -- common ColdFire SoC device support
+ *
+ * (C) Copyright 2011, Greg Ungerer <gerg@uclinux.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <asm/traps.h>
+#include <asm/coldfire.h>
+#include <asm/mcfsim.h>
+#include <asm/mcfuart.h>
+
+static struct mcf_platform_uart mcf_uart_platform_data[] = {
+       {
+               .mapbase        = MCFUART_BASE0,
+               .irq            = MCF_IRQ_UART0,
+       },
+       {
+               .mapbase        = MCFUART_BASE1,
+               .irq            = MCF_IRQ_UART1,
+       },
+#ifdef MCFUART_BASE2
+       {
+               .mapbase        = MCFUART_BASE2,
+               .irq            = MCF_IRQ_UART2,
+       },
+#endif
+#ifdef MCFUART_BASE3
+       {
+               .mapbase        = MCFUART_BASE3,
+               .irq            = MCF_IRQ_UART3,
+       },
+#endif
+       { },
+};
+
+static struct platform_device mcf_uart = {
+       .name                   = "mcfuart",
+       .id                     = 0,
+       .dev.platform_data      = mcf_uart_platform_data,
+};
+
+static struct platform_device *mcf_devices[] __initdata = {
+       &mcf_uart,
+};
+
+static int __init mcf_init_devices(void)
+{
+       platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices));
+       return 0;
+}
+
+arch_initcall(mcf_init_devices);
+