Path: blob/master/arch/mips/pnx8550/common/platform.c
10820 views
/*1* Platform device support for NXP PNX8550 SoCs2*3* Copyright 2005, Embedded Alley Solutions, Inc4*5* Based on arch/mips/au1000/common/platform.c6* Platform device support for Au1x00 SoCs.7*8* Copyright 2004, Matt Porter <[email protected]>9*10* This file is licensed under the terms of the GNU General Public11* License version 2. This program is licensed "as is" without any12* warranty of any kind, whether express or implied.13*/14#include <linux/device.h>15#include <linux/dma-mapping.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>2223#include <int.h>24#include <usb.h>25#include <uart.h>2627static struct resource pnx8550_usb_ohci_resources[] = {28[0] = {29.start = PNX8550_USB_OHCI_OP_BASE,30.end = PNX8550_USB_OHCI_OP_BASE +31PNX8550_USB_OHCI_OP_LEN,32.flags = IORESOURCE_MEM,33},34[1] = {35.start = PNX8550_INT_USB,36.end = PNX8550_INT_USB,37.flags = IORESOURCE_IRQ,38},39};4041static struct resource pnx8550_uart_resources[] = {42[0] = {43.start = PNX8550_UART_PORT0,44.end = PNX8550_UART_PORT0 + 0xfff,45.flags = IORESOURCE_MEM,46},47[1] = {48.start = PNX8550_UART_INT(0),49.end = PNX8550_UART_INT(0),50.flags = IORESOURCE_IRQ,51},52[2] = {53.start = PNX8550_UART_PORT1,54.end = PNX8550_UART_PORT1 + 0xfff,55.flags = IORESOURCE_MEM,56},57[3] = {58.start = PNX8550_UART_INT(1),59.end = PNX8550_UART_INT(1),60.flags = IORESOURCE_IRQ,61},62};6364struct 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,76},77},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,89},90},91};9293/* The dmamask must be set for OHCI to work */94static u64 ohci_dmamask = DMA_BIT_MASK(32);9596static u64 uart_dmamask = DMA_BIT_MASK(32);9798static 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 = DMA_BIT_MASK(32),104},105.num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),106.resource = pnx8550_usb_ohci_resources,107};108109static struct platform_device pnx8550_uart_device = {110.name = "pnx8xxx-uart",111.id = -1,112.dev = {113.dma_mask = &uart_dmamask,114.coherent_dma_mask = DMA_BIT_MASK(32),115.platform_data = pnx8xxx_ports,116},117.num_resources = ARRAY_SIZE(pnx8550_uart_resources),118.resource = pnx8550_uart_resources,119};120121static struct platform_device *pnx8550_platform_devices[] __initdata = {122&pnx8550_usb_ohci_device,123&pnx8550_uart_device,124};125126static int __init pnx8550_platform_init(void)127{128return platform_add_devices(pnx8550_platform_devices,129ARRAY_SIZE(pnx8550_platform_devices));130}131132arch_initcall(pnx8550_platform_init);133134135