]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/txx9/generic/setup.c
[MIPS] TXx9: Unify serial_txx9 setup
[linux-2.6-omap-h63xx.git] / arch / mips / txx9 / generic / setup.c
index 82272e85a04212c31b5cf207be06661bf166c7aa..94ce1a5c38a4f15491dd75dd8348fbe76d595a0e 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
 #include <asm/bootinfo.h>
 #include <asm/time.h>
 #include <asm/reboot.h>
@@ -208,6 +210,67 @@ static void __noreturn txx9_machine_halt(void)
        }
 }
 
+/* Watchdog support */
+void __init txx9_wdt_init(unsigned long base)
+{
+       struct resource res = {
+               .start  = base,
+               .end    = base + 0x100 - 1,
+               .flags  = IORESOURCE_MEM,
+       };
+       platform_device_register_simple("txx9wdt", -1, &res, 1);
+}
+
+/* SPI support */
+void __init txx9_spi_init(int busid, unsigned long base, int irq)
+{
+       struct resource res[] = {
+               {
+                       .start  = base,
+                       .end    = base + 0x20 - 1,
+                       .flags  = IORESOURCE_MEM,
+               }, {
+                       .start  = irq,
+                       .flags  = IORESOURCE_IRQ,
+               },
+       };
+       platform_device_register_simple("spi_txx9", busid,
+                                       res, ARRAY_SIZE(res));
+}
+
+void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
+{
+       struct platform_device *pdev =
+               platform_device_alloc("tc35815-mac", id);
+       if (!pdev ||
+           platform_device_add_data(pdev, ethaddr, 6) ||
+           platform_device_add(pdev))
+               platform_device_put(pdev);
+}
+
+void __init txx9_sio_init(unsigned long baseaddr, int irq,
+                         unsigned int line, unsigned int sclk, int nocts)
+{
+#ifdef CONFIG_SERIAL_TXX9
+       struct uart_port req;
+
+       memset(&req, 0, sizeof(req));
+       req.line = line;
+       req.iotype = UPIO_MEM;
+       req.membase = ioremap(baseaddr, 0x24);
+       req.mapbase = baseaddr;
+       req.irq = irq;
+       if (!nocts)
+               req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
+       if (sclk) {
+               req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/;
+               req.uartclk = sclk;
+       } else
+               req.uartclk = TXX9_IMCLK;
+       early_serial_txx9_setup(&req);
+#endif /* CONFIG_SERIAL_TXX9 */
+}
+
 /* wrappers */
 void __init plat_mem_setup(void)
 {