[MIPS] TXx9: Support early_printk
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Tue, 29 Jul 2008 13:10:08 +0000 (22:10 +0900)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 30 Jul 2008 20:54:41 +0000 (21:54 +0100)
Kill jmr3927-specific prom_putchar and add txx9-generic prom_putchar
to support early_printk.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/txx9/Kconfig
arch/mips/txx9/generic/setup.c
arch/mips/txx9/jmr3927/prom.c
arch/mips/txx9/rbtx4927/prom.c
arch/mips/txx9/rbtx4938/prom.c
include/asm-mips/txx9/generic.h

index 6de4c5a..9b14db2 100644 (file)
@@ -30,6 +30,7 @@ config SOC_TX3927
        select IRQ_TXX9
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_TX39XX
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_BIG_ENDIAN
@@ -49,6 +50,7 @@ config SOC_TX4927
        select PCI_TX4927
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_TX49XX
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -70,6 +72,7 @@ config SOC_TX4938
        select PCI_TX4927
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_TX49XX
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
index 94ce1a5..1bc57d0 100644 (file)
@@ -271,6 +271,37 @@ void __init txx9_sio_init(unsigned long baseaddr, int irq,
 #endif /* CONFIG_SERIAL_TXX9 */
 }
 
+#ifdef CONFIG_EARLY_PRINTK
+static void __init null_prom_putchar(char c)
+{
+}
+void (*txx9_prom_putchar)(char c) __initdata = null_prom_putchar;
+
+void __init prom_putchar(char c)
+{
+       txx9_prom_putchar(c);
+}
+
+static void __iomem *early_txx9_sio_port;
+
+static void __init early_txx9_sio_putchar(char c)
+{
+#define TXX9_SICISR    0x0c
+#define TXX9_SITFIFO   0x1c
+#define TXX9_SICISR_TXALS      0x00000002
+       while (!(__raw_readl(early_txx9_sio_port + TXX9_SICISR) &
+                TXX9_SICISR_TXALS))
+               ;
+       __raw_writel(c, early_txx9_sio_port + TXX9_SITFIFO);
+}
+
+void __init txx9_sio_putchar_init(unsigned long baseaddr)
+{
+       early_txx9_sio_port = ioremap(baseaddr, 0x24);
+       txx9_prom_putchar = early_txx9_sio_putchar;
+}
+#endif /* CONFIG_EARLY_PRINTK */
+
 /* wrappers */
 void __init plat_mem_setup(void)
 {
index 23df38c..70c4c8e 100644 (file)
 #include <asm/txx9/generic.h>
 #include <asm/txx9/jmr3927.h>
 
-#define TIMEOUT       0xffffff
-
-void
-prom_putchar(char c)
-{
-        int i = 0;
-
-        do {
-            i++;
-            if (i>TIMEOUT)
-                break;
-        } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
-       tx3927_sioptr(1)->tfifo = c;
-       return;
-}
-
 void __init jmr3927_prom_init(void)
 {
        /* CCFG */
@@ -65,4 +49,5 @@ void __init jmr3927_prom_init(void)
 
        prom_init_cmdline();
        add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX3927_SIO_REG(1));
 }
index 5c0de54..1dc0a5b 100644 (file)
@@ -38,4 +38,5 @@ void __init rbtx4927_prom_init(void)
 {
        prom_init_cmdline();
        add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX4927_SIO_REG(0) & 0xfffffffffULL);
 }
index ee18951..d73123c 100644 (file)
@@ -22,4 +22,5 @@ void __init rbtx4938_prom_init(void)
        prom_init_cmdline();
 #endif
        add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL);
 }
index a295aaa..5b1ccf9 100644 (file)
@@ -49,5 +49,14 @@ void txx9_spi_init(int busid, unsigned long base, int irq);
 void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
 void txx9_sio_init(unsigned long baseaddr, int irq,
                   unsigned int line, unsigned int sclk, int nocts);
+void prom_putchar(char c);
+#ifdef CONFIG_EARLY_PRINTK
+extern void (*txx9_prom_putchar)(char c);
+void txx9_sio_putchar_init(unsigned long baseaddr);
+#else
+static inline void txx9_sio_putchar_init(unsigned long baseaddr)
+{
+}
+#endif
 
 #endif /* __ASM_TXX9_GENERIC_H */