1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * DA8XX/OMAP L1XX platform device data
5 * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com>
6 * Derived from code that was:
7 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
9 #include <linux/ahci_platform.h>
10 #include <linux/clk-provider.h>
11 #include <linux/clk.h>
12 #include <linux/clkdev.h>
13 #include <linux/dma-contiguous.h>
14 #include <linux/dmaengine.h>
15 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/reboot.h>
19 #include <linux/serial_8250.h>
21 #include <mach/common.h>
22 #include <mach/cputype.h>
23 #include <mach/da8xx.h>
24 #include <mach/time.h>
31 #define DA8XX_TPCC_BASE 0x01c00000
32 #define DA8XX_TPTC0_BASE 0x01c08000
33 #define DA8XX_TPTC1_BASE 0x01c08400
34 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
35 #define DA8XX_I2C0_BASE 0x01c22000
36 #define DA8XX_RTC_BASE 0x01c23000
37 #define DA8XX_PRUSS_MEM_BASE 0x01c30000
38 #define DA8XX_MMCSD0_BASE 0x01c40000
39 #define DA8XX_SPI0_BASE 0x01c41000
40 #define DA830_SPI1_BASE 0x01e12000
41 #define DA8XX_LCD_CNTRL_BASE 0x01e13000
42 #define DA850_SATA_BASE 0x01e18000
43 #define DA850_MMCSD1_BASE 0x01e1b000
44 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
45 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
46 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
47 #define DA8XX_EMAC_MDIO_BASE 0x01e24000
48 #define DA8XX_I2C1_BASE 0x01e28000
49 #define DA850_TPCC1_BASE 0x01e30000
50 #define DA850_TPTC2_BASE 0x01e38000
51 #define DA850_SPI1_BASE 0x01f0e000
52 #define DA8XX_DDR2_CTL_BASE 0xb0000000
54 #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
55 #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
56 #define DA8XX_EMAC_RAM_OFFSET 0x0000
57 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
59 void __iomem
*da8xx_syscfg0_base
;
60 void __iomem
*da8xx_syscfg1_base
;
62 static struct plat_serial8250_port da8xx_serial0_pdata
[] = {
64 .mapbase
= DA8XX_UART0_BASE
,
65 .irq
= DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT0
),
66 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
75 static struct plat_serial8250_port da8xx_serial1_pdata
[] = {
77 .mapbase
= DA8XX_UART1_BASE
,
78 .irq
= DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT1
),
79 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
88 static struct plat_serial8250_port da8xx_serial2_pdata
[] = {
90 .mapbase
= DA8XX_UART2_BASE
,
91 .irq
= DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT2
),
92 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
|
102 struct platform_device da8xx_serial_device
[] = {
104 .name
= "serial8250",
105 .id
= PLAT8250_DEV_PLATFORM
,
107 .platform_data
= da8xx_serial0_pdata
,
111 .name
= "serial8250",
112 .id
= PLAT8250_DEV_PLATFORM1
,
114 .platform_data
= da8xx_serial1_pdata
,
118 .name
= "serial8250",
119 .id
= PLAT8250_DEV_PLATFORM2
,
121 .platform_data
= da8xx_serial2_pdata
,
128 static s8 da8xx_queue_priority_mapping
[][2] = {
129 /* {event queue no, Priority} */
135 static s8 da850_queue_priority_mapping
[][2] = {
136 /* {event queue no, Priority} */
141 static struct edma_soc_info da8xx_edma0_pdata
= {
142 .queue_priority_mapping
= da8xx_queue_priority_mapping
,
143 .default_queue
= EVENTQ_1
,
146 static struct edma_soc_info da850_edma1_pdata
= {
147 .queue_priority_mapping
= da850_queue_priority_mapping
,
148 .default_queue
= EVENTQ_0
,
151 static struct resource da8xx_edma0_resources
[] = {
154 .start
= DA8XX_TPCC_BASE
,
155 .end
= DA8XX_TPCC_BASE
+ SZ_32K
- 1,
156 .flags
= IORESOURCE_MEM
,
160 .start
= DA8XX_TPTC0_BASE
,
161 .end
= DA8XX_TPTC0_BASE
+ SZ_1K
- 1,
162 .flags
= IORESOURCE_MEM
,
166 .start
= DA8XX_TPTC1_BASE
,
167 .end
= DA8XX_TPTC1_BASE
+ SZ_1K
- 1,
168 .flags
= IORESOURCE_MEM
,
171 .name
= "edma3_ccint",
172 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_CCINT0
),
173 .flags
= IORESOURCE_IRQ
,
176 .name
= "edma3_ccerrint",
177 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_CCERRINT
),
178 .flags
= IORESOURCE_IRQ
,
182 static struct resource da850_edma1_resources
[] = {
185 .start
= DA850_TPCC1_BASE
,
186 .end
= DA850_TPCC1_BASE
+ SZ_32K
- 1,
187 .flags
= IORESOURCE_MEM
,
191 .start
= DA850_TPTC2_BASE
,
192 .end
= DA850_TPTC2_BASE
+ SZ_1K
- 1,
193 .flags
= IORESOURCE_MEM
,
196 .name
= "edma3_ccint",
197 .start
= DAVINCI_INTC_IRQ(IRQ_DA850_CCINT1
),
198 .flags
= IORESOURCE_IRQ
,
201 .name
= "edma3_ccerrint",
202 .start
= DAVINCI_INTC_IRQ(IRQ_DA850_CCERRINT1
),
203 .flags
= IORESOURCE_IRQ
,
207 static const struct platform_device_info da8xx_edma0_device __initconst
= {
210 .dma_mask
= DMA_BIT_MASK(32),
211 .res
= da8xx_edma0_resources
,
212 .num_res
= ARRAY_SIZE(da8xx_edma0_resources
),
213 .data
= &da8xx_edma0_pdata
,
214 .size_data
= sizeof(da8xx_edma0_pdata
),
217 static const struct platform_device_info da850_edma1_device __initconst
= {
220 .dma_mask
= DMA_BIT_MASK(32),
221 .res
= da850_edma1_resources
,
222 .num_res
= ARRAY_SIZE(da850_edma1_resources
),
223 .data
= &da850_edma1_pdata
,
224 .size_data
= sizeof(da850_edma1_pdata
),
227 static const struct dma_slave_map da830_edma_map
[] = {
228 { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
229 { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
230 { "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) },
231 { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) },
232 { "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) },
233 { "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) },
234 { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
235 { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
236 { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
237 { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
238 { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
239 { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
242 int __init
da830_register_edma(struct edma_rsv_info
*rsv
)
244 struct platform_device
*edma_pdev
;
246 da8xx_edma0_pdata
.rsv
= rsv
;
248 da8xx_edma0_pdata
.slave_map
= da830_edma_map
;
249 da8xx_edma0_pdata
.slavecnt
= ARRAY_SIZE(da830_edma_map
);
251 edma_pdev
= platform_device_register_full(&da8xx_edma0_device
);
252 return PTR_ERR_OR_ZERO(edma_pdev
);
255 static const struct dma_slave_map da850_edma0_map
[] = {
256 { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) },
257 { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) },
258 { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 2) },
259 { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 3) },
260 { "davinci-mcbsp.1", "rx", EDMA_FILTER_PARAM(0, 4) },
261 { "davinci-mcbsp.1", "tx", EDMA_FILTER_PARAM(0, 5) },
262 { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) },
263 { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) },
264 { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) },
265 { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) },
266 { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) },
267 { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) },
270 static const struct dma_slave_map da850_edma1_map
[] = {
271 { "da830-mmc.1", "rx", EDMA_FILTER_PARAM(1, 28) },
272 { "da830-mmc.1", "tx", EDMA_FILTER_PARAM(1, 29) },
275 int __init
da850_register_edma(struct edma_rsv_info
*rsv
[2])
277 struct platform_device
*edma_pdev
;
280 da8xx_edma0_pdata
.rsv
= rsv
[0];
281 da850_edma1_pdata
.rsv
= rsv
[1];
284 da8xx_edma0_pdata
.slave_map
= da850_edma0_map
;
285 da8xx_edma0_pdata
.slavecnt
= ARRAY_SIZE(da850_edma0_map
);
287 edma_pdev
= platform_device_register_full(&da8xx_edma0_device
);
288 if (IS_ERR(edma_pdev
)) {
289 pr_warn("%s: Failed to register eDMA0\n", __func__
);
290 return PTR_ERR(edma_pdev
);
293 da850_edma1_pdata
.slave_map
= da850_edma1_map
;
294 da850_edma1_pdata
.slavecnt
= ARRAY_SIZE(da850_edma1_map
);
296 edma_pdev
= platform_device_register_full(&da850_edma1_device
);
297 return PTR_ERR_OR_ZERO(edma_pdev
);
300 static struct resource da8xx_i2c_resources0
[] = {
302 .start
= DA8XX_I2C0_BASE
,
303 .end
= DA8XX_I2C0_BASE
+ SZ_4K
- 1,
304 .flags
= IORESOURCE_MEM
,
307 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT0
),
308 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT0
),
309 .flags
= IORESOURCE_IRQ
,
313 static struct platform_device da8xx_i2c_device0
= {
314 .name
= "i2c_davinci",
316 .num_resources
= ARRAY_SIZE(da8xx_i2c_resources0
),
317 .resource
= da8xx_i2c_resources0
,
320 static struct resource da8xx_i2c_resources1
[] = {
322 .start
= DA8XX_I2C1_BASE
,
323 .end
= DA8XX_I2C1_BASE
+ SZ_4K
- 1,
324 .flags
= IORESOURCE_MEM
,
327 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT1
),
328 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT1
),
329 .flags
= IORESOURCE_IRQ
,
333 static struct platform_device da8xx_i2c_device1
= {
334 .name
= "i2c_davinci",
336 .num_resources
= ARRAY_SIZE(da8xx_i2c_resources1
),
337 .resource
= da8xx_i2c_resources1
,
340 int __init
da8xx_register_i2c(int instance
,
341 struct davinci_i2c_platform_data
*pdata
)
343 struct platform_device
*pdev
;
346 pdev
= &da8xx_i2c_device0
;
347 else if (instance
== 1)
348 pdev
= &da8xx_i2c_device1
;
352 pdev
->dev
.platform_data
= pdata
;
353 return platform_device_register(pdev
);
356 static struct resource da8xx_watchdog_resources
[] = {
358 .start
= DA8XX_WDOG_BASE
,
359 .end
= DA8XX_WDOG_BASE
+ SZ_4K
- 1,
360 .flags
= IORESOURCE_MEM
,
364 static struct platform_device da8xx_wdt_device
= {
365 .name
= "davinci-wdt",
367 .num_resources
= ARRAY_SIZE(da8xx_watchdog_resources
),
368 .resource
= da8xx_watchdog_resources
,
371 int __init
da8xx_register_watchdog(void)
373 return platform_device_register(&da8xx_wdt_device
);
376 static struct resource da8xx_emac_resources
[] = {
378 .start
= DA8XX_EMAC_CPPI_PORT_BASE
,
379 .end
= DA8XX_EMAC_CPPI_PORT_BASE
+ SZ_16K
- 1,
380 .flags
= IORESOURCE_MEM
,
383 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_THRESH_PULSE
),
384 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_THRESH_PULSE
),
385 .flags
= IORESOURCE_IRQ
,
388 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_PULSE
),
389 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_PULSE
),
390 .flags
= IORESOURCE_IRQ
,
393 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_TX_PULSE
),
394 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_TX_PULSE
),
395 .flags
= IORESOURCE_IRQ
,
398 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_MISC_PULSE
),
399 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_MISC_PULSE
),
400 .flags
= IORESOURCE_IRQ
,
404 struct emac_platform_data da8xx_emac_pdata
= {
405 .ctrl_reg_offset
= DA8XX_EMAC_CTRL_REG_OFFSET
,
406 .ctrl_mod_reg_offset
= DA8XX_EMAC_MOD_REG_OFFSET
,
407 .ctrl_ram_offset
= DA8XX_EMAC_RAM_OFFSET
,
408 .ctrl_ram_size
= DA8XX_EMAC_CTRL_RAM_SIZE
,
409 .version
= EMAC_VERSION_2
,
412 static struct platform_device da8xx_emac_device
= {
413 .name
= "davinci_emac",
416 .platform_data
= &da8xx_emac_pdata
,
418 .num_resources
= ARRAY_SIZE(da8xx_emac_resources
),
419 .resource
= da8xx_emac_resources
,
422 static struct resource da8xx_mdio_resources
[] = {
424 .start
= DA8XX_EMAC_MDIO_BASE
,
425 .end
= DA8XX_EMAC_MDIO_BASE
+ SZ_4K
- 1,
426 .flags
= IORESOURCE_MEM
,
430 static struct platform_device da8xx_mdio_device
= {
431 .name
= "davinci_mdio",
433 .num_resources
= ARRAY_SIZE(da8xx_mdio_resources
),
434 .resource
= da8xx_mdio_resources
,
437 int __init
da8xx_register_emac(void)
441 ret
= platform_device_register(&da8xx_mdio_device
);
445 return platform_device_register(&da8xx_emac_device
);
448 static struct resource da830_mcasp1_resources
[] = {
451 .start
= DAVINCI_DA830_MCASP1_REG_BASE
,
452 .end
= DAVINCI_DA830_MCASP1_REG_BASE
+ (SZ_1K
* 12) - 1,
453 .flags
= IORESOURCE_MEM
,
458 .start
= DAVINCI_DA830_DMA_MCASP1_AXEVT
,
459 .end
= DAVINCI_DA830_DMA_MCASP1_AXEVT
,
460 .flags
= IORESOURCE_DMA
,
465 .start
= DAVINCI_DA830_DMA_MCASP1_AREVT
,
466 .end
= DAVINCI_DA830_DMA_MCASP1_AREVT
,
467 .flags
= IORESOURCE_DMA
,
471 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT
),
472 .flags
= IORESOURCE_IRQ
,
476 static struct platform_device da830_mcasp1_device
= {
477 .name
= "davinci-mcasp",
479 .num_resources
= ARRAY_SIZE(da830_mcasp1_resources
),
480 .resource
= da830_mcasp1_resources
,
483 static struct resource da830_mcasp2_resources
[] = {
486 .start
= DAVINCI_DA830_MCASP2_REG_BASE
,
487 .end
= DAVINCI_DA830_MCASP2_REG_BASE
+ (SZ_1K
* 12) - 1,
488 .flags
= IORESOURCE_MEM
,
493 .start
= DAVINCI_DA830_DMA_MCASP2_AXEVT
,
494 .end
= DAVINCI_DA830_DMA_MCASP2_AXEVT
,
495 .flags
= IORESOURCE_DMA
,
500 .start
= DAVINCI_DA830_DMA_MCASP2_AREVT
,
501 .end
= DAVINCI_DA830_DMA_MCASP2_AREVT
,
502 .flags
= IORESOURCE_DMA
,
506 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT
),
507 .flags
= IORESOURCE_IRQ
,
511 static struct platform_device da830_mcasp2_device
= {
512 .name
= "davinci-mcasp",
514 .num_resources
= ARRAY_SIZE(da830_mcasp2_resources
),
515 .resource
= da830_mcasp2_resources
,
518 static struct resource da850_mcasp_resources
[] = {
521 .start
= DAVINCI_DA8XX_MCASP0_REG_BASE
,
522 .end
= DAVINCI_DA8XX_MCASP0_REG_BASE
+ (SZ_1K
* 12) - 1,
523 .flags
= IORESOURCE_MEM
,
528 .start
= DAVINCI_DA8XX_DMA_MCASP0_AXEVT
,
529 .end
= DAVINCI_DA8XX_DMA_MCASP0_AXEVT
,
530 .flags
= IORESOURCE_DMA
,
535 .start
= DAVINCI_DA8XX_DMA_MCASP0_AREVT
,
536 .end
= DAVINCI_DA8XX_DMA_MCASP0_AREVT
,
537 .flags
= IORESOURCE_DMA
,
541 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT
),
542 .flags
= IORESOURCE_IRQ
,
546 static struct platform_device da850_mcasp_device
= {
547 .name
= "davinci-mcasp",
549 .num_resources
= ARRAY_SIZE(da850_mcasp_resources
),
550 .resource
= da850_mcasp_resources
,
553 void __init
da8xx_register_mcasp(int id
, struct snd_platform_data
*pdata
)
555 struct platform_device
*pdev
;
559 /* Valid for DA830/OMAP-L137 or DA850/OMAP-L138 */
560 pdev
= &da850_mcasp_device
;
563 /* Valid for DA830/OMAP-L137 only */
564 if (!cpu_is_davinci_da830())
566 pdev
= &da830_mcasp1_device
;
569 /* Valid for DA830/OMAP-L137 only */
570 if (!cpu_is_davinci_da830())
572 pdev
= &da830_mcasp2_device
;
578 pdev
->dev
.platform_data
= pdata
;
579 platform_device_register(pdev
);
582 static struct resource da8xx_pruss_resources
[] = {
584 .start
= DA8XX_PRUSS_MEM_BASE
,
585 .end
= DA8XX_PRUSS_MEM_BASE
+ 0xFFFF,
586 .flags
= IORESOURCE_MEM
,
589 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT0
),
590 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT0
),
591 .flags
= IORESOURCE_IRQ
,
594 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT1
),
595 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT1
),
596 .flags
= IORESOURCE_IRQ
,
599 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT2
),
600 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT2
),
601 .flags
= IORESOURCE_IRQ
,
604 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT3
),
605 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT3
),
606 .flags
= IORESOURCE_IRQ
,
609 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT4
),
610 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT4
),
611 .flags
= IORESOURCE_IRQ
,
614 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT5
),
615 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT5
),
616 .flags
= IORESOURCE_IRQ
,
619 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT6
),
620 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT6
),
621 .flags
= IORESOURCE_IRQ
,
624 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT7
),
625 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT7
),
626 .flags
= IORESOURCE_IRQ
,
630 static struct uio_pruss_pdata da8xx_uio_pruss_pdata
= {
631 .pintc_base
= 0x4000,
634 static struct platform_device da8xx_uio_pruss_dev
= {
637 .num_resources
= ARRAY_SIZE(da8xx_pruss_resources
),
638 .resource
= da8xx_pruss_resources
,
640 .coherent_dma_mask
= DMA_BIT_MASK(32),
641 .platform_data
= &da8xx_uio_pruss_pdata
,
645 int __init
da8xx_register_uio_pruss(void)
647 da8xx_uio_pruss_pdata
.sram_pool
= sram_get_gen_pool();
648 return platform_device_register(&da8xx_uio_pruss_dev
);
651 static struct lcd_ctrl_config lcd_cfg
= {
652 .panel_shade
= COLOR_ACTIVE
,
656 struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata
= {
657 .manu_name
= "sharp",
658 .controller_data
= &lcd_cfg
,
659 .type
= "Sharp_LCD035Q3DG01",
662 struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata
= {
663 .manu_name
= "sharp",
664 .controller_data
= &lcd_cfg
,
665 .type
= "Sharp_LK043T1DG01",
668 static struct resource da8xx_lcdc_resources
[] = {
669 [0] = { /* registers */
670 .start
= DA8XX_LCD_CNTRL_BASE
,
671 .end
= DA8XX_LCD_CNTRL_BASE
+ SZ_4K
- 1,
672 .flags
= IORESOURCE_MEM
,
674 [1] = { /* interrupt */
675 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_LCDINT
),
676 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_LCDINT
),
677 .flags
= IORESOURCE_IRQ
,
681 static struct platform_device da8xx_lcdc_device
= {
682 .name
= "da8xx_lcdc",
684 .num_resources
= ARRAY_SIZE(da8xx_lcdc_resources
),
685 .resource
= da8xx_lcdc_resources
,
687 .coherent_dma_mask
= DMA_BIT_MASK(32),
691 int __init
da8xx_register_lcdc(struct da8xx_lcdc_platform_data
*pdata
)
693 da8xx_lcdc_device
.dev
.platform_data
= pdata
;
694 return platform_device_register(&da8xx_lcdc_device
);
697 static struct resource da8xx_gpio_resources
[] = {
699 .start
= DA8XX_GPIO_BASE
,
700 .end
= DA8XX_GPIO_BASE
+ SZ_4K
- 1,
701 .flags
= IORESOURCE_MEM
,
704 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO0
),
705 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO0
),
706 .flags
= IORESOURCE_IRQ
,
709 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO1
),
710 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO1
),
711 .flags
= IORESOURCE_IRQ
,
714 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO2
),
715 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO2
),
716 .flags
= IORESOURCE_IRQ
,
719 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO3
),
720 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO3
),
721 .flags
= IORESOURCE_IRQ
,
724 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO4
),
725 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO4
),
726 .flags
= IORESOURCE_IRQ
,
729 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO5
),
730 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO5
),
731 .flags
= IORESOURCE_IRQ
,
734 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO6
),
735 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO6
),
736 .flags
= IORESOURCE_IRQ
,
739 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO7
),
740 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO7
),
741 .flags
= IORESOURCE_IRQ
,
744 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO8
),
745 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO8
),
746 .flags
= IORESOURCE_IRQ
,
750 static struct platform_device da8xx_gpio_device
= {
751 .name
= "davinci_gpio",
753 .num_resources
= ARRAY_SIZE(da8xx_gpio_resources
),
754 .resource
= da8xx_gpio_resources
,
757 int __init
da8xx_register_gpio(void *pdata
)
759 da8xx_gpio_device
.dev
.platform_data
= pdata
;
760 return platform_device_register(&da8xx_gpio_device
);
763 static struct resource da8xx_mmcsd0_resources
[] = {
765 .start
= DA8XX_MMCSD0_BASE
,
766 .end
= DA8XX_MMCSD0_BASE
+ SZ_4K
- 1,
767 .flags
= IORESOURCE_MEM
,
770 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_MMCSDINT0
),
771 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_MMCSDINT0
),
772 .flags
= IORESOURCE_IRQ
,
776 static struct platform_device da8xx_mmcsd0_device
= {
779 .num_resources
= ARRAY_SIZE(da8xx_mmcsd0_resources
),
780 .resource
= da8xx_mmcsd0_resources
,
783 int __init
da8xx_register_mmcsd0(struct davinci_mmc_config
*config
)
785 da8xx_mmcsd0_device
.dev
.platform_data
= config
;
786 return platform_device_register(&da8xx_mmcsd0_device
);
789 #ifdef CONFIG_ARCH_DAVINCI_DA850
790 static struct resource da850_mmcsd1_resources
[] = {
792 .start
= DA850_MMCSD1_BASE
,
793 .end
= DA850_MMCSD1_BASE
+ SZ_4K
- 1,
794 .flags
= IORESOURCE_MEM
,
797 .start
= DAVINCI_INTC_IRQ(IRQ_DA850_MMCSDINT0_1
),
798 .end
= DAVINCI_INTC_IRQ(IRQ_DA850_MMCSDINT0_1
),
799 .flags
= IORESOURCE_IRQ
,
803 static struct platform_device da850_mmcsd1_device
= {
806 .num_resources
= ARRAY_SIZE(da850_mmcsd1_resources
),
807 .resource
= da850_mmcsd1_resources
,
810 int __init
da850_register_mmcsd1(struct davinci_mmc_config
*config
)
812 da850_mmcsd1_device
.dev
.platform_data
= config
;
813 return platform_device_register(&da850_mmcsd1_device
);
817 static struct resource da8xx_rproc_resources
[] = {
818 { /* DSP boot address */
820 .start
= DA8XX_SYSCFG0_BASE
+ DA8XX_HOST1CFG_REG
,
821 .end
= DA8XX_SYSCFG0_BASE
+ DA8XX_HOST1CFG_REG
+ 3,
822 .flags
= IORESOURCE_MEM
,
824 { /* DSP interrupt registers */
826 .start
= DA8XX_SYSCFG0_BASE
+ DA8XX_CHIPSIG_REG
,
827 .end
= DA8XX_SYSCFG0_BASE
+ DA8XX_CHIPSIG_REG
+ 7,
828 .flags
= IORESOURCE_MEM
,
832 .start
= DA8XX_DSP_L2_RAM_BASE
,
833 .end
= DA8XX_DSP_L2_RAM_BASE
+ SZ_256K
- 1,
834 .flags
= IORESOURCE_MEM
,
838 .start
= DA8XX_DSP_L1P_RAM_BASE
,
839 .end
= DA8XX_DSP_L1P_RAM_BASE
+ SZ_32K
- 1,
840 .flags
= IORESOURCE_MEM
,
844 .start
= DA8XX_DSP_L1D_RAM_BASE
,
845 .end
= DA8XX_DSP_L1D_RAM_BASE
+ SZ_32K
- 1,
846 .flags
= IORESOURCE_MEM
,
849 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_CHIPINT0
),
850 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_CHIPINT0
),
851 .flags
= IORESOURCE_IRQ
,
855 static struct platform_device da8xx_dsp
= {
856 .name
= "davinci-rproc",
858 .coherent_dma_mask
= DMA_BIT_MASK(32),
860 .num_resources
= ARRAY_SIZE(da8xx_rproc_resources
),
861 .resource
= da8xx_rproc_resources
,
864 static bool rproc_mem_inited __initdata
;
866 #if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC)
868 static phys_addr_t rproc_base __initdata
;
869 static unsigned long rproc_size __initdata
;
871 static int __init
early_rproc_mem(char *p
)
878 rproc_size
= memparse(p
, &endp
);
880 rproc_base
= memparse(endp
+ 1, NULL
);
884 early_param("rproc_mem", early_rproc_mem
);
886 void __init
da8xx_rproc_reserve_cma(void)
890 if (!rproc_base
|| !rproc_size
) {
891 pr_err("%s: 'rproc_mem=nn@address' badly specified\n"
892 " 'nn' and 'address' must both be non-zero\n",
898 pr_info("%s: reserving 0x%lx @ 0x%lx...\n",
899 __func__
, rproc_size
, (unsigned long)rproc_base
);
901 ret
= dma_declare_contiguous(&da8xx_dsp
.dev
, rproc_size
, rproc_base
, 0);
903 pr_err("%s: dma_declare_contiguous failed %d\n", __func__
, ret
);
905 rproc_mem_inited
= true;
910 void __init
da8xx_rproc_reserve_cma(void)
916 int __init
da8xx_register_rproc(void)
920 if (!rproc_mem_inited
) {
921 pr_warn("%s: memory not reserved for DSP, not registering DSP device\n",
926 ret
= platform_device_register(&da8xx_dsp
);
928 pr_err("%s: can't register DSP device: %d\n", __func__
, ret
);
933 static struct resource da8xx_rtc_resources
[] = {
935 .start
= DA8XX_RTC_BASE
,
936 .end
= DA8XX_RTC_BASE
+ SZ_4K
- 1,
937 .flags
= IORESOURCE_MEM
,
940 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC
),
941 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC
),
942 .flags
= IORESOURCE_IRQ
,
945 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC
),
946 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC
),
947 .flags
= IORESOURCE_IRQ
,
951 static struct platform_device da8xx_rtc_device
= {
954 .num_resources
= ARRAY_SIZE(da8xx_rtc_resources
),
955 .resource
= da8xx_rtc_resources
,
958 int da8xx_register_rtc(void)
960 return platform_device_register(&da8xx_rtc_device
);
963 static void __iomem
*da8xx_ddr2_ctlr_base
;
964 void __iomem
* __init
da8xx_get_mem_ctlr(void)
966 if (da8xx_ddr2_ctlr_base
)
967 return da8xx_ddr2_ctlr_base
;
969 da8xx_ddr2_ctlr_base
= ioremap(DA8XX_DDR2_CTL_BASE
, SZ_32K
);
970 if (!da8xx_ddr2_ctlr_base
)
971 pr_warn("%s: Unable to map DDR2 controller", __func__
);
973 return da8xx_ddr2_ctlr_base
;
976 static struct resource da8xx_cpuidle_resources
[] = {
978 .start
= DA8XX_DDR2_CTL_BASE
,
979 .end
= DA8XX_DDR2_CTL_BASE
+ SZ_32K
- 1,
980 .flags
= IORESOURCE_MEM
,
984 /* DA8XX devices support DDR2 power down */
985 static struct davinci_cpuidle_config da8xx_cpuidle_pdata
= {
990 static struct platform_device da8xx_cpuidle_device
= {
991 .name
= "cpuidle-davinci",
992 .num_resources
= ARRAY_SIZE(da8xx_cpuidle_resources
),
993 .resource
= da8xx_cpuidle_resources
,
995 .platform_data
= &da8xx_cpuidle_pdata
,
999 int __init
da8xx_register_cpuidle(void)
1001 da8xx_cpuidle_pdata
.ddr2_ctlr_base
= da8xx_get_mem_ctlr();
1003 return platform_device_register(&da8xx_cpuidle_device
);
1006 static struct resource da8xx_spi0_resources
[] = {
1008 .start
= DA8XX_SPI0_BASE
,
1009 .end
= DA8XX_SPI0_BASE
+ SZ_4K
- 1,
1010 .flags
= IORESOURCE_MEM
,
1013 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT0
),
1014 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT0
),
1015 .flags
= IORESOURCE_IRQ
,
1019 static struct resource da8xx_spi1_resources
[] = {
1021 .start
= DA830_SPI1_BASE
,
1022 .end
= DA830_SPI1_BASE
+ SZ_4K
- 1,
1023 .flags
= IORESOURCE_MEM
,
1026 .start
= DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT1
),
1027 .end
= DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT1
),
1028 .flags
= IORESOURCE_IRQ
,
1032 static struct davinci_spi_platform_data da8xx_spi_pdata
[] = {
1034 .version
= SPI_VERSION_2
,
1036 .dma_event_q
= EVENTQ_0
,
1037 .prescaler_limit
= 2,
1040 .version
= SPI_VERSION_2
,
1042 .dma_event_q
= EVENTQ_0
,
1043 .prescaler_limit
= 2,
1047 static struct platform_device da8xx_spi_device
[] = {
1049 .name
= "spi_davinci",
1051 .num_resources
= ARRAY_SIZE(da8xx_spi0_resources
),
1052 .resource
= da8xx_spi0_resources
,
1054 .platform_data
= &da8xx_spi_pdata
[0],
1058 .name
= "spi_davinci",
1060 .num_resources
= ARRAY_SIZE(da8xx_spi1_resources
),
1061 .resource
= da8xx_spi1_resources
,
1063 .platform_data
= &da8xx_spi_pdata
[1],
1068 int __init
da8xx_register_spi_bus(int instance
, unsigned num_chipselect
)
1070 if (instance
< 0 || instance
> 1)
1073 da8xx_spi_pdata
[instance
].num_chipselect
= num_chipselect
;
1075 if (instance
== 1 && cpu_is_davinci_da850()) {
1076 da8xx_spi1_resources
[0].start
= DA850_SPI1_BASE
;
1077 da8xx_spi1_resources
[0].end
= DA850_SPI1_BASE
+ SZ_4K
- 1;
1080 return platform_device_register(&da8xx_spi_device
[instance
]);
1083 #ifdef CONFIG_ARCH_DAVINCI_DA850
1084 int __init
da850_register_sata_refclk(int rate
)
1088 clk
= clk_register_fixed_rate(NULL
, "sata_refclk", NULL
, 0, rate
);
1090 return PTR_ERR(clk
);
1092 return clk_register_clkdev(clk
, "refclk", "ahci_da850");
1095 static struct resource da850_sata_resources
[] = {
1097 .start
= DA850_SATA_BASE
,
1098 .end
= DA850_SATA_BASE
+ 0x1fff,
1099 .flags
= IORESOURCE_MEM
,
1102 .start
= DA8XX_SYSCFG1_BASE
+ DA8XX_PWRDN_REG
,
1103 .end
= DA8XX_SYSCFG1_BASE
+ DA8XX_PWRDN_REG
+ 0x3,
1104 .flags
= IORESOURCE_MEM
,
1107 .start
= DAVINCI_INTC_IRQ(IRQ_DA850_SATAINT
),
1108 .flags
= IORESOURCE_IRQ
,
1112 static u64 da850_sata_dmamask
= DMA_BIT_MASK(32);
1114 static struct platform_device da850_sata_device
= {
1115 .name
= "ahci_da850",
1118 .dma_mask
= &da850_sata_dmamask
,
1119 .coherent_dma_mask
= DMA_BIT_MASK(32),
1121 .num_resources
= ARRAY_SIZE(da850_sata_resources
),
1122 .resource
= da850_sata_resources
,
1125 int __init
da850_register_sata(unsigned long refclkpn
)
1129 ret
= da850_register_sata_refclk(refclkpn
);
1133 return platform_device_register(&da850_sata_device
);
1137 static struct regmap
*da8xx_cfgchip
;
1139 static const struct regmap_config da8xx_cfgchip_config __initconst
= {
1144 .max_register
= DA8XX_CFGCHIP4_REG
- DA8XX_CFGCHIP0_REG
,
1148 * da8xx_get_cfgchip - Lazy gets CFGCHIP as regmap
1150 * This is for use on non-DT boards only. For DT boards, use
1151 * syscon_regmap_lookup_by_compatible("ti,da830-cfgchip")
1153 * Returns: Pointer to the CFGCHIP regmap or negative error code.
1155 struct regmap
* __init
da8xx_get_cfgchip(void)
1157 if (IS_ERR_OR_NULL(da8xx_cfgchip
))
1158 da8xx_cfgchip
= regmap_init_mmio(NULL
,
1159 DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG
),
1160 &da8xx_cfgchip_config
);
1162 return da8xx_cfgchip
;