1 /* arch/arm/mach-rk30/devices.c
3 * Copyright (C) 2012 ROCKCHIP, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
17 #include <linux/kernel.h>
18 #include <linux/platform_device.h>
19 #include <linux/delay.h>
20 #include <linux/dma-mapping.h>
22 #include <mach/irqs.h>
23 #include <mach/board.h>
24 #include <plat/dma-pl330.h>
25 #include <mach/gpio.h>
26 #include <mach/iomux.h>
27 #include <mach/debug_uart.h>
28 #include <plat/rk_fiq_debugger.h>
30 #ifdef CONFIG_ADC_RK30
31 static struct adc_platform_data rk30_adc_pdata = {
32 #if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
33 .ref_volt = 1800, //1800mV
35 .ref_volt = 2500, //2500mV
39 static struct resource rk30_adc_resource[] = {
43 .flags = IORESOURCE_IRQ,
46 .start = RK30_SARADC_PHYS,
47 .end = RK30_SARADC_PHYS + RK30_SARADC_SIZE - 1,
48 .flags = IORESOURCE_MEM,
52 struct platform_device device_adc = {
55 .num_resources = ARRAY_SIZE(rk30_adc_resource),
56 .resource = rk30_adc_resource,
58 .platform_data = &rk30_adc_pdata,
63 #if !defined(CONFIG_ARCH_RK3066B) && defined(IRQ_TSADC)
64 static struct resource rk30_tsadc_resource[] = {
68 .flags = IORESOURCE_IRQ,
71 .start = RK30_TSADC_PHYS,
72 .end = RK30_TSADC_PHYS + RK30_TSADC_SIZE - 1,
73 .flags = IORESOURCE_MEM,
77 static struct platform_device device_tsadc = {
80 .num_resources = ARRAY_SIZE(rk30_tsadc_resource),
81 .resource = rk30_tsadc_resource,
84 static void __init rk30_init_tsadc(void)
86 platform_device_register(&device_tsadc);
89 static void __init rk30_init_tsadc(void) {}
92 static u64 dma_dmamask = DMA_BIT_MASK(32);
94 static struct resource resource_dmac1[] = {
96 .start = RK30_DMACS1_PHYS,
97 .end = RK30_DMACS1_PHYS + RK30_DMACS1_SIZE -1,
98 .flags = IORESOURCE_MEM,
101 .start = IRQ_DMAC1_0,
103 .flags = IORESOURCE_IRQ,
107 #if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
109 static struct rk29_pl330_platdata dmac1_pdata = {
111 [0] = DMACH_UART0_TX,
112 [1] = DMACH_UART0_RX,
113 [2] = DMACH_UART1_TX,
114 [3] = DMACH_UART1_RX,
117 [6] = DMACH_I2S1_2CH_TX,
118 [7] = DMACH_I2S1_2CH_RX,
119 [8] = DMACH_SPDIF_TX,
120 [9] = DMACH_DMAC0_MEMTOMEM,
148 static struct rk29_pl330_platdata dmac1_pdata = {
150 [0] = DMACH_UART0_TX,
151 [1] = DMACH_UART0_RX,
152 [2] = DMACH_UART1_TX,
153 [3] = DMACH_UART1_RX,
154 [4] = DMACH_I2S0_8CH_TX,
155 [5] = DMACH_I2S0_8CH_RX,
156 [6] = DMACH_I2S1_2CH_TX,
157 [7] = DMACH_I2S1_2CH_RX,
158 [8] = DMACH_SPDIF_TX,
159 [9] = DMACH_I2S2_2CH_TX,
160 [10] = DMACH_I2S2_2CH_RX,
161 [11] = DMACH_DMAC0_MEMTOMEM,
187 static struct platform_device device_dmac1 = {
188 .name = "rk29-pl330",
190 .num_resources = ARRAY_SIZE(resource_dmac1),
191 .resource = resource_dmac1,
193 .dma_mask = &dma_dmamask,
194 .coherent_dma_mask = DMA_BIT_MASK(32),
195 .platform_data = &dmac1_pdata,
199 static struct resource resource_dmac2[] = {
201 .start = RK30_DMAC2_PHYS,
202 .end = RK30_DMAC2_PHYS + RK30_DMAC2_SIZE - 1,
203 .flags = IORESOURCE_MEM,
206 .start = IRQ_DMAC2_0,
208 .flags = IORESOURCE_IRQ,
212 static struct rk29_pl330_platdata dmac2_pdata = {
219 [5] = DMACH_PID_FILTER,
220 [6] = DMACH_UART2_TX,
221 [7] = DMACH_UART2_RX,
222 [8] = DMACH_UART3_TX,
223 [9] = DMACH_UART3_RX,
224 [10] = DMACH_SPI0_TX,
225 [11] = DMACH_SPI0_RX,
226 [12] = DMACH_SPI1_TX,
227 [13] = DMACH_SPI1_RX,
228 [14] = DMACH_DMAC1_MEMTOMEM,
249 static struct platform_device device_dmac2 = {
250 .name = "rk29-pl330",
252 .num_resources = ARRAY_SIZE(resource_dmac2),
253 .resource = resource_dmac2,
255 .dma_mask = &dma_dmamask,
256 .coherent_dma_mask = DMA_BIT_MASK(32),
257 .platform_data = &dmac2_pdata,
261 static struct platform_device *rk30_dmacs[] __initdata = {
266 static void __init rk30_init_dma(void)
268 platform_add_devices(rk30_dmacs, ARRAY_SIZE(rk30_dmacs));
271 #ifdef CONFIG_UART0_RK29
272 static struct resource resources_uart0[] = {
276 .flags = IORESOURCE_IRQ,
279 .start = RK30_UART0_PHYS,
280 .end = RK30_UART0_PHYS + RK30_UART0_SIZE - 1,
281 .flags = IORESOURCE_MEM,
285 static struct platform_device device_uart0 = {
288 .num_resources = ARRAY_SIZE(resources_uart0),
289 .resource = resources_uart0,
293 #ifdef CONFIG_UART1_RK29
294 static struct resource resources_uart1[] = {
298 .flags = IORESOURCE_IRQ,
301 .start = RK30_UART1_PHYS,
302 .end = RK30_UART1_PHYS + RK30_UART1_SIZE - 1,
303 .flags = IORESOURCE_MEM,
307 static struct platform_device device_uart1 = {
310 .num_resources = ARRAY_SIZE(resources_uart1),
311 .resource = resources_uart1,
315 #ifdef CONFIG_UART2_RK29
316 static struct resource resources_uart2[] = {
320 .flags = IORESOURCE_IRQ,
323 .start = RK30_UART2_PHYS,
324 .end = RK30_UART2_PHYS + RK30_UART2_SIZE - 1,
325 .flags = IORESOURCE_MEM,
329 static struct platform_device device_uart2 = {
332 .num_resources = ARRAY_SIZE(resources_uart2),
333 .resource = resources_uart2,
337 #ifdef CONFIG_UART3_RK29
338 static struct resource resources_uart3[] = {
342 .flags = IORESOURCE_IRQ,
345 .start = RK30_UART3_PHYS,
346 .end = RK30_UART3_PHYS + RK30_UART3_SIZE - 1,
347 .flags = IORESOURCE_MEM,
351 static struct platform_device device_uart3 = {
354 .num_resources = ARRAY_SIZE(resources_uart3),
355 .resource = resources_uart3,
359 static void __init rk30_init_uart(void)
361 #ifdef CONFIG_UART0_RK29
362 platform_device_register(&device_uart0);
364 #ifdef CONFIG_UART1_RK29
365 platform_device_register(&device_uart1);
367 #ifdef CONFIG_UART2_RK29
368 platform_device_register(&device_uart2);
370 #ifdef CONFIG_UART3_RK29
371 platform_device_register(&device_uart3);
375 #ifdef CONFIG_I2C0_CONTROLLER_RK29
376 #define I2C0_ADAP_TYPE I2C_RK29_ADAP
377 #define I2C0_START RK30_I2C0_PHYS
378 #define I2C0_END RK30_I2C0_PHYS + SZ_4K - 1
380 #ifdef CONFIG_I2C0_CONTROLLER_RK30
381 #define I2C0_ADAP_TYPE I2C_RK30_ADAP
382 #define I2C0_START RK30_I2C0_PHYS + SZ_4K
383 #define I2C0_END RK30_I2C0_PHYS + SZ_8K - 1
386 #ifdef CONFIG_I2C1_CONTROLLER_RK29
387 #define I2C1_ADAP_TYPE I2C_RK29_ADAP
388 #define I2C1_START RK30_I2C1_PHYS
389 #define I2C1_END RK30_I2C1_PHYS + SZ_4K - 1
391 #ifdef CONFIG_I2C1_CONTROLLER_RK30
392 #define I2C1_ADAP_TYPE I2C_RK30_ADAP
393 #define I2C1_START RK30_I2C1_PHYS + SZ_4K
394 #define I2C1_END RK30_I2C1_PHYS + SZ_8K - 1
397 #ifdef CONFIG_I2C2_CONTROLLER_RK29
398 #define I2C2_ADAP_TYPE I2C_RK29_ADAP
399 #define I2C2_START RK30_I2C2_PHYS
400 #define I2C2_END RK30_I2C2_PHYS + SZ_8K - 1
402 #ifdef CONFIG_I2C2_CONTROLLER_RK30
403 #define I2C2_ADAP_TYPE I2C_RK30_ADAP
404 #define I2C2_START RK30_I2C2_PHYS + SZ_8K
405 #define I2C2_END RK30_I2C2_PHYS + SZ_16K - 1
408 #ifdef CONFIG_I2C3_CONTROLLER_RK29
409 #define I2C3_ADAP_TYPE I2C_RK29_ADAP
410 #define I2C3_START RK30_I2C3_PHYS
411 #define I2C3_END RK30_I2C3_PHYS + SZ_8K - 1
413 #ifdef CONFIG_I2C3_CONTROLLER_RK30
414 #define I2C3_ADAP_TYPE I2C_RK30_ADAP
415 #define I2C3_START RK30_I2C3_PHYS + SZ_8K
416 #define I2C3_END RK30_I2C3_PHYS + SZ_16K - 1
419 #ifdef CONFIG_I2C4_CONTROLLER_RK29
420 #define I2C4_ADAP_TYPE I2C_RK29_ADAP
421 #define I2C4_START RK30_I2C4_PHYS
422 #define I2C4_END RK30_I2C4_PHYS + SZ_8K - 1
424 #ifdef CONFIG_I2C4_CONTROLLER_RK30
425 #define I2C4_ADAP_TYPE I2C_RK30_ADAP
426 #define I2C4_START RK30_I2C4_PHYS + SZ_8K
427 #define I2C4_END RK30_I2C4_PHYS + SZ_16K - 1
430 #ifdef CONFIG_I2C0_RK30
431 static struct rk30_i2c_platform_data default_i2c0_data = {
433 #if defined(CONFIG_ARCH_RK3066B)
434 .is_div_from_arm = 0,
436 .is_div_from_arm = 1,
438 .adap_type = I2C0_ADAP_TYPE,
439 .sda_mode = I2C0_SDA,
440 .scl_mode = I2C0_SCL,
443 static struct resource resources_i2c0[] = {
447 .flags = IORESOURCE_IRQ,
452 .flags = IORESOURCE_MEM,
456 static struct platform_device device_i2c0 = {
459 .num_resources = ARRAY_SIZE(resources_i2c0),
460 .resource = resources_i2c0,
462 .platform_data = &default_i2c0_data,
467 #ifdef CONFIG_I2C1_RK30
468 static struct rk30_i2c_platform_data default_i2c1_data = {
470 #if defined(CONFIG_ARCH_RK3066B)
471 .is_div_from_arm = 0,
473 .is_div_from_arm = 1,
475 .adap_type = I2C1_ADAP_TYPE,
476 .sda_mode = I2C1_SDA,
477 .scl_mode = I2C1_SCL,
480 static struct resource resources_i2c1[] = {
484 .flags = IORESOURCE_IRQ,
489 .flags = IORESOURCE_MEM,
493 static struct platform_device device_i2c1 = {
496 .num_resources = ARRAY_SIZE(resources_i2c1),
497 .resource = resources_i2c1,
499 .platform_data = &default_i2c1_data,
504 #ifdef CONFIG_I2C2_RK30
505 static struct rk30_i2c_platform_data default_i2c2_data = {
507 .is_div_from_arm = 0,
508 .adap_type = I2C2_ADAP_TYPE,
509 .sda_mode = I2C2_SDA,
510 .scl_mode = I2C2_SCL,
513 static struct resource resources_i2c2[] = {
517 .flags = IORESOURCE_IRQ,
522 .flags = IORESOURCE_MEM,
526 static struct platform_device device_i2c2 = {
529 .num_resources = ARRAY_SIZE(resources_i2c2),
530 .resource = resources_i2c2,
532 .platform_data = &default_i2c2_data,
537 #ifdef CONFIG_I2C3_RK30
538 static struct rk30_i2c_platform_data default_i2c3_data = {
540 .is_div_from_arm = 0,
541 .adap_type = I2C3_ADAP_TYPE,
542 .sda_mode = I2C3_SDA,
543 .scl_mode = I2C3_SCL,
546 static struct resource resources_i2c3[] = {
550 .flags = IORESOURCE_IRQ,
555 .flags = IORESOURCE_MEM,
559 static struct platform_device device_i2c3 = {
562 .num_resources = ARRAY_SIZE(resources_i2c3),
563 .resource = resources_i2c3,
565 .platform_data = &default_i2c3_data,
570 #ifdef CONFIG_I2C4_RK30
571 static struct rk30_i2c_platform_data default_i2c4_data = {
573 .is_div_from_arm = 0,
574 .adap_type = I2C4_ADAP_TYPE,
575 .sda_mode = I2C4_SDA,
576 .scl_mode = I2C4_SCL,
579 static struct resource resources_i2c4[] = {
583 .flags = IORESOURCE_IRQ,
588 .flags = IORESOURCE_MEM,
592 static struct platform_device device_i2c4 = {
595 .num_resources = ARRAY_SIZE(resources_i2c4),
596 .resource = resources_i2c4,
598 .platform_data = &default_i2c4_data,
603 #ifdef CONFIG_I2C_GPIO_RK30
604 static struct platform_device device_i2c_gpio = {
608 .platform_data = &default_i2c_gpio_data,
613 static void __init rk30_init_i2c(void)
615 #ifdef CONFIG_I2C0_RK30
616 platform_device_register(&device_i2c0);
618 #ifdef CONFIG_I2C1_RK30
619 platform_device_register(&device_i2c1);
621 #ifdef CONFIG_I2C2_RK30
622 platform_device_register(&device_i2c2);
624 #ifdef CONFIG_I2C3_RK30
625 platform_device_register(&device_i2c3);
627 #ifdef CONFIG_I2C4_RK30
628 platform_device_register(&device_i2c4);
630 #ifdef CONFIG_I2C_GPIO_RK30
631 platform_device_register(&device_i2c_gpio);
635 #if defined(CONFIG_SPIM0_RK29) || defined(CONFIG_SPIM1_RK29)
636 /*****************************************************************************************
638 * author: cmc@rock-chips.com
639 *****************************************************************************************/
640 #define SPI_CHIPSELECT_NUM 2
642 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
646 for (i = 0; i < cs_num; i++) {
647 rk30_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
653 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
658 static int spi_io_fix_leakage_bug(void)
661 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
666 static int spi_io_resume_leakage_bug(void)
669 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
676 * rk29xx spi master device
678 #ifdef CONFIG_SPIM0_RK29
679 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
681 #if defined(CONFIG_ARCH_RK3066B)
684 .cs_gpio = RK30_PIN1_PA7,
685 .cs_iomux_name = GPIO1A7_UART1RTSN_SPI0CSN0_NAME,
686 .cs_iomux_mode = GPIO1A_SPI0CSN0,
690 .cs_gpio = RK30_PIN1_PB7,
691 .cs_iomux_name = GPIO1B7_SPI0CSN1_NAME,//if no iomux,set it NULL
692 .cs_iomux_mode = GPIO1B_SPI0CSN1,
698 .cs_gpio = RK30_PIN1_PA4,
699 .cs_iomux_name = GPIO1A4_UART1SIN_SPI0CSN0_NAME,
700 .cs_iomux_mode = GPIO1A_SPI0_CSN0,
704 .cs_gpio = RK30_PIN4_PB7,
705 .cs_iomux_name = GPIO4B7_SPI0CSN1_NAME,//if no iomux,set it NULL
706 .cs_iomux_mode = GPIO4B_SPI0_CSN1,
712 static struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
713 .num_chipselect = SPI_CHIPSELECT_NUM,
714 .chipselect_gpios = rk29xx_spi0_cs_gpios,
715 .io_init = spi_io_init,
716 .io_deinit = spi_io_deinit,
717 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
718 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
721 static struct resource rk29_spi0_resources[] = {
725 .flags = IORESOURCE_IRQ,
728 .start = RK30_SPI0_PHYS,
729 .end = RK30_SPI0_PHYS + RK30_SPI0_SIZE - 1,
730 .flags = IORESOURCE_MEM,
733 .start = DMACH_SPI0_TX,
734 .end = DMACH_SPI0_TX,
735 .flags = IORESOURCE_DMA,
738 .start = DMACH_SPI0_RX,
739 .end = DMACH_SPI0_RX,
740 .flags = IORESOURCE_DMA,
744 struct platform_device rk29xx_device_spi0m = {
745 .name = "rk29xx_spim",
747 .num_resources = ARRAY_SIZE(rk29_spi0_resources),
748 .resource = rk29_spi0_resources,
750 .dma_mask = &dma_dmamask,
751 .coherent_dma_mask = DMA_BIT_MASK(32),
752 .platform_data = &rk29xx_spi0_platdata,
757 #ifdef CONFIG_SPIM1_RK29
758 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
760 #if defined(CONFIG_ARCH_RK3066B)
763 .cs_gpio = RK30_PIN0_PD7,
764 .cs_iomux_name = GPIO0D7_SPI1CSN0_NAME,
765 .cs_iomux_mode = GPIO0D_SPI1CSN0,
769 .cs_gpio = RK30_PIN1_PB6,
770 .cs_iomux_name = GPIO1B6_SPDIFTX_SPI1CSN1_NAME,//if no iomux,set it NULL
771 .cs_iomux_mode = GPIO1B_SPI1CSN1,
777 .cs_gpio = RK30_PIN2_PC4,
778 .cs_iomux_name = GPIO2C4_LCDC1DATA20_SPI1CSN0_HSADCDATA1_NAME,
779 .cs_iomux_mode = GPIO2C_SPI1_CSN0,
783 .cs_gpio = RK30_PIN2_PC7,
784 .cs_iomux_name = GPIO2C7_LCDC1DATA23_SPI1CSN1_HSADCDATA4_NAME,//if no iomux,set it NULL
785 .cs_iomux_mode = GPIO2C_SPI1_CSN1,
791 static struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
792 .num_chipselect = SPI_CHIPSELECT_NUM,
793 .chipselect_gpios = rk29xx_spi1_cs_gpios,
794 .io_init = spi_io_init,
795 .io_deinit = spi_io_deinit,
796 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
797 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
800 static struct resource rk29_spi1_resources[] = {
804 .flags = IORESOURCE_IRQ,
807 .start = RK30_SPI1_PHYS,
808 .end = RK30_SPI1_PHYS + RK30_SPI1_SIZE - 1,
809 .flags = IORESOURCE_MEM,
812 .start = DMACH_SPI1_TX,
813 .end = DMACH_SPI1_TX,
814 .flags = IORESOURCE_DMA,
817 .start = DMACH_SPI1_RX,
818 .end = DMACH_SPI1_RX,
819 .flags = IORESOURCE_DMA,
823 struct platform_device rk29xx_device_spi1m = {
824 .name = "rk29xx_spim",
826 .num_resources = ARRAY_SIZE(rk29_spi1_resources),
827 .resource = rk29_spi1_resources,
829 .dma_mask = &dma_dmamask,
830 .coherent_dma_mask = DMA_BIT_MASK(32),
831 .platform_data = &rk29xx_spi1_platdata,
836 static void __init rk30_init_spim(void)
838 #ifdef CONFIG_SPIM0_RK29
839 platform_device_register(&rk29xx_device_spi0m);
841 #ifdef CONFIG_SPIM1_RK29
842 platform_device_register(&rk29xx_device_spi1m);
846 #ifdef CONFIG_MTD_NAND_RK29XX
847 static struct resource resources_nand[] = {
849 .start = RK30_NANDC_PHYS,
850 .end = RK30_NANDC_PHYS + RK30_NANDC_SIZE - 1,
851 .flags = IORESOURCE_MEM,
855 static struct platform_device device_nand = {
856 .name = "rk29xxnand",
858 .resource = resources_nand,
859 .num_resources = ARRAY_SIZE(resources_nand),
863 #ifdef CONFIG_HDMI_RK30
864 static struct resource resource_hdmi[] = {
866 .start = RK30_HDMI_PHYS,
867 .end = RK30_HDMI_PHYS + RK30_HDMI_SIZE - 1,
868 .flags = IORESOURCE_MEM,
873 .flags = IORESOURCE_IRQ,
877 static struct platform_device device_hdmi = {
880 .num_resources = ARRAY_SIZE(resource_hdmi),
881 .resource = resource_hdmi,
885 #ifdef CONFIG_RGA_RK30
886 static struct resource resource_rga[] = {
888 .start = RK30_RGA_PHYS,
889 .end = RK30_RGA_PHYS + RK30_RGA_SIZE - 1,
890 .flags = IORESOURCE_MEM,
895 .flags = IORESOURCE_IRQ,
899 static struct platform_device device_rga = {
902 .num_resources = ARRAY_SIZE(resource_rga),
903 .resource = resource_rga,
907 static struct resource resource_ipp[] = {
909 .start = RK30_IPP_PHYS,
910 .end = RK30_IPP_PHYS + RK30_IPP_SIZE - 1,
911 .flags = IORESOURCE_MEM,
916 .flags = IORESOURCE_IRQ,
920 static struct platform_device device_ipp = {
923 .num_resources = ARRAY_SIZE(resource_ipp),
924 .resource = resource_ipp,
927 #ifdef CONFIG_SND_RK29_SOC_I2S
928 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
929 static struct resource resource_iis0_8ch[] = {
931 .start = RK30_I2S0_8CH_PHYS,
932 .end = RK30_I2S0_8CH_PHYS + RK30_I2S0_8CH_SIZE - 1,
933 .flags = IORESOURCE_MEM,
936 .start = DMACH_I2S0_8CH_TX,
937 .end = DMACH_I2S0_8CH_TX,
938 .flags = IORESOURCE_DMA,
941 .start = DMACH_I2S0_8CH_RX,
942 .end = DMACH_I2S0_8CH_RX,
943 .flags = IORESOURCE_DMA,
946 .start = IRQ_I2S0_8CH,
948 .flags = IORESOURCE_IRQ,
952 static struct platform_device device_iis0_8ch = {
955 .num_resources = ARRAY_SIZE(resource_iis0_8ch),
956 .resource = resource_iis0_8ch,
959 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
960 static struct resource resource_iis1_2ch[] = {
962 .start = RK30_I2S1_2CH_PHYS,
963 .end = RK30_I2S1_2CH_PHYS + RK30_I2S1_2CH_SIZE -1,
964 .flags = IORESOURCE_MEM,
967 .start = DMACH_I2S1_2CH_TX,
968 .end = DMACH_I2S1_2CH_TX,
969 .flags = IORESOURCE_DMA,
972 .start = DMACH_I2S1_2CH_RX,
973 .end = DMACH_I2S1_2CH_RX,
974 .flags = IORESOURCE_DMA,
977 .start = IRQ_I2S1_2CH,
979 .flags = IORESOURCE_IRQ,
983 static struct platform_device device_iis1_2ch = {
986 .num_resources = ARRAY_SIZE(resource_iis1_2ch),
987 .resource = resource_iis1_2ch,
990 #ifdef CONFIG_SND_RK_SOC_I2S2_2CH
991 static struct resource resource_iis2_2ch[] = {
993 .start = RK30_I2S2_2CH_PHYS,
994 .end = RK30_I2S2_2CH_PHYS + RK30_I2S2_2CH_SIZE -1,
995 .flags = IORESOURCE_MEM,
998 .start = DMACH_I2S2_2CH_TX,
999 .end = DMACH_I2S2_2CH_TX,
1000 .flags = IORESOURCE_DMA,
1003 .start = DMACH_I2S2_2CH_RX,
1004 .end = DMACH_I2S2_2CH_RX,
1005 .flags = IORESOURCE_DMA,
1008 .start = IRQ_I2S2_2CH,
1009 .end = IRQ_I2S2_2CH,
1010 .flags = IORESOURCE_IRQ,
1014 static struct platform_device device_iis2_2ch = {
1017 .num_resources = ARRAY_SIZE(resource_iis2_2ch),
1018 .resource = resource_iis2_2ch,
1023 static struct platform_device device_pcm = {
1024 .name = "rockchip-audio",
1028 static void __init rk30_init_i2s(void)
1030 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
1031 platform_device_register(&device_iis0_8ch);
1033 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
1034 platform_device_register(&device_iis1_2ch);
1036 #ifdef CONFIG_SND_RK_SOC_I2S2_2CH
1037 platform_device_register(&device_iis2_2ch);
1039 platform_device_register(&device_pcm);
1044 #ifdef CONFIG_KEYS_RK29
1045 extern struct rk29_keys_platform_data rk29_keys_pdata;
1046 static struct platform_device device_keys = {
1047 .name = "rk29-keypad",
1050 .platform_data = &rk29_keys_pdata,
1055 #ifdef CONFIG_SDMMC0_RK29
1056 static struct resource resources_sdmmc0[] = {
1060 .flags = IORESOURCE_IRQ,
1063 .start = RK30_SDMMC0_PHYS,
1064 .end = RK30_SDMMC0_PHYS + RK30_SDMMC0_SIZE -1,
1065 .flags = IORESOURCE_MEM,
1069 static struct platform_device device_sdmmc0 = {
1070 .name = "rk29_sdmmc",
1072 .num_resources = ARRAY_SIZE(resources_sdmmc0),
1073 .resource = resources_sdmmc0,
1075 .platform_data = &default_sdmmc0_data,
1080 #ifdef CONFIG_SDMMC1_RK29
1081 static struct resource resources_sdmmc1[] = {
1085 .flags = IORESOURCE_IRQ,
1088 .start = RK30_SDIO_PHYS,
1089 .end = RK30_SDIO_PHYS + RK30_SDIO_SIZE - 1,
1090 .flags = IORESOURCE_MEM,
1094 static struct platform_device device_sdmmc1 = {
1095 .name = "rk29_sdmmc",
1097 .num_resources = ARRAY_SIZE(resources_sdmmc1),
1098 .resource = resources_sdmmc1,
1100 .platform_data = &default_sdmmc1_data,
1105 static void __init rk30_init_sdmmc(void)
1107 #ifdef CONFIG_SDMMC0_RK29
1108 platform_device_register(&device_sdmmc0);
1110 #ifdef CONFIG_SDMMC1_RK29
1111 platform_device_register(&device_sdmmc1);
1115 #ifdef CONFIG_SND_RK_SOC_SPDIF
1116 static struct resource resources_spdif[] = {
1118 .name = "spdif_base",
1119 .start = RK30_SPDIF_PHYS,
1120 .end = RK30_SPDIF_PHYS + RK30_SPDIF_SIZE - 1,
1121 .flags = IORESOURCE_MEM,
1124 .name = "spdif_irq",
1127 .flags = IORESOURCE_IRQ,
1130 .name = "spdif_dma",
1131 .start = DMACH_SPDIF_TX,
1132 .end = DMACH_SPDIF_TX,
1133 .flags = IORESOURCE_DMA,
1136 struct platform_device rk29_device_spdif = {
1139 .num_resources = ARRAY_SIZE(resources_spdif),
1140 .resource = resources_spdif,
1144 #ifdef CONFIG_RK29_VMAC
1145 static u64 eth_dmamask = DMA_BIT_MASK(32);
1146 static struct resource resources_vmac[] = {
1148 .start = RK30_MAC_PHYS,
1149 .end = RK30_MAC_PHYS + RK30_MAC_SIZE - 1,
1150 .flags = IORESOURCE_MEM,
1155 .flags = IORESOURCE_IRQ,
1159 static struct platform_device device_vmac = {
1160 .name = "rk29 vmac",
1163 .dma_mask = ð_dmamask,
1164 .coherent_dma_mask = DMA_BIT_MASK(32),
1165 .platform_data = &board_vmac_data,
1167 .num_resources = ARRAY_SIZE(resources_vmac),
1168 .resource = resources_vmac,
1172 #ifdef CONFIG_RK29_WATCHDOG
1173 static struct resource resources_wdt[] = {
1177 .flags = IORESOURCE_IRQ,
1180 .start = RK30_WDT_PHYS,
1181 .end = RK30_WDT_PHYS + RK30_WDT_SIZE - 1,
1182 .flags = IORESOURCE_MEM,
1186 static struct platform_device device_wdt = {
1189 .num_resources = ARRAY_SIZE(resources_wdt),
1190 .resource = resources_wdt,
1194 static struct resource resource_arm_pmu[] = {
1196 .start = IRQ_ARM_PMU,
1198 .flags = IORESOURCE_IRQ,
1201 .start = IRQ_ARM_PMU + 1,
1202 .end = IRQ_ARM_PMU + 1,
1203 .flags = IORESOURCE_IRQ,
1205 #if defined(CONFIG_ARCH_RK3188)
1207 .start = IRQ_ARM_PMU + 2,
1208 .end = IRQ_ARM_PMU + 2,
1209 .flags = IORESOURCE_IRQ,
1212 .start = IRQ_ARM_PMU + 3,
1213 .end = IRQ_ARM_PMU + 3,
1214 .flags = IORESOURCE_IRQ,
1219 struct platform_device device_arm_pmu = {
1221 .id = ARM_PMU_DEVICE_CPU,
1222 .num_resources = ARRAY_SIZE(resource_arm_pmu),
1223 .resource = resource_arm_pmu,
1226 static int __init rk30_init_devices(void)
1232 #ifdef CONFIG_RGA_RK30
1233 platform_device_register(&device_rga);
1235 platform_device_register(&device_ipp);
1237 #ifdef CONFIG_HDMI_RK30
1238 platform_device_register(&device_hdmi);
1240 #ifdef CONFIG_ADC_RK30
1241 platform_device_register(&device_adc);
1243 #ifdef CONFIG_KEYS_RK29
1244 platform_device_register(&device_keys);
1248 #if defined(CONFIG_FIQ_DEBUGGER) && defined(DEBUG_UART_PHYS)
1249 rk_serial_debug_init(DEBUG_UART_BASE, IRQ_DEBUG_UART, IRQ_UART_SIGNAL, -1);
1253 #ifdef CONFIG_SND_RK_SOC_SPDIF
1254 platform_device_register(&rk29_device_spdif);
1256 #ifdef CONFIG_RK29_VMAC
1257 platform_device_register(&device_vmac);
1259 #ifdef CONFIG_RK29_WATCHDOG
1260 platform_device_register(&device_wdt);
1262 platform_device_register(&device_arm_pmu);
1263 #ifdef CONFIG_MTD_NAND_RK29XX
1264 platform_device_register(&device_nand);
1269 arch_initcall(rk30_init_devices);