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>
47 #include <mach/cpufreq.h>
48 #include <mach/rk29_smc.h>
50 #include <linux/regulator/rk29-pwm-regulator.h>
51 #include <linux/regulator/machine.h>
53 #include <linux/mtd/nand.h>
54 #include <linux/mtd/partitions.h>
55 #include <linux/i2c-gpio.h>
58 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
60 #ifdef CONFIG_BU92747GUW_CIR
61 #include "../../../drivers/cir/bu92747guw_cir.h"
64 #ifdef CONFIG_VIDEO_RK29
65 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
66 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
67 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV2655 /* back camera sensor */
68 #define CONFIG_SENSOR_IIC_ADDR_0 0//0x60
69 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
70 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
71 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
72 #define CONFIG_SENSOR_POWERDN_PIN_0 INVALID_GPIO
73 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
74 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
75 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
76 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
77 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
79 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV3640 /* front camera sensor */
80 #define CONFIG_SENSOR_IIC_ADDR_1 0x78
81 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
82 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
83 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
84 #define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
85 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
86 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
87 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
88 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
89 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
90 #endif //#ifdef CONFIG_VIDEO_RK29
91 /*---------------- Camera Sensor Configuration Macro End------------------------*/
92 #include "../../../drivers/media/video/rk29_camera.c"
93 /*---------------- Camera Sensor Macro Define End ------------------------*/
95 /* Set memory size of pmem */
96 #ifdef CONFIG_RK29_MEM_SIZE_M
97 #define SDRAM_SIZE (CONFIG_RK29_MEM_SIZE_M * SZ_1M)
99 #define SDRAM_SIZE SZ_512M
101 #define PMEM_GPU_SIZE SZ_64M
102 #define PMEM_UI_SIZE SZ_32M
103 #define PMEM_VPU_SIZE SZ_64M
104 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
105 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
106 #define MEM_CAMIPP_SIZE SZ_4M
108 #define MEM_CAMIPP_SIZE 0
110 #define MEM_FB_SIZE (3*SZ_2M)
111 #ifdef CONFIG_FB_WORK_IPP
112 #define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4
114 #define MEM_FBIPP_SIZE 0
116 #if SDRAM_SIZE > SZ_512M
117 #define PMEM_GPU_BASE (RK29_SDRAM_PHYS + SZ_512M - PMEM_GPU_SIZE)
119 #define PMEM_GPU_BASE (RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
121 #define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
122 #define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
123 #define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
124 #define MEM_CAMIPP_BASE (PMEM_CAM_BASE - MEM_CAMIPP_SIZE)
125 #define MEM_FB_BASE (MEM_CAMIPP_BASE - MEM_FB_SIZE)
126 #define MEM_FBIPP_BASE (MEM_FB_BASE - MEM_FBIPP_SIZE)
127 #define LINUX_SIZE (MEM_FBIPP_BASE - RK29_SDRAM_PHYS)
129 #define PREALLOC_WLAN_SEC_NUM 4
130 #define PREALLOC_WLAN_BUF_NUM 160
131 #define PREALLOC_WLAN_SECTION_HEADER 24
133 #define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
134 #define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
135 #define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
136 #define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
138 #define WLAN_SKB_BUF_NUM 16
140 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
142 struct wifi_mem_prealloc {
147 extern struct sys_timer rk29_timer;
149 static int rk29_nand_io_init(void)
154 struct rk29_nand_platform_data rk29_nand_data = {
155 .width = 1, /* data bus width in bytes */
156 .hw_ecc = 1, /* hw ecc 0: soft ecc */
158 .io_init = rk29_nand_io_init,
161 #define TOUCH_SCREEN_STANDBY_PIN RK29_PIN6_PD1
162 #define TOUCH_SCREEN_STANDBY_VALUE GPIO_HIGH
163 #define TOUCH_SCREEN_DISPLAY_PIN INVALID_GPIO
164 #define TOUCH_SCREEN_DISPLAY_VALUE GPIO_HIGH
165 #ifdef CONFIG_FB_RK29
166 /*****************************************************************************************
168 * author: zyw@rock-chips.com
169 *****************************************************************************************/
170 //#ifdef CONFIG_LCD_TD043MGEA1
171 #define LCD_TXD_PIN INVALID_GPIO
172 #define LCD_CLK_PIN INVALID_GPIO
173 #define LCD_CS_PIN INVALID_GPIO
174 /*****************************************************************************************
175 * frame buffe devices
176 * author: zyw@rock-chips.com
177 *****************************************************************************************/
179 #define FB_DISPLAY_ON_PIN RK29_PIN6_PD1
180 #define FB_LCD_STANDBY_PIN RK29_PIN1_PD6
181 #define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
182 #define FB_MCU_FMK_PIN INVALID_GPIO
184 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
185 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
186 //#define FB_LCD_STANDBY_VALUE GPIO_LOW
189 #define NEWTON_LCD_DISP RK29_PIN1_PD6
190 #define NEWTON_LCD_EN RK29_PIN6_PD1
191 static int rk29_lcd_io_init(void)
197 static int rk29_lcd_io_deinit(void)
203 static struct rk29lcd_info rk29_lcd_info = {
204 .txd_pin = LCD_TXD_PIN,
205 .clk_pin = LCD_CLK_PIN,
206 .cs_pin = LCD_CS_PIN,
207 .io_init = rk29_lcd_io_init,
208 .io_deinit = rk29_lcd_io_deinit,
211 int rk29_fb_io_enable(void)
213 gpio_direction_output(NEWTON_LCD_DISP, 0);
214 gpio_set_value(NEWTON_LCD_DISP,GPIO_HIGH);
215 gpio_direction_output(NEWTON_LCD_EN, 0);
216 gpio_set_value(NEWTON_LCD_EN,GPIO_LOW);
220 int rk29_fb_io_disable(void)
222 gpio_direction_output(NEWTON_LCD_DISP, 0);
223 gpio_set_value(NEWTON_LCD_DISP,GPIO_LOW);
224 gpio_direction_output(NEWTON_LCD_EN, 0);
225 gpio_set_value(NEWTON_LCD_EN,GPIO_HIGH);
229 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
231 if(gpio_request(NEWTON_LCD_DISP,NULL) != 0){
232 gpio_free(NEWTON_LCD_DISP);
233 printk("NEWTON_LCD_DISP gpio_request error\n");
236 if(gpio_request(NEWTON_LCD_EN,NULL) != 0){
237 gpio_free(NEWTON_LCD_EN);
238 printk("NEWTON_LCD_EN gpio_request error\n");
241 rk29_fb_io_enable(); //enable it
246 static struct rk29fb_info rk29_fb_info = {
248 .mcu_fmk_pin = FB_MCU_FMK_PIN,
249 .lcd_info = &rk29_lcd_info,
250 .io_init = rk29_fb_io_init,
251 .io_enable = rk29_fb_io_enable,
252 .io_disable = rk29_fb_io_disable,
255 /* rk29 fb resource */
256 static struct resource rk29_fb_resource[] = {
259 .start = RK29_LCDC_PHYS,
260 .end = RK29_LCDC_PHYS + RK29_LCDC_SIZE - 1,
261 .flags = IORESOURCE_MEM,
267 .flags = IORESOURCE_IRQ,
271 .start = MEM_FB_BASE,
272 .end = MEM_FB_BASE + MEM_FB_SIZE - 1,
273 .flags = IORESOURCE_MEM,
275 #ifdef CONFIG_FB_WORK_IPP
277 .name = "win1 ipp buf",
278 .start = MEM_FBIPP_BASE,
279 .end = MEM_FBIPP_BASE + MEM_FBIPP_SIZE - 1,
280 .flags = IORESOURCE_MEM,
286 struct platform_device rk29_device_fb = {
289 .num_resources = ARRAY_SIZE(rk29_fb_resource),
290 .resource = rk29_fb_resource,
292 .platform_data = &rk29_fb_info,
296 struct platform_device rk29_device_dma_cpy = {
297 .name = "dma_memcpy",
304 #if defined(CONFIG_RK_IRDA) || defined(CONFIG_BU92747GUW_CIR)
305 #define BU92747GUW_RESET_PIN RK29_PIN3_PD4// INVALID_GPIO //
306 #define BU92747GUW_RESET_MUX_NAME GPIO3D4_HOSTWRN_NAME//NULL //
307 #define BU92747GUW_RESET_MUX_MODE GPIO3H_GPIO3D4//NULL //
309 #define BU92747GUW_PWDN_PIN RK29_PIN3_PD3//RK29_PIN5_PA7 //
310 #define BU92747GUW_PWDN_MUX_NAME GPIO3D3_HOSTRDN_NAME//GPIO5A7_HSADCDATA2_NAME //
311 #define BU92747GUW_PWDN_MUX_MODE GPIO3H_GPIO3D3//GPIO5L_GPIO5A7 //
313 static int bu92747guw_io_init(void)
318 if(BU92747GUW_RESET_MUX_NAME != NULL)
320 rk29_mux_api_set(BU92747GUW_RESET_MUX_NAME, BU92747GUW_RESET_MUX_MODE);
322 ret = gpio_request(BU92747GUW_RESET_PIN, NULL);
325 gpio_free(BU92747GUW_RESET_PIN);
326 printk(">>>>>> BU92747GUW_RESET_PIN gpio_request err \n ");
328 gpio_direction_output(BU92747GUW_RESET_PIN, GPIO_HIGH);
331 if(BU92747GUW_PWDN_MUX_NAME != NULL)
333 rk29_mux_api_set(BU92747GUW_PWDN_MUX_NAME, BU92747GUW_PWDN_MUX_MODE);
335 ret = gpio_request(BU92747GUW_PWDN_PIN, NULL);
338 gpio_free(BU92747GUW_PWDN_PIN);
339 printk(">>>>>> BU92747GUW_PWDN_PIN gpio_request err \n ");
342 //power down as default
343 gpio_direction_output(BU92747GUW_PWDN_PIN, GPIO_LOW);
349 static int bu92747guw_io_deinit(void)
351 gpio_free(BU92747GUW_PWDN_PIN);
352 gpio_free(BU92747GUW_RESET_PIN);
356 //power ctl func is share with irda and remote
357 static int nPowerOnCount = 0;
358 static DEFINE_MUTEX(bu92747_power_mutex);
360 //1---power on; 0---power off
361 static int bu92747guw_power_ctl(int enable)
363 printk("%s \n",__FUNCTION__);
365 mutex_lock(&bu92747_power_mutex);
368 if (nPowerOnCount == 1) {//power on first
370 gpio_set_value(BU92747GUW_PWDN_PIN, GPIO_HIGH);
371 gpio_set_value(BU92747GUW_RESET_PIN, GPIO_LOW);
373 gpio_set_value(BU92747GUW_RESET_PIN, GPIO_HIGH);
379 if (nPowerOnCount <= 0) {//power down final
382 gpio_set_value(BU92747GUW_PWDN_PIN, GPIO_LOW);
385 mutex_unlock(&bu92747_power_mutex);
390 #ifdef CONFIG_RK_IRDA
391 #define IRDA_IRQ_PIN RK29_PIN5_PB2
392 #define IRDA_IRQ_MUX_NAME GPIO5B2_HSADCDATA5_NAME
393 #define IRDA_IRQ_MUX_MODE GPIO5L_GPIO5B2
395 int irda_iomux_init(void)
400 if(IRDA_IRQ_MUX_NAME != NULL)
402 rk29_mux_api_set(IRDA_IRQ_MUX_NAME, IRDA_IRQ_MUX_MODE);
404 ret = gpio_request(IRDA_IRQ_PIN, NULL);
407 gpio_free(IRDA_IRQ_PIN);
408 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
410 gpio_pull_updown(IRDA_IRQ_PIN, GPIO_HIGH);
411 gpio_direction_input(IRDA_IRQ_PIN);
416 int irda_iomux_deinit(void)
418 gpio_free(IRDA_IRQ_PIN);
422 static struct irda_info rk29_irda_info = {
423 .intr_pin = IRDA_IRQ_PIN,
424 .iomux_init = irda_iomux_init,
425 .iomux_deinit = irda_iomux_deinit,
426 .irda_pwr_ctl = bu92747guw_power_ctl,
429 static struct platform_device irda_device = {
430 #ifdef CONFIG_RK_IRDA_NET
433 .name = "bu92747_irda",
437 .platform_data = &rk29_irda_info,
442 #ifdef CONFIG_BU92747GUW_CIR
443 #define BU92747_CIR_IRQ_PIN RK29_PIN5_PB0
444 #define CIR_IRQ_PIN_IOMUX_NAME GPIO5B0_HSADCDATA3_NAME
445 #define CIR_IRQ_PIN_IOMUX_VALUE GPIO5L_GPIO5B0
446 static int cir_iomux_init(void)
448 if (CIR_IRQ_PIN_IOMUX_NAME)
449 rk29_mux_api_set(CIR_IRQ_PIN_IOMUX_NAME, CIR_IRQ_PIN_IOMUX_VALUE);
450 rk29_mux_api_set(GPIO5A7_HSADCDATA2_NAME, GPIO5L_GPIO5A7);
454 static struct bu92747guw_platform_data bu92747guw_pdata = {
455 .intr_pin = BU92747_CIR_IRQ_PIN,
456 .iomux_init = cir_iomux_init,
457 .iomux_deinit = NULL,
458 .cir_pwr_ctl = bu92747guw_power_ctl,
461 #ifdef CONFIG_RK29_NEWTON
462 struct rk29_newton_data rk29_newton_info = {
464 struct platform_device rk29_device_newton = {
465 .name = "rk29_newton",
468 .platform_data = &rk29_newton_info,
472 #if defined (CONFIG_TOUCHSCREEN_FT5406)
473 #define TOUCH_RESET_PIN RK29_PIN6_PC3
474 #define TOUCH_INT_PIN RK29_PIN0_PA2
475 int ft5406_init_platform_hw(void)
477 printk("ft5406_init_platform_hw\n");
478 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
479 gpio_free(TOUCH_RESET_PIN);
480 printk("ft5406_init_platform_hw gpio_request error\n");
484 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
485 gpio_free(TOUCH_INT_PIN);
486 printk("ift5406_init_platform_hw gpio_request error\n");
490 gpio_direction_output(TOUCH_RESET_PIN, 0);
491 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
493 gpio_direction_input(TOUCH_INT_PIN);
495 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
500 void ft5406_exit_platform_hw(void)
502 printk("ft5406_exit_platform_hw\n");
503 gpio_free(TOUCH_RESET_PIN);
504 gpio_free(TOUCH_INT_PIN);
507 int ft5406_platform_sleep(void)
509 printk("ft5406_platform_sleep\n");
510 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
514 int ft5406_platform_wakeup(void)
516 printk("ft5406_platform_wakeup\n");
517 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
522 struct ft5406_platform_data ft5406_info = {
524 .init_platform_hw= ft5406_init_platform_hw,
525 .exit_platform_hw= ft5406_exit_platform_hw,
526 .platform_sleep = ft5406_platform_sleep,
527 .platform_wakeup = ft5406_platform_wakeup,
532 #if defined(CONFIG_TOUCHSCREEN_GT819)
533 #define TOUCH_RESET_PIN RK29_PIN6_PC3
534 #define TOUCH_INT_PIN RK29_PIN0_PA2
535 int gt819_init_platform_hw(void)
537 printk("gt819_init_platform_hw\n");
538 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
539 gpio_free(TOUCH_RESET_PIN);
540 printk("gt819_init_platform_hw gpio_request error\n");
544 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
545 gpio_free(TOUCH_INT_PIN);
546 printk("gt819_init_platform_hw gpio_request error\n");
549 gpio_direction_output(TOUCH_RESET_PIN, 0);
550 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
552 // gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
554 // gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
555 gpio_direction_input(TOUCH_INT_PIN);
557 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
563 void gt819_exit_platform_hw(void)
565 printk("gt819_exit_platform_hw\n");
566 gpio_free(TOUCH_RESET_PIN);
567 gpio_free(TOUCH_INT_PIN);
570 int gt819_platform_sleep(void)
572 printk("gt819_platform_sleep\n");
573 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
577 int gt819_platform_wakeup(void)
579 printk("gt819_platform_wakeup\n");
580 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
582 //gpio_set_value(TOUCH_INT_PIN, GPIO_LOW);
584 //gpio_set_value(TOUCH_INT_PIN, GPIO_HIGH);
587 struct goodix_platform_data goodix_info = {
589 .init_platform_hw= gt819_init_platform_hw,
590 .exit_platform_hw= gt819_exit_platform_hw,
591 .platform_sleep = gt819_platform_sleep,
592 .platform_wakeup = gt819_platform_wakeup,
598 #if defined (CONFIG_SND_SOC_CS42L52)
600 int cs42l52_init_platform_hw()
602 printk("cs42l52_init_platform_hw\n");
603 if(gpio_request(RK29_PIN6_PB6,NULL) != 0){
604 gpio_free(RK29_PIN6_PB6);
605 printk("cs42l52_init_platform_hw gpio_request error\n");
608 gpio_direction_output(RK29_PIN6_PB6, 0);
609 gpio_set_value(RK29_PIN6_PB6,GPIO_HIGH);
612 struct cs42l52_platform_data cs42l52_info = {
614 .init_platform_hw= cs42l52_init_platform_hw,
618 #if defined (CONFIG_BATTERY_BQ27541)
619 #define DC_CHECK_PIN RK29_PIN4_PA1
620 #define LI_LION_BAT_NUM 1
621 #define CHG_OK RK29_PIN4_PA3
622 #define BAT_LOW RK29_PIN4_PA2
624 static int bq27541_init_dc_check_pin(void){
625 if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){
626 gpio_free(DC_CHECK_PIN);
627 printk("bq27541 init dc check pin request error\n");
630 gpio_direction_input(DC_CHECK_PIN);
634 struct bq27541_platform_data bq27541_info = {
635 .init_dc_check_pin = bq27541_init_dc_check_pin,
636 .dc_check_pin = DC_CHECK_PIN,
637 .bat_num = LI_LION_BAT_NUM,
638 .chgok_check_pin = CHG_OK,
639 .bat_check_pin = BAT_LOW,
642 static struct android_pmem_platform_data android_pmem_pdata = {
644 .start = PMEM_UI_BASE,
645 .size = PMEM_UI_SIZE,
650 static struct platform_device android_pmem_device = {
651 .name = "android_pmem",
654 .platform_data = &android_pmem_pdata,
659 static struct vpu_mem_platform_data vpu_mem_pdata = {
661 .start = PMEM_VPU_BASE,
662 .size = PMEM_VPU_SIZE,
666 static struct platform_device rk29_vpu_mem_device = {
670 .platform_data = &vpu_mem_pdata,
673 #ifdef CONFIG_VIDEO_RK29XX_VOUT
674 static struct platform_device rk29_v4l2_output_devce = {
678 /*HANNSTAR_P1003 touch*/
679 #if defined (CONFIG_HANNSTAR_P1003)
680 #define TOUCH_RESET_PIN RK29_PIN6_PC3
681 #define TOUCH_INT_PIN RK29_PIN0_PA2
683 int p1003_init_platform_hw(void)
685 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
686 gpio_free(TOUCH_RESET_PIN);
687 printk("p1003_init_platform_hw gpio_request error\n");
691 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
692 gpio_free(TOUCH_INT_PIN);
693 printk("p1003_init_platform_hw gpio_request error\n");
696 gpio_pull_updown(TOUCH_INT_PIN, 1);
697 gpio_direction_output(TOUCH_RESET_PIN, 0);
699 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
701 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
707 struct p1003_platform_data p1003_info = {
709 .init_platform_hw= p1003_init_platform_hw,
713 #if defined (CONFIG_EETI_EGALAX)
714 #define TOUCH_RESET_PIN RK29_PIN6_PC3
715 #define TOUCH_INT_PIN RK29_PIN0_PA2
717 static int EETI_EGALAX_init_platform_hw(void)
719 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
720 gpio_free(TOUCH_RESET_PIN);
721 printk("p1003_init_platform_hw gpio_request error\n");
725 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
726 gpio_free(TOUCH_INT_PIN);
727 printk("p1003_init_platform_hw gpio_request error\n");
730 gpio_pull_updown(TOUCH_INT_PIN, 1);
731 gpio_direction_output(TOUCH_RESET_PIN, 0);
733 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
735 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
741 static struct eeti_egalax_platform_data eeti_egalax_info = {
743 .init_platform_hw= EETI_EGALAX_init_platform_hw,
744 .standby_pin = TOUCH_SCREEN_STANDBY_PIN,
745 .standby_value = TOUCH_SCREEN_STANDBY_VALUE,
746 .disp_on_pin = TOUCH_SCREEN_DISPLAY_PIN,
747 .disp_on_value = TOUCH_SCREEN_DISPLAY_VALUE,
751 #if defined (CONFIG_GS_MMA8452)
752 #define MMA8452_INT_PIN RK29_PIN0_PA3
754 static int mma8452_init_platform_hw(void)
757 if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
758 gpio_free(MMA8452_INT_PIN);
759 printk("mma8452_init_platform_hw gpio_request error\n");
762 gpio_pull_updown(MMA8452_INT_PIN, 1);
767 static struct mma8452_platform_data mma8452_info = {
770 .init_platform_hw= mma8452_init_platform_hw,
774 #if defined (CONFIG_MPU_SENSORS_MPU3050)
776 static struct mpu3050_platform_data mpu3050_data = {
778 //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
779 //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
780 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
781 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
783 #if defined (CONFIG_MPU_SENSORS_KXTF9)
785 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
786 .get_slave_descr = NULL ,
788 .get_slave_descr = get_accel_slave_descr ,
790 .adapt_num = 0, // The i2c bus to which the mpu device is
792 //.irq = RK29_PIN0_PA3,
793 .bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU
795 //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
796 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
797 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
798 .orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
801 #if defined (CONFIG_MPU_SENSORS_AK8975)
803 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
804 .get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
806 .get_slave_descr = get_compass_slave_descr,
808 .adapt_num = 0, // The i2c bus to which the compass device is.
809 // It can be difference with mpu
811 //.irq = RK29_PIN0_PA4,
812 .bus = EXT_SLAVE_BUS_PRIMARY,
814 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
815 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
816 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
817 //.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
818 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
823 #if defined (CONFIG_BATTERY_BQ27510)
824 #define DC_CHECK_PIN RK29_PIN4_PA1
825 #define LI_LION_BAT_NUM 2
826 static int bq27510_init_dc_check_pin(void){
827 if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){
828 gpio_free(DC_CHECK_PIN);
829 printk("bq27510 init dc check pin request error\n");
832 gpio_direction_input(DC_CHECK_PIN);
836 struct bq27510_platform_data bq27510_info = {
837 .init_dc_check_pin = bq27510_init_dc_check_pin,
838 .dc_check_pin = DC_CHECK_PIN,
839 .bat_num = LI_LION_BAT_NUM,
844 /*****************************************************************************************
846 * author: kfx@rock-chips.com
847 *****************************************************************************************/
848 static int rk29_i2c0_io_init(void)
850 #ifdef CONFIG_RK29_I2C0_CONTROLLER
851 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
852 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
854 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
855 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
860 static int rk29_i2c1_io_init(void)
862 #ifdef CONFIG_RK29_I2C1_CONTROLLER
863 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
864 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
866 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
867 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
871 static int rk29_i2c2_io_init(void)
873 #ifdef CONFIG_RK29_I2C2_CONTROLLER
874 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
875 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
877 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
878 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
883 static int rk29_i2c3_io_init(void)
885 #ifdef CONFIG_RK29_I2C3_CONTROLLER
886 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
887 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
889 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
890 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
894 #ifdef CONFIG_RK29_I2C0_CONTROLLER
895 struct rk29_i2c_platform_data default_i2c0_data = {
899 .scl_rate = 400*1000,
900 .mode = I2C_MODE_IRQ,
901 .io_init = rk29_i2c0_io_init,
904 struct i2c_gpio_platform_data default_i2c0_data = {
905 .sda_pin = RK29_PIN2_PB6,
906 .scl_pin = RK29_PIN2_PB7,
907 .udelay = 5, // clk = 500/udelay = 100Khz
908 .timeout = 100,//msecs_to_jiffies(200),
910 .io_init = rk29_i2c0_io_init,
913 #ifdef CONFIG_RK29_I2C1_CONTROLLER
914 struct rk29_i2c_platform_data default_i2c1_data = {
918 .scl_rate = 400*1000,
919 .mode = I2C_MODE_IRQ,
920 .io_init = rk29_i2c1_io_init,
923 struct i2c_gpio_platform_data default_i2c1_data = {
924 .sda_pin = RK29_PIN1_PA6,
925 .scl_pin = RK29_PIN1_PA7,
926 .udelay = 5, // clk = 500/udelay = 100Khz
927 .timeout = 100,//msecs_to_jiffies(200),
929 .io_init = rk29_i2c1_io_init,
932 #ifdef CONFIG_RK29_I2C2_CONTROLLER
933 struct rk29_i2c_platform_data default_i2c2_data = {
937 .scl_rate = 400*1000,
938 .mode = I2C_MODE_IRQ,
939 .io_init = rk29_i2c2_io_init,
942 struct i2c_gpio_platform_data default_i2c2_data = {
943 .sda_pin = RK29_PIN5_PD3,
944 .scl_pin = RK29_PIN5_PD4,
945 .udelay = 5, // clk = 500/udelay = 100Khz
946 .timeout = 100,//msecs_to_jiffies(200),
948 .io_init = rk29_i2c2_io_init,
951 #ifdef CONFIG_RK29_I2C3_CONTROLLER
952 struct rk29_i2c_platform_data default_i2c3_data = {
956 .scl_rate = 400*1000,
957 .mode = I2C_MODE_IRQ,
958 .io_init = rk29_i2c3_io_init,
961 struct i2c_gpio_platform_data default_i2c3_data = {
962 .sda_pin = RK29_PIN5_PB5,
963 .scl_pin = RK29_PIN5_PB4,
964 .udelay = 5, // clk = 500/udelay = 100Khz
965 .timeout = 100,//msecs_to_jiffies(200),
967 .io_init = rk29_i2c3_io_init,
970 #ifdef CONFIG_I2C0_RK29
971 static struct i2c_board_info __initdata board_i2c0_devices[] = {
972 #if defined (CONFIG_RK1000_CONTROL)
974 .type = "rk1000_control",
979 #if defined (CONFIG_SND_SOC_alc5621)
986 #if defined (CONFIG_SND_SOC_alc5631)
993 #if defined (CONFIG_SND_SOC_RK1000)
995 .type = "rk1000_i2c_codec",
1000 #if defined (CONFIG_SND_SOC_WM8900)
1007 #if defined (CONFIG_BATTERY_STC3100)
1014 #if defined (CONFIG_BATTERY_BQ27510)
1019 .platform_data = &bq27510_info,
1022 #if defined (CONFIG_RTC_HYM8563)
1024 .type = "rtc_hym8563",
1027 .irq = RK29_PIN0_PA1,
1030 #if defined (CONFIG_GS_MMA8452)
1032 .type = "gs_mma8452",
1035 .irq = MMA8452_INT_PIN,
1036 .platform_data = &mma8452_info,
1039 #if defined (CONFIG_COMPASS_AK8973)
1044 .irq = RK29_PIN0_PA4,
1047 #if defined (CONFIG_COMPASS_AK8975)
1052 .irq = RK29_PIN0_PA4,
1056 #if defined (CONFIG_MPU_SENSORS_MPU3050)
1061 .irq = RK29_PIN5_PA3,
1062 .platform_data = &mpu3050_data,
1066 #if defined (CONFIG_SND_SOC_CS42L52)
1071 .platform_data = &cs42l52_info,
1074 #if defined (CONFIG_RTC_M41T66)
1076 .type = "rtc-M41T66",
1079 .irq = RK29_PIN0_PA1,
1085 #ifdef CONFIG_I2C1_RK29
1086 static struct i2c_board_info __initdata board_i2c1_devices[] = {
1087 #if defined (CONFIG_RK1000_CONTROL1)
1089 .type = "rk1000_control",
1094 #if defined (CONFIG_ANX7150) || defined (CONFIG_ANX7150_NEW)
1097 .addr = 0x39, //0x39, 0x3d
1099 .irq = RK29_PIN1_PD7,
1102 #ifdef CONFIG_BU92747GUW_CIR
1104 .type ="bu92747_cir",
1107 .irq = BU92747_CIR_IRQ_PIN,
1108 .platform_data = &bu92747guw_pdata,
1115 #ifdef CONFIG_I2C2_RK29
1116 static struct i2c_board_info __initdata board_i2c2_devices[] = {
1117 #if defined (CONFIG_HANNSTAR_P1003)
1119 .type = "p1003_touch",
1121 .flags = 0, //I2C_M_NEED_DELAY
1122 .irq = RK29_PIN0_PA2,
1123 .platform_data = &p1003_info,
1127 #if defined (CONFIG_EETI_EGALAX)
1129 .type = "egalax_i2c",
1132 .irq = RK29_PIN0_PA2,
1133 .platform_data = &eeti_egalax_info,
1136 #if defined (CONFIG_TOUCHSCREEN_GT819)
1138 .type = "Goodix-TS",
1141 .irq =RK29_PIN0_PA2,
1142 .platform_data = &goodix_info,
1145 #if defined (CONFIG_TOUCHSCREEN_FT5406)
1148 .addr = 0x38, //0x70,
1150 .irq =RK29_PIN0_PA2, // support goodix tp detect, 20110706
1151 .platform_data = &ft5406_info,
1157 #ifdef CONFIG_I2C3_RK29
1158 static struct i2c_board_info __initdata board_i2c3_devices[] = {
1159 #if defined (CONFIG_BATTERY_BQ27541)
1164 .platform_data = &bq27541_info,
1170 /*****************************************************************************************
1172 * author: ddl@rock-chips.com
1173 *****************************************************************************************/
1174 #ifdef CONFIG_VIDEO_RK29
1175 #define CONFIG_SENSOR_POWER_IOCTL_USR 0
1176 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
1177 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
1178 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
1180 #if CONFIG_SENSOR_POWER_IOCTL_USR
1181 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
1183 #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
1187 #if CONFIG_SENSOR_RESET_IOCTL_USR
1188 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
1190 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
1194 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1195 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
1197 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
1201 #if CONFIG_SENSOR_FLASH_IOCTL_USR
1202 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
1204 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
1208 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
1209 #if CONFIG_SENSOR_POWER_IOCTL_USR
1210 .sensor_power_cb = sensor_power_usr_cb,
1212 .sensor_power_cb = NULL,
1215 #if CONFIG_SENSOR_RESET_IOCTL_USR
1216 .sensor_reset_cb = sensor_reset_usr_cb,
1218 .sensor_reset_cb = NULL,
1221 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1222 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
1224 .sensor_powerdown_cb = NULL,
1227 #if CONFIG_SENSOR_FLASH_IOCTL_USR
1228 .sensor_flash_cb = sensor_flash_usr_cb,
1230 .sensor_flash_cb = NULL,
1233 #include "../../../drivers/media/video/rk29_camera.c"
1235 /*****************************************************************************************
1237 * author: nzy@rock-chips.com
1238 *****************************************************************************************/
1239 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1241 GPIO1B5_PWM0_NAME, GPIO1L_PWM0
1242 GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_PWM1
1243 GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME, GPIO2L_PWM2
1244 GPIO1A5_EMMCPWREN_PWM3_NAME, GPIO1L_PWM3
1248 #define PWM_MUX_NAME GPIO1B5_PWM0_NAME
1249 #define PWM_MUX_MODE GPIO1L_PWM0
1250 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
1251 #define PWM_GPIO RK29_PIN1_PB5
1252 #define PWM_EFFECT_VALUE 0
1253 #define BACKLIGHT_MINVALUE 52
1254 #define LCD_DISP_ON_PIN
1256 #ifdef LCD_DISP_ON_PIN
1257 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
1258 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
1260 #define BL_EN_PIN RK29_PIN6_PD0
1261 #define BL_EN_VALUE GPIO_HIGH
1263 static int rk29_backlight_io_init(void)
1267 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1268 #ifdef LCD_DISP_ON_PIN
1269 // rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
1271 ret = gpio_request(BL_EN_PIN, NULL);
1274 gpio_free(BL_EN_PIN);
1277 gpio_direction_output(BL_EN_PIN, 0);
1278 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1283 static int rk29_backlight_io_deinit(void)
1286 #ifdef LCD_DISP_ON_PIN
1287 gpio_free(BL_EN_PIN);
1289 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1294 static int rk29_backlight_pwm_suspend(void)
1297 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1298 if (gpio_request(PWM_GPIO, NULL)) {
1299 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
1302 gpio_direction_output(PWM_GPIO, GPIO_HIGH);
1303 //gpio_direction_output(PWM_GPIO, GPIO_LOW);
1304 #ifdef LCD_DISP_ON_PIN
1305 gpio_direction_output(BL_EN_PIN, 0);
1306 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1311 static int rk29_backlight_pwm_resume(void)
1313 gpio_free(PWM_GPIO);
1314 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1316 #ifdef LCD_DISP_ON_PIN
1318 gpio_direction_output(BL_EN_PIN, 1);
1319 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
1324 struct rk29_bl_info rk29_bl_info = {
1326 .bl_ref = PWM_EFFECT_VALUE,
1327 .io_init = rk29_backlight_io_init,
1328 .io_deinit = rk29_backlight_io_deinit,
1329 .pwm_suspend = rk29_backlight_pwm_suspend,
1330 .pwm_resume = rk29_backlight_pwm_resume,
1331 .min_brightness = BACKLIGHT_MINVALUE,
1333 struct platform_device rk29_device_backlight = {
1334 .name = "rk29_backlight",
1337 .platform_data = &rk29_bl_info,
1341 /*****************************************************************************************
1342 * pwm voltage regulator devices
1343 ******************************************************************************************/
1344 #if defined (CONFIG_RK29_PWM_REGULATOR)
1346 #define REGULATOR_PWM_ID 2
1347 #define REGULATOR_PWM_MUX_NAME GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
1348 #define REGULATOR_PWM_MUX_MODE GPIO2L_PWM2
1349 #define REGULATOR_PWM_MUX_MODE_GPIO GPIO2L_GPIO2A3
1350 #define REGULATOR_PWM_GPIO RK29_PIN2_PA3
1352 static struct regulator_consumer_supply pwm_consumers[] = {
1358 static struct regulator_init_data rk29_pwm_regulator_data = {
1364 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1366 .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
1367 .consumer_supplies = pwm_consumers,
1370 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
1371 .pwm_id = REGULATOR_PWM_ID,
1372 .pwm_gpio = REGULATOR_PWM_GPIO,
1373 //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
1374 .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
1375 .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
1376 .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
1377 .init_data = &rk29_pwm_regulator_data,
1380 static struct platform_device rk29_device_pwm_regulator = {
1381 .name = "pwm-voltage-regulator",
1384 .platform_data = &rk29_regulator_pwm_platform_data,
1390 /*****************************************************************************************
1392 *****************************************************************************************/
1393 #ifdef CONFIG_SDMMC0_RK29
1394 static int rk29_sdmmc0_cfg_gpio(void)
1396 rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
1397 rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
1398 rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
1399 rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
1400 rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
1401 rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
1403 #ifdef CONFIG_SDMMC_RK29_OLD
1404 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
1406 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);//Modifyed by xbw.
1409 rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
1410 gpio_request(RK29_PIN5_PD5,"sdmmc");
1412 gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
1414 gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
1416 gpio_direction_output(RK29_PIN5_PD5,GPIO_LOW);
1421 #define CONFIG_SDMMC0_USE_DMA
1422 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1423 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
1424 MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
1425 MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
1426 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1427 .io_init = rk29_sdmmc0_cfg_gpio,
1428 .dma_name = "sd_mmc",
1429 #ifdef CONFIG_SDMMC0_USE_DMA
1434 .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO
1435 .enable_sd_wakeup = 0,
1438 #ifdef CONFIG_SDMMC1_RK29
1439 #define CONFIG_SDMMC1_USE_DMA
1440 static int rk29_sdmmc1_cfg_gpio(void)
1442 rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
1443 rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
1444 rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
1445 rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
1446 rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
1447 rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
1448 //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
1452 #ifdef CONFIG_WIFI_CONTROL_FUNC
1453 static int rk29sdk_wifi_status(struct device *dev);
1454 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
1457 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
1459 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1460 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
1461 MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
1462 MMC_VDD_32_33|MMC_VDD_33_34),
1463 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
1464 MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1465 .io_init = rk29_sdmmc1_cfg_gpio,
1467 #ifdef CONFIG_SDMMC1_USE_DMA
1472 #ifdef CONFIG_WIFI_CONTROL_FUNC
1473 .status = rk29sdk_wifi_status,
1474 .register_status_notify = rk29sdk_wifi_status_register,
1477 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1482 #ifdef CONFIG_WIFI_CONTROL_FUNC
1483 #define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
1484 #define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
1485 #define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC4
1487 static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
1488 static void (*wifi_status_cb)(int card_present, void *dev_id);
1489 static void *wifi_status_cb_devid;
1490 int rk29sdk_wifi_power_state = 0;
1491 int rk29sdk_bt_power_state = 0;
1493 static int rk29sdk_wifi_status(struct device *dev)
1495 return rk29sdk_wifi_cd;
1498 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
1502 wifi_status_cb = callback;
1503 wifi_status_cb_devid = dev_id;
1507 static int rk29sdk_wifi_bt_gpio_control_init(void)
1509 if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
1510 pr_info("%s: request wifi_bt power gpio failed\n", __func__);
1514 if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
1515 pr_info("%s: request wifi reset gpio failed\n", __func__);
1516 gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
1520 if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
1521 pr_info("%s: request bt reset gpio failed\n", __func__);
1522 gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
1526 gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1527 gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1528 gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
1530 pr_info("%s: init finished\n",__func__);
1535 static int rk29sdk_wifi_power(int on)
1537 pr_info("%s: %d\n", __func__, on);
1539 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
1540 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
1542 pr_info("wifi turn on power\n");
1544 if (!rk29sdk_bt_power_state){
1545 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1547 pr_info("wifi shut off power\n");
1550 pr_info("wifi shouldn't shut off power, bt is using it!\n");
1552 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1556 rk29sdk_wifi_power_state = on;
1560 static int rk29sdk_wifi_reset_state;
1561 static int rk29sdk_wifi_reset(int on)
1563 pr_info("%s: %d\n", __func__, on);
1564 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
1566 rk29sdk_wifi_reset_state = on;
1570 int rk29sdk_wifi_set_carddetect(int val)
1572 pr_info("%s:%d\n", __func__, val);
1573 rk29sdk_wifi_cd = val;
1574 if (wifi_status_cb){
1575 wifi_status_cb(val, wifi_status_cb_devid);
1577 pr_warning("%s, nobody to notify\n", __func__);
1581 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
1583 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
1584 {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
1585 {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
1586 {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
1587 {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
1590 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
1592 if (section == PREALLOC_WLAN_SEC_NUM)
1593 return wlan_static_skb;
1595 if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
1598 if (wifi_mem_array[section].size < size)
1601 return wifi_mem_array[section].mem_ptr;
1604 int __init rk29sdk_init_wifi_mem(void)
1609 for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
1610 wlan_static_skb[i] = dev_alloc_skb(
1611 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
1613 if (!wlan_static_skb[i])
1617 for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
1618 wifi_mem_array[i].mem_ptr =
1619 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
1621 if (!wifi_mem_array[i].mem_ptr)
1627 pr_err("Failed to mem_alloc for WLAN\n");
1628 for (j = 0 ; j < i ; j++)
1629 kfree(wifi_mem_array[j].mem_ptr);
1631 i = WLAN_SKB_BUF_NUM;
1634 pr_err("Failed to skb_alloc for WLAN\n");
1635 for (j = 0 ; j < i ; j++)
1636 dev_kfree_skb(wlan_static_skb[j]);
1641 static struct wifi_platform_data rk29sdk_wifi_control = {
1642 .set_power = rk29sdk_wifi_power,
1643 .set_reset = rk29sdk_wifi_reset,
1644 .set_carddetect = rk29sdk_wifi_set_carddetect,
1645 .mem_prealloc = rk29sdk_mem_prealloc,
1647 static struct platform_device rk29sdk_wifi_device = {
1648 .name = "bcm4329_wlan",
1651 .platform_data = &rk29sdk_wifi_control,
1657 /* bluetooth rfkill device */
1658 static struct platform_device rk29sdk_rfkill = {
1659 .name = "rk29sdk_rfkill",
1664 #ifdef CONFIG_VIVANTE
1665 #define GPU_HIGH_CLOCK 552
1666 #define GPU_LOW_CLOCK (periph_pll_default / 1000000) /* same as general pll clock rate below */
1667 static struct resource resources_gpu[] = {
1672 .flags = IORESOURCE_IRQ,
1676 .start = RK29_GPU_PHYS,
1677 .end = RK29_GPU_PHYS + RK29_GPU_SIZE - 1,
1678 .flags = IORESOURCE_MEM,
1682 .start = PMEM_GPU_BASE,
1683 .end = PMEM_GPU_BASE + PMEM_GPU_SIZE - 1,
1684 .flags = IORESOURCE_MEM,
1688 .start = GPU_LOW_CLOCK,
1689 .end = GPU_HIGH_CLOCK,
1690 .flags = IORESOURCE_IO,
1693 static struct platform_device rk29_device_gpu = {
1696 .num_resources = ARRAY_SIZE(resources_gpu),
1697 .resource = resources_gpu,
1701 #ifdef CONFIG_KEYS_RK29_NEWTON
1702 extern struct rk29_keys_platform_data rk29_keys_pdata;
1703 static struct platform_device rk29_device_keys = {
1704 .name = "rk29-keypad",
1707 .platform_data = &rk29_keys_pdata,
1712 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1713 struct gpio_led rk29_leds[] = {
1715 .name = "rk29_red_led",
1716 .gpio = RK29_PIN4_PB2,
1717 .default_trigger = "timer",
1719 .retain_state_suspended = 1,
1720 .default_state = LEDS_GPIO_DEFSTATE_OFF,
1723 .name = "rk29_green_led",
1724 .gpio = RK29_PIN4_PB1,
1725 .default_trigger = "timer",
1727 .retain_state_suspended = 1,
1728 .default_state = LEDS_GPIO_DEFSTATE_OFF,
1731 .name = "rk29_blue_led",
1732 .gpio = RK29_PIN4_PB0,
1733 .default_trigger = "timer",
1735 .retain_state_suspended = 1,
1736 .default_state = LEDS_GPIO_DEFSTATE_OFF,
1740 struct gpio_led_platform_data rk29_leds_pdata = {
1742 .num_leds = ARRAY_SIZE(rk29_leds),
1745 struct platform_device rk29_device_gpio_leds = {
1746 .name = "leds-gpio",
1749 .platform_data = &rk29_leds_pdata,
1754 #ifdef CONFIG_LEDS_NEWTON_PWM
1755 static struct led_newton_pwm rk29_pwm_leds[] = {
1757 .name = "power_led",
1759 .pwm_gpio = RK29_PIN5_PD2,
1760 .pwm_iomux_name = GPIO5D2_PWM1_UART1SIRIN_NAME,
1761 .pwm_iomux_pwm = GPIO5H_PWM1,
1762 .pwm_iomux_gpio = GPIO5H_GPIO5D2,
1768 static struct led_newton_pwm_platform_data rk29_pwm_leds_pdata = {
1769 .leds = &rk29_pwm_leds,
1770 .num_leds = ARRAY_SIZE(rk29_pwm_leds),
1773 static struct platform_device rk29_device_pwm_leds = {
1774 .name = "leds_newton_pwm",
1777 .platform_data = &rk29_pwm_leds_pdata,
1782 #ifdef CONFIG_USB_ANDROID
1783 struct usb_mass_storage_platform_data newton_mass_storage_pdata = {
1785 .vendor = "RockChip",
1786 .product = "rk29 sdk",
1791 struct platform_device newton_usb_mass_storage_device = {
1792 .name = "usb_mass_storage",
1795 .platform_data = &newton_mass_storage_pdata,
1799 static struct platform_device rk29_cs42l52_device = {
1800 .name = "rk29_cs42l52",
1804 static void __init rk29_board_iomux_init(void)
1806 #ifdef CONFIG_RK29_PWM_REGULATOR
1807 rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
1809 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1810 rk29_mux_api_set(GPIO4B0_FLASHDATA8_NAME,GPIO4L_GPIO4B0);
1811 rk29_mux_api_set(GPIO4B1_FLASHDATA9_NAME,GPIO4L_GPIO4B1);
1812 rk29_mux_api_set(GPIO4B2_FLASHDATA10_NAME,GPIO4L_GPIO4B2);
1814 #ifdef CONFIG_LEDS_NEWTON_PWM
1815 rk29_mux_api_set(GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_GPIO5D2);
1819 static struct platform_device *devices[] __initdata = {
1821 #ifdef CONFIG_RK29_WATCHDOG
1825 #ifdef CONFIG_UART1_RK29
1828 #ifdef CONFIG_UART0_RK29
1831 #ifdef CONFIG_UART2_RK29
1834 #ifdef CONFIG_UART3_RK29
1838 #ifdef CONFIG_RK29_PWM_REGULATOR
1839 &rk29_device_pwm_regulator,
1841 #ifdef CONFIG_SPIM0_RK29
1842 &rk29xx_device_spi0m,
1844 #ifdef CONFIG_SPIM1_RK29
1845 &rk29xx_device_spi1m,
1847 #ifdef CONFIG_ADC_RK29
1850 #ifdef CONFIG_I2C0_RK29
1853 #ifdef CONFIG_I2C1_RK29
1856 #ifdef CONFIG_I2C2_RK29
1859 #ifdef CONFIG_I2C3_RK29
1863 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
1864 &rk29_device_iis_2ch,
1866 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
1867 &rk29_device_iis_8ch,
1870 #ifdef CONFIG_KEYS_RK29_NEWTON
1873 #ifdef CONFIG_SDMMC0_RK29
1874 &rk29_device_sdmmc0,
1876 #ifdef CONFIG_SDMMC1_RK29
1877 &rk29_device_sdmmc1,
1880 #ifdef CONFIG_MTD_NAND_RK29XX
1881 &rk29xx_device_nand,
1884 #ifdef CONFIG_WIFI_CONTROL_FUNC
1885 &rk29sdk_wifi_device,
1892 #ifdef CONFIG_MTD_NAND_RK29
1896 #ifdef CONFIG_FB_RK29
1898 &rk29_device_dma_cpy,
1900 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1901 &rk29_device_backlight,
1903 #ifdef CONFIG_RK29_VMAC
1906 #ifdef CONFIG_VIVANTE
1909 #ifdef CONFIG_VIDEO_RK29
1910 &rk29_device_camera, /* ddl@rock-chips.com : camera support */
1911 #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
1912 &rk29_soc_camera_pdrv_0,
1914 &rk29_soc_camera_pdrv_1,
1915 &android_pmem_cam_device,
1917 &android_pmem_device,
1918 &rk29_vpu_mem_device,
1919 #ifdef CONFIG_USB20_OTG
1920 &rk29_device_usb20_otg,
1922 #ifdef CONFIG_USB20_HOST
1923 &rk29_device_usb20_host,
1925 #ifdef CONFIG_USB11_HOST
1926 &rk29_device_usb11_host,
1928 #ifdef CONFIG_USB_ANDROID
1929 &android_usb_device,
1930 &newton_usb_mass_storage_device,
1932 #ifdef CONFIG_USB_ANDROID_RNDIS
1935 #ifdef CONFIG_RK29_IPP
1938 #ifdef CONFIG_VIDEO_RK29XX_VOUT
1939 &rk29_v4l2_output_devce,
1941 #ifdef CONFIG_RK29_NEWTON
1942 &rk29_device_newton,
1944 #ifdef CONFIG_RK_IRDA
1947 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1948 &rk29_device_gpio_leds,
1950 #ifdef CONFIG_LEDS_NEWTON_PWM
1951 &rk29_device_pwm_leds,
1953 #ifdef CONFIG_SND_RK29_SOC_CS42L52
1954 &rk29_cs42l52_device,
1958 /*****************************************************************************************
1960 * author: cmc@rock-chips.com
1961 *****************************************************************************************/
1962 static int rk29_vmac_register_set(void)
1964 //config rk29 vmac as rmii, 100MHz
1965 u32 value= readl(RK29_GRF_BASE + 0xbc);
1966 value = (value & 0xfff7ff) | (0x400);
1967 writel(value, RK29_GRF_BASE + 0xbc);
1971 static int rk29_rmii_io_init(void)
1976 err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
1978 gpio_free(RK29_PIN6_PB0);
1979 printk("-------request RK29_PIN6_PB0 fail--------\n");
1983 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1984 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1989 static int rk29_rmii_io_deinit(void)
1992 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1993 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1995 gpio_free(RK29_PIN6_PB0);
1999 static int rk29_rmii_power_control(int enable)
2003 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
2004 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
2007 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2008 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2013 struct rk29_vmac_platform_data rk29_vmac_pdata = {
2014 .vmac_register_set = rk29_vmac_register_set,
2015 .rmii_io_init = rk29_rmii_io_init,
2016 .rmii_io_deinit = rk29_rmii_io_deinit,
2017 .rmii_power_control = rk29_rmii_power_control,
2020 /*****************************************************************************************
2022 * author: cmc@rock-chips.com
2023 *****************************************************************************************/
2024 #define SPI_CHIPSELECT_NUM 2
2025 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
2028 .cs_gpio = RK29_PIN2_PC1,
2029 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
2030 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
2034 .cs_gpio = RK29_PIN1_PA4,
2035 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
2036 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
2040 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
2043 .cs_gpio = RK29_PIN2_PC5,
2044 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
2045 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
2049 .cs_gpio = RK29_PIN1_PA3,
2050 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
2051 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
2055 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
2060 for (i=0; i<cs_num; i++) {
2061 rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
2068 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
2073 static int spi_io_fix_leakage_bug(void)
2076 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
2081 static int spi_io_resume_leakage_bug(void)
2084 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
2089 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
2090 .num_chipselect = SPI_CHIPSELECT_NUM,
2091 .chipselect_gpios = rk29xx_spi0_cs_gpios,
2092 .io_init = spi_io_init,
2093 .io_deinit = spi_io_deinit,
2094 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2095 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2098 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
2099 .num_chipselect = SPI_CHIPSELECT_NUM,
2100 .chipselect_gpios = rk29xx_spi1_cs_gpios,
2101 .io_init = spi_io_init,
2102 .io_deinit = spi_io_deinit,
2103 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2104 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2107 /*****************************************************************************************
2108 * xpt2046 touch panel
2109 * author: cmc@rock-chips.com
2110 *****************************************************************************************/
2111 #define XPT2046_GPIO_INT RK29_PIN0_PA3
2112 #define DEBOUNCE_REPTIME 3
2114 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI)
2115 static struct xpt2046_platform_data xpt2046_info = {
2124 .debounce_rep = DEBOUNCE_REPTIME,
2126 .gpio_pendown = XPT2046_GPIO_INT,
2127 .penirq_recheck_delay_usecs = 1,
2129 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
2130 static struct xpt2046_platform_data xpt2046_info = {
2139 .debounce_rep = DEBOUNCE_REPTIME,
2141 .gpio_pendown = XPT2046_GPIO_INT,
2142 .penirq_recheck_delay_usecs = 1,
2144 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2145 static struct xpt2046_platform_data xpt2046_info = {
2154 .debounce_rep = DEBOUNCE_REPTIME,
2156 .gpio_pendown = XPT2046_GPIO_INT,
2158 .penirq_recheck_delay_usecs = 1,
2160 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2161 static struct xpt2046_platform_data xpt2046_info = {
2170 .debounce_rep = DEBOUNCE_REPTIME,
2172 .gpio_pendown = XPT2046_GPIO_INT,
2174 .penirq_recheck_delay_usecs = 1,
2178 static struct spi_board_info board_spi_devices[] = {
2179 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\
2180 ||defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2182 .modalias = "xpt2046_ts",
2184 .max_speed_hz = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
2186 .irq = XPT2046_GPIO_INT,
2187 .platform_data = &xpt2046_info,
2193 static void __init rk29_gic_init_irq(void)
2195 gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
2196 gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
2199 static void __init machine_rk29_init_irq(void)
2201 rk29_gic_init_irq();
2205 static struct cpufreq_frequency_table freq_table[] = {
2206 { .index = 1200000, .frequency = 408000 },
2207 { .index = 1200000, .frequency = 816000 },
2208 { .index = 1300000, .frequency = 1008000 },
2209 { .frequency = CPUFREQ_TABLE_END },
2213 static void __init machine_rk29_board_init(void)
2215 rk29_board_iomux_init();
2218 board_update_cpufreq_table(freq_table);
2220 platform_add_devices(devices, ARRAY_SIZE(devices));
2221 #ifdef CONFIG_I2C0_RK29
2222 i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
2223 ARRAY_SIZE(board_i2c0_devices));
2225 #ifdef CONFIG_I2C1_RK29
2226 i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
2227 ARRAY_SIZE(board_i2c1_devices));
2229 #ifdef CONFIG_I2C2_RK29
2230 i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
2231 ARRAY_SIZE(board_i2c2_devices));
2233 #ifdef CONFIG_I2C3_RK29
2234 i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
2235 ARRAY_SIZE(board_i2c3_devices));
2238 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2240 #ifdef CONFIG_WIFI_CONTROL_FUNC
2241 rk29sdk_wifi_bt_gpio_control_init();
2242 rk29sdk_init_wifi_mem();
2245 board_usb_detect_init(RK29_PIN0_PA0);
2247 #if defined(CONFIG_RK_IRDA) || defined(CONFIG_BU92747GUW_CIR)
2249 bu92747guw_io_init();
2254 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
2255 char **cmdline, struct meminfo *mi)
2258 mi->bank[0].start = RK29_SDRAM_PHYS;
2259 mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
2260 mi->bank[0].size = LINUX_SIZE;
2261 #if SDRAM_SIZE > SZ_512M
2263 mi->bank[1].start = RK29_SDRAM_PHYS + SZ_512M;
2264 mi->bank[1].size = SDRAM_SIZE - SZ_512M;
2268 static void __init machine_rk29_mapio(void)
2270 rk29_map_common_io();
2271 rk29_setup_early_printk();
2273 rk29_clock_init(periph_pll_default);
2275 ddr_init(DDR_TYPE,DDR_FREQ); // DDR3_1333H, 400
2278 MACHINE_START(RK29, "RK29board")
2279 /* UART for LL DEBUG */
2280 .phys_io = RK29_UART1_PHYS & 0xfff00000,
2281 .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
2282 .boot_params = RK29_SDRAM_PHYS + 0x88000,
2283 .fixup = machine_rk29_fixup,
2284 .map_io = machine_rk29_mapio,
2285 .init_irq = machine_rk29_init_irq,
2286 .init_machine = machine_rk29_board_init,
2287 .timer = &rk29_timer,