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>
35 /* USB Device Controller */
36 struct platform_device jz4740_udc_xceiv_device
= {
37 .name
= "usb_phy_generic",
41 static struct resource jz4740_udc_resources
[] = {
43 .start
= JZ4740_UDC_BASE_ADDR
,
44 .end
= JZ4740_UDC_BASE_ADDR
+ 0x10000 - 1,
45 .flags
= IORESOURCE_MEM
,
48 .start
= JZ4740_IRQ_UDC
,
49 .end
= JZ4740_IRQ_UDC
,
50 .flags
= IORESOURCE_IRQ
,
55 struct platform_device jz4740_udc_device
= {
56 .name
= "musb-jz4740",
59 .dma_mask
= &jz4740_udc_device
.dev
.coherent_dma_mask
,
60 .coherent_dma_mask
= DMA_BIT_MASK(32),
62 .num_resources
= ARRAY_SIZE(jz4740_udc_resources
),
63 .resource
= jz4740_udc_resources
,
66 /* MMC/SD controller */
67 static struct resource jz4740_mmc_resources
[] = {
69 .start
= JZ4740_MSC_BASE_ADDR
,
70 .end
= JZ4740_MSC_BASE_ADDR
+ 0x1000 - 1,
71 .flags
= IORESOURCE_MEM
,
74 .start
= JZ4740_IRQ_MSC
,
75 .end
= JZ4740_IRQ_MSC
,
76 .flags
= IORESOURCE_IRQ
,
80 struct platform_device jz4740_mmc_device
= {
84 .dma_mask
= &jz4740_mmc_device
.dev
.coherent_dma_mask
,
85 .coherent_dma_mask
= DMA_BIT_MASK(32),
87 .num_resources
= ARRAY_SIZE(jz4740_mmc_resources
),
88 .resource
= jz4740_mmc_resources
,
92 static struct resource jz4740_rtc_resources
[] = {
94 .start
= JZ4740_RTC_BASE_ADDR
,
95 .end
= JZ4740_RTC_BASE_ADDR
+ 0x38 - 1,
96 .flags
= IORESOURCE_MEM
,
99 .start
= JZ4740_IRQ_RTC
,
100 .end
= JZ4740_IRQ_RTC
,
101 .flags
= IORESOURCE_IRQ
,
105 struct platform_device jz4740_rtc_device
= {
106 .name
= "jz4740-rtc",
108 .num_resources
= ARRAY_SIZE(jz4740_rtc_resources
),
109 .resource
= jz4740_rtc_resources
,
113 static struct resource jz4740_i2c_resources
[] = {
115 .start
= JZ4740_I2C_BASE_ADDR
,
116 .end
= JZ4740_I2C_BASE_ADDR
+ 0x1000 - 1,
117 .flags
= IORESOURCE_MEM
,
120 .start
= JZ4740_IRQ_I2C
,
121 .end
= JZ4740_IRQ_I2C
,
122 .flags
= IORESOURCE_IRQ
,
126 struct platform_device jz4740_i2c_device
= {
127 .name
= "jz4740-i2c",
129 .num_resources
= ARRAY_SIZE(jz4740_i2c_resources
),
130 .resource
= jz4740_i2c_resources
,
133 /* NAND controller */
134 static struct resource jz4740_nand_resources
[] = {
137 .start
= JZ4740_EMC_BASE_ADDR
,
138 .end
= JZ4740_EMC_BASE_ADDR
+ 0x1000 - 1,
139 .flags
= IORESOURCE_MEM
,
144 .end
= 0x180C0000 - 1,
145 .flags
= IORESOURCE_MEM
,
150 .end
= 0x140C0000 - 1,
151 .flags
= IORESOURCE_MEM
,
156 .end
= 0x0C0C0000 - 1,
157 .flags
= IORESOURCE_MEM
,
162 .end
= 0x080C0000 - 1,
163 .flags
= IORESOURCE_MEM
,
167 struct platform_device jz4740_nand_device
= {
168 .name
= "jz4740-nand",
169 .num_resources
= ARRAY_SIZE(jz4740_nand_resources
),
170 .resource
= jz4740_nand_resources
,
174 static struct resource jz4740_framebuffer_resources
[] = {
176 .start
= JZ4740_LCD_BASE_ADDR
,
177 .end
= JZ4740_LCD_BASE_ADDR
+ 0x1000 - 1,
178 .flags
= IORESOURCE_MEM
,
182 struct platform_device jz4740_framebuffer_device
= {
185 .num_resources
= ARRAY_SIZE(jz4740_framebuffer_resources
),
186 .resource
= jz4740_framebuffer_resources
,
188 .dma_mask
= &jz4740_framebuffer_device
.dev
.coherent_dma_mask
,
189 .coherent_dma_mask
= DMA_BIT_MASK(32),
194 static struct resource jz4740_i2s_resources
[] = {
196 .start
= JZ4740_AIC_BASE_ADDR
,
197 .end
= JZ4740_AIC_BASE_ADDR
+ 0x38 - 1,
198 .flags
= IORESOURCE_MEM
,
202 struct platform_device jz4740_i2s_device
= {
203 .name
= "jz4740-i2s",
205 .num_resources
= ARRAY_SIZE(jz4740_i2s_resources
),
206 .resource
= jz4740_i2s_resources
,
210 struct platform_device jz4740_pcm_device
= {
211 .name
= "jz4740-pcm-audio",
216 static struct resource jz4740_codec_resources
[] = {
218 .start
= JZ4740_AIC_BASE_ADDR
+ 0x80,
219 .end
= JZ4740_AIC_BASE_ADDR
+ 0x88 - 1,
220 .flags
= IORESOURCE_MEM
,
224 struct platform_device jz4740_codec_device
= {
225 .name
= "jz4740-codec",
227 .num_resources
= ARRAY_SIZE(jz4740_codec_resources
),
228 .resource
= jz4740_codec_resources
,
232 static struct resource jz4740_adc_resources
[] = {
234 .start
= JZ4740_SADC_BASE_ADDR
,
235 .end
= JZ4740_SADC_BASE_ADDR
+ 0x30,
236 .flags
= IORESOURCE_MEM
,
239 .start
= JZ4740_IRQ_SADC
,
240 .end
= JZ4740_IRQ_SADC
,
241 .flags
= IORESOURCE_IRQ
,
244 .start
= JZ4740_IRQ_ADC_BASE
,
245 .end
= JZ4740_IRQ_ADC_BASE
,
246 .flags
= IORESOURCE_IRQ
,
250 struct platform_device jz4740_adc_device
= {
251 .name
= "jz4740-adc",
253 .num_resources
= ARRAY_SIZE(jz4740_adc_resources
),
254 .resource
= jz4740_adc_resources
,
258 static struct resource jz4740_wdt_resources
[] = {
260 .start
= JZ4740_WDT_BASE_ADDR
,
261 .end
= JZ4740_WDT_BASE_ADDR
+ 0x10 - 1,
262 .flags
= IORESOURCE_MEM
,
266 struct platform_device jz4740_wdt_device
= {
267 .name
= "jz4740-wdt",
269 .num_resources
= ARRAY_SIZE(jz4740_wdt_resources
),
270 .resource
= jz4740_wdt_resources
,
274 struct platform_device jz4740_pwm_device
= {
275 .name
= "jz4740-pwm",
280 static struct resource jz4740_dma_resources
[] = {
282 .start
= JZ4740_DMAC_BASE_ADDR
,
283 .end
= JZ4740_DMAC_BASE_ADDR
+ 0x400 - 1,
284 .flags
= IORESOURCE_MEM
,
287 .start
= JZ4740_IRQ_DMAC
,
288 .end
= JZ4740_IRQ_DMAC
,
289 .flags
= IORESOURCE_IRQ
,
293 struct platform_device jz4740_dma_device
= {
294 .name
= "jz4740-dma",
296 .num_resources
= ARRAY_SIZE(jz4740_dma_resources
),
297 .resource
= jz4740_dma_resources
,