1 /* arch/arm/mach-rk29/board-rk29-phonesdk.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>
50 #include <linux/mfd/wm831x/pdata.h>
51 #include <linux/mfd/wm831x/core.h>
52 #include <linux/mfd/wm831x/gpio.h>
53 #include <linux/mfd/wm8994/pdata.h>
54 #include <linux/mfd/wm8994/registers.h>
56 #include <linux/mtd/nand.h>
57 #include <linux/mtd/partitions.h>
58 #include <linux/i2c-gpio.h>
59 #include <linux/mpu.h>
62 #if defined(CONFIG_MTK23D)
63 #include <linux/mtk23d.h>
66 #ifdef CONFIG_USE_GPIO_GENERATE_WAVE
67 #include "../../../drivers/testcode/gpio_wave.h"
70 #include "../../../drivers/headset_observe/rk_headset.h"
71 /*set touchscreen different type header*/
72 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI)
73 #include "../../../drivers/input/touchscreen/xpt2046_ts.h"
74 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
75 #include "../../../drivers/input/touchscreen/xpt2046_tslib_ts.h"
76 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
77 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
79 #include "../../../drivers/misc/gps/rk29_gps.h"
80 #include "../../../drivers/serial/sc8800.h"
81 #ifdef CONFIG_VIDEO_RK29
82 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
83 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
84 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
85 #define CONFIG_SENSOR_IIC_ADDR_0 0x78
86 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
87 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
88 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
89 #define CONFIG_SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
90 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
91 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
92 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
93 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
94 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
96 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor */
97 #define CONFIG_SENSOR_IIC_ADDR_1 0x60
98 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
99 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
100 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
101 #define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
102 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
103 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
104 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
105 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
106 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
107 #endif //#ifdef CONFIG_VIDEO_RK29
108 /*---------------- Camera Sensor Configuration Macro End------------------------*/
109 #include "../../../drivers/media/video/rk29_camera.c"
110 /*---------------- Camera Sensor Macro Define End ------------------------*/
113 /* Set memory size of pmem */
114 #ifdef CONFIG_RK29_MEM_SIZE_M
115 #define SDRAM_SIZE (CONFIG_RK29_MEM_SIZE_M * SZ_1M)
117 #define SDRAM_SIZE SZ_512M
119 #define PMEM_GPU_SIZE SZ_64M
120 #define PMEM_UI_SIZE SZ_32M
121 #define PMEM_VPU_SIZE SZ_64M
122 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
123 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
124 #define MEM_CAMIPP_SIZE SZ_4M
126 #define MEM_CAMIPP_SIZE 0
128 #define MEM_FB_SIZE (3*SZ_2M)
129 #ifdef CONFIG_FB_WORK_IPP
130 #define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4
132 #define MEM_FBIPP_SIZE 0
134 #define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
135 #define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
136 #define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
137 #define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
138 #define MEM_CAMIPP_BASE (PMEM_CAM_BASE - MEM_CAMIPP_SIZE)
139 #define MEM_FB_BASE (MEM_CAMIPP_BASE - MEM_FB_SIZE)
140 #define MEM_FBIPP_BASE (MEM_FB_BASE - MEM_FBIPP_SIZE)
141 #define LINUX_SIZE (MEM_FBIPP_BASE - RK29_SDRAM_PHYS)
143 #define PREALLOC_WLAN_SEC_NUM 4
144 #define PREALLOC_WLAN_BUF_NUM 160
145 #define PREALLOC_WLAN_SECTION_HEADER 24
147 #define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
148 #define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
149 #define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
150 #define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
152 #define WLAN_SKB_BUF_NUM 16
154 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
156 struct wifi_mem_prealloc {
161 extern struct sys_timer rk29_timer;
163 static int rk29_nand_io_init(void)
168 struct rk29_nand_platform_data rk29_nand_data = {
169 .width = 1, /* data bus width in bytes */
170 .hw_ecc = 1, /* hw ecc 0: soft ecc */
172 .io_init = rk29_nand_io_init,
175 #ifdef CONFIG_FB_RK29
176 /*****************************************************************************************
178 * author: zyw@rock-chips.com
179 *****************************************************************************************/
180 //#ifdef CONFIG_LCD_TD043MGEA1
181 #define LCD_RXD_PIN RK29_PIN2_PC7
182 #define LCD_TXD_PIN RK29_PIN2_PC6
183 #define LCD_CLK_PIN RK29_PIN2_PC4
184 #define LCD_CS_PIN RK29_PIN2_PC5
185 /*****************************************************************************************
186 * frame buffer devices
187 * author: zyw@rock-chips.com
188 *****************************************************************************************/
190 #define FB_DISPLAY_ON_PIN INVALID_GPIO//RK29_PIN6_PD0
191 #define FB_LCD_STANDBY_PIN INVALID_GPIO//RK29_PIN6_PD1
192 #define FB_LCD_CABC_EN_PIN INVALID_GPIO//RK29_PIN6_PD2
193 #define FB_MCU_FMK_PIN INVALID_GPIO
195 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
196 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
199 static int rk29_lcd_io_init(void)
202 //printk("rk29_lcd_io_init\n");
203 //ret = gpio_request(LCD_RXD_PIN, NULL);
204 ret = gpio_request(LCD_TXD_PIN, NULL);
205 ret = gpio_request(LCD_CLK_PIN, NULL);
206 ret = gpio_request(LCD_CS_PIN, NULL);
207 //rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME,GPIO2H_GPIO2C7);
208 rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME,GPIO2H_GPIO2C6);
209 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME,GPIO2H_GPIO2C5);
210 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME,GPIO2H_GPIO2C4);
214 static int rk29_lcd_io_deinit(void)
217 //printk("rk29_lcd_io_deinit\n");
218 gpio_free(LCD_CS_PIN);
219 gpio_free(LCD_CLK_PIN);
220 gpio_free(LCD_TXD_PIN);
221 //gpio_free(LCD_RXD_PIN);
222 //rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME,GPIO2H_SPI1_RXD);
223 rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME,GPIO2H_SPI1_TXD);
224 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME,GPIO2H_SPI1_CSN0);
225 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME,GPIO2H_SPI1_CLK);
229 static struct rk29lcd_info rk29_lcd_info = {
230 .txd_pin = LCD_TXD_PIN,
231 .clk_pin = LCD_CLK_PIN,
232 .cs_pin = LCD_CS_PIN,
233 .io_init = rk29_lcd_io_init,
234 .io_deinit = rk29_lcd_io_deinit,
237 int rk29_fb_io_enable(void)
239 if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
241 gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
242 gpio_set_value(FB_DISPLAY_ON_PIN, FB_DISPLAY_ON_VALUE);
244 if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
246 gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
247 gpio_set_value(FB_LCD_STANDBY_PIN, FB_LCD_STANDBY_VALUE);
252 int rk29_fb_io_disable(void)
254 if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
256 gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
257 gpio_set_value(FB_DISPLAY_ON_PIN, !FB_DISPLAY_ON_VALUE);
259 if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
261 gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
262 gpio_set_value(FB_LCD_STANDBY_PIN, !FB_LCD_STANDBY_VALUE);
267 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
270 if(fb_setting->mcu_fmk_en && (FB_MCU_FMK_PIN != INVALID_GPIO))
272 ret = gpio_request(FB_MCU_FMK_PIN, NULL);
275 gpio_free(FB_MCU_FMK_PIN);
276 printk(">>>>>> FB_MCU_FMK_PIN gpio_request err \n ");
278 gpio_direction_input(FB_MCU_FMK_PIN);
280 if(fb_setting->disp_on_en && (FB_DISPLAY_ON_PIN != INVALID_GPIO))
282 ret = gpio_request(FB_DISPLAY_ON_PIN, NULL);
285 gpio_free(FB_DISPLAY_ON_PIN);
286 printk(">>>>>> FB_DISPLAY_ON_PIN gpio_request err \n ");
290 if(fb_setting->disp_on_en && (FB_LCD_STANDBY_PIN != INVALID_GPIO))
292 ret = gpio_request(FB_LCD_STANDBY_PIN, NULL);
295 gpio_free(FB_LCD_STANDBY_PIN);
296 printk(">>>>>> FB_LCD_STANDBY_PIN gpio_request err \n ");
300 if(FB_LCD_CABC_EN_PIN != INVALID_GPIO)
302 ret = gpio_request(FB_LCD_CABC_EN_PIN, NULL);
305 gpio_free(FB_LCD_CABC_EN_PIN);
306 printk(">>>>>> FB_LCD_CABC_EN_PIN gpio_request err \n ");
308 gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
309 gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
311 rk29_fb_io_enable(); //enable it
316 static struct rk29fb_info rk29_fb_info = {
318 .mcu_fmk_pin = FB_MCU_FMK_PIN,
319 .lcd_info = &rk29_lcd_info,
320 .io_init = rk29_fb_io_init,
321 .io_enable = rk29_fb_io_enable,
322 .io_disable = rk29_fb_io_disable,
325 /* rk29 fb resource */
326 static struct resource rk29_fb_resource[] = {
329 .start = RK29_LCDC_PHYS,
330 .end = RK29_LCDC_PHYS + RK29_LCDC_SIZE - 1,
331 .flags = IORESOURCE_MEM,
337 .flags = IORESOURCE_IRQ,
341 .start = MEM_FB_BASE,
342 .end = MEM_FB_BASE + MEM_FB_SIZE - 1,
343 .flags = IORESOURCE_MEM,
345 #ifdef CONFIG_FB_WORK_IPP
347 .name = "win1 ipp buf",
348 .start = MEM_FBIPP_BASE,
349 .end = MEM_FBIPP_BASE + MEM_FBIPP_SIZE - 1,
350 .flags = IORESOURCE_MEM,
356 struct platform_device rk29_device_fb = {
359 .num_resources = ARRAY_SIZE(rk29_fb_resource),
360 .resource = rk29_fb_resource,
362 .platform_data = &rk29_fb_info,
366 struct platform_device rk29_device_dma_cpy = {
367 .name = "dma_memcpy",
374 static struct android_pmem_platform_data android_pmem_pdata = {
376 .start = PMEM_UI_BASE,
377 .size = PMEM_UI_SIZE,
382 static struct platform_device android_pmem_device = {
383 .name = "android_pmem",
386 .platform_data = &android_pmem_pdata,
391 static struct vpu_mem_platform_data vpu_mem_pdata = {
393 .start = PMEM_VPU_BASE,
394 .size = PMEM_VPU_SIZE,
398 static struct platform_device rk29_vpu_mem_device = {
402 .platform_data = &vpu_mem_pdata,
406 static struct platform_device rk29_v4l2_output_devce = {
410 /* HANNSTAR_P1003 touch I2C */
411 #if defined (CONFIG_HANNSTAR_P1003)
412 #define TOUCH_RESET_PIN RK29_PIN6_PC3
413 #define TOUCH_INT_PIN RK29_PIN4_PD5
415 int p1003_init_platform_hw(void)
417 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
418 gpio_free(TOUCH_RESET_PIN);
419 printk("p1003_init_platform_hw gpio_request error\n");
423 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
424 gpio_free(TOUCH_INT_PIN);
425 printk("p1003_init_platform_hw gpio_request error\n");
428 gpio_pull_updown(TOUCH_INT_PIN, 1);
429 gpio_direction_output(TOUCH_RESET_PIN, 0);
431 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
433 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
439 struct p1003_platform_data p1003_info = {
441 .init_platform_hw= p1003_init_platform_hw,
446 #if defined(CONFIG_TOUCHSCREEN_GT801_IIC)
447 #include "../../../drivers/input/touchscreen/gt801_ts.h"
448 #define GT801_GPIO_INT RK29_PIN4_PD5
449 #define GT801_GPIO_RESET RK29_PIN6_PC3
450 static struct gt801_platform_data gt801_info = {
457 .gpio_reset = GT801_GPIO_RESET,
458 .gpio_reset_active_low = 0,
459 .gpio_pendown = GT801_GPIO_INT,
460 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
461 .resetpin_iomux_name = NULL,
462 .pendown_iomux_mode = GPIO4H_GPIO4D5,
463 .resetpin_iomux_mode = 0,
467 #if defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
468 #include "../../../drivers/input/touchscreen/ili2102_ts.h"
469 #define GT801_GPIO_INT RK29_PIN4_PD5
470 #define GT801_GPIO_RESET RK29_PIN6_PC3
471 static struct ili2102_platform_data ili2102_info = {
478 .gpio_reset = GT801_GPIO_RESET,
479 .gpio_reset_active_low = 1,
480 .gpio_pendown = GT801_GPIO_INT,
481 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
482 .resetpin_iomux_name = NULL,
483 .pendown_iomux_mode = GPIO4H_GPIO4D5,
484 .resetpin_iomux_mode = 0,
488 /* EETI_EGALAX touch I2C */
489 #if defined (CONFIG_EETI_EGALAX)
490 #define TOUCH_RESET_PIN RK29_PIN6_PC3
491 #define TOUCH_INT_PIN RK29_PIN4_PD5
493 static int EETI_EGALAX_init_platform_hw(void)
495 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
496 gpio_free(TOUCH_RESET_PIN);
497 printk("p1003_init_platform_hw gpio_request error\n");
501 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
502 gpio_free(TOUCH_INT_PIN);
503 printk("p1003_init_platform_hw gpio_request error\n");
506 gpio_pull_updown(TOUCH_INT_PIN, 1);
507 gpio_direction_output(TOUCH_RESET_PIN, 0);
509 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
511 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
517 static struct eeti_egalax_platform_data eeti_egalax_info = {
519 .init_platform_hw= EETI_EGALAX_init_platform_hw,
525 #if defined (CONFIG_GS_MMA8452)
526 #define MMA8452_INT_PIN RK29_PIN6_PC4
528 static int mma8452_init_platform_hw(void)
531 if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
532 gpio_free(MMA8452_INT_PIN);
533 printk("mma8452_init_platform_hw gpio_request error\n");
536 gpio_pull_updown(MMA8452_INT_PIN, 1);
541 static struct mma8452_platform_data mma8452_info = {
544 .init_platform_hw= mma8452_init_platform_hw,
549 #if defined (CONFIG_SENSORS_MPU3050)
551 static struct mpu3050_platform_data mpu3050_data = {
553 //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
554 //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
555 .orientation = { 1, 0, 0,0, 1, 0, 0, 0, 1 },
557 #if defined (CONFIG_SENSORS_KXTF9)
559 .get_slave_descr = kxtf9_get_slave_descr ,
560 .adapt_num = 0, // The i2c bus to which the mpu device is
562 .irq = RK29_PIN6_PC4,
563 .bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU
565 //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
566 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
567 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
568 .orientation = {1, 0, 0, 0, 1, 0, 0, 0, 1},
571 #if defined (CONFIG_SENSORS_AK8975)
573 .get_slave_descr = ak8975_get_slave_descr,/*ak5883_get_slave_descr,*/
574 .adapt_num = 0, // The i2c bus to which the compass device is.
575 // It can be difference with mpu
577 .irq = RK29_PIN6_PC5,
578 .bus = EXT_SLAVE_BUS_PRIMARY,
580 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
581 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
582 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
588 #if defined(CONFIG_GPIO_WM831X)
589 struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = {
591 .gpio_num =WM831X_P01,// tp3
592 .pin_type = GPIO_OUT,
593 .pin_value =GPIO_HIGH,
597 .gpio_num =WM831X_P02,//tp4
598 .pin_type = GPIO_OUT,
599 .pin_value =GPIO_HIGH,
602 .gpio_num =WM831X_P03,//tp2
603 .pin_type = GPIO_OUT,
604 .pin_value =GPIO_HIGH,
607 .gpio_num =WM831X_P04,//tp1
608 .pin_type = GPIO_OUT,
609 .pin_value =GPIO_HIGH,
612 .gpio_num =WM831X_P05,//tp1
613 .pin_type = GPIO_OUT,
614 .pin_value =GPIO_HIGH,
617 .gpio_num =WM831X_P06,//tp1
618 .pin_type = GPIO_OUT,
619 .pin_value =GPIO_HIGH,
622 .gpio_num =WM831X_P07,//tp1
623 .pin_type = GPIO_OUT,
624 .pin_value =GPIO_HIGH,
627 .gpio_num =WM831X_P08,//tp1
628 .pin_type = GPIO_OUT,
629 .pin_value =GPIO_HIGH,
632 .gpio_num =WM831X_P09,//tp1
633 .pin_type = GPIO_OUT,
634 .pin_value =GPIO_HIGH,
637 .gpio_num =WM831X_P10,//tp1
638 .pin_type = GPIO_OUT,
639 .pin_value =GPIO_HIGH,
642 .gpio_num =WM831X_P11,//tp1
643 .pin_type = GPIO_OUT,
644 .pin_value =GPIO_HIGH,
647 .gpio_num =WM831X_P12,
648 .pin_type = GPIO_OUT,
649 .pin_value =GPIO_HIGH,
657 #if defined(CONFIG_MFD_WM831X)
658 static struct wm831x *gWm831x;
659 int wm831x_pre_init(struct wm831x *parm)
662 printk("%s\n", __FUNCTION__);
665 ret = wm831x_reg_read(parm, WM831X_POWER_STATE) & 0xffff;
666 wm831x_reg_write(parm, WM831X_POWER_STATE, (ret&0xfff8) | 0x04);
668 wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 3), 0);
669 wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 7), 0);
670 printk("%s:disable ldo4 and ldo8 because they are enabled in uboot\n",__FUNCTION__);
674 int wm831x_post_init(struct wm831x *parm)
676 struct regulator *dcdc;
677 struct regulator *ldo;
679 dcdc = regulator_get(NULL, "dcdc3"); // 1th IO
680 regulator_set_voltage(dcdc,3000000,3000000);
681 regulator_set_suspend_voltage(dcdc, 3000000);
682 regulator_enable(dcdc);
683 printk("%s set dcdc3=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
687 ldo = regulator_get(NULL, "ldo10"); // 1th modem IO
688 regulator_set_voltage(ldo,3000000,3000000);
689 regulator_set_suspend_voltage(ldo,3000000);
690 regulator_enable(ldo);
691 printk("%s set ldo10=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
695 dcdc = regulator_get(NULL, "dcdc2"); // 2th CORE
696 regulator_set_voltage(dcdc,1300000,1300000);
697 regulator_set_suspend_voltage(dcdc,1000000);
698 regulator_enable(dcdc);
699 printk("%s set dcdc2=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
703 dcdc = regulator_get(NULL, "dcdc1"); // 3th ddr
704 regulator_set_voltage(dcdc,1800000,1800000);
705 regulator_set_suspend_voltage(ldo, 1800000);
706 regulator_enable(dcdc);
707 printk("%s set dcdc1=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
711 ldo = regulator_get(NULL, "ldo1"); // 3th nand
712 regulator_set_voltage(ldo,1800000,1800000);
713 regulator_set_suspend_voltage(ldo,1800000);
714 regulator_enable(ldo);
715 printk("%s set ldo1=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
719 ldo = regulator_get(NULL, "ldo4"); // 4th usb
720 regulator_set_voltage(ldo,2500000,2500000);
721 regulator_set_suspend_voltage(ldo,2500000);
722 regulator_enable(ldo);
723 printk("%s set ldo4=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
727 ldo = regulator_get(NULL, "ldo7"); // 5th usb
728 regulator_set_voltage(ldo,3300000,3300000);
729 regulator_set_suspend_voltage(ldo,3300000);
730 regulator_enable(ldo);
731 printk("%s set ldo7=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
735 dcdc = regulator_get(NULL, "dcdc4"); // backlight
736 regulator_set_voltage(dcdc,20000000,20000000);
737 regulator_set_suspend_voltage(dcdc, 20000000);
738 regulator_enable(dcdc);
739 printk("%s set dcdc4=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
744 ldo = regulator_get(NULL, "ldo2"); //lcd
745 regulator_set_voltage(ldo,3000000,3000000);
746 regulator_set_suspend_voltage(ldo,3000000);
747 regulator_enable(ldo);
748 printk("%s set ldo2=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
751 ldo = regulator_get(NULL, "ldo3"); //sram
752 regulator_set_voltage(ldo,1800000,1800000);
753 regulator_set_suspend_voltage(ldo,1800000);
754 regulator_enable(ldo);
755 printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
758 ldo = regulator_get(NULL, "ldo5"); //tf
759 regulator_set_voltage(ldo,3000000,3000000);
760 regulator_set_suspend_voltage(ldo,3000000);
761 regulator_enable(ldo);
762 printk("%s set ldo5=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
765 ldo = regulator_get(NULL, "ldo6"); //camera
766 regulator_set_voltage(ldo,1800000,1800000);
767 regulator_set_suspend_voltage(ldo,1800000);
768 regulator_enable(ldo);
769 printk("%s set ldo6=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
772 ldo = regulator_get(NULL, "ldo8"); //cmmb
773 regulator_set_voltage(ldo,1200000,1200000);
774 regulator_set_suspend_voltage(ldo,1200000);
775 regulator_enable(ldo);
776 printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
779 ldo = regulator_get(NULL, "ldo9"); //cmmb
780 regulator_set_voltage(ldo,3000000,3000000);
781 regulator_set_suspend_voltage(ldo,3000000);
782 regulator_enable(ldo);
783 printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
788 ldo = regulator_get(NULL, "ldo11");
789 //regulator_enable(ldo);
790 printk("%s set ldo11=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
797 extern void wm831x_enter_sleep(void);
798 extern void wm831x_exit_sleep(void);
800 void pmu_wm831x_set_suspend_voltage(void)
804 EXPORT_SYMBOL_GPL(pmu_wm831x_set_suspend_voltage);
806 void pmu_wm831x_set_resume_voltage(void)
810 EXPORT_SYMBOL_GPL(pmu_wm831x_set_resume_voltage);
812 int wm831x_last_deinit(struct wm831x *parm)
814 struct regulator* ldo;
816 printk("%s\n", __FUNCTION__);
818 ldo = regulator_get(NULL, "ldo1");
819 regulator_disable(ldo);
822 ldo = regulator_get(NULL, "ldo2");
823 regulator_disable(ldo);
826 ldo = regulator_get(NULL, "ldo3");
827 regulator_disable(ldo);
830 ldo = regulator_get(NULL, "ldo4");
831 //regulator_disable(ldo);
834 ldo = regulator_get(NULL, "ldo5");
835 regulator_disable(ldo);
838 ldo = regulator_get(NULL, "ldo6");
839 regulator_disable(ldo);
842 ldo = regulator_get(NULL, "ldo7");
843 regulator_disable(ldo);
846 ldo = regulator_get(NULL, "ldo8");
847 //regulator_disable(ldo);
850 ldo = regulator_get(NULL, "ldo9");
851 regulator_disable(ldo);
854 ldo = regulator_get(NULL, "ldo10");
855 regulator_disable(ldo);
861 struct wm831x_backlight_pdata wm831x_backlight_platdata = {
862 .isink = 1, /** ISINK to use, 1 or 2 */
863 .max_uA = 19484, /** Maximum current to allow */
866 struct wm831x_backup_pdata wm831x_backup_platdata = {
868 .no_constant_voltage = 0, /** Disable constant voltage charging */
869 .vlim = 3100, /** Voltage limit in milivolts */
870 .ilim = 300, /** Current limit in microamps */
873 struct wm831x_battery_pdata wm831x_battery_platdata = {
874 .enable = 1, /** Enable charging */
875 .fast_enable = 1, /** Enable fast charging */
876 .off_mask = 1, /** Mask OFF while charging */
877 .trickle_ilim = 200, /** Trickle charge current limit, in mA */
878 .vsel = 4200, /** Target voltage, in mV */
879 .eoc_iterm = 90, /** End of trickle charge current, in mA */
880 .fast_ilim = 1000, /** Fast charge current limit, in mA */
881 .timeout = 180, /** Charge cycle timeout, in minutes */
882 .syslo = 3300, /* syslo threshold, in mV*/
883 .sysok = 3500, /* sysko threshold, in mV*/
886 struct wm831x_status_pdata wm831x_status_platdata[WM831X_MAX_STATUS] = {
888 .default_src = WM831X_STATUS_OTP,
889 .name = "wm831x_status0",
890 .default_trigger = "wm831x_otp",
893 .default_src = WM831X_STATUS_POWER,
894 .name = "wm831x_status1",
895 .default_trigger = "wm831x_power",
900 static struct regulator_consumer_supply dcdc1_consumers[] = {
905 static struct regulator_consumer_supply dcdc2_consumers[] = {
913 static struct regulator_consumer_supply dcdc3_consumers[] = {
918 static struct regulator_consumer_supply dcdc4_consumers[] = {
923 static struct regulator_consumer_supply epe1_consumers[] = {
928 static struct regulator_consumer_supply epe2_consumers[] = {
933 static struct regulator_consumer_supply ldo1_consumers[] = {
938 static struct regulator_consumer_supply ldo2_consumers[] = {
943 static struct regulator_consumer_supply ldo3_consumers[] = {
948 static struct regulator_consumer_supply ldo4_consumers[] = {
953 static struct regulator_consumer_supply ldo5_consumers[] = {
958 static struct regulator_consumer_supply ldo6_consumers[] = {
963 static struct regulator_consumer_supply ldo7_consumers[] = {
968 static struct regulator_consumer_supply ldo8_consumers[] = {
973 static struct regulator_consumer_supply ldo9_consumers[] = {
978 static struct regulator_consumer_supply ldo10_consumers[] = {
983 static struct regulator_consumer_supply ldo11_consumers[] = {
988 static struct regulator_consumer_supply isink1_consumers[] = {
993 static struct regulator_consumer_supply isink2_consumers[] = {
999 struct regulator_init_data wm831x_regulator_init_dcdc[WM831X_MAX_DCDC] = {
1004 .max_uV = 1800000,//0.6-1.8V
1006 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1008 .num_consumer_supplies = ARRAY_SIZE(dcdc1_consumers),
1009 .consumer_supplies = dcdc1_consumers,
1015 .max_uV = 1800000,//0.6-1.8V
1017 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1019 .num_consumer_supplies = ARRAY_SIZE(dcdc2_consumers),
1020 .consumer_supplies = dcdc2_consumers,
1026 .max_uV = 3400000,//0.85-3.4V
1028 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1030 .num_consumer_supplies = ARRAY_SIZE(dcdc3_consumers),
1031 .consumer_supplies = dcdc3_consumers,
1037 .max_uV = 30000000,//30V/40mA
1039 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1041 .num_consumer_supplies = ARRAY_SIZE(dcdc4_consumers),
1042 .consumer_supplies = dcdc4_consumers,
1046 struct regulator_init_data wm831x_regulator_init_epe[WM831X_MAX_EPE] = {
1053 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1055 .num_consumer_supplies = ARRAY_SIZE(epe1_consumers),
1056 .consumer_supplies = epe1_consumers,
1064 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1066 .num_consumer_supplies = ARRAY_SIZE(epe2_consumers),
1067 .consumer_supplies = epe2_consumers,
1071 struct regulator_init_data wm831x_regulator_init_ldo[WM831X_MAX_LDO] = {
1078 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1080 .num_consumer_supplies = ARRAY_SIZE(ldo1_consumers),
1081 .consumer_supplies = ldo1_consumers,
1089 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1091 .num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
1092 .consumer_supplies = ldo2_consumers,
1100 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1102 .num_consumer_supplies = ARRAY_SIZE(ldo3_consumers),
1103 .consumer_supplies = ldo3_consumers,
1111 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1113 .num_consumer_supplies = ARRAY_SIZE(ldo4_consumers),
1114 .consumer_supplies = ldo4_consumers,
1122 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1124 .num_consumer_supplies = ARRAY_SIZE(ldo5_consumers),
1125 .consumer_supplies = ldo5_consumers,
1133 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1135 .num_consumer_supplies = ARRAY_SIZE(ldo6_consumers),
1136 .consumer_supplies = ldo6_consumers,
1144 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1146 .num_consumer_supplies = ARRAY_SIZE(ldo7_consumers),
1147 .consumer_supplies = ldo7_consumers,
1155 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1157 .num_consumer_supplies = ARRAY_SIZE(ldo8_consumers),
1158 .consumer_supplies = ldo8_consumers,
1166 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1168 .num_consumer_supplies = ARRAY_SIZE(ldo9_consumers),
1169 .consumer_supplies = ldo9_consumers,
1177 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1179 .num_consumer_supplies = ARRAY_SIZE(ldo10_consumers),
1180 .consumer_supplies = ldo10_consumers,
1188 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1190 .num_consumer_supplies = ARRAY_SIZE(ldo11_consumers),
1191 .consumer_supplies = ldo11_consumers,
1195 struct regulator_init_data wm831x_regulator_init_isink[WM831X_MAX_ISINK] = {
1203 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
1205 .num_consumer_supplies = ARRAY_SIZE(isink1_consumers),
1206 .consumer_supplies = isink1_consumers,
1214 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
1216 .num_consumer_supplies = ARRAY_SIZE(isink2_consumers),
1217 .consumer_supplies = isink2_consumers,
1221 static int wm831x_checkrange(int start,int num,int val)
1223 if((val<(start+num))&&(val>=start))
1229 static int wm831x_init_pin_type(struct wm831x *wm831x)
1232 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
1233 struct rk29_gpio_expander_info *wm831x_gpio_settinginfo;
1234 uint16_t offset = 0;
1235 uint16_t wm831x_settingpin_num = 0;
1241 wm831x_gpio_settinginfo=pdata->settinginfo;
1242 if(wm831x_gpio_settinginfo)
1244 wm831x_settingpin_num = pdata->settinginfolen;
1245 for(i=0;i<wm831x_settingpin_num;i++)
1247 if(!wm831x_checkrange(pdata->gpio_base,pdata->gpio_pin_num,wm831x_gpio_settinginfo[i].gpio_num))
1249 offset = wm831x_gpio_settinginfo[i].gpio_num - pdata->gpio_base;
1251 if(wm831x_gpio_settinginfo[i].pin_type==GPIO_IN)
1253 wm831x_set_bits(wm831x,(WM831X_GPIO1_CONTROL+offset), WM831X_GPN_DIR_MASK|WM831X_GPN_TRI_MASK, 1<<WM831X_GPN_DIR_SHIFT|1<<WM831X_GPN_TRI_SHIFT);
1257 wm831x_set_bits(wm831x,(WM831X_GPIO1_CONTROL+offset), WM831X_GPN_DIR_MASK|WM831X_GPN_TRI_MASK, 1<<WM831X_GPN_TRI_SHIFT);
1258 if(wm831x_gpio_settinginfo[i].pin_value==GPIO_HIGH)
1260 wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, (1 << offset),(1 << offset));
1264 wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, (1 << offset),(0 << offset));
1273 for(i=0;i<pdata->gpio_pin_num;i++)
1275 wm831x_set_bits(wm831x,(WM831X_GPIO1_CONTROL+i),
1276 WM831X_GPN_PULL_MASK|WM831X_GPN_POL_MASK|WM831X_GPN_OD_MASK|WM831X_GPN_TRI_MASK,
1277 1<<WM831X_GPN_POL_SHIFT|1<<WM831X_GPN_TRI_SHIFT);
1278 ret = wm831x_reg_read(wm831x, WM831X_GPIO1_CONTROL+i);
1279 printk("Gpio%d Pin Configuration = %x\n",i,ret);
1288 #if defined(CONFIG_KEYBOARD_WM831X_GPIO)
1289 static struct wm831x_gpio_keys_button wm831x_gpio_buttons[] = {
1292 .gpio = TCA6424_P21,
1296 .debounce_interval = 120,
1299 .code= KEY_VOLUMEUP,
1313 .code= KEY_VOLUMEDOWN,
1316 .desc= "volume_down",
1349 struct wm831x_gpio_keys_pdata wm831x_gpio_keys_platdata = {
1350 .buttons = wm831x_gpio_buttons,
1351 .nbuttons = ARRAY_SIZE(wm831x_gpio_buttons),
1355 struct wm831x_pdata wm831x_platdata = {
1356 /** Called before subdevices are set up */
1357 .pre_init= wm831x_pre_init,
1358 /** Called after subdevices are set up */
1359 .post_init = wm831x_post_init,
1360 /** Called before subdevices are power down */
1361 .last_deinit = wm831x_last_deinit,
1363 #if defined(CONFIG_GPIO_WM831X)
1364 .gpio_base=WM831X_GPIO_EXPANDER_BASE,
1365 .gpio_pin_num=WM831X_TOTOL_GPIO_NUM,
1366 .settinginfo=wm831x_gpio_settinginfo,
1367 .settinginfolen=ARRAY_SIZE(wm831x_gpio_settinginfo),
1368 .pin_type_init = wm831x_init_pin_type,
1369 .irq_base= NR_AIC_IRQS + 7*NUM_GROUP,
1372 .backlight = &wm831x_backlight_platdata,
1374 .backup = &wm831x_backup_platdata,
1376 .battery = &wm831x_battery_platdata,
1377 //.wm831x_touch_pdata = NULL,
1380 #if defined(CONFIG_KEYBOARD_WM831X_GPIO)
1381 .gpio_keys = &wm831x_gpio_keys_platdata,
1384 /** LED1 = 0 and so on */
1385 .status = {&wm831x_status_platdata[0], &wm831x_status_platdata[1]},
1387 /** DCDC1 = 0 and so on */
1388 .dcdc = {&wm831x_regulator_init_dcdc[0], &wm831x_regulator_init_dcdc[1], &wm831x_regulator_init_dcdc[2], &wm831x_regulator_init_dcdc[3]},
1390 /** EPE1 = 0 and so on */
1391 .epe = {&wm831x_regulator_init_epe[0], &wm831x_regulator_init_epe[1]},
1393 /** LDO1 = 0 and so on */
1394 .ldo = {&wm831x_regulator_init_ldo[0], &wm831x_regulator_init_ldo[1], &wm831x_regulator_init_ldo[2], &wm831x_regulator_init_ldo[3],
1395 &wm831x_regulator_init_ldo[4], &wm831x_regulator_init_ldo[5], &wm831x_regulator_init_ldo[6], &wm831x_regulator_init_ldo[7],
1396 &wm831x_regulator_init_ldo[8], &wm831x_regulator_init_ldo[9], &wm831x_regulator_init_ldo[10]},
1398 /** ISINK1 = 0 and so on*/
1399 .isink = {&wm831x_regulator_init_isink[0], &wm831x_regulator_init_isink[1]},
1405 #if defined(CONFIG_RK29_GPS)
1407 #define RK29_GPS_POWER_PIN RK29_PIN6_PB2
1408 #define RK29_GPS_RESET_PIN RK29_PIN6_PC1
1410 int rk29_gps_power_up(void)
1412 printk("%s \n", __FUNCTION__);
1414 gpio_request(RK29_GPS_POWER_PIN, NULL);
1415 gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_HIGH);
1420 int rk29_gps_power_down(void)
1422 printk("%s \n", __FUNCTION__);
1424 gpio_request(RK29_GPS_POWER_PIN, NULL);
1425 gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_LOW);
1430 int rk29_gps_reset_set(int level)
1432 gpio_request(RK29_GPS_RESET_PIN, NULL);
1434 gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_HIGH);
1436 gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_LOW);
1441 struct rk29_gps_data rk29_gps_info = {
1442 .power_up = rk29_gps_power_up,
1443 .power_down = rk29_gps_power_down,
1444 .reset = rk29_gps_reset_set,
1448 struct platform_device rk29_device_gps = {
1452 .platform_data = &rk29_gps_info,
1457 /*****************************************************************************************
1459 * author: qjb@rock-chips.com
1460 *****************************************************************************************/
1461 //#if defined(CONFIG_MFD_WM8994)
1462 #if defined (CONFIG_REGULATOR_WM8994)
1463 static struct regulator_consumer_supply wm8994_ldo1_consumers[] = {
1474 .supply = "SPKVDD1",
1477 static struct regulator_consumer_supply wm8994_ldo2_consumers[] = {
1485 .supply = "SPKVDD2",
1488 struct regulator_init_data regulator_init_data_ldo1 = {
1490 .name = "wm8994-ldo1",
1495 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
1497 .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo1_consumers),
1498 .consumer_supplies = wm8994_ldo1_consumers,
1500 struct regulator_init_data regulator_init_data_ldo2 = {
1502 .name = "wm8994-ldo2",
1507 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
1509 .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo2_consumers),
1510 .consumer_supplies = wm8994_ldo2_consumers,
1513 struct wm8994_drc_cfg wm8994_drc_cfg_pdata = {
1514 .name = "wm8994_DRC",
1515 .regs = {0,0,0,0,0},
1518 struct wm8994_retune_mobile_cfg wm8994_retune_mobile_cfg_pdata = {
1519 .name = "wm8994_EQ",
1521 .regs = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
1524 struct wm8994_pdata wm8994_platdata = {
1525 #if defined (CONFIG_GPIO_WM8994)
1526 .gpio_base = WM8994_GPIO_EXPANDER_BASE,
1527 //Fill value to initialize the GPIO
1530 //enable=0 disable ldo
1531 #if defined (CONFIG_REGULATOR_WM8994)
1537 .init_data = ®ulator_init_data_ldo1,
1542 .init_data = ®ulator_init_data_ldo2,
1546 //DRC 0--use default
1548 .drc_cfgs = &wm8994_drc_cfg_pdata,
1550 .num_retune_mobile_cfgs = 0,
1551 .retune_mobile_cfgs = &wm8994_retune_mobile_cfg_pdata,
1565 .PA_control_pin = 0,
1566 .Power_EN_Pin = RK29_PIN5_PA1,
1568 .speaker_incall_vol = 0,
1569 .speaker_incall_mic_vol = -9,
1570 .speaker_normal_vol = 6,
1571 .earpiece_incall_vol = 0,
1572 .headset_incall_vol = 6,
1573 .headset_incall_mic_vol = -6,
1574 .headset_normal_vol = 6,
1576 .BT_incall_mic_vol = 0,
1582 #ifdef CONFIG_RK_HEADSET_DET
1583 #define HEADSET_GPIO RK29_PIN4_PD2
1584 struct rk_headset_pdata rk_headset_info = {
1585 .Headset_gpio = RK29_PIN4_PD2,
1586 .headset_in_type= HEADSET_IN_HIGH,
1587 .Hook_gpio = RK29_PIN4_PD1,//Detection Headset--Must be set
1590 struct platform_device rk_device_headset = {
1591 .name = "rk_headsetdet",
1594 .platform_data = &rk_headset_info,
1599 #if defined(CONFIG_GS_L3G4200D)
1601 #include <linux/l3g4200d.h>
1602 #define L3G4200D_INT_PIN RK29_PIN5_PA3
1604 static int l3g4200d_init_platform_hw(void)
1606 if (gpio_request(L3G4200D_INT_PIN, NULL) != 0) {
1607 gpio_free(L3G4200D_INT_PIN);
1608 printk("%s: request l3g4200d int pin error\n", __func__);
1611 gpio_pull_updown(L3G4200D_INT_PIN, 1);
1615 static struct l3g4200d_platform_data l3g4200d_info = {
1626 .init = l3g4200d_init_platform_hw,
1631 /*****************************************************************************************
1633 * author: kfx@rock-chips.com
1634 *****************************************************************************************/
1635 static int rk29_i2c0_io_init(void)
1637 #ifdef CONFIG_RK29_I2C0_CONTROLLER
1638 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
1639 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
1641 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
1642 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
1647 static int rk29_i2c1_io_init(void)
1649 #ifdef CONFIG_RK29_I2C1_CONTROLLER
1650 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
1651 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
1653 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
1654 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
1658 static int rk29_i2c2_io_init(void)
1660 #ifdef CONFIG_RK29_I2C2_CONTROLLER
1661 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
1662 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
1664 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
1665 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
1670 static int rk29_i2c3_io_init(void)
1672 #ifdef CONFIG_RK29_I2C3_CONTROLLER
1673 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
1674 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
1676 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
1677 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
1681 #ifdef CONFIG_RK29_I2C0_CONTROLLER
1682 struct rk29_i2c_platform_data default_i2c0_data = {
1686 .scl_rate = 400*1000,
1687 .mode = I2C_MODE_IRQ,
1688 .io_init = rk29_i2c0_io_init,
1691 struct i2c_gpio_platform_data default_i2c0_data = {
1692 .sda_pin = RK29_PIN2_PB6,
1693 .scl_pin = RK29_PIN2_PB7,
1694 .udelay = 5, // clk = 500/udelay = 100Khz
1695 .timeout = 100,//msecs_to_jiffies(200),
1697 .io_init = rk29_i2c0_io_init,
1700 #ifdef CONFIG_RK29_I2C1_CONTROLLER
1701 struct rk29_i2c_platform_data default_i2c1_data = {
1705 .scl_rate = 400*1000,
1706 .mode = I2C_MODE_IRQ,
1707 .io_init = rk29_i2c1_io_init,
1710 struct i2c_gpio_platform_data default_i2c1_data = {
1711 .sda_pin = RK29_PIN1_PA6,
1712 .scl_pin = RK29_PIN1_PA7,
1713 .udelay = 5, // clk = 500/udelay = 100Khz
1714 .timeout = 100,//msecs_to_jiffies(200),
1716 .io_init = rk29_i2c1_io_init,
1719 #ifdef CONFIG_RK29_I2C2_CONTROLLER
1720 struct rk29_i2c_platform_data default_i2c2_data = {
1724 .scl_rate = 400*1000,
1725 .mode = I2C_MODE_IRQ,
1726 .io_init = rk29_i2c2_io_init,
1729 struct i2c_gpio_platform_data default_i2c2_data = {
1730 .sda_pin = RK29_PIN5_PD3,
1731 .scl_pin = RK29_PIN5_PD4,
1732 .udelay = 5, // clk = 500/udelay = 100Khz
1733 .timeout = 100,//msecs_to_jiffies(200),
1735 .io_init = rk29_i2c2_io_init,
1738 #ifdef CONFIG_RK29_I2C3_CONTROLLER
1739 struct rk29_i2c_platform_data default_i2c3_data = {
1743 .scl_rate = 400*1000,
1744 .mode = I2C_MODE_IRQ,
1745 .io_init = rk29_i2c3_io_init,
1748 struct i2c_gpio_platform_data default_i2c3_data = {
1749 .sda_pin = RK29_PIN5_PB5,
1750 .scl_pin = RK29_PIN5_PB4,
1751 .udelay = 5, // clk = 500/udelay = 100Khz
1752 .timeout = 100,//msecs_to_jiffies(200),
1754 .io_init = rk29_i2c3_io_init,
1757 #ifdef CONFIG_I2C0_RK29
1758 static struct i2c_board_info __initdata board_i2c0_devices[] = {
1759 #if defined (CONFIG_RK1000_CONTROL)
1761 .type = "rk1000_control",
1766 #if defined (CONFIG_SND_SOC_RK1000)
1768 .type = "rk1000_i2c_codec",
1773 #if defined (CONFIG_SND_SOC_WM8900)
1780 #if defined (CONFIG_SND_SOC_WM8994)
1785 // #if defined(CONFIG_MFD_WM8994)
1786 .platform_data = &wm8994_platdata,
1790 #if defined (CONFIG_BATTERY_STC3100)
1797 #if defined (CONFIG_BATTERY_BQ27510)
1804 #if defined (CONFIG_RTC_HYM8563)
1806 .type = "rtc_hym8563",
1809 .irq = RK29_PIN0_PA1,
1812 #if defined (CONFIG_GS_MMA8452)
1814 .type = "gs_mma8452",
1817 .irq = MMA8452_INT_PIN,
1818 .platform_data = &mma8452_info,
1821 #if defined (CONFIG_COMPASS_AK8973)
1826 .irq = RK29_PIN6_PC5,
1829 #if defined (CONFIG_COMPASS_AK8975)
1834 .irq = RK29_PIN6_PC5,
1837 #if defined (CONFIG_INPUT_LPSENSOR_ISL29028)
1842 .irq = RK29_PIN4_PD3,
1845 #if defined (CONFIG_ANX7150)
1848 .addr = 0x39, //0x39, 0x3d
1850 .irq = RK29_PIN2_PA3,
1853 #if defined (CONFIG_GS_L3G4200D)
1855 .type = "gs_l3g4200d",
1858 .irq = L3G4200D_INT_PIN,
1859 .platform_data = &l3g4200d_info,
1862 #if defined (CONFIG_SENSORS_MPU3050)
1867 .irq = RK29_PIN4_PC4,
1868 .platform_data = &mpu3050_data,
1874 #ifdef CONFIG_I2C1_RK29
1875 static struct i2c_board_info __initdata board_i2c1_devices[] = {
1876 #if defined (CONFIG_RK1000_CONTROL1)
1878 .type = "rk1000_control",
1887 #ifdef CONFIG_I2C2_RK29
1888 static struct i2c_board_info __initdata board_i2c2_devices[] = {
1889 #if defined (CONFIG_TOUCHSCREEN_GT801_IIC)
1894 .irq = RK29_PIN4_PD5,
1895 .platform_data = >801_info,
1899 #if defined (CONFIG_TOUCHSCREEN_ILI2102_IIC)
1901 .type = "ili2102_ts",
1903 .flags = I2C_M_NEED_DELAY,
1905 .irq = RK29_PIN4_PD5,
1906 .platform_data = &ili2102_info,
1910 #if defined (CONFIG_MFD_WM831X_I2C)
1915 .irq = RK29_PIN4_PD0,
1916 .platform_data = &wm831x_platdata,
1919 #if defined (CONFIG_HANNSTAR_P1003)
1921 .type = "p1003_touch",
1924 .irq = RK29_PIN0_PA2,
1925 .platform_data = &p1003_info,
1928 #if defined (CONFIG_EETI_EGALAX)
1930 .type = "egalax_i2c",
1933 .irq = RK29_PIN4_PD5,
1934 .platform_data = &eeti_egalax_info,
1940 #ifdef CONFIG_I2C3_RK29
1941 static struct i2c_board_info __initdata board_i2c3_devices[] = {
1945 /*****************************************************************************************
1947 * author: ddl@rock-chips.com
1948 *****************************************************************************************/
1949 #ifdef CONFIG_VIDEO_RK29
1950 #define CONFIG_SENSOR_POWER_IOCTL_USR 0
1951 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
1952 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
1953 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
1955 #if CONFIG_SENSOR_POWER_IOCTL_USR
1956 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
1958 #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
1962 #if CONFIG_SENSOR_RESET_IOCTL_USR
1963 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
1965 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
1969 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1970 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
1972 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
1976 #if CONFIG_SENSOR_FLASH_IOCTL_USR
1977 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
1979 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
1983 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
1984 #if CONFIG_SENSOR_POWER_IOCTL_USR
1985 .sensor_power_cb = sensor_power_usr_cb,
1987 .sensor_power_cb = NULL,
1990 #if CONFIG_SENSOR_RESET_IOCTL_USR
1991 .sensor_reset_cb = sensor_reset_usr_cb,
1993 .sensor_reset_cb = NULL,
1996 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1997 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
1999 .sensor_powerdown_cb = NULL,
2002 #if CONFIG_SENSOR_FLASH_IOCTL_USR
2003 .sensor_flash_cb = sensor_flash_usr_cb,
2005 .sensor_flash_cb = NULL,
2008 #include "../../../drivers/media/video/rk29_camera.c"
2011 /*****************************************************************************************
2013 * author: nzy@rock-chips.com
2014 *****************************************************************************************/
2015 #ifdef CONFIG_BACKLIGHT_RK29_BL
2017 GPIO1B5_PWM0_NAME, GPIO1L_PWM0
2018 GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_PWM1
2019 GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME, GPIO2L_PWM2
2020 GPIO1A5_EMMCPWREN_PWM3_NAME, GPIO1L_PWM3
2024 #define PWM_MUX_NAME GPIO1B5_PWM0_NAME
2025 #define PWM_MUX_MODE GPIO1L_PWM0
2026 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
2027 #define PWM_EFFECT_VALUE 1
2029 //#define LCD_DISP_ON_PIN
2031 #ifdef LCD_DISP_ON_PIN
2032 #define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
2033 #define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
2035 #define BL_EN_PIN GPIO0L_GPIO0A5
2036 #define BL_EN_VALUE GPIO_HIGH
2038 static int rk29_backlight_io_init(void)
2042 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
2043 #ifdef LCD_DISP_ON_PIN
2044 rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
2046 ret = gpio_request(BL_EN_PIN, NULL);
2049 gpio_free(BL_EN_PIN);
2052 gpio_direction_output(BL_EN_PIN, 0);
2053 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
2058 static int rk29_backlight_io_deinit(void)
2061 #ifdef LCD_DISP_ON_PIN
2062 gpio_free(BL_EN_PIN);
2064 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
2067 struct rk29_bl_info rk29_bl_info = {
2069 .bl_ref = PWM_EFFECT_VALUE,
2070 .io_init = rk29_backlight_io_init,
2071 .io_deinit = rk29_backlight_io_deinit,
2074 /*****************************************************************************************
2075 * pwm voltage regulator devices
2076 ******************************************************************************************/
2077 #if defined (CONFIG_RK29_PWM_REGULATOR)
2079 #define REGULATOR_PWM_ID 2
2080 #define REGULATOR_PWM_MUX_NAME GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
2081 #define REGULATOR_PWM_MUX_MODE GPIO2L_PWM2
2082 #define REGULATOR_PWM_MUX_MODE_GPIO GPIO2L_GPIO2A3
2083 #define REGULATOR_PWM_GPIO RK29_PIN2_PA3
2085 static struct regulator_consumer_supply pwm_consumers[] = {
2091 static struct regulator_init_data rk29_pwm_regulator_data = {
2097 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
2099 .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
2100 .consumer_supplies = pwm_consumers,
2103 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
2104 .pwm_id = REGULATOR_PWM_ID,
2105 .pwm_gpio = REGULATOR_PWM_GPIO,
2106 //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
2107 .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
2108 .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
2109 .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
2110 .init_data = &rk29_pwm_regulator_data,
2113 static struct platform_device rk29_device_pwm_regulator = {
2114 .name = "pwm-voltage-regulator",
2117 .platform_data = &rk29_regulator_pwm_platform_data,
2124 #if defined(CONFIG_MTK23D)
2125 static int mtk23d_io_init(void)
2131 static int mtk23d_io_deinit(void)
2137 struct rk2818_23d_data rk2818_23d_info = {
2138 .io_init = mtk23d_io_init,
2139 .io_deinit = mtk23d_io_deinit,
2140 .bp_power = RK29_PIN0_PA0,
2141 .bp_power_active_low = 0,
2142 .bp_reset = RK29_PIN0_PA1,
2143 .bp_reset_active_low = 1,
2144 .bp_statue = RK29_PIN0_PA2,//input high bp sleep;
2145 .ap_statue = RK29_PIN0_PA4,//output high ap sleep;
2146 .ap_bp_wakeup = RK29_PIN0_PA3, //output AP wake up BP used rising edge;
2147 .bp_ap_wakeup = 0,//input BP wake up AP
2149 struct platform_device rk2818_device_mtk23d = {
2153 .platform_data = &rk2818_23d_info,
2159 /*****************************************************************************************
2161 *****************************************************************************************/
2162 #ifdef CONFIG_SDMMC0_RK29
2163 static int rk29_sdmmc0_cfg_gpio(void)
2165 rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
2166 rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
2167 rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
2168 rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
2169 rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
2170 rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
2171 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
2172 rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
2173 gpio_request(RK29_PIN5_PD5,"sdmmc");
2174 gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
2176 gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
2180 #define CONFIG_SDMMC0_USE_DMA
2181 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
2182 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
2183 MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
2184 MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
2185 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
2186 .io_init = rk29_sdmmc0_cfg_gpio,
2187 .dma_name = "sd_mmc",
2188 #ifdef CONFIG_SDMMC0_USE_DMA
2193 .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO
2194 .enable_sd_wakeup = 0,
2197 #ifdef CONFIG_SDMMC1_RK29
2198 #define CONFIG_SDMMC1_USE_DMA
2199 static int rk29_sdmmc1_cfg_gpio(void)
2201 rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
2202 rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
2203 rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
2204 rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
2205 rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
2206 rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
2207 //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
2211 #ifdef CONFIG_WIFI_CONTROL_FUNC
2212 static int rk29sdk_wifi_status(struct device *dev);
2213 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
2216 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
2218 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
2219 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
2220 MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
2221 MMC_VDD_32_33|MMC_VDD_33_34),
2222 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
2223 MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
2224 .io_init = rk29_sdmmc1_cfg_gpio,
2226 #ifdef CONFIG_SDMMC1_USE_DMA
2231 #ifdef CONFIG_WIFI_CONTROL_FUNC
2232 .status = rk29sdk_wifi_status,
2233 .register_status_notify = rk29sdk_wifi_status_register,
2236 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
2241 #ifdef CONFIG_WIFI_CONTROL_FUNC
2242 #define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
2243 #define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
2244 #define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC7
2246 static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
2247 static void (*wifi_status_cb)(int card_present, void *dev_id);
2248 static void *wifi_status_cb_devid;
2249 int rk29sdk_wifi_power_state = 0;
2250 int rk29sdk_bt_power_state = 0;
2252 static int rk29sdk_wifi_status(struct device *dev)
2254 return rk29sdk_wifi_cd;
2257 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
2261 wifi_status_cb = callback;
2262 wifi_status_cb_devid = dev_id;
2266 static int rk29sdk_wifi_bt_gpio_control_init(void)
2268 if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
2269 pr_info("%s: request wifi_bt power gpio failed\n", __func__);
2273 if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
2274 pr_info("%s: request wifi reset gpio failed\n", __func__);
2275 gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
2279 if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
2280 pr_info("%s: request bt reset gpio failed\n", __func__);
2281 gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
2285 gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
2286 gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
2287 gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
2289 pr_info("%s: init finished\n",__func__);
2294 static int rk29sdk_wifi_power(int on)
2296 pr_info("%s: %d\n", __func__, on);
2298 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
2299 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
2301 pr_info("wifi turn on power\n");
2303 if (!rk29sdk_bt_power_state){
2304 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
2306 pr_info("wifi shut off power\n");
2309 pr_info("wifi shouldn't shut off power, bt is using it!\n");
2311 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
2315 rk29sdk_wifi_power_state = on;
2319 static int rk29sdk_wifi_reset_state;
2320 static int rk29sdk_wifi_reset(int on)
2322 pr_info("%s: %d\n", __func__, on);
2323 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
2325 rk29sdk_wifi_reset_state = on;
2329 int rk29sdk_wifi_set_carddetect(int val)
2331 pr_info("%s:%d\n", __func__, val);
2332 rk29sdk_wifi_cd = val;
2333 if (wifi_status_cb){
2334 wifi_status_cb(val, wifi_status_cb_devid);
2336 pr_warning("%s, nobody to notify\n", __func__);
2340 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
2342 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
2343 {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
2344 {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
2345 {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
2346 {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
2349 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
2351 if (section == PREALLOC_WLAN_SEC_NUM)
2352 return wlan_static_skb;
2354 if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
2357 if (wifi_mem_array[section].size < size)
2360 return wifi_mem_array[section].mem_ptr;
2363 int __init rk29sdk_init_wifi_mem(void)
2368 for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
2369 wlan_static_skb[i] = dev_alloc_skb(
2370 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
2372 if (!wlan_static_skb[i])
2376 for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
2377 wifi_mem_array[i].mem_ptr =
2378 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
2380 if (!wifi_mem_array[i].mem_ptr)
2386 pr_err("Failed to mem_alloc for WLAN\n");
2387 for (j = 0 ; j < i ; j++)
2388 kfree(wifi_mem_array[j].mem_ptr);
2390 i = WLAN_SKB_BUF_NUM;
2393 pr_err("Failed to skb_alloc for WLAN\n");
2394 for (j = 0 ; j < i ; j++)
2395 dev_kfree_skb(wlan_static_skb[j]);
2400 static struct wifi_platform_data rk29sdk_wifi_control = {
2401 .set_power = rk29sdk_wifi_power,
2402 .set_reset = rk29sdk_wifi_reset,
2403 .set_carddetect = rk29sdk_wifi_set_carddetect,
2404 .mem_prealloc = rk29sdk_mem_prealloc,
2406 static struct platform_device rk29sdk_wifi_device = {
2407 .name = "bcm4329_wlan",
2410 .platform_data = &rk29sdk_wifi_control,
2416 /* bluetooth rfkill device */
2417 static struct platform_device rk29sdk_rfkill = {
2418 .name = "rk29sdk_rfkill",
2423 #ifdef CONFIG_VIVANTE
2424 static struct resource resources_gpu[] = {
2429 .flags = IORESOURCE_IRQ,
2433 .start = RK29_GPU_PHYS,
2434 .end = RK29_GPU_PHYS + RK29_GPU_SIZE,
2435 .flags = IORESOURCE_MEM,
2439 .start = PMEM_GPU_BASE,
2440 .end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
2441 .flags = IORESOURCE_MEM,
2444 static struct platform_device rk29_device_gpu = {
2447 .num_resources = ARRAY_SIZE(resources_gpu),
2448 .resource = resources_gpu,
2451 #ifdef CONFIG_KEYS_RK29
2452 extern struct rk29_keys_platform_data rk29_keys_pdata;
2453 static struct platform_device rk29_device_keys = {
2454 .name = "rk29-keypad",
2457 .platform_data = &rk29_keys_pdata,
2462 #ifdef CONFIG_USE_GPIO_GENERATE_WAVE
2463 static struct gpio_wave_platform_data gpio_wave_pdata = {
2464 .gpio = RK29_PIN0_PA0,
2467 .Dvalue = GPIO_HIGH,
2469 static struct platform_device gpio_wave_device = {
2470 .name = "gpio_wave",
2473 .platform_data = &gpio_wave_pdata,
2478 static void __init rk29_board_iomux_init(void)
2480 #ifdef CONFIG_RK29_PWM_REGULATOR
2481 rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
2485 static struct platform_device *devices[] __initdata = {
2486 #ifdef CONFIG_UART1_RK29
2489 #ifdef CONFIG_UART0_RK29
2492 #ifdef CONFIG_UART2_RK29
2495 #ifdef CONFIG_UART3_RK29
2499 #ifdef CONFIG_RK29_PWM_REGULATOR
2500 &rk29_device_pwm_regulator,
2502 #ifdef CONFIG_SPIM0_RK29
2503 &rk29xx_device_spi0m,
2505 #ifdef CONFIG_SPIM1_RK29
2506 &rk29xx_device_spi1m,
2508 #ifdef CONFIG_ADC_RK29
2511 #ifdef CONFIG_I2C0_RK29
2514 #ifdef CONFIG_I2C1_RK29
2517 #ifdef CONFIG_I2C2_RK29
2520 #ifdef CONFIG_I2C3_RK29
2524 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
2525 &rk29_device_iis_2ch,
2527 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
2528 &rk29_device_iis_8ch,
2531 #ifdef CONFIG_KEYS_RK29
2534 #ifdef CONFIG_USE_GPIO_GENERATE_WAVE
2537 #ifdef CONFIG_SDMMC0_RK29
2538 &rk29_device_sdmmc0,
2540 #ifdef CONFIG_SDMMC1_RK29
2541 &rk29_device_sdmmc1,
2544 #ifdef CONFIG_MTD_NAND_RK29XX
2545 &rk29xx_device_nand,
2548 #ifdef CONFIG_WIFI_CONTROL_FUNC
2549 &rk29sdk_wifi_device,
2556 #if defined(CONFIG_MTK23D)
2557 &rk2818_device_mtk23d,
2560 #ifdef CONFIG_MTD_NAND_RK29
2564 #ifdef CONFIG_FB_RK29
2566 &rk29_device_dma_cpy,
2568 #ifdef CONFIG_BACKLIGHT_RK29_BL
2569 &rk29_device_backlight,
2571 #ifdef CONFIG_RK29_VMAC
2574 #ifdef CONFIG_VIVANTE
2577 #ifdef CONFIG_VIDEO_RK29
2578 &rk29_device_camera, /* ddl@rock-chips.com : camera support */
2579 #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
2580 &rk29_soc_camera_pdrv_0,
2582 &rk29_soc_camera_pdrv_1,
2583 &android_pmem_cam_device,
2585 &android_pmem_device,
2586 &rk29_vpu_mem_device,
2587 #ifdef CONFIG_USB20_OTG
2588 &rk29_device_usb20_otg,
2590 #ifdef CONFIG_USB20_HOST
2591 &rk29_device_usb20_host,
2593 #ifdef CONFIG_USB11_HOST
2594 &rk29_device_usb11_host,
2596 #ifdef CONFIG_USB_ANDROID
2597 &android_usb_device,
2598 &usb_mass_storage_device,
2600 #ifdef CONFIG_RK29_IPP
2603 #ifdef CONFIG_VIDEO_RK29XX_VOUT
2604 &rk29_v4l2_output_devce,
2606 #ifdef CONFIG_RK_HEADSET_DET
2609 #ifdef CONFIG_RK29_GPS
2614 #ifdef CONFIG_RK29_VMAC
2615 /*****************************************************************************************
2617 * author: lyx@rock-chips.com
2618 *****************************************************************************************/
2619 static int rk29_vmac_register_set(void)
2621 //config rk29 vmac as rmii, 100MHz
2622 u32 value= readl(RK29_GRF_BASE + 0xbc);
2623 value = (value & 0xfff7ff) | (0x400);
2624 writel(value, RK29_GRF_BASE + 0xbc);
2628 static int rk29_rmii_io_init(void)
2633 err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
2635 gpio_free(RK29_PIN6_PB0);
2636 printk("-------request RK29_PIN6_PB0 fail--------\n");
2640 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2641 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2646 static int rk29_rmii_io_deinit(void)
2649 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2650 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2652 gpio_free(RK29_PIN6_PB0);
2656 static int rk29_rmii_power_control(int enable)
2660 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
2661 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
2664 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2665 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2670 struct rk29_vmac_platform_data rk29_vmac_pdata = {
2671 .vmac_register_set = rk29_vmac_register_set,
2672 .rmii_io_init = rk29_rmii_io_init,
2673 .rmii_io_deinit = rk29_rmii_io_deinit,
2674 .rmii_power_control = rk29_rmii_power_control,
2678 /*****************************************************************************************
2680 * author: cmc@rock-chips.com
2681 *****************************************************************************************/
2682 #define SPI_CHIPSELECT_NUM 2
2683 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
2686 .cs_gpio = RK29_PIN2_PC1,
2687 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
2688 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
2692 .cs_gpio = RK29_PIN1_PA4,
2693 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
2694 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
2698 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
2701 .cs_gpio = RK29_PIN2_PC5,
2702 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
2703 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
2707 .cs_gpio = RK29_PIN1_PA3,
2708 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
2709 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
2713 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
2718 for (i=0; i<cs_num; i++) {
2719 rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
2726 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
2731 static int spi_io_fix_leakage_bug(void)
2734 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
2739 static int spi_io_resume_leakage_bug(void)
2742 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
2747 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
2748 .num_chipselect = SPI_CHIPSELECT_NUM,
2749 .chipselect_gpios = rk29xx_spi0_cs_gpios,
2750 .io_init = spi_io_init,
2751 .io_deinit = spi_io_deinit,
2752 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2753 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2756 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
2757 .num_chipselect = SPI_CHIPSELECT_NUM,
2758 .chipselect_gpios = rk29xx_spi1_cs_gpios,
2759 .io_init = spi_io_init,
2760 .io_deinit = spi_io_deinit,
2761 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2762 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2765 /*****************************************************************************************
2766 * xpt2046 touch panel
2767 * author: hhb@rock-chips.com
2768 *****************************************************************************************/
2769 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
2770 #define XPT2046_GPIO_INT RK29_PIN4_PD5 //ä¸æ–???#define DEBOUNCE_REPTIME 3
2772 static struct xpt2046_platform_data xpt2046_info = {
2777 .debounce_rep = DEBOUNCE_REPTIME,
2779 .gpio_pendown = XPT2046_GPIO_INT,
2780 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
2781 .pendown_iomux_mode = GPIO4H_GPIO4D5,
2782 .touch_virtualkey_length = 60,
2783 .penirq_recheck_delay_usecs = 1,
2784 #if defined(CONFIG_TOUCHSCREEN_480X800)
2789 .touch_ad_top = 3940,
2790 .touch_ad_bottom = 310,
2791 .touch_ad_left = 3772,
2792 .touch_ad_right = 340,
2793 #elif defined(CONFIG_TOUCHSCREEN_800X480)
2798 .touch_ad_top = 2447,
2799 .touch_ad_bottom = 207,
2800 .touch_ad_left = 5938,
2801 .touch_ad_right = 153,
2802 #elif defined(CONFIG_TOUCHSCREEN_320X480)
2807 .touch_ad_top = 3166,
2808 .touch_ad_bottom = 256,
2809 .touch_ad_left = 3658,
2810 .touch_ad_right = 380,
2813 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2814 static struct xpt2046_platform_data xpt2046_info = {
2819 .debounce_rep = DEBOUNCE_REPTIME,
2821 .gpio_pendown = XPT2046_GPIO_INT,
2822 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
2823 .pendown_iomux_mode = GPIO4H_GPIO4D5,
2824 .touch_virtualkey_length = 60,
2825 .penirq_recheck_delay_usecs = 1,
2827 #if defined(CONFIG_TOUCHSCREEN_480X800)
2832 .screen_x = { 70, 410, 70, 410, 240},
2833 .screen_y = { 50, 50, 740, 740, 400},
2834 .uncali_x_default = { 3267, 831, 3139, 715, 1845 },
2835 .uncali_y_default = { 3638, 3664, 564, 591, 2087 },
2836 #elif defined(CONFIG_TOUCHSCREEN_800X480)
2841 .screen_x[5] = { 50, 750, 50, 750, 400};
2842 .screen_y[5] = { 40, 40, 440, 440, 240};
2843 .uncali_x_default[5] = { 438, 565, 3507, 3631, 2105 };
2844 .uncali_y_default[5] = { 3756, 489, 3792, 534, 2159 };
2845 #elif defined(CONFIG_TOUCHSCREEN_320X480)
2850 .screen_x[5] = { 50, 270, 50, 270, 160};
2851 .screen_y[5] = { 40, 40, 440, 440, 240};
2852 .uncali_x_default[5] = { 812, 3341, 851, 3371, 2183 };
2853 .uncali_y_default[5] = { 442, 435, 3193, 3195, 2004 };
2858 #if defined(CONFIG_SERIAL_SC8800)
2859 static struct plat_sc8800 sc8800_plat_data = {
2860 .slav_rts_pin = RK29_PIN4_PD4,
2861 .slav_rdy_pin = RK29_PIN4_PD1,
2862 .master_rts_pin = RK29_PIN4_PD2,
2863 .master_rdy_pin = RK29_PIN4_PD3,
2868 static struct spi_board_info board_spi_devices[] = {
2869 #if defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2871 .modalias = "xpt2046_ts",
2872 .chip_select = 0,// 2,
2873 .max_speed_hz = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
2875 .irq = XPT2046_GPIO_INT,
2876 .platform_data = &xpt2046_info,
2880 #if defined(CONFIG_MFD_WM831X_SPI)
2882 .modalias = "wm8310",
2884 .max_speed_hz = 1*1000*1000,
2886 .irq = RK29_PIN4_PD0,
2887 .platform_data = &wm831x_platdata,
2890 #if defined(CONFIG_SERIAL_SC8800)
2892 .modalias = "sc8800",
2894 .platform_data = &sc8800_plat_data,
2895 .max_speed_hz = 12*1000*1000,
2902 /**********************************************************************************************
2904 * The virtual keys for android "back", "home", "menu", "search", these four keys are touch key
2905 * on the touch screen panel. (added by hhb@rock-chips.com 2011.03.31)
2907 ***********************************************************************************************/
2908 static ssize_t rk29xx_virtual_keys_show(struct kobject *kobj,
2909 struct kobj_attribute *attr, char *buf)
2911 #if (defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) && defined(CONFIG_TOUCHSCREEN_480X800)) \
2912 || defined(CONFIG_TOUCHSCREEN_HX8520_IIC) || defined(CONFIG_TOUCHSCREEN_GT801_IIC)
2913 /* center: x: home: 50, menu: 184, back: 315, search 435, y: 830*/
2914 /* centerx;centery;width;height; */
2916 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":315:815:120:50" //":50:830:98:50" //":210:796:98:50"
2917 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":85:815:88:50" // ":184:830:120:50" // ":435:796:120:50"
2918 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":184:815:100:50" //":315:830:100:50" //":320:796:100:50"
2919 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":435:815:88:50" //":50:815:98:50" // //":85:796:88:50"
2925 static struct kobj_attribute rk29xx_virtual_keys_attr = {
2927 #if defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2928 .name = "virtualkeys.xpt2046-touchscreen",
2929 #elif defined(CONFIG_TOUCHSCREEN_HX8520_IIC)
2930 .name = "virtualkeys.hx8520-touchscreen",
2931 #elif defined(CONFIG_TOUCHSCREEN_GT801_IIC)
2932 .name = "virtualkeys.gt801-touchscreen",
2933 #elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
2934 .name = "virtualkeys.ili2102-touchscreen",
2940 .show = &rk29xx_virtual_keys_show,
2943 static struct attribute *rk29xx_properties_attrs[] = {
2944 &rk29xx_virtual_keys_attr.attr,
2948 static struct attribute_group rk29xx_properties_attr_group = {
2949 .attrs = rk29xx_properties_attrs,
2951 static int rk29xx_virtual_keys_init(void)
2954 struct kobject *properties_kobj;
2955 printk("rk29xx_virtual_keys_init \n");
2956 properties_kobj = kobject_create_and_add("board_properties", NULL);
2957 if (properties_kobj)
2958 ret = sysfs_create_group(properties_kobj,
2959 &rk29xx_properties_attr_group);
2960 if (!properties_kobj || ret)
2962 pr_err("failed to create board_properties\n");
2968 static void __init rk29_gic_init_irq(void)
2970 gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
2971 gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
2974 static void __init machine_rk29_init_irq(void)
2976 rk29_gic_init_irq();
2980 #define POWER_ON_PIN RK29_PIN4_PA4
2982 static void rk29_pm_power_restart(void)
2984 printk("%s,line=%d\n",__FUNCTION__,__LINE__);
2986 #if defined(CONFIG_MFD_WM831X)
2987 wm831x_device_restart(gWm831x);
2992 static void rk29_pm_power_off(void)
2994 printk(KERN_ERR "rk29_pm_power_off start...\n");
2995 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
2996 #if defined(CONFIG_MFD_WM831X)
2997 if(wm831x_read_usb(gWm831x))
2998 rk29_pm_power_restart(); //if charging then restart
3000 wm831x_device_shutdown(gWm831x);//else shutdown
3005 static void __init machine_rk29_board_init(void)
3007 rk29_board_iomux_init();
3009 gpio_request(POWER_ON_PIN,"poweronpin");
3010 gpio_set_value(POWER_ON_PIN, GPIO_HIGH);
3011 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
3012 pm_power_off = rk29_pm_power_off;
3013 //arm_pm_restart = rk29_pm_power_restart;
3015 platform_add_devices(devices, ARRAY_SIZE(devices));
3016 #ifdef CONFIG_I2C0_RK29
3017 i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
3018 ARRAY_SIZE(board_i2c0_devices));
3020 #ifdef CONFIG_I2C1_RK29
3021 i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
3022 ARRAY_SIZE(board_i2c1_devices));
3024 #ifdef CONFIG_I2C2_RK29
3025 i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
3026 ARRAY_SIZE(board_i2c2_devices));
3028 #ifdef CONFIG_I2C3_RK29
3029 i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
3030 ARRAY_SIZE(board_i2c3_devices));
3033 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
3035 #ifdef CONFIG_WIFI_CONTROL_FUNC
3036 rk29sdk_wifi_bt_gpio_control_init();
3037 rk29sdk_init_wifi_mem();
3040 rk29xx_virtual_keys_init();
3043 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
3044 char **cmdline, struct meminfo *mi)
3047 mi->bank[0].start = RK29_SDRAM_PHYS;
3048 mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
3049 mi->bank[0].size = LINUX_SIZE;
3052 static void __init machine_rk29_mapio(void)
3054 rk29_map_common_io();
3055 rk29_setup_early_printk();
3057 rk29_clock_init2(periph_pll_288mhz, codec_pll_300mhz, false);
3059 ddr_init(DDR_TYPE, DDR_FREQ);
3062 MACHINE_START(RK29, "RK29board")
3063 /* UART for LL DEBUG */
3064 .phys_io = RK29_UART1_PHYS,
3065 .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
3066 .boot_params = RK29_SDRAM_PHYS + 0x88000,
3067 .fixup = machine_rk29_fixup,
3068 .map_io = machine_rk29_mapio,
3069 .init_irq = machine_rk29_init_irq,
3070 .init_machine = machine_rk29_board_init,
3071 .timer = &rk29_timer,