[ARM] Orion: platform device registration for UART, USB and NAND
authorTzachi Perelstein <tzachi@marvell.com>
Tue, 23 Oct 2007 19:14:42 +0000 (15:14 -0400)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 26 Jan 2008 15:03:50 +0000 (15:03 +0000)
Signed-off-by: Tzachi Perelstein <tzachi@marvell.com>
Reviewed-by: Nicolas Pitre <nico@marvell.com>
Reviewed-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-orion/common.c
include/asm-arm/arch-orion/platform.h [new file with mode: 0644]

index 69363cb..ab1000e 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/serial_8250.h>
 #include <asm/page.h>
 #include <asm/timex.h>
 #include <asm/mach/map.h>
@@ -54,6 +56,119 @@ void __init orion_map_io(void)
 }
 
 /*****************************************************************************
+ * UART
+ ****************************************************************************/
+
+static struct resource orion_uart_resources[] = {
+       {
+               .start          = UART0_BASE,
+               .end            = UART0_BASE + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = IRQ_ORION_UART0,
+               .end            = IRQ_ORION_UART0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = UART1_BASE,
+               .end            = UART1_BASE + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = IRQ_ORION_UART1,
+               .end            = IRQ_ORION_UART1,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct plat_serial8250_port orion_uart_data[] = {
+       {
+               .mapbase        = UART0_BASE,
+               .membase        = (char *)UART0_BASE,
+               .irq            = IRQ_ORION_UART0,
+               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = ORION_TCLK,
+       },
+       {
+               .mapbase        = UART1_BASE,
+               .membase        = (char *)UART1_BASE,
+               .irq            = IRQ_ORION_UART1,
+               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = ORION_TCLK,
+       },
+       { },
+};
+
+static struct platform_device orion_uart = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = orion_uart_data,
+       },
+       .resource               = orion_uart_resources,
+       .num_resources          = ARRAY_SIZE(orion_uart_resources),
+};
+
+/*******************************************************************************
+ * USB Controller - 2 interfaces
+ ******************************************************************************/
+
+static struct resource orion_ehci0_resources[] = {
+       {
+               .start  = ORION_USB0_REG_BASE,
+               .end    = ORION_USB0_REG_BASE + SZ_4K,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_ORION_USB0_CTRL,
+               .end    = IRQ_ORION_USB0_CTRL,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct resource orion_ehci1_resources[] = {
+       {
+               .start  = ORION_USB1_REG_BASE,
+               .end    = ORION_USB1_REG_BASE + SZ_4K,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_ORION_USB1_CTRL,
+               .end    = IRQ_ORION_USB1_CTRL,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static u64 ehci_dmamask = 0xffffffffUL;
+
+static struct platform_device orion_ehci0 = {
+       .name           = "orion-ehci",
+       .id             = 0,
+       .dev            = {
+               .dma_mask               = &ehci_dmamask,
+               .coherent_dma_mask      = 0xffffffff,
+       },
+       .resource       = orion_ehci0_resources,
+       .num_resources  = ARRAY_SIZE(orion_ehci0_resources),
+};
+
+static struct platform_device orion_ehci1 = {
+       .name           = "orion-ehci",
+       .id             = 1,
+       .dev            = {
+               .dma_mask               = &ehci_dmamask,
+               .coherent_dma_mask      = 0xffffffff,
+       },
+       .resource       = orion_ehci1_resources,
+       .num_resources  = ARRAY_SIZE(orion_ehci1_resources),
+};
+
+/*****************************************************************************
  * General
  ****************************************************************************/
 
@@ -101,4 +216,12 @@ void __init orion_init(void)
        orion_setup_pcie_wins();
        if (dev == MV88F5182_DEV_ID)
                orion_setup_sata_wins();
+
+       /*
+        * REgister devices
+        */
+       platform_device_register(&orion_uart);
+       platform_device_register(&orion_ehci0);
+       if (dev == MV88F5182_DEV_ID)
+               platform_device_register(&orion_ehci1);
 }
diff --git a/include/asm-arm/arch-orion/platform.h b/include/asm-arm/arch-orion/platform.h
new file mode 100644 (file)
index 0000000..143c38e
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * asm-arm/arch-orion/platform.h
+ *
+ * Tzachi Perelstein <tzachi@marvell.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __ASM_ARCH_PLATFORM_H__
+#define __ASM_ARCH_PLATFORM_H__
+
+/*
+ * Device bus NAND private data
+ */
+struct orion_nand_data {
+       struct mtd_partition *parts;
+       u32 nr_parts;
+       u8 ale;         /* address line number connected to ALE */
+       u8 cle;         /* address line number connected to CLE */
+       u8 width;       /* buswidth */
+};
+
+#endif