[PATCH] OSS: replace kmalloc()+memset() combos with kzalloc()
[wrt350n-kernel.git] / arch / mips / philips / pnx8550 / common / platform.c
blobd43f56e2cd7887b1adea9cbae07996b59e3951c6
1 /*
2 * Platform device support for Philips PNX8550 SoCs
4 * Copyright 2005, Embedded Alley Solutions, Inc
6 * Based on arch/mips/au1000/common/platform.c
7 * Platform device support for Au1x00 SoCs.
9 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
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.
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_pnx8xxx.h>
21 #include <linux/platform_device.h>
23 #include <int.h>
24 #include <usb.h>
25 #include <uart.h>
27 static struct resource pnx8550_usb_ohci_resources[] = {
28 [0] = {
29 .start = PNX8550_USB_OHCI_OP_BASE,
30 .end = PNX8550_USB_OHCI_OP_BASE +
31 PNX8550_USB_OHCI_OP_LEN,
32 .flags = IORESOURCE_MEM,
34 [1] = {
35 .start = PNX8550_INT_USB,
36 .end = PNX8550_INT_USB,
37 .flags = IORESOURCE_IRQ,
41 static struct resource pnx8550_uart_resources[] = {
42 [0] = {
43 .start = PNX8550_UART_PORT0,
44 .end = PNX8550_UART_PORT0 + 0xfff,
45 .flags = IORESOURCE_MEM,
47 [1] = {
48 .start = PNX8550_UART_INT(0),
49 .end = PNX8550_UART_INT(0),
50 .flags = IORESOURCE_IRQ,
52 [2] = {
53 .start = PNX8550_UART_PORT1,
54 .end = PNX8550_UART_PORT1 + 0xfff,
55 .flags = IORESOURCE_MEM,
57 [3] = {
58 .start = PNX8550_UART_INT(1),
59 .end = PNX8550_UART_INT(1),
60 .flags = IORESOURCE_IRQ,
64 struct pnx8xxx_port pnx8xxx_ports[] = {
65 [0] = {
66 .port = {
67 .type = PORT_PNX8XXX,
68 .iotype = UPIO_MEM,
69 .membase = (void __iomem *)PNX8550_UART_PORT0,
70 .mapbase = PNX8550_UART_PORT0,
71 .irq = PNX8550_UART_INT(0),
72 .uartclk = 3692300,
73 .fifosize = 16,
74 .flags = UPF_BOOT_AUTOCONF,
75 .line = 0,
78 [1] = {
79 .port = {
80 .type = PORT_PNX8XXX,
81 .iotype = UPIO_MEM,
82 .membase = (void __iomem *)PNX8550_UART_PORT1,
83 .mapbase = PNX8550_UART_PORT1,
84 .irq = PNX8550_UART_INT(1),
85 .uartclk = 3692300,
86 .fifosize = 16,
87 .flags = UPF_BOOT_AUTOCONF,
88 .line = 1,
93 /* The dmamask must be set for OHCI to work */
94 static u64 ohci_dmamask = ~(u32)0;
96 static u64 uart_dmamask = ~(u32)0;
98 static struct platform_device pnx8550_usb_ohci_device = {
99 .name = "pnx8550-ohci",
100 .id = -1,
101 .dev = {
102 .dma_mask = &ohci_dmamask,
103 .coherent_dma_mask = 0xffffffff,
105 .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
106 .resource = pnx8550_usb_ohci_resources,
109 static struct platform_device pnx8550_uart_device = {
110 .name = "pnx8xxx-uart",
111 .id = -1,
112 .dev = {
113 .dma_mask = &uart_dmamask,
114 .coherent_dma_mask = 0xffffffff,
115 .platform_data = pnx8xxx_ports,
117 .num_resources = ARRAY_SIZE(pnx8550_uart_resources),
118 .resource = pnx8550_uart_resources,
121 static struct platform_device *pnx8550_platform_devices[] __initdata = {
122 &pnx8550_usb_ohci_device,
123 &pnx8550_uart_device,
126 int pnx8550_platform_init(void)
128 return platform_add_devices(pnx8550_platform_devices,
129 ARRAY_SIZE(pnx8550_platform_devices));
132 arch_initcall(pnx8550_platform_init);