1 /* arch/arm/mach-rk29/board-rk29.c
3 * Copyright (C) 2010 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.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/input.h>
21 #include <linux/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/spi/spi.h>
24 #include <linux/mmc/host.h>
25 #include <linux/android_pmem.h>
26 #include <linux/usb/android_composite.h>
28 #include <mach/hardware.h>
29 #include <asm/setup.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/flash.h>
34 #include <asm/hardware/gic.h>
36 #include <mach/iomux.h>
37 #include <mach/gpio.h>
38 #include <mach/irqs.h>
39 #include <mach/rk29_iomap.h>
40 #include <mach/board.h>
41 #include <mach/rk29_nand.h>
42 #include <mach/rk29_camera.h> /* ddl@rock-chips.com : camera support */
43 #include <media/soc_camera.h> /* ddl@rock-chips.com : camera support */
44 #include <mach/vpu_mem.h>
45 #include <mach/sram.h>
48 #include <linux/regulator/rk29-pwm-regulator.h>
49 #include <linux/regulator/machine.h>
51 #include <linux/mtd/nand.h>
52 #include <linux/mtd/partitions.h>
53 #include <linux/i2c-gpio.h>
56 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
58 #ifdef CONFIG_VIDEO_RK29
59 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
60 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
61 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
62 #define CONFIG_SENSOR_IIC_ADDR_0 0x78
63 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
64 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
65 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
66 #define CONFIG_SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
67 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
68 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
69 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
70 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
71 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
73 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor */
74 #define CONFIG_SENSOR_IIC_ADDR_1 0x60
75 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
76 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
77 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
78 #define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
79 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
80 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
81 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
82 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
83 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
84 #endif //#ifdef CONFIG_VIDEO_RK29
85 /*---------------- Camera Sensor Configuration Macro End------------------------*/
86 #include "../../../drivers/media/video/rk29_camera.c"
87 /*---------------- Camera Sensor Macro Define End ------------------------*/
89 /* Set memory size of pmem */
90 #ifdef CONFIG_RK29_MEM_SIZE_M
91 #define SDRAM_SIZE (CONFIG_RK29_MEM_SIZE_M * SZ_1M)
93 #define SDRAM_SIZE SZ_512M
95 #define PMEM_GPU_SIZE SZ_64M
96 #define PMEM_UI_SIZE SZ_32M
97 #define PMEM_VPU_SIZE SZ_64M
98 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
99 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
100 #define MEM_CAMIPP_SIZE SZ_4M
102 #define MEM_CAMIPP_SIZE 0
104 #define MEM_FB_SIZE (3*SZ_2M)
105 #ifdef CONFIG_FB_WORK_IPP
106 #define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4
108 #define MEM_FBIPP_SIZE 0
110 #define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
111 #define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
112 #define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
113 #define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
114 #define MEM_CAMIPP_BASE (PMEM_CAM_BASE - MEM_CAMIPP_SIZE)
115 #define MEM_FB_BASE (MEM_CAMIPP_BASE - MEM_FB_SIZE)
116 #define MEM_FBIPP_BASE (MEM_FB_BASE - MEM_FBIPP_SIZE)
117 #define LINUX_SIZE (MEM_FBIPP_BASE - RK29_SDRAM_PHYS)
119 #define PREALLOC_WLAN_SEC_NUM 4
120 #define PREALLOC_WLAN_BUF_NUM 160
121 #define PREALLOC_WLAN_SECTION_HEADER 24
123 #define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
124 #define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
125 #define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
126 #define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
128 #define WLAN_SKB_BUF_NUM 16
130 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
132 struct wifi_mem_prealloc {
137 extern struct sys_timer rk29_timer;
139 static int rk29_nand_io_init(void)
144 struct rk29_nand_platform_data rk29_nand_data = {
145 .width = 1, /* data bus width in bytes */
146 .hw_ecc = 1, /* hw ecc 0: soft ecc */
148 .io_init = rk29_nand_io_init,
151 #define TOUCH_SCREEN_STANDBY_PIN RK29_PIN6_PD1
152 #define TOUCH_SCREEN_STANDBY_VALUE GPIO_HIGH
153 #define TOUCH_SCREEN_DISPLAY_PIN INVALID_GPIO
154 #define TOUCH_SCREEN_DISPLAY_VALUE GPIO_HIGH
155 #ifdef CONFIG_FB_RK29
156 /*****************************************************************************************
158 * author: zyw@rock-chips.com
159 *****************************************************************************************/
160 //#ifdef CONFIG_LCD_TD043MGEA1
161 #define LCD_TXD_PIN INVALID_GPIO
162 #define LCD_CLK_PIN INVALID_GPIO
163 #define LCD_CS_PIN INVALID_GPIO
164 /*****************************************************************************************
165 * frame buffe devices
166 * author: zyw@rock-chips.com
167 *****************************************************************************************/
169 #define FB_DISPLAY_ON_PIN INVALID_GPIO// RK29_PIN6_PD0
170 #define FB_LCD_STANDBY_PIN INVALID_GPIO
171 #define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
172 #define FB_MCU_FMK_PIN INVALID_GPIO
174 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
175 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
177 static int rk29_lcd_io_init(void)
183 static int rk29_lcd_io_deinit(void)
189 static struct rk29lcd_info rk29_lcd_info = {
190 .txd_pin = LCD_TXD_PIN,
191 .clk_pin = LCD_CLK_PIN,
192 .cs_pin = LCD_CS_PIN,
193 .io_init = rk29_lcd_io_init,
194 .io_deinit = rk29_lcd_io_deinit,
197 int rk29_fb_io_enable(void)
199 if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
201 gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
202 gpio_set_value(FB_DISPLAY_ON_PIN, FB_DISPLAY_ON_VALUE);
204 if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
206 gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
207 gpio_set_value(FB_LCD_STANDBY_PIN, FB_LCD_STANDBY_VALUE);
212 int rk29_fb_io_disable(void)
214 if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
216 gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
217 gpio_set_value(FB_DISPLAY_ON_PIN, !FB_DISPLAY_ON_VALUE);
219 if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
221 gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
222 gpio_set_value(FB_LCD_STANDBY_PIN, !FB_LCD_STANDBY_VALUE);
227 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
230 if(fb_setting->mcu_fmk_en && (FB_MCU_FMK_PIN != INVALID_GPIO))
232 ret = gpio_request(FB_MCU_FMK_PIN, NULL);
235 gpio_free(FB_MCU_FMK_PIN);
236 printk(">>>>>> FB_MCU_FMK_PIN gpio_request err \n ");
238 gpio_direction_input(FB_MCU_FMK_PIN);
240 if(fb_setting->disp_on_en)
242 if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
244 ret = gpio_request(FB_DISPLAY_ON_PIN, NULL);
247 gpio_free(FB_DISPLAY_ON_PIN);
248 printk(">>>>>> FB_DISPLAY_ON_PIN gpio_request err \n ");
253 ret = gpio_request(TOUCH_SCREEN_DISPLAY_PIN, NULL);
256 gpio_free(TOUCH_SCREEN_DISPLAY_PIN);
257 printk(">>>>>> TOUCH_SCREEN_DISPLAY_PIN gpio_request err \n ");
259 gpio_direction_output(TOUCH_SCREEN_DISPLAY_PIN, 0);
260 gpio_set_value(TOUCH_SCREEN_DISPLAY_PIN, TOUCH_SCREEN_DISPLAY_VALUE);
264 if(fb_setting->disp_on_en)
266 if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
268 ret = gpio_request(FB_LCD_STANDBY_PIN, NULL);
271 gpio_free(FB_LCD_STANDBY_PIN);
272 printk(">>>>>> FB_LCD_STANDBY_PIN gpio_request err \n ");
277 ret = gpio_request(TOUCH_SCREEN_STANDBY_PIN, NULL);
280 gpio_free(TOUCH_SCREEN_STANDBY_PIN);
281 printk(">>>>>> TOUCH_SCREEN_STANDBY_PIN gpio_request err \n ");
283 gpio_direction_output(TOUCH_SCREEN_STANDBY_PIN, 0);
284 gpio_set_value(TOUCH_SCREEN_STANDBY_PIN, TOUCH_SCREEN_STANDBY_VALUE);
288 if(FB_LCD_CABC_EN_PIN != INVALID_GPIO)
290 ret = gpio_request(FB_LCD_CABC_EN_PIN, NULL);
293 gpio_free(FB_LCD_CABC_EN_PIN);
294 printk(">>>>>> FB_LCD_CABC_EN_PIN gpio_request err \n ");
296 gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
297 gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
300 rk29_fb_io_enable(); //enable it
305 static struct rk29fb_info rk29_fb_info = {
307 .mcu_fmk_pin = FB_MCU_FMK_PIN,
308 .lcd_info = &rk29_lcd_info,
309 .io_init = rk29_fb_io_init,
310 .io_enable = rk29_fb_io_enable,
311 .io_disable = rk29_fb_io_disable,
314 /* rk29 fb resource */
315 static struct resource rk29_fb_resource[] = {
318 .start = RK29_LCDC_PHYS,
319 .end = RK29_LCDC_PHYS + RK29_LCDC_SIZE - 1,
320 .flags = IORESOURCE_MEM,
326 .flags = IORESOURCE_IRQ,
330 .start = MEM_FB_BASE,
331 .end = MEM_FB_BASE + MEM_FB_SIZE - 1,
332 .flags = IORESOURCE_MEM,
334 #ifdef CONFIG_FB_WORK_IPP
336 .name = "win1 ipp buf",
337 .start = MEM_FBIPP_BASE,
338 .end = MEM_FBIPP_BASE + MEM_FBIPP_SIZE - 1,
339 .flags = IORESOURCE_MEM,
345 struct platform_device rk29_device_fb = {
348 .num_resources = ARRAY_SIZE(rk29_fb_resource),
349 .resource = rk29_fb_resource,
351 .platform_data = &rk29_fb_info,
355 struct platform_device rk29_device_dma_cpy = {
356 .name = "dma_memcpy",
363 static struct android_pmem_platform_data android_pmem_pdata = {
365 .start = PMEM_UI_BASE,
366 .size = PMEM_UI_SIZE,
371 static struct platform_device android_pmem_device = {
372 .name = "android_pmem",
375 .platform_data = &android_pmem_pdata,
380 static struct vpu_mem_platform_data vpu_mem_pdata = {
382 .start = PMEM_VPU_BASE,
383 .size = PMEM_VPU_SIZE,
387 static struct platform_device rk29_vpu_mem_device = {
391 .platform_data = &vpu_mem_pdata,
394 #ifdef CONFIG_VIDEO_RK29XX_VOUT
395 static struct platform_device rk29_v4l2_output_devce = {
399 /*HANNSTAR_P1003 touch*/
400 #if defined (CONFIG_HANNSTAR_P1003)
401 #define TOUCH_RESET_PIN RK29_PIN6_PC3
402 #define TOUCH_INT_PIN RK29_PIN0_PA2
404 int p1003_init_platform_hw(void)
406 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
407 gpio_free(TOUCH_RESET_PIN);
408 printk("p1003_init_platform_hw gpio_request error\n");
412 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
413 gpio_free(TOUCH_INT_PIN);
414 printk("p1003_init_platform_hw gpio_request error\n");
417 gpio_pull_updown(TOUCH_INT_PIN, 1);
418 gpio_direction_output(TOUCH_RESET_PIN, 0);
420 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
422 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
428 struct p1003_platform_data p1003_info = {
430 .init_platform_hw= p1003_init_platform_hw,
434 #if defined (CONFIG_EETI_EGALAX)
435 #define TOUCH_RESET_PIN RK29_PIN6_PC3
436 #define TOUCH_INT_PIN RK29_PIN0_PA2
438 static int EETI_EGALAX_init_platform_hw(void)
440 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
441 gpio_free(TOUCH_RESET_PIN);
442 printk("p1003_init_platform_hw gpio_request error\n");
446 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
447 gpio_free(TOUCH_INT_PIN);
448 printk("p1003_init_platform_hw gpio_request error\n");
451 gpio_pull_updown(TOUCH_INT_PIN, 1);
452 gpio_direction_output(TOUCH_RESET_PIN, 0);
454 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
456 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
462 static struct eeti_egalax_platform_data eeti_egalax_info = {
464 .init_platform_hw= EETI_EGALAX_init_platform_hw,
465 .standby_pin = TOUCH_SCREEN_STANDBY_PIN,
466 .standby_value = TOUCH_SCREEN_STANDBY_VALUE,
467 .disp_on_pin = TOUCH_SCREEN_DISPLAY_PIN,
468 .disp_on_value = TOUCH_SCREEN_DISPLAY_VALUE,
472 #if defined (CONFIG_GS_MMA8452)
473 #define MMA8452_INT_PIN RK29_PIN0_PA3
475 static int mma8452_init_platform_hw(void)
478 if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
479 gpio_free(MMA8452_INT_PIN);
480 printk("mma8452_init_platform_hw gpio_request error\n");
483 gpio_pull_updown(MMA8452_INT_PIN, 1);
488 static struct mma8452_platform_data mma8452_info = {
491 .init_platform_hw= mma8452_init_platform_hw,
496 #if defined (CONFIG_BATTERY_BQ27510)
497 #define DC_CHECK_PIN RK29_PIN4_PA1
498 #define LI_LION_BAT_NUM 2
499 static int bq27510_init_dc_check_pin(void){
500 if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){
501 gpio_free(DC_CHECK_PIN);
502 printk("bq27510 init dc check pin request error\n");
505 gpio_direction_input(DC_CHECK_PIN);
509 struct bq27510_platform_data bq27510_info = {
510 .init_dc_check_pin = bq27510_init_dc_check_pin,
511 .dc_check_pin = DC_CHECK_PIN,
512 .bat_num = LI_LION_BAT_NUM,
517 /*****************************************************************************************
519 * author: kfx@rock-chips.com
520 *****************************************************************************************/
521 static int rk29_i2c0_io_init(void)
523 #ifdef CONFIG_RK29_I2C0_CONTROLLER
524 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
525 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
527 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
528 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
533 static int rk29_i2c1_io_init(void)
535 #ifdef CONFIG_RK29_I2C1_CONTROLLER
536 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
537 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
539 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
540 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
544 static int rk29_i2c2_io_init(void)
546 #ifdef CONFIG_RK29_I2C2_CONTROLLER
547 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
548 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
550 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
551 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
556 static int rk29_i2c3_io_init(void)
558 #ifdef CONFIG_RK29_I2C3_CONTROLLER
559 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
560 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
562 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
563 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
567 #ifdef CONFIG_RK29_I2C0_CONTROLLER
568 struct rk29_i2c_platform_data default_i2c0_data = {
572 .scl_rate = 400*1000,
573 .mode = I2C_MODE_IRQ,
574 .io_init = rk29_i2c0_io_init,
577 struct i2c_gpio_platform_data default_i2c0_data = {
578 .sda_pin = RK29_PIN2_PB6,
579 .scl_pin = RK29_PIN2_PB7,
580 .udelay = 5, // clk = 500/udelay = 100Khz
581 .timeout = 100,//msecs_to_jiffies(200),
583 .io_init = rk29_i2c0_io_init,
586 #ifdef CONFIG_RK29_I2C1_CONTROLLER
587 struct rk29_i2c_platform_data default_i2c1_data = {
591 .scl_rate = 400*1000,
592 .mode = I2C_MODE_IRQ,
593 .io_init = rk29_i2c1_io_init,
596 struct i2c_gpio_platform_data default_i2c1_data = {
597 .sda_pin = RK29_PIN1_PA6,
598 .scl_pin = RK29_PIN1_PA7,
599 .udelay = 5, // clk = 500/udelay = 100Khz
600 .timeout = 100,//msecs_to_jiffies(200),
602 .io_init = rk29_i2c1_io_init,
605 #ifdef CONFIG_RK29_I2C2_CONTROLLER
606 struct rk29_i2c_platform_data default_i2c2_data = {
610 .scl_rate = 400*1000,
611 .mode = I2C_MODE_IRQ,
612 .io_init = rk29_i2c2_io_init,
615 struct i2c_gpio_platform_data default_i2c2_data = {
616 .sda_pin = RK29_PIN5_PD3,
617 .scl_pin = RK29_PIN5_PD4,
618 .udelay = 5, // clk = 500/udelay = 100Khz
619 .timeout = 100,//msecs_to_jiffies(200),
621 .io_init = rk29_i2c2_io_init,
624 #ifdef CONFIG_RK29_I2C3_CONTROLLER
625 struct rk29_i2c_platform_data default_i2c3_data = {
629 .scl_rate = 400*1000,
630 .mode = I2C_MODE_IRQ,
631 .io_init = rk29_i2c3_io_init,
634 struct i2c_gpio_platform_data default_i2c3_data = {
635 .sda_pin = RK29_PIN5_PB5,
636 .scl_pin = RK29_PIN5_PB4,
637 .udelay = 5, // clk = 500/udelay = 100Khz
638 .timeout = 100,//msecs_to_jiffies(200),
640 .io_init = rk29_i2c3_io_init,
643 #ifdef CONFIG_I2C0_RK29
644 static struct i2c_board_info __initdata board_i2c0_devices[] = {
645 #if defined (CONFIG_RK1000_CONTROL)
647 .type = "rk1000_control",
652 #if defined (CONFIG_SND_SOC_alc5621)
659 #if defined (CONFIG_SND_SOC_alc5631)
666 #if defined (CONFIG_SND_SOC_RK1000)
668 .type = "rk1000_i2c_codec",
673 #if defined (CONFIG_SND_SOC_WM8900)
680 #if defined (CONFIG_BATTERY_STC3100)
687 #if defined (CONFIG_BATTERY_BQ27510)
692 .platform_data = &bq27510_info,
695 #if defined (CONFIG_RTC_HYM8563)
697 .type = "rtc_hym8563",
700 .irq = RK29_PIN0_PA1,
703 #if defined (CONFIG_GS_MMA8452)
705 .type = "gs_mma8452",
708 .irq = MMA8452_INT_PIN,
709 .platform_data = &mma8452_info,
712 #if defined (CONFIG_COMPASS_AK8973)
717 .irq = RK29_PIN0_PA4,
720 #if defined (CONFIG_COMPASS_AK8975)
725 .irq = RK29_PIN0_PA4,
731 #ifdef CONFIG_I2C1_RK29
732 static struct i2c_board_info __initdata board_i2c1_devices[] = {
733 #if defined (CONFIG_RK1000_CONTROL1)
735 .type = "rk1000_control",
740 #if defined (CONFIG_ANX7150) || defined (CONFIG_ANX7150_NEW)
743 .addr = 0x39, //0x39, 0x3d
745 .irq = RK29_PIN1_PD7,
752 #ifdef CONFIG_I2C2_RK29
753 static struct i2c_board_info __initdata board_i2c2_devices[] = {
754 #if defined (CONFIG_HANNSTAR_P1003)
756 .type = "p1003_touch",
758 .flags = 0, //I2C_M_NEED_DELAY
759 .irq = RK29_PIN0_PA2,
760 .platform_data = &p1003_info,
764 #if defined (CONFIG_EETI_EGALAX)
766 .type = "egalax_i2c",
769 .irq = RK29_PIN0_PA2,
770 .platform_data = &eeti_egalax_info,
776 #ifdef CONFIG_I2C3_RK29
777 static struct i2c_board_info __initdata board_i2c3_devices[] = {
781 /*****************************************************************************************
783 * author: ddl@rock-chips.com
784 *****************************************************************************************/
785 #ifdef CONFIG_VIDEO_RK29
786 #define CONFIG_SENSOR_POWER_IOCTL_USR 0
787 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
788 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
789 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
791 #if CONFIG_SENSOR_POWER_IOCTL_USR
792 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
794 #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
798 #if CONFIG_SENSOR_RESET_IOCTL_USR
799 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
801 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
805 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
806 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
808 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
812 #if CONFIG_SENSOR_FLASH_IOCTL_USR
813 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
815 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
819 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
820 #if CONFIG_SENSOR_POWER_IOCTL_USR
821 .sensor_power_cb = sensor_power_usr_cb,
823 .sensor_power_cb = NULL,
826 #if CONFIG_SENSOR_RESET_IOCTL_USR
827 .sensor_reset_cb = sensor_reset_usr_cb,
829 .sensor_reset_cb = NULL,
832 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
833 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
835 .sensor_powerdown_cb = NULL,
838 #if CONFIG_SENSOR_FLASH_IOCTL_USR
839 .sensor_flash_cb = sensor_flash_usr_cb,
841 .sensor_flash_cb = NULL,
845 #include "../../../drivers/media/video/rk29_camera.c"
847 /*****************************************************************************************
849 * author: nzy@rock-chips.com
850 *****************************************************************************************/
851 #ifdef CONFIG_BACKLIGHT_RK29_BL
853 GPIO1B5_PWM0_NAME, GPIO1L_PWM0
854 GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_PWM1
855 GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME, GPIO2L_PWM2
856 GPIO1A5_EMMCPWREN_PWM3_NAME, GPIO1L_PWM3
860 #define PWM_MUX_NAME GPIO1B5_PWM0_NAME
861 #define PWM_MUX_MODE GPIO1L_PWM0
862 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
863 #define PWM_GPIO RK29_PIN1_PB5
864 #define PWM_EFFECT_VALUE 1
866 #define LCD_DISP_ON_PIN
868 #ifdef LCD_DISP_ON_PIN
869 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
870 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
872 #define BL_EN_PIN RK29_PIN6_PD0
873 #define BL_EN_VALUE GPIO_HIGH
875 static int rk29_backlight_io_init(void)
879 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
880 #ifdef LCD_DISP_ON_PIN
881 // rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
883 ret = gpio_request(BL_EN_PIN, NULL);
886 gpio_free(BL_EN_PIN);
889 gpio_direction_output(BL_EN_PIN, 0);
890 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
895 static int rk29_backlight_io_deinit(void)
898 #ifdef LCD_DISP_ON_PIN
899 gpio_free(BL_EN_PIN);
901 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
905 static int rk29_backlight_pwm_suspend(void)
908 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
909 if (gpio_request(PWM_GPIO, NULL)) {
910 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
913 gpio_direction_output(PWM_GPIO, GPIO_LOW);
914 #ifdef LCD_DISP_ON_PIN
915 gpio_direction_output(BL_EN_PIN, 0);
916 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
921 static int rk29_backlight_pwm_resume(void)
924 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
926 #ifdef LCD_DISP_ON_PIN
928 gpio_direction_output(BL_EN_PIN, 1);
929 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
934 struct rk29_bl_info rk29_bl_info = {
936 .bl_ref = PWM_EFFECT_VALUE,
937 .io_init = rk29_backlight_io_init,
938 .io_deinit = rk29_backlight_io_deinit,
939 .pwm_suspend = rk29_backlight_pwm_suspend,
940 .pwm_resume = rk29_backlight_pwm_resume,
943 /*****************************************************************************************
944 * pwm voltage regulator devices
945 ******************************************************************************************/
946 #if defined (CONFIG_RK29_PWM_REGULATOR)
948 #define REGULATOR_PWM_ID 2
949 #define REGULATOR_PWM_MUX_NAME GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
950 #define REGULATOR_PWM_MUX_MODE GPIO2L_PWM2
951 #define REGULATOR_PWM_MUX_MODE_GPIO GPIO2L_GPIO2A3
952 #define REGULATOR_PWM_GPIO RK29_PIN2_PA3
954 static struct regulator_consumer_supply pwm_consumers[] = {
960 static struct regulator_init_data rk29_pwm_regulator_data = {
966 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
968 .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
969 .consumer_supplies = pwm_consumers,
972 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
973 .pwm_id = REGULATOR_PWM_ID,
974 .pwm_gpio = REGULATOR_PWM_GPIO,
975 //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
976 .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
977 .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
978 .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
979 .init_data = &rk29_pwm_regulator_data,
982 static struct platform_device rk29_device_pwm_regulator = {
983 .name = "pwm-voltage-regulator",
986 .platform_data = &rk29_regulator_pwm_platform_data,
992 /*****************************************************************************************
994 *****************************************************************************************/
995 #ifdef CONFIG_SDMMC0_RK29
996 static int rk29_sdmmc0_cfg_gpio(void)
998 rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
999 rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
1000 rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
1001 rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
1002 rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
1003 rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
1004 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
1005 rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
1006 gpio_request(RK29_PIN5_PD5,"sdmmc");
1008 gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
1010 gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
1012 gpio_direction_output(RK29_PIN5_PD5,GPIO_LOW);
1017 #define CONFIG_SDMMC0_USE_DMA
1018 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1019 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
1020 MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
1021 MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
1022 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1023 .io_init = rk29_sdmmc0_cfg_gpio,
1024 .dma_name = "sd_mmc",
1025 #ifdef CONFIG_SDMMC0_USE_DMA
1030 .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO
1031 .enable_sd_wakeup = 0,
1034 #ifdef CONFIG_SDMMC1_RK29
1035 #define CONFIG_SDMMC1_USE_DMA
1036 static int rk29_sdmmc1_cfg_gpio(void)
1038 rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
1039 rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
1040 rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
1041 rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
1042 rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
1043 rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
1044 //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
1048 #ifdef CONFIG_WIFI_CONTROL_FUNC
1049 static int rk29sdk_wifi_status(struct device *dev);
1050 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
1053 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
1055 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1056 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
1057 MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
1058 MMC_VDD_32_33|MMC_VDD_33_34),
1059 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
1060 MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1061 .io_init = rk29_sdmmc1_cfg_gpio,
1063 #ifdef CONFIG_SDMMC1_USE_DMA
1068 #ifdef CONFIG_WIFI_CONTROL_FUNC
1069 .status = rk29sdk_wifi_status,
1070 .register_status_notify = rk29sdk_wifi_status_register,
1073 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1078 #ifdef CONFIG_WIFI_CONTROL_FUNC
1079 #define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
1080 #define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
1081 #define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC4
1083 static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
1084 static void (*wifi_status_cb)(int card_present, void *dev_id);
1085 static void *wifi_status_cb_devid;
1086 int rk29sdk_wifi_power_state = 0;
1087 int rk29sdk_bt_power_state = 0;
1089 static int rk29sdk_wifi_status(struct device *dev)
1091 return rk29sdk_wifi_cd;
1094 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
1098 wifi_status_cb = callback;
1099 wifi_status_cb_devid = dev_id;
1103 static int rk29sdk_wifi_bt_gpio_control_init(void)
1105 if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
1106 pr_info("%s: request wifi_bt power gpio failed\n", __func__);
1110 if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
1111 pr_info("%s: request wifi reset gpio failed\n", __func__);
1112 gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
1116 if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
1117 pr_info("%s: request bt reset gpio failed\n", __func__);
1118 gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
1122 gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1123 gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1124 gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
1126 pr_info("%s: init finished\n",__func__);
1131 static int rk29sdk_wifi_power(int on)
1133 pr_info("%s: %d\n", __func__, on);
1135 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
1136 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
1138 pr_info("wifi turn on power\n");
1140 if (!rk29sdk_bt_power_state){
1141 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1143 pr_info("wifi shut off power\n");
1146 pr_info("wifi shouldn't shut off power, bt is using it!\n");
1148 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1152 rk29sdk_wifi_power_state = on;
1156 static int rk29sdk_wifi_reset_state;
1157 static int rk29sdk_wifi_reset(int on)
1159 pr_info("%s: %d\n", __func__, on);
1160 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
1162 rk29sdk_wifi_reset_state = on;
1166 int rk29sdk_wifi_set_carddetect(int val)
1168 pr_info("%s:%d\n", __func__, val);
1169 rk29sdk_wifi_cd = val;
1170 if (wifi_status_cb){
1171 wifi_status_cb(val, wifi_status_cb_devid);
1173 pr_warning("%s, nobody to notify\n", __func__);
1177 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
1179 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
1180 {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
1181 {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
1182 {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
1183 {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
1186 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
1188 if (section == PREALLOC_WLAN_SEC_NUM)
1189 return wlan_static_skb;
1191 if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
1194 if (wifi_mem_array[section].size < size)
1197 return wifi_mem_array[section].mem_ptr;
1200 int __init rk29sdk_init_wifi_mem(void)
1205 for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
1206 wlan_static_skb[i] = dev_alloc_skb(
1207 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
1209 if (!wlan_static_skb[i])
1213 for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
1214 wifi_mem_array[i].mem_ptr =
1215 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
1217 if (!wifi_mem_array[i].mem_ptr)
1223 pr_err("Failed to mem_alloc for WLAN\n");
1224 for (j = 0 ; j < i ; j++)
1225 kfree(wifi_mem_array[j].mem_ptr);
1227 i = WLAN_SKB_BUF_NUM;
1230 pr_err("Failed to skb_alloc for WLAN\n");
1231 for (j = 0 ; j < i ; j++)
1232 dev_kfree_skb(wlan_static_skb[j]);
1237 static struct wifi_platform_data rk29sdk_wifi_control = {
1238 .set_power = rk29sdk_wifi_power,
1239 .set_reset = rk29sdk_wifi_reset,
1240 .set_carddetect = rk29sdk_wifi_set_carddetect,
1241 .mem_prealloc = rk29sdk_mem_prealloc,
1243 static struct platform_device rk29sdk_wifi_device = {
1244 .name = "bcm4329_wlan",
1247 .platform_data = &rk29sdk_wifi_control,
1253 /* bluetooth rfkill device */
1254 static struct platform_device rk29sdk_rfkill = {
1255 .name = "rk29sdk_rfkill",
1260 #ifdef CONFIG_VIVANTE
1261 #define GPU_HIGH_CLOCK 552
1262 #define GPU_LOW_CLOCK 300
1263 static struct resource resources_gpu[] = {
1268 .flags = IORESOURCE_IRQ,
1272 .start = RK29_GPU_PHYS,
1273 .end = RK29_GPU_PHYS + RK29_GPU_SIZE,
1274 .flags = IORESOURCE_MEM,
1278 .start = PMEM_GPU_BASE,
1279 .end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
1280 .flags = IORESOURCE_MEM,
1284 .start = GPU_LOW_CLOCK,
1285 .end = GPU_HIGH_CLOCK,
1286 .flags = IORESOURCE_IO,
1289 static struct platform_device rk29_device_gpu = {
1292 .num_resources = ARRAY_SIZE(resources_gpu),
1293 .resource = resources_gpu,
1297 #ifdef CONFIG_KEYS_RK29
1298 extern struct rk29_keys_platform_data rk29_keys_pdata;
1299 static struct platform_device rk29_device_keys = {
1300 .name = "rk29-keypad",
1303 .platform_data = &rk29_keys_pdata,
1308 static void __init rk29_board_iomux_init(void)
1310 #ifdef CONFIG_RK29_PWM_REGULATOR
1311 rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
1315 static struct platform_device *devices[] __initdata = {
1316 #ifdef CONFIG_UART1_RK29
1319 #ifdef CONFIG_UART0_RK29
1322 #ifdef CONFIG_UART2_RK29
1325 #ifdef CONFIG_UART3_RK29
1329 #ifdef CONFIG_RK29_PWM_REGULATOR
1330 &rk29_device_pwm_regulator,
1332 #ifdef CONFIG_SPIM0_RK29
1333 &rk29xx_device_spi0m,
1335 #ifdef CONFIG_SPIM1_RK29
1336 &rk29xx_device_spi1m,
1338 #ifdef CONFIG_ADC_RK29
1341 #ifdef CONFIG_I2C0_RK29
1344 #ifdef CONFIG_I2C1_RK29
1347 #ifdef CONFIG_I2C2_RK29
1350 #ifdef CONFIG_I2C3_RK29
1354 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
1355 &rk29_device_iis_2ch,
1357 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
1358 &rk29_device_iis_8ch,
1361 #ifdef CONFIG_KEYS_RK29
1364 #ifdef CONFIG_SDMMC0_RK29
1365 &rk29_device_sdmmc0,
1367 #ifdef CONFIG_SDMMC1_RK29
1368 &rk29_device_sdmmc1,
1371 #ifdef CONFIG_MTD_NAND_RK29XX
1372 &rk29xx_device_nand,
1375 #ifdef CONFIG_WIFI_CONTROL_FUNC
1376 &rk29sdk_wifi_device,
1383 #ifdef CONFIG_MTD_NAND_RK29
1387 #ifdef CONFIG_FB_RK29
1389 &rk29_device_dma_cpy,
1391 #ifdef CONFIG_BACKLIGHT_RK29_BL
1392 &rk29_device_backlight,
1394 #ifdef CONFIG_RK29_VMAC
1397 #ifdef CONFIG_VIVANTE
1400 #ifdef CONFIG_VIDEO_RK29
1401 &rk29_device_camera, /* ddl@rock-chips.com : camera support */
1402 #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
1403 &rk29_soc_camera_pdrv_0,
1405 &rk29_soc_camera_pdrv_1,
1406 &android_pmem_cam_device,
1408 &android_pmem_device,
1409 &rk29_vpu_mem_device,
1410 #ifdef CONFIG_USB20_OTG
1411 &rk29_device_usb20_otg,
1413 #ifdef CONFIG_USB20_HOST
1414 &rk29_device_usb20_host,
1416 #ifdef CONFIG_USB11_HOST
1417 &rk29_device_usb11_host,
1419 #ifdef CONFIG_USB_ANDROID
1420 &android_usb_device,
1421 &usb_mass_storage_device,
1423 #ifdef CONFIG_RK29_IPP
1426 #ifdef CONFIG_VIDEO_RK29XX_VOUT
1427 &rk29_v4l2_output_devce,
1431 /*****************************************************************************************
1433 * author: cmc@rock-chips.com
1434 *****************************************************************************************/
1435 static int rk29_vmac_register_set(void)
1437 //config rk29 vmac as rmii, 100MHz
1438 u32 value= readl(RK29_GRF_BASE + 0xbc);
1439 value = (value & 0xfff7ff) | (0x400);
1440 writel(value, RK29_GRF_BASE + 0xbc);
1444 static int rk29_rmii_io_init(void)
1449 err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
1451 gpio_free(RK29_PIN6_PB0);
1452 printk("-------request RK29_PIN6_PB0 fail--------\n");
1456 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1457 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1462 static int rk29_rmii_io_deinit(void)
1465 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1466 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1468 gpio_free(RK29_PIN6_PB0);
1472 static int rk29_rmii_power_control(int enable)
1476 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
1477 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
1480 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1481 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1486 struct rk29_vmac_platform_data rk29_vmac_pdata = {
1487 .vmac_register_set = rk29_vmac_register_set,
1488 .rmii_io_init = rk29_rmii_io_init,
1489 .rmii_io_deinit = rk29_rmii_io_deinit,
1490 .rmii_power_control = rk29_rmii_power_control,
1493 /*****************************************************************************************
1495 * author: cmc@rock-chips.com
1496 *****************************************************************************************/
1497 #define SPI_CHIPSELECT_NUM 2
1498 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
1501 .cs_gpio = RK29_PIN2_PC1,
1502 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
1503 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
1507 .cs_gpio = RK29_PIN1_PA4,
1508 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
1509 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
1513 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
1516 .cs_gpio = RK29_PIN2_PC5,
1517 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
1518 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
1522 .cs_gpio = RK29_PIN1_PA3,
1523 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
1524 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
1528 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
1533 for (i=0; i<cs_num; i++) {
1534 rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
1541 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
1546 static int spi_io_fix_leakage_bug(void)
1549 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
1554 static int spi_io_resume_leakage_bug(void)
1557 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
1562 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
1563 .num_chipselect = SPI_CHIPSELECT_NUM,
1564 .chipselect_gpios = rk29xx_spi0_cs_gpios,
1565 .io_init = spi_io_init,
1566 .io_deinit = spi_io_deinit,
1567 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
1568 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
1571 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
1572 .num_chipselect = SPI_CHIPSELECT_NUM,
1573 .chipselect_gpios = rk29xx_spi1_cs_gpios,
1574 .io_init = spi_io_init,
1575 .io_deinit = spi_io_deinit,
1576 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
1577 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
1580 /*****************************************************************************************
1581 * xpt2046 touch panel
1582 * author: cmc@rock-chips.com
1583 *****************************************************************************************/
1584 #define XPT2046_GPIO_INT RK29_PIN0_PA3
1585 #define DEBOUNCE_REPTIME 3
1587 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI)
1588 static struct xpt2046_platform_data xpt2046_info = {
1597 .debounce_rep = DEBOUNCE_REPTIME,
1599 .gpio_pendown = XPT2046_GPIO_INT,
1600 .penirq_recheck_delay_usecs = 1,
1602 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
1603 static struct xpt2046_platform_data xpt2046_info = {
1612 .debounce_rep = DEBOUNCE_REPTIME,
1614 .gpio_pendown = XPT2046_GPIO_INT,
1615 .penirq_recheck_delay_usecs = 1,
1617 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
1618 static struct xpt2046_platform_data xpt2046_info = {
1627 .debounce_rep = DEBOUNCE_REPTIME,
1629 .gpio_pendown = XPT2046_GPIO_INT,
1631 .penirq_recheck_delay_usecs = 1,
1633 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
1634 static struct xpt2046_platform_data xpt2046_info = {
1643 .debounce_rep = DEBOUNCE_REPTIME,
1645 .gpio_pendown = XPT2046_GPIO_INT,
1647 .penirq_recheck_delay_usecs = 1,
1651 static struct spi_board_info board_spi_devices[] = {
1652 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\
1653 ||defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
1655 .modalias = "xpt2046_ts",
1657 .max_speed_hz = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
1659 .irq = XPT2046_GPIO_INT,
1660 .platform_data = &xpt2046_info,
1666 static void __init rk29_gic_init_irq(void)
1668 gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
1669 gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
1672 static void __init machine_rk29_init_irq(void)
1674 rk29_gic_init_irq();
1678 static void __init machine_rk29_board_init(void)
1680 rk29_board_iomux_init();
1684 platform_add_devices(devices, ARRAY_SIZE(devices));
1685 #ifdef CONFIG_I2C0_RK29
1686 i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
1687 ARRAY_SIZE(board_i2c0_devices));
1689 #ifdef CONFIG_I2C1_RK29
1690 i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
1691 ARRAY_SIZE(board_i2c1_devices));
1693 #ifdef CONFIG_I2C2_RK29
1694 i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
1695 ARRAY_SIZE(board_i2c2_devices));
1697 #ifdef CONFIG_I2C3_RK29
1698 i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
1699 ARRAY_SIZE(board_i2c3_devices));
1702 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1704 #ifdef CONFIG_WIFI_CONTROL_FUNC
1705 rk29sdk_wifi_bt_gpio_control_init();
1706 rk29sdk_init_wifi_mem();
1709 board_usb_detect_init(RK29_PIN0_PA0);
1712 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
1713 char **cmdline, struct meminfo *mi)
1716 mi->bank[0].start = RK29_SDRAM_PHYS;
1717 mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
1718 mi->bank[0].size = LINUX_SIZE;
1721 static void __init machine_rk29_mapio(void)
1723 rk29_map_common_io();
1724 rk29_setup_early_printk();
1726 rk29_clock_init(periph_pll_288mhz);
1728 ddr_init(DDR_TYPE, DDR_FREQ);
1731 MACHINE_START(RK29, "RK29board")
1732 /* UART for LL DEBUG */
1733 .phys_io = RK29_UART1_PHYS,
1734 .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
1735 .boot_params = RK29_SDRAM_PHYS + 0x88000,
1736 .fixup = machine_rk29_fixup,
1737 .map_io = machine_rk29_mapio,
1738 .init_irq = machine_rk29_init_irq,
1739 .init_machine = machine_rk29_board_init,
1740 .timer = &rk29_timer,