Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Platform device support for Philips PNX8550 SoCs |
| 3 | * |
| 4 | * Copyright 2005, Embedded Alley Solutions, Inc |
| 5 | * |
| 6 | * Based on arch/mips/au1000/common/platform.c |
| 7 | * Platform device support for Au1x00 SoCs. |
| 8 | * |
| 9 | * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> |
| 10 | * |
| 11 | * This file is licensed under the terms of the GNU General Public |
| 12 | * License version 2. This program is licensed "as is" without any |
| 13 | * warranty of any kind, whether express or implied. |
| 14 | */ |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/resource.h> |
| 19 | #include <linux/serial.h> |
| 20 | #include <linux/serial_ip3106.h> |
Ralf Baechle | 41d4f0e | 2006-04-01 21:25:28 +0100 | [diff] [blame] | 21 | #include <linux/platform_device.h> |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 22 | |
| 23 | #include <int.h> |
| 24 | #include <usb.h> |
| 25 | #include <uart.h> |
| 26 | |
| 27 | extern struct uart_ops ip3106_pops; |
| 28 | |
| 29 | static struct resource pnx8550_usb_ohci_resources[] = { |
| 30 | [0] = { |
| 31 | .start = PNX8550_USB_OHCI_OP_BASE, |
| 32 | .end = PNX8550_USB_OHCI_OP_BASE + |
| 33 | PNX8550_USB_OHCI_OP_LEN, |
| 34 | .flags = IORESOURCE_MEM, |
| 35 | }, |
| 36 | [1] = { |
| 37 | .start = PNX8550_INT_USB, |
| 38 | .end = PNX8550_INT_USB, |
| 39 | .flags = IORESOURCE_IRQ, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static struct resource pnx8550_uart_resources[] = { |
| 44 | [0] = { |
| 45 | .start = PNX8550_UART_PORT0, |
| 46 | .end = PNX8550_UART_PORT0 + 0xfff, |
| 47 | .flags = IORESOURCE_MEM, |
| 48 | }, |
| 49 | [1] = { |
| 50 | .start = PNX8550_UART_INT(0), |
| 51 | .end = PNX8550_UART_INT(0), |
| 52 | .flags = IORESOURCE_IRQ, |
| 53 | }, |
| 54 | [2] = { |
| 55 | .start = PNX8550_UART_PORT1, |
| 56 | .end = PNX8550_UART_PORT1 + 0xfff, |
| 57 | .flags = IORESOURCE_MEM, |
| 58 | }, |
| 59 | [3] = { |
| 60 | .start = PNX8550_UART_INT(1), |
| 61 | .end = PNX8550_UART_INT(1), |
| 62 | .flags = IORESOURCE_IRQ, |
| 63 | }, |
| 64 | }; |
| 65 | |
| 66 | struct ip3106_port ip3106_ports[] = { |
| 67 | [0] = { |
| 68 | .port = { |
| 69 | .type = PORT_IP3106, |
Russell King | 9b4a161 | 2006-02-05 10:48:10 +0000 | [diff] [blame] | 70 | .iotype = UPIO_MEM, |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 71 | .membase = (void __iomem *)PNX8550_UART_PORT0, |
| 72 | .mapbase = PNX8550_UART_PORT0, |
| 73 | .irq = PNX8550_UART_INT(0), |
| 74 | .uartclk = 3692300, |
| 75 | .fifosize = 16, |
| 76 | .ops = &ip3106_pops, |
Russell King | 59a675b | 2006-02-05 10:52:29 +0000 | [diff] [blame] | 77 | .flags = UPF_BOOT_AUTOCONF, |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 78 | .line = 0, |
| 79 | }, |
| 80 | }, |
| 81 | [1] = { |
| 82 | .port = { |
| 83 | .type = PORT_IP3106, |
Russell King | 9b4a161 | 2006-02-05 10:48:10 +0000 | [diff] [blame] | 84 | .iotype = UPIO_MEM, |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 85 | .membase = (void __iomem *)PNX8550_UART_PORT1, |
| 86 | .mapbase = PNX8550_UART_PORT1, |
| 87 | .irq = PNX8550_UART_INT(1), |
| 88 | .uartclk = 3692300, |
| 89 | .fifosize = 16, |
| 90 | .ops = &ip3106_pops, |
Russell King | 59a675b | 2006-02-05 10:52:29 +0000 | [diff] [blame] | 91 | .flags = UPF_BOOT_AUTOCONF, |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 92 | .line = 1, |
| 93 | }, |
| 94 | }, |
| 95 | }; |
| 96 | |
| 97 | /* The dmamask must be set for OHCI to work */ |
| 98 | static u64 ohci_dmamask = ~(u32)0; |
| 99 | |
| 100 | static u64 uart_dmamask = ~(u32)0; |
| 101 | |
| 102 | static struct platform_device pnx8550_usb_ohci_device = { |
| 103 | .name = "pnx8550-ohci", |
| 104 | .id = -1, |
| 105 | .dev = { |
| 106 | .dma_mask = &ohci_dmamask, |
| 107 | .coherent_dma_mask = 0xffffffff, |
| 108 | }, |
| 109 | .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources), |
| 110 | .resource = pnx8550_usb_ohci_resources, |
| 111 | }; |
| 112 | |
| 113 | static struct platform_device pnx8550_uart_device = { |
| 114 | .name = "ip3106-uart", |
| 115 | .id = -1, |
| 116 | .dev = { |
| 117 | .dma_mask = &uart_dmamask, |
| 118 | .coherent_dma_mask = 0xffffffff, |
| 119 | .platform_data = ip3106_ports, |
| 120 | }, |
| 121 | .num_resources = ARRAY_SIZE(pnx8550_uart_resources), |
| 122 | .resource = pnx8550_uart_resources, |
| 123 | }; |
| 124 | |
| 125 | static struct platform_device *pnx8550_platform_devices[] __initdata = { |
| 126 | &pnx8550_usb_ohci_device, |
| 127 | &pnx8550_uart_device, |
| 128 | }; |
| 129 | |
| 130 | int pnx8550_platform_init(void) |
| 131 | { |
| 132 | return platform_add_devices(pnx8550_platform_devices, |
| 133 | ARRAY_SIZE(pnx8550_platform_devices)); |
| 134 | } |
| 135 | |
| 136 | arch_initcall(pnx8550_platform_init); |