m68knommu: platform setup for 5272 ColdFire parts
[powerpc.git] / arch / m68knommu / platform / 5272 / config.c
index d500e27..2a3cf5e 100644 (file)
 /***************************************************************************/
 
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/param.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <asm/irq.h>
-#include <asm/dma.h>
-#include <asm/traps.h>
+#include <linux/io.h>
 #include <asm/machdep.h>
 #include <asm/coldfire.h>
-#include <asm/mcftimer.h>
 #include <asm/mcfsim.h>
-#include <asm/mcfdma.h>
+#include <asm/mcfuart.h>
 
 /***************************************************************************/
 
-void coldfire_tick(void);
-void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
-unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 extern unsigned int mcf_timervector;
@@ -45,14 +37,57 @@ unsigned char ledbank = 0xff;
 
 /***************************************************************************/
 
-/*
- *     DMA channel base address table.
- */
-unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
-        MCF_MBAR + MCFDMA_BASE0,
+static struct mcf_platform_uart m5272_uart_platform[] = {
+       {
+               .mapbase        = MCF_MBAR + MCFUART_BASE1,
+               .irq            = 73,
+       },
+       {
+               .mapbase        = MCF_MBAR + MCFUART_BASE2,
+               .irq            = 74,
+       },
+       { },
+};
+
+static struct platform_device m5272_uart = {
+       .name                   = "mcfuart",
+       .id                     = 0,
+       .dev.platform_data      = m5272_uart_platform,
 };
 
-unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
+static struct platform_device *m5272_devices[] __initdata = {
+       &m5272_uart,
+};
+
+/***************************************************************************/
+
+static void __init m5272_uart_init_line(int line, int irq)
+{
+       u32 v;
+
+       if ((line >= 0) && (line < 2)) {
+               v = (line) ? 0x0e000000 : 0xe0000000;
+               writel(v, MCF_MBAR + MCFSIM_ICR2);
+
+               /* Enable the output lines for the serial ports */
+               v = readl(MCF_MBAR + MCFSIM_PBCNT);
+               v = (v & ~0x000000ff) | 0x00000055;
+               writel(v, MCF_MBAR + MCFSIM_PBCNT);
+
+               v = readl(MCF_MBAR + MCFSIM_PDCNT);
+               v = (v & ~0x000003fc) | 0x000002a8;
+               writel(v, MCF_MBAR + MCFSIM_PDCNT);
+       }
+}
+
+static void __init m5272_uarts_init(void)
+{
+       const int nrlines = ARRAY_SIZE(m5272_uart_platform);
+       int line;
+
+       for (line = 0; (line < nrlines); line++)
+               m5272_uart_init_line(line, m5272_uart_platform[line].irq);
+}
 
 /***************************************************************************/
 
@@ -101,7 +136,7 @@ int mcf_timerirqpending(int timer)
 
 /***************************************************************************/
 
-void config_BSP(char *commandp, int size)
+void __init config_BSP(char *commandp, int size)
 {
 #if defined (CONFIG_MOD5272)
        volatile unsigned char  *pivrp;
@@ -113,10 +148,7 @@ void config_BSP(char *commandp, int size)
 
        mcf_disableall();
 
-#if defined(CONFIG_BOOTPARAM)
-       strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
-       commandp[size-1] = 0;
-#elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
+#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
        /* Copy command line from FLASH to local buffer... */
        memcpy(commandp, (char *) 0xf0004000, size);
        commandp[size-1] = 0;
@@ -128,17 +160,22 @@ void config_BSP(char *commandp, int size)
        /* Copy command line from FLASH to local buffer... */
        memcpy(commandp, (char *) 0xf0010000, size);
        commandp[size-1] = 0;
-#else
-       memset(commandp, 0, size);
 #endif
 
        mcf_timervector = 69;
        mcf_profilevector = 70;
-       mach_sched_init = coldfire_timer_init;
-       mach_tick = coldfire_tick;
-       mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
 /***************************************************************************/
+
+static int __init init_BSP(void)
+{
+       m5272_uarts_init();
+       platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
+       return 0;
+}
+
+arch_initcall(init_BSP);
+
+/***************************************************************************/