Ben Dooks | 0241cbb | 2008-10-21 14:06:46 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/plat-s3c64xx/dev-uart.c |
| 2 | * |
| 3 | * Copyright 2008 Openmoko, Inc. |
| 4 | * Copyright 2008 Simtec Electronics |
| 5 | * Ben Dooks <ben@simtec.co.uk> |
| 6 | * http://armlinux.simtec.co.uk/ |
| 7 | * |
| 8 | * Base S3C64XX UART resource and device definitions |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/list.h> |
| 20 | #include <linux/platform_device.h> |
| 21 | |
| 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | #include <mach/hardware.h> |
| 25 | #include <mach/map.h> |
| 26 | |
| 27 | #include <plat/devs.h> |
| 28 | |
| 29 | /* Serial port registrations */ |
| 30 | |
| 31 | /* 64xx uarts are closer together */ |
| 32 | |
| 33 | static struct resource s3c64xx_uart0_resource[] = { |
| 34 | [0] = { |
| 35 | .start = S3C_PA_UART0, |
| 36 | .end = S3C_PA_UART0 + 0x100, |
| 37 | .flags = IORESOURCE_MEM, |
| 38 | }, |
| 39 | [1] = { |
| 40 | .start = IRQ_S3CUART_RX0, |
| 41 | .end = IRQ_S3CUART_RX0, |
| 42 | .flags = IORESOURCE_IRQ, |
| 43 | }, |
| 44 | [2] = { |
| 45 | .start = IRQ_S3CUART_TX0, |
| 46 | .end = IRQ_S3CUART_TX0, |
| 47 | .flags = IORESOURCE_IRQ, |
| 48 | |
| 49 | }, |
| 50 | [3] = { |
| 51 | .start = IRQ_S3CUART_ERR0, |
| 52 | .end = IRQ_S3CUART_ERR0, |
| 53 | .flags = IORESOURCE_IRQ, |
| 54 | } |
| 55 | }; |
| 56 | |
| 57 | static struct resource s3c64xx_uart1_resource[] = { |
| 58 | [0] = { |
| 59 | .start = S3C_PA_UART1, |
| 60 | .end = S3C_PA_UART1 + 0x100, |
| 61 | .flags = IORESOURCE_MEM, |
| 62 | }, |
| 63 | [1] = { |
| 64 | .start = IRQ_S3CUART_RX1, |
| 65 | .end = IRQ_S3CUART_RX1, |
| 66 | .flags = IORESOURCE_IRQ, |
| 67 | }, |
| 68 | [2] = { |
| 69 | .start = IRQ_S3CUART_TX1, |
| 70 | .end = IRQ_S3CUART_TX1, |
| 71 | .flags = IORESOURCE_IRQ, |
| 72 | |
| 73 | }, |
| 74 | [3] = { |
| 75 | .start = IRQ_S3CUART_ERR1, |
| 76 | .end = IRQ_S3CUART_ERR1, |
| 77 | .flags = IORESOURCE_IRQ, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static struct resource s3c6xx_uart2_resource[] = { |
| 82 | [0] = { |
| 83 | .start = S3C_PA_UART2, |
| 84 | .end = S3C_PA_UART2 + 0x100, |
| 85 | .flags = IORESOURCE_MEM, |
| 86 | }, |
| 87 | [1] = { |
| 88 | .start = IRQ_S3CUART_RX2, |
| 89 | .end = IRQ_S3CUART_RX2, |
| 90 | .flags = IORESOURCE_IRQ, |
| 91 | }, |
| 92 | [2] = { |
| 93 | .start = IRQ_S3CUART_TX2, |
| 94 | .end = IRQ_S3CUART_TX2, |
| 95 | .flags = IORESOURCE_IRQ, |
| 96 | |
| 97 | }, |
| 98 | [3] = { |
| 99 | .start = IRQ_S3CUART_ERR2, |
| 100 | .end = IRQ_S3CUART_ERR2, |
| 101 | .flags = IORESOURCE_IRQ, |
| 102 | }, |
| 103 | }; |
| 104 | |
| 105 | static struct resource s3c64xx_uart3_resource[] = { |
| 106 | [0] = { |
| 107 | .start = S3C_PA_UART3, |
| 108 | .end = S3C_PA_UART3 + 0x100, |
| 109 | .flags = IORESOURCE_MEM, |
| 110 | }, |
| 111 | [1] = { |
| 112 | .start = IRQ_S3CUART_RX3, |
| 113 | .end = IRQ_S3CUART_RX3, |
| 114 | .flags = IORESOURCE_IRQ, |
| 115 | }, |
| 116 | [2] = { |
| 117 | .start = IRQ_S3CUART_TX3, |
| 118 | .end = IRQ_S3CUART_TX3, |
| 119 | .flags = IORESOURCE_IRQ, |
| 120 | |
| 121 | }, |
| 122 | [3] = { |
| 123 | .start = IRQ_S3CUART_ERR3, |
| 124 | .end = IRQ_S3CUART_ERR3, |
| 125 | .flags = IORESOURCE_IRQ, |
| 126 | }, |
| 127 | }; |
| 128 | |
| 129 | |
| 130 | struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = { |
| 131 | [0] = { |
| 132 | .resources = s3c64xx_uart0_resource, |
| 133 | .nr_resources = ARRAY_SIZE(s3c64xx_uart0_resource), |
| 134 | }, |
| 135 | [1] = { |
| 136 | .resources = s3c64xx_uart1_resource, |
| 137 | .nr_resources = ARRAY_SIZE(s3c64xx_uart1_resource), |
| 138 | }, |
| 139 | [2] = { |
| 140 | .resources = s3c6xx_uart2_resource, |
| 141 | .nr_resources = ARRAY_SIZE(s3c6xx_uart2_resource), |
| 142 | }, |
| 143 | [3] = { |
| 144 | .resources = s3c64xx_uart3_resource, |
| 145 | .nr_resources = ARRAY_SIZE(s3c64xx_uart3_resource), |
| 146 | }, |
| 147 | }; |
| 148 | |
| 149 | /* uart devices */ |
| 150 | |
| 151 | static struct platform_device s3c24xx_uart_device0 = { |
| 152 | .id = 0, |
| 153 | }; |
| 154 | |
| 155 | static struct platform_device s3c24xx_uart_device1 = { |
| 156 | .id = 1, |
| 157 | }; |
| 158 | |
| 159 | static struct platform_device s3c24xx_uart_device2 = { |
| 160 | .id = 2, |
| 161 | }; |
| 162 | |
| 163 | static struct platform_device s3c24xx_uart_device3 = { |
| 164 | .id = 3, |
| 165 | }; |
| 166 | |
| 167 | struct platform_device *s3c24xx_uart_src[4] = { |
| 168 | &s3c24xx_uart_device0, |
| 169 | &s3c24xx_uart_device1, |
| 170 | &s3c24xx_uart_device2, |
| 171 | &s3c24xx_uart_device3, |
| 172 | }; |
| 173 | |
| 174 | struct platform_device *s3c24xx_uart_devs[4] = { |
| 175 | }; |
| 176 | |