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>
26 /* USB Device Controller */
27 struct platform_device jz4740_udc_xceiv_device = {
28 .name = "usb_phy_generic",
32 static struct resource jz4740_udc_resources[] = {
34 .start = JZ4740_UDC_BASE_ADDR,
35 .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
36 .flags = IORESOURCE_MEM,
39 .start = JZ4740_IRQ_UDC,
40 .end = JZ4740_IRQ_UDC,
41 .flags = IORESOURCE_IRQ,
46 struct platform_device jz4740_udc_device = {
47 .name = "musb-jz4740",
50 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
51 .coherent_dma_mask = DMA_BIT_MASK(32),
53 .num_resources = ARRAY_SIZE(jz4740_udc_resources),
54 .resource = jz4740_udc_resources,
57 /* MMC/SD controller */
58 static struct resource jz4740_mmc_resources[] = {
60 .start = JZ4740_MSC_BASE_ADDR,
61 .end = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
62 .flags = IORESOURCE_MEM,
65 .start = JZ4740_IRQ_MSC,
66 .end = JZ4740_IRQ_MSC,
67 .flags = IORESOURCE_IRQ,
71 struct platform_device jz4740_mmc_device = {
75 .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
76 .coherent_dma_mask = DMA_BIT_MASK(32),
78 .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
79 .resource = jz4740_mmc_resources,
83 static struct resource jz4740_i2c_resources[] = {
85 .start = JZ4740_I2C_BASE_ADDR,
86 .end = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
87 .flags = IORESOURCE_MEM,
90 .start = JZ4740_IRQ_I2C,
91 .end = JZ4740_IRQ_I2C,
92 .flags = IORESOURCE_IRQ,
96 struct platform_device jz4740_i2c_device = {
99 .num_resources = ARRAY_SIZE(jz4740_i2c_resources),
100 .resource = jz4740_i2c_resources,
103 /* NAND controller */
104 static struct resource jz4740_nand_resources[] = {
107 .start = JZ4740_EMC_BASE_ADDR,
108 .end = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
109 .flags = IORESOURCE_MEM,
114 .end = 0x180C0000 - 1,
115 .flags = IORESOURCE_MEM,
120 .end = 0x140C0000 - 1,
121 .flags = IORESOURCE_MEM,
126 .end = 0x0C0C0000 - 1,
127 .flags = IORESOURCE_MEM,
132 .end = 0x080C0000 - 1,
133 .flags = IORESOURCE_MEM,
137 struct platform_device jz4740_nand_device = {
138 .name = "jz4740-nand",
139 .num_resources = ARRAY_SIZE(jz4740_nand_resources),
140 .resource = jz4740_nand_resources,
144 static struct resource jz4740_framebuffer_resources[] = {
146 .start = JZ4740_LCD_BASE_ADDR,
147 .end = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
148 .flags = IORESOURCE_MEM,
152 struct platform_device jz4740_framebuffer_device = {
155 .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
156 .resource = jz4740_framebuffer_resources,
158 .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
159 .coherent_dma_mask = DMA_BIT_MASK(32),
164 static struct resource jz4740_i2s_resources[] = {
166 .start = JZ4740_AIC_BASE_ADDR,
167 .end = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
168 .flags = IORESOURCE_MEM,
172 struct platform_device jz4740_i2s_device = {
173 .name = "jz4740-i2s",
175 .num_resources = ARRAY_SIZE(jz4740_i2s_resources),
176 .resource = jz4740_i2s_resources,
180 struct platform_device jz4740_pcm_device = {
181 .name = "jz4740-pcm-audio",
186 static struct resource jz4740_codec_resources[] = {
188 .start = JZ4740_AIC_BASE_ADDR + 0x80,
189 .end = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
190 .flags = IORESOURCE_MEM,
194 struct platform_device jz4740_codec_device = {
195 .name = "jz4740-codec",
197 .num_resources = ARRAY_SIZE(jz4740_codec_resources),
198 .resource = jz4740_codec_resources,
202 static struct resource jz4740_adc_resources[] = {
204 .start = JZ4740_SADC_BASE_ADDR,
205 .end = JZ4740_SADC_BASE_ADDR + 0x30,
206 .flags = IORESOURCE_MEM,
209 .start = JZ4740_IRQ_SADC,
210 .end = JZ4740_IRQ_SADC,
211 .flags = IORESOURCE_IRQ,
214 .start = JZ4740_IRQ_ADC_BASE,
215 .end = JZ4740_IRQ_ADC_BASE,
216 .flags = IORESOURCE_IRQ,
220 struct platform_device jz4740_adc_device = {
221 .name = "jz4740-adc",
223 .num_resources = ARRAY_SIZE(jz4740_adc_resources),
224 .resource = jz4740_adc_resources,
228 struct platform_device jz4740_pwm_device = {
229 .name = "jz4740-pwm",
234 static struct resource jz4740_dma_resources[] = {
236 .start = JZ4740_DMAC_BASE_ADDR,
237 .end = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
238 .flags = IORESOURCE_MEM,
241 .start = JZ4740_IRQ_DMAC,
242 .end = JZ4740_IRQ_DMAC,
243 .flags = IORESOURCE_IRQ,
247 struct platform_device jz4740_dma_device = {
248 .name = "jz4740-dma",
250 .num_resources = ARRAY_SIZE(jz4740_dma_resources),
251 .resource = jz4740_dma_resources,