2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform devices
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 #include <linux/clk.h>
17 #include <linux/device.h>
18 #include <linux/kernel.h>
19 #include <linux/platform_device.h>
20 #include <linux/resource.h>
22 #include <linux/dma-mapping.h>
24 #include <linux/usb/musb.h>
26 #include <asm/mach-jz4740/platform.h>
27 #include <asm/mach-jz4740/base.h>
28 #include <asm/mach-jz4740/irq.h>
30 #include <linux/serial_core.h>
31 #include <linux/serial_8250.h>
36 static struct resource jz4740_usb_ohci_resources
[] = {
38 .start
= JZ4740_UHC_BASE_ADDR
,
39 .end
= JZ4740_UHC_BASE_ADDR
+ 0x1000 - 1,
40 .flags
= IORESOURCE_MEM
,
43 .start
= JZ4740_IRQ_UHC
,
44 .end
= JZ4740_IRQ_UHC
,
45 .flags
= IORESOURCE_IRQ
,
49 struct platform_device jz4740_usb_ohci_device
= {
50 .name
= "jz4740-ohci",
53 .dma_mask
= &jz4740_usb_ohci_device
.dev
.coherent_dma_mask
,
54 .coherent_dma_mask
= DMA_BIT_MASK(32),
56 .num_resources
= ARRAY_SIZE(jz4740_usb_ohci_resources
),
57 .resource
= jz4740_usb_ohci_resources
,
60 /* USB Device Controller */
61 struct platform_device jz4740_udc_xceiv_device
= {
62 .name
= "usb_phy_generic",
66 static struct resource jz4740_udc_resources
[] = {
68 .start
= JZ4740_UDC_BASE_ADDR
,
69 .end
= JZ4740_UDC_BASE_ADDR
+ 0x10000 - 1,
70 .flags
= IORESOURCE_MEM
,
73 .start
= JZ4740_IRQ_UDC
,
74 .end
= JZ4740_IRQ_UDC
,
75 .flags
= IORESOURCE_IRQ
,
80 struct platform_device jz4740_udc_device
= {
81 .name
= "musb-jz4740",
84 .dma_mask
= &jz4740_udc_device
.dev
.coherent_dma_mask
,
85 .coherent_dma_mask
= DMA_BIT_MASK(32),
87 .num_resources
= ARRAY_SIZE(jz4740_udc_resources
),
88 .resource
= jz4740_udc_resources
,
91 /* MMC/SD controller */
92 static struct resource jz4740_mmc_resources
[] = {
94 .start
= JZ4740_MSC_BASE_ADDR
,
95 .end
= JZ4740_MSC_BASE_ADDR
+ 0x1000 - 1,
96 .flags
= IORESOURCE_MEM
,
99 .start
= JZ4740_IRQ_MSC
,
100 .end
= JZ4740_IRQ_MSC
,
101 .flags
= IORESOURCE_IRQ
,
105 struct platform_device jz4740_mmc_device
= {
106 .name
= "jz4740-mmc",
109 .dma_mask
= &jz4740_mmc_device
.dev
.coherent_dma_mask
,
110 .coherent_dma_mask
= DMA_BIT_MASK(32),
112 .num_resources
= ARRAY_SIZE(jz4740_mmc_resources
),
113 .resource
= jz4740_mmc_resources
,
117 static struct resource jz4740_rtc_resources
[] = {
119 .start
= JZ4740_RTC_BASE_ADDR
,
120 .end
= JZ4740_RTC_BASE_ADDR
+ 0x38 - 1,
121 .flags
= IORESOURCE_MEM
,
124 .start
= JZ4740_IRQ_RTC
,
125 .end
= JZ4740_IRQ_RTC
,
126 .flags
= IORESOURCE_IRQ
,
130 struct platform_device jz4740_rtc_device
= {
131 .name
= "jz4740-rtc",
133 .num_resources
= ARRAY_SIZE(jz4740_rtc_resources
),
134 .resource
= jz4740_rtc_resources
,
138 static struct resource jz4740_i2c_resources
[] = {
140 .start
= JZ4740_I2C_BASE_ADDR
,
141 .end
= JZ4740_I2C_BASE_ADDR
+ 0x1000 - 1,
142 .flags
= IORESOURCE_MEM
,
145 .start
= JZ4740_IRQ_I2C
,
146 .end
= JZ4740_IRQ_I2C
,
147 .flags
= IORESOURCE_IRQ
,
151 struct platform_device jz4740_i2c_device
= {
152 .name
= "jz4740-i2c",
154 .num_resources
= ARRAY_SIZE(jz4740_i2c_resources
),
155 .resource
= jz4740_i2c_resources
,
158 /* NAND controller */
159 static struct resource jz4740_nand_resources
[] = {
162 .start
= JZ4740_EMC_BASE_ADDR
,
163 .end
= JZ4740_EMC_BASE_ADDR
+ 0x1000 - 1,
164 .flags
= IORESOURCE_MEM
,
169 .end
= 0x180C0000 - 1,
170 .flags
= IORESOURCE_MEM
,
175 .end
= 0x140C0000 - 1,
176 .flags
= IORESOURCE_MEM
,
181 .end
= 0x0C0C0000 - 1,
182 .flags
= IORESOURCE_MEM
,
187 .end
= 0x080C0000 - 1,
188 .flags
= IORESOURCE_MEM
,
192 struct platform_device jz4740_nand_device
= {
193 .name
= "jz4740-nand",
194 .num_resources
= ARRAY_SIZE(jz4740_nand_resources
),
195 .resource
= jz4740_nand_resources
,
199 static struct resource jz4740_framebuffer_resources
[] = {
201 .start
= JZ4740_LCD_BASE_ADDR
,
202 .end
= JZ4740_LCD_BASE_ADDR
+ 0x1000 - 1,
203 .flags
= IORESOURCE_MEM
,
207 struct platform_device jz4740_framebuffer_device
= {
210 .num_resources
= ARRAY_SIZE(jz4740_framebuffer_resources
),
211 .resource
= jz4740_framebuffer_resources
,
213 .dma_mask
= &jz4740_framebuffer_device
.dev
.coherent_dma_mask
,
214 .coherent_dma_mask
= DMA_BIT_MASK(32),
219 static struct resource jz4740_i2s_resources
[] = {
221 .start
= JZ4740_AIC_BASE_ADDR
,
222 .end
= JZ4740_AIC_BASE_ADDR
+ 0x38 - 1,
223 .flags
= IORESOURCE_MEM
,
227 struct platform_device jz4740_i2s_device
= {
228 .name
= "jz4740-i2s",
230 .num_resources
= ARRAY_SIZE(jz4740_i2s_resources
),
231 .resource
= jz4740_i2s_resources
,
235 struct platform_device jz4740_pcm_device
= {
236 .name
= "jz4740-pcm-audio",
241 static struct resource jz4740_codec_resources
[] = {
243 .start
= JZ4740_AIC_BASE_ADDR
+ 0x80,
244 .end
= JZ4740_AIC_BASE_ADDR
+ 0x88 - 1,
245 .flags
= IORESOURCE_MEM
,
249 struct platform_device jz4740_codec_device
= {
250 .name
= "jz4740-codec",
252 .num_resources
= ARRAY_SIZE(jz4740_codec_resources
),
253 .resource
= jz4740_codec_resources
,
257 static struct resource jz4740_adc_resources
[] = {
259 .start
= JZ4740_SADC_BASE_ADDR
,
260 .end
= JZ4740_SADC_BASE_ADDR
+ 0x30,
261 .flags
= IORESOURCE_MEM
,
264 .start
= JZ4740_IRQ_SADC
,
265 .end
= JZ4740_IRQ_SADC
,
266 .flags
= IORESOURCE_IRQ
,
269 .start
= JZ4740_IRQ_ADC_BASE
,
270 .end
= JZ4740_IRQ_ADC_BASE
,
271 .flags
= IORESOURCE_IRQ
,
275 struct platform_device jz4740_adc_device
= {
276 .name
= "jz4740-adc",
278 .num_resources
= ARRAY_SIZE(jz4740_adc_resources
),
279 .resource
= jz4740_adc_resources
,
283 static struct resource jz4740_wdt_resources
[] = {
285 .start
= JZ4740_WDT_BASE_ADDR
,
286 .end
= JZ4740_WDT_BASE_ADDR
+ 0x10 - 1,
287 .flags
= IORESOURCE_MEM
,
291 struct platform_device jz4740_wdt_device
= {
292 .name
= "jz4740-wdt",
294 .num_resources
= ARRAY_SIZE(jz4740_wdt_resources
),
295 .resource
= jz4740_wdt_resources
,
299 struct platform_device jz4740_pwm_device
= {
300 .name
= "jz4740-pwm",
305 static struct resource jz4740_dma_resources
[] = {
307 .start
= JZ4740_DMAC_BASE_ADDR
,
308 .end
= JZ4740_DMAC_BASE_ADDR
+ 0x400 - 1,
309 .flags
= IORESOURCE_MEM
,
312 .start
= JZ4740_IRQ_DMAC
,
313 .end
= JZ4740_IRQ_DMAC
,
314 .flags
= IORESOURCE_IRQ
,
318 struct platform_device jz4740_dma_device
= {
319 .name
= "jz4740-dma",
321 .num_resources
= ARRAY_SIZE(jz4740_dma_resources
),
322 .resource
= jz4740_dma_resources
,