1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
4 * JZ4740 platform devices
8 #include <linux/device.h>
9 #include <linux/kernel.h>
10 #include <linux/platform_device.h>
11 #include <linux/resource.h>
13 #include <linux/dma-mapping.h>
15 #include <linux/usb/musb.h>
17 #include <asm/mach-jz4740/platform.h>
18 #include <asm/mach-jz4740/base.h>
19 #include <asm/mach-jz4740/irq.h>
21 #include <linux/serial_core.h>
22 #include <linux/serial_8250.h>
24 /* USB Device Controller */
25 struct platform_device jz4740_udc_xceiv_device = {
26 .name = "usb_phy_generic",
30 static struct resource jz4740_udc_resources[] = {
32 .start = JZ4740_UDC_BASE_ADDR,
33 .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
34 .flags = IORESOURCE_MEM,
37 .start = JZ4740_IRQ_UDC,
38 .end = JZ4740_IRQ_UDC,
39 .flags = IORESOURCE_IRQ,
44 struct platform_device jz4740_udc_device = {
45 .name = "musb-jz4740",
48 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
49 .coherent_dma_mask = DMA_BIT_MASK(32),
51 .num_resources = ARRAY_SIZE(jz4740_udc_resources),
52 .resource = jz4740_udc_resources,
55 /* MMC/SD controller */
56 static struct resource jz4740_mmc_resources[] = {
58 .start = JZ4740_MSC_BASE_ADDR,
59 .end = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
60 .flags = IORESOURCE_MEM,
63 .start = JZ4740_IRQ_MSC,
64 .end = JZ4740_IRQ_MSC,
65 .flags = IORESOURCE_IRQ,
69 struct platform_device jz4740_mmc_device = {
73 .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
74 .coherent_dma_mask = DMA_BIT_MASK(32),
76 .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
77 .resource = jz4740_mmc_resources,
81 static struct resource jz4740_i2c_resources[] = {
83 .start = JZ4740_I2C_BASE_ADDR,
84 .end = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
85 .flags = IORESOURCE_MEM,
88 .start = JZ4740_IRQ_I2C,
89 .end = JZ4740_IRQ_I2C,
90 .flags = IORESOURCE_IRQ,
94 struct platform_device jz4740_i2c_device = {
97 .num_resources = ARRAY_SIZE(jz4740_i2c_resources),
98 .resource = jz4740_i2c_resources,
101 /* NAND controller */
102 static struct resource jz4740_nand_resources[] = {
105 .start = JZ4740_EMC_BASE_ADDR,
106 .end = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
107 .flags = IORESOURCE_MEM,
112 .end = 0x180C0000 - 1,
113 .flags = IORESOURCE_MEM,
118 .end = 0x140C0000 - 1,
119 .flags = IORESOURCE_MEM,
124 .end = 0x0C0C0000 - 1,
125 .flags = IORESOURCE_MEM,
130 .end = 0x080C0000 - 1,
131 .flags = IORESOURCE_MEM,
135 struct platform_device jz4740_nand_device = {
136 .name = "jz4740-nand",
137 .num_resources = ARRAY_SIZE(jz4740_nand_resources),
138 .resource = jz4740_nand_resources,
142 static struct resource jz4740_framebuffer_resources[] = {
144 .start = JZ4740_LCD_BASE_ADDR,
145 .end = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
146 .flags = IORESOURCE_MEM,
150 struct platform_device jz4740_framebuffer_device = {
153 .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
154 .resource = jz4740_framebuffer_resources,
156 .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
157 .coherent_dma_mask = DMA_BIT_MASK(32),
162 static struct resource jz4740_i2s_resources[] = {
164 .start = JZ4740_AIC_BASE_ADDR,
165 .end = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
166 .flags = IORESOURCE_MEM,
170 struct platform_device jz4740_i2s_device = {
171 .name = "jz4740-i2s",
173 .num_resources = ARRAY_SIZE(jz4740_i2s_resources),
174 .resource = jz4740_i2s_resources,
178 struct platform_device jz4740_pcm_device = {
179 .name = "jz4740-pcm-audio",
184 static struct resource jz4740_codec_resources[] = {
186 .start = JZ4740_AIC_BASE_ADDR + 0x80,
187 .end = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
188 .flags = IORESOURCE_MEM,
192 struct platform_device jz4740_codec_device = {
193 .name = "jz4740-codec",
195 .num_resources = ARRAY_SIZE(jz4740_codec_resources),
196 .resource = jz4740_codec_resources,
200 static struct resource jz4740_adc_resources[] = {
202 .start = JZ4740_SADC_BASE_ADDR,
203 .end = JZ4740_SADC_BASE_ADDR + 0x30,
204 .flags = IORESOURCE_MEM,
207 .start = JZ4740_IRQ_SADC,
208 .end = JZ4740_IRQ_SADC,
209 .flags = IORESOURCE_IRQ,
212 .start = JZ4740_IRQ_ADC_BASE,
213 .end = JZ4740_IRQ_ADC_BASE,
214 .flags = IORESOURCE_IRQ,
218 struct platform_device jz4740_adc_device = {
219 .name = "jz4740-adc",
221 .num_resources = ARRAY_SIZE(jz4740_adc_resources),
222 .resource = jz4740_adc_resources,
226 struct platform_device jz4740_pwm_device = {
227 .name = "jz4740-pwm",
232 static struct resource jz4740_dma_resources[] = {
234 .start = JZ4740_DMAC_BASE_ADDR,
235 .end = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
236 .flags = IORESOURCE_MEM,
239 .start = JZ4740_IRQ_DMAC,
240 .end = JZ4740_IRQ_DMAC,
241 .flags = IORESOURCE_IRQ,
245 struct platform_device jz4740_dma_device = {
246 .name = "jz4740-dma",
248 .num_resources = ARRAY_SIZE(jz4740_dma_resources),
249 .resource = jz4740_dma_resources,