OSDN Git Service

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151
[uclinux-h8/linux.git] / arch / mips / jz4740 / platform.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *  Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
4  *  JZ4740 platform devices
5  */
6
7 #include <linux/clk.h>
8 #include <linux/device.h>
9 #include <linux/kernel.h>
10 #include <linux/platform_device.h>
11 #include <linux/resource.h>
12
13 #include <linux/dma-mapping.h>
14
15 #include <linux/usb/musb.h>
16
17 #include <asm/mach-jz4740/platform.h>
18 #include <asm/mach-jz4740/base.h>
19 #include <asm/mach-jz4740/irq.h>
20
21 #include <linux/serial_core.h>
22 #include <linux/serial_8250.h>
23
24 #include "clock.h"
25
26 /* USB Device Controller */
27 struct platform_device jz4740_udc_xceiv_device = {
28         .name = "usb_phy_generic",
29         .id   = 0,
30 };
31
32 static struct resource jz4740_udc_resources[] = {
33         [0] = {
34                 .start = JZ4740_UDC_BASE_ADDR,
35                 .end   = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
36                 .flags = IORESOURCE_MEM,
37         },
38         [1] = {
39                 .start = JZ4740_IRQ_UDC,
40                 .end   = JZ4740_IRQ_UDC,
41                 .flags = IORESOURCE_IRQ,
42                 .name  = "mc",
43         },
44 };
45
46 struct platform_device jz4740_udc_device = {
47         .name = "musb-jz4740",
48         .id   = -1,
49         .dev  = {
50                 .dma_mask          = &jz4740_udc_device.dev.coherent_dma_mask,
51                 .coherent_dma_mask = DMA_BIT_MASK(32),
52         },
53         .num_resources = ARRAY_SIZE(jz4740_udc_resources),
54         .resource      = jz4740_udc_resources,
55 };
56
57 /* MMC/SD controller */
58 static struct resource jz4740_mmc_resources[] = {
59         {
60                 .start  = JZ4740_MSC_BASE_ADDR,
61                 .end    = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
62                 .flags  = IORESOURCE_MEM,
63         },
64         {
65                 .start  = JZ4740_IRQ_MSC,
66                 .end    = JZ4740_IRQ_MSC,
67                 .flags  = IORESOURCE_IRQ,
68         }
69 };
70
71 struct platform_device jz4740_mmc_device = {
72         .name           = "jz4740-mmc",
73         .id             = 0,
74         .dev = {
75                 .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
76                 .coherent_dma_mask = DMA_BIT_MASK(32),
77         },
78         .num_resources  = ARRAY_SIZE(jz4740_mmc_resources),
79         .resource       = jz4740_mmc_resources,
80 };
81
82 /* I2C controller */
83 static struct resource jz4740_i2c_resources[] = {
84         {
85                 .start  = JZ4740_I2C_BASE_ADDR,
86                 .end    = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
87                 .flags  = IORESOURCE_MEM,
88         },
89         {
90                 .start  = JZ4740_IRQ_I2C,
91                 .end    = JZ4740_IRQ_I2C,
92                 .flags  = IORESOURCE_IRQ,
93         }
94 };
95
96 struct platform_device jz4740_i2c_device = {
97         .name           = "jz4740-i2c",
98         .id             = 0,
99         .num_resources  = ARRAY_SIZE(jz4740_i2c_resources),
100         .resource       = jz4740_i2c_resources,
101 };
102
103 /* NAND controller */
104 static struct resource jz4740_nand_resources[] = {
105         {
106                 .name   = "mmio",
107                 .start  = JZ4740_EMC_BASE_ADDR,
108                 .end    = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
109                 .flags  = IORESOURCE_MEM,
110         },
111         {
112                 .name   = "bank1",
113                 .start  = 0x18000000,
114                 .end    = 0x180C0000 - 1,
115                 .flags = IORESOURCE_MEM,
116         },
117         {
118                 .name   = "bank2",
119                 .start  = 0x14000000,
120                 .end    = 0x140C0000 - 1,
121                 .flags = IORESOURCE_MEM,
122         },
123         {
124                 .name   = "bank3",
125                 .start  = 0x0C000000,
126                 .end    = 0x0C0C0000 - 1,
127                 .flags = IORESOURCE_MEM,
128         },
129         {
130                 .name   = "bank4",
131                 .start  = 0x08000000,
132                 .end    = 0x080C0000 - 1,
133                 .flags = IORESOURCE_MEM,
134         },
135 };
136
137 struct platform_device jz4740_nand_device = {
138         .name = "jz4740-nand",
139         .num_resources = ARRAY_SIZE(jz4740_nand_resources),
140         .resource = jz4740_nand_resources,
141 };
142
143 /* LCD controller */
144 static struct resource jz4740_framebuffer_resources[] = {
145         {
146                 .start  = JZ4740_LCD_BASE_ADDR,
147                 .end    = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
148                 .flags  = IORESOURCE_MEM,
149         },
150 };
151
152 struct platform_device jz4740_framebuffer_device = {
153         .name           = "jz4740-fb",
154         .id             = -1,
155         .num_resources  = ARRAY_SIZE(jz4740_framebuffer_resources),
156         .resource       = jz4740_framebuffer_resources,
157         .dev = {
158                 .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
159                 .coherent_dma_mask = DMA_BIT_MASK(32),
160         },
161 };
162
163 /* I2S controller */
164 static struct resource jz4740_i2s_resources[] = {
165         {
166                 .start  = JZ4740_AIC_BASE_ADDR,
167                 .end    = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
168                 .flags  = IORESOURCE_MEM,
169         },
170 };
171
172 struct platform_device jz4740_i2s_device = {
173         .name           = "jz4740-i2s",
174         .id             = -1,
175         .num_resources  = ARRAY_SIZE(jz4740_i2s_resources),
176         .resource       = jz4740_i2s_resources,
177 };
178
179 /* PCM */
180 struct platform_device jz4740_pcm_device = {
181         .name           = "jz4740-pcm-audio",
182         .id             = -1,
183 };
184
185 /* Codec */
186 static struct resource jz4740_codec_resources[] = {
187         {
188                 .start  = JZ4740_AIC_BASE_ADDR + 0x80,
189                 .end    = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
190                 .flags  = IORESOURCE_MEM,
191         },
192 };
193
194 struct platform_device jz4740_codec_device = {
195         .name           = "jz4740-codec",
196         .id             = -1,
197         .num_resources  = ARRAY_SIZE(jz4740_codec_resources),
198         .resource       = jz4740_codec_resources,
199 };
200
201 /* ADC controller */
202 static struct resource jz4740_adc_resources[] = {
203         {
204                 .start  = JZ4740_SADC_BASE_ADDR,
205                 .end    = JZ4740_SADC_BASE_ADDR + 0x30,
206                 .flags  = IORESOURCE_MEM,
207         },
208         {
209                 .start  = JZ4740_IRQ_SADC,
210                 .end    = JZ4740_IRQ_SADC,
211                 .flags  = IORESOURCE_IRQ,
212         },
213         {
214                 .start  = JZ4740_IRQ_ADC_BASE,
215                 .end    = JZ4740_IRQ_ADC_BASE,
216                 .flags  = IORESOURCE_IRQ,
217         },
218 };
219
220 struct platform_device jz4740_adc_device = {
221         .name           = "jz4740-adc",
222         .id             = -1,
223         .num_resources  = ARRAY_SIZE(jz4740_adc_resources),
224         .resource       = jz4740_adc_resources,
225 };
226
227 /* PWM */
228 struct platform_device jz4740_pwm_device = {
229         .name = "jz4740-pwm",
230         .id   = -1,
231 };
232
233 /* DMA */
234 static struct resource jz4740_dma_resources[] = {
235         {
236                 .start  = JZ4740_DMAC_BASE_ADDR,
237                 .end    = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
238                 .flags  = IORESOURCE_MEM,
239         },
240         {
241                 .start  = JZ4740_IRQ_DMAC,
242                 .end    = JZ4740_IRQ_DMAC,
243                 .flags  = IORESOURCE_IRQ,
244         },
245 };
246
247 struct platform_device jz4740_dma_device = {
248         .name           = "jz4740-dma",
249         .id             = -1,
250         .num_resources  = ARRAY_SIZE(jz4740_dma_resources),
251         .resource       = jz4740_dma_resources,
252 };