| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-03-06 09:07:18 +00:00
										 |  |  |  * Platform device support for NXP PNX8550 SoCs | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2005, Embedded Alley Solutions, Inc | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Based on arch/mips/au1000/common/platform.c | 
					
						
							|  |  |  |  * Platform device support for Au1x00 SoCs. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <linux/device.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-15 18:44:29 +01:00
										 |  |  | #include <linux/dma-mapping.h>
 | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/resource.h>
 | 
					
						
							|  |  |  | #include <linux/serial.h>
 | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | #include <linux/serial_pnx8xxx.h>
 | 
					
						
							| 
									
										
										
										
											2006-04-01 21:25:28 +01:00
										 |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <int.h>
 | 
					
						
							|  |  |  | #include <usb.h>
 | 
					
						
							|  |  |  | #include <uart.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource pnx8550_usb_ohci_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_USB_OHCI_OP_BASE, | 
					
						
							|  |  |  | 		.end		= PNX8550_USB_OHCI_OP_BASE + | 
					
						
							|  |  |  | 				  PNX8550_USB_OHCI_OP_LEN, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_INT_USB, | 
					
						
							|  |  |  | 		.end		= PNX8550_INT_USB, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource pnx8550_uart_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_UART_PORT0, | 
					
						
							|  |  |  | 		.end		= PNX8550_UART_PORT0 + 0xfff, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_UART_INT(0), | 
					
						
							|  |  |  | 		.end		= PNX8550_UART_INT(0), | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[2] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_UART_PORT1, | 
					
						
							|  |  |  | 		.end		= PNX8550_UART_PORT1 + 0xfff, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[3] = { | 
					
						
							|  |  |  | 		.start		= PNX8550_UART_INT(1), | 
					
						
							|  |  |  | 		.end		= PNX8550_UART_INT(1), | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | struct pnx8xxx_port pnx8xxx_ports[] = { | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.port   = { | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | 			.type		= PORT_PNX8XXX, | 
					
						
							| 
									
										
										
										
											2006-02-05 10:48:10 +00:00
										 |  |  | 			.iotype		= UPIO_MEM, | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 			.membase	= (void __iomem *)PNX8550_UART_PORT0, | 
					
						
							|  |  |  | 			.mapbase	= PNX8550_UART_PORT0, | 
					
						
							|  |  |  | 			.irq		= PNX8550_UART_INT(0), | 
					
						
							|  |  |  | 			.uartclk	= 3692300, | 
					
						
							|  |  |  | 			.fifosize	= 16, | 
					
						
							| 
									
										
										
										
											2006-02-05 10:52:29 +00:00
										 |  |  | 			.flags		= UPF_BOOT_AUTOCONF, | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 			.line		= 0, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.port   = { | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | 			.type		= PORT_PNX8XXX, | 
					
						
							| 
									
										
										
										
											2006-02-05 10:48:10 +00:00
										 |  |  | 			.iotype		= UPIO_MEM, | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 			.membase	= (void __iomem *)PNX8550_UART_PORT1, | 
					
						
							|  |  |  | 			.mapbase	= PNX8550_UART_PORT1, | 
					
						
							|  |  |  | 			.irq		= PNX8550_UART_INT(1), | 
					
						
							|  |  |  | 			.uartclk	= 3692300, | 
					
						
							|  |  |  | 			.fifosize	= 16, | 
					
						
							| 
									
										
										
										
											2006-02-05 10:52:29 +00:00
										 |  |  | 			.flags		= UPF_BOOT_AUTOCONF, | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 			.line		= 1, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* The dmamask must be set for OHCI to work */ | 
					
						
							| 
									
										
										
										
											2009-04-06 19:01:15 -07:00
										 |  |  | static u64 ohci_dmamask = DMA_BIT_MASK(32); | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-06 19:01:15 -07:00
										 |  |  | static u64 uart_dmamask = DMA_BIT_MASK(32); | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device pnx8550_usb_ohci_device = { | 
					
						
							|  |  |  | 	.name		= "pnx8550-ohci", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= &ohci_dmamask, | 
					
						
							| 
									
										
										
										
											2009-04-06 19:01:15 -07:00
										 |  |  | 		.coherent_dma_mask	= DMA_BIT_MASK(32), | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(pnx8550_usb_ohci_resources), | 
					
						
							|  |  |  | 	.resource	= pnx8550_usb_ohci_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device pnx8550_uart_device = { | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | 	.name		= "pnx8xxx-uart", | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= &uart_dmamask, | 
					
						
							| 
									
										
										
										
											2009-04-06 19:01:15 -07:00
										 |  |  | 		.coherent_dma_mask	= DMA_BIT_MASK(32), | 
					
						
							| 
									
										
										
										
											2006-10-04 19:19:58 +04:00
										 |  |  | 		.platform_data = pnx8xxx_ports, | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(pnx8550_uart_resources), | 
					
						
							|  |  |  | 	.resource	= pnx8550_uart_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device *pnx8550_platform_devices[] __initdata = { | 
					
						
							|  |  |  | 	&pnx8550_usb_ohci_device, | 
					
						
							|  |  |  | 	&pnx8550_uart_device, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-10 15:04:06 +01:00
										 |  |  | static int __init pnx8550_platform_init(void) | 
					
						
							| 
									
										
										
										
											2005-07-14 17:47:57 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	return platform_add_devices(pnx8550_platform_devices, | 
					
						
							|  |  |  | 			            ARRAY_SIZE(pnx8550_platform_devices)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | arch_initcall(pnx8550_platform_init); |