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>
47 #include <linux/regulator/rk29-pwm-regulator.h>
48 #include <linux/regulator/machine.h>
49 #include <linux/mfd/wm831x/pdata.h>
50 #include <linux/mfd/wm831x/core.h>
51 #include <linux/mfd/wm831x/gpio.h>
53 #include <linux/mtd/nand.h>
54 #include <linux/mtd/partitions.h>
60 /*set touchscreen different type header*/
61 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI)
62 #include "../../../drivers/input/touchscreen/xpt2046_ts.h"
63 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
64 #include "../../../drivers/input/touchscreen/xpt2046_tslib_ts.h"
65 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
66 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
69 #include "../../../drivers/misc/gps/rk29_gps.h"
71 /* Set memory size of pmem */
72 #ifdef CONFIG_RK29_MEM_SIZE_M
73 #define SDRAM_SIZE (CONFIG_RK29_MEM_SIZE_M * SZ_1M)
75 #define SDRAM_SIZE SZ_512M
77 #define PMEM_GPU_SIZE SZ_64M
78 #define PMEM_UI_SIZE SZ_32M
79 #define PMEM_VPU_SIZE SZ_64M
80 #define PMEM_CAM_SIZE 0x01300000
81 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
82 #define MEM_CAMIPP_SIZE SZ_4M
84 #define MEM_CAMIPP_SIZE 0
86 #define MEM_FB_SIZE (3*SZ_2M)
88 #define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
89 #define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
90 #define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
91 #define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
92 #define MEM_CAMIPP_BASE (PMEM_CAM_BASE - MEM_CAMIPP_SIZE)
93 #define MEM_FB_BASE (MEM_CAMIPP_BASE - MEM_FB_SIZE)
94 #define LINUX_SIZE (MEM_FB_BASE - RK29_SDRAM_PHYS)
96 #define PREALLOC_WLAN_SEC_NUM 4
97 #define PREALLOC_WLAN_BUF_NUM 160
98 #define PREALLOC_WLAN_SECTION_HEADER 24
100 #define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_BUF_NUM * 128)
101 #define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_BUF_NUM * 128)
102 #define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_BUF_NUM * 512)
103 #define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_BUF_NUM * 1024)
105 #define WLAN_SKB_BUF_NUM 16
107 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
109 struct wifi_mem_prealloc {
114 extern struct sys_timer rk29_timer;
116 static int rk29_nand_io_init(void)
121 struct rk29_nand_platform_data rk29_nand_data = {
122 .width = 1, /* data bus width in bytes */
123 .hw_ecc = 1, /* hw ecc 0: soft ecc */
125 .io_init = rk29_nand_io_init,
128 #ifdef CONFIG_FB_RK29
129 /*****************************************************************************************
131 * author: zyw@rock-chips.com
132 *****************************************************************************************/
133 //#ifdef CONFIG_LCD_TD043MGEA1
134 #define LCD_TXD_PIN RK29_PIN2_PC6
135 #define LCD_CLK_PIN RK29_PIN2_PC4
136 #define LCD_CS_PIN RK29_PIN2_PC5
137 /*****************************************************************************************
138 * frame buffer devices
139 * author: zyw@rock-chips.com
140 *****************************************************************************************/
142 #define FB_DISPLAY_ON_PIN RK29_PIN6_PD0
143 #define FB_LCD_STANDBY_PIN RK29_PIN6_PD1
144 #define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
145 #define FB_MCU_FMK_PIN INVALID_GPIO
147 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
148 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
151 static int rk29_lcd_io_init(void)
154 rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME, GPIO2H_GPIO2C6);
155 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME, GPIO2H_GPIO2C5);
156 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME, GPIO2H_GPIO2C4);
160 static int rk29_lcd_io_deinit(void)
163 rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME, GPIO2H_SPI1_TXD);
164 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME, GPIO2H_SPI1_CSN0);
165 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME, GPIO2H_SPI1_CLK);
169 static struct rk29lcd_info rk29_lcd_info = {
170 .txd_pin = LCD_TXD_PIN,
171 .clk_pin = LCD_CLK_PIN,
172 .cs_pin = LCD_CS_PIN,
173 .io_init = rk29_lcd_io_init,
174 .io_deinit = rk29_lcd_io_deinit,
178 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
181 if(fb_setting->mcu_fmk_en && (FB_MCU_FMK_PIN != INVALID_GPIO))
183 ret = gpio_request(FB_MCU_FMK_PIN, NULL);
186 gpio_free(FB_MCU_FMK_PIN);
187 printk(">>>>>> FB_MCU_FMK_PIN gpio_request err \n ");
189 gpio_direction_input(FB_MCU_FMK_PIN);
191 if(fb_setting->disp_on_en && (FB_DISPLAY_ON_PIN != INVALID_GPIO))
193 ret = gpio_request(FB_DISPLAY_ON_PIN, NULL);
196 gpio_free(FB_DISPLAY_ON_PIN);
197 printk(">>>>>> FB_DISPLAY_ON_PIN gpio_request err \n ");
201 if(fb_setting->disp_on_en && (FB_LCD_STANDBY_PIN != INVALID_GPIO))
203 ret = gpio_request(FB_LCD_STANDBY_PIN, NULL);
206 gpio_free(FB_LCD_STANDBY_PIN);
207 printk(">>>>>> FB_LCD_STANDBY_PIN gpio_request err \n ");
211 if(FB_LCD_CABC_EN_PIN != INVALID_GPIO)
213 ret = gpio_request(FB_LCD_CABC_EN_PIN, NULL);
216 gpio_free(FB_LCD_CABC_EN_PIN);
217 printk(">>>>>> FB_LCD_CABC_EN_PIN gpio_request err \n ");
219 gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
220 gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
226 static struct rk29fb_info rk29_fb_info = {
228 .disp_on_pin = FB_DISPLAY_ON_PIN,
229 .disp_on_value = FB_DISPLAY_ON_VALUE,
230 .standby_pin = FB_LCD_STANDBY_PIN,
231 .standby_value = FB_LCD_STANDBY_VALUE,
232 .mcu_fmk_pin = FB_MCU_FMK_PIN,
233 .lcd_info = &rk29_lcd_info,
234 .io_init = rk29_fb_io_init,
237 /* rk29 fb resource */
238 static struct resource rk29_fb_resource[] = {
241 .start = RK29_LCDC_PHYS,
242 .end = RK29_LCDC_PHYS + RK29_LCDC_SIZE - 1,
243 .flags = IORESOURCE_MEM,
249 .flags = IORESOURCE_IRQ,
253 .start = MEM_FB_BASE,
254 .end = MEM_FB_BASE + MEM_FB_SIZE,
255 .flags = IORESOURCE_MEM,
260 struct platform_device rk29_device_fb = {
263 .num_resources = ARRAY_SIZE(rk29_fb_resource),
264 .resource = rk29_fb_resource,
266 .platform_data = &rk29_fb_info,
270 struct platform_device rk29_device_dma_cpy = {
271 .name = "dma_memcpy",
278 static struct android_pmem_platform_data android_pmem_pdata = {
280 .start = PMEM_UI_BASE,
281 .size = PMEM_UI_SIZE,
286 static struct platform_device android_pmem_device = {
287 .name = "android_pmem",
290 .platform_data = &android_pmem_pdata,
295 static struct android_pmem_platform_data android_pmem_cam_pdata = {
297 .start = PMEM_CAM_BASE,
298 .size = PMEM_CAM_SIZE,
303 static struct platform_device android_pmem_cam_device = {
304 .name = "android_pmem",
307 .platform_data = &android_pmem_cam_pdata,
312 static struct vpu_mem_platform_data vpu_mem_pdata = {
314 .start = PMEM_VPU_BASE,
315 .size = PMEM_VPU_SIZE,
319 static struct platform_device rk29_vpu_mem_device = {
323 .platform_data = &vpu_mem_pdata,
327 static struct platform_device rk29_v4l2_output_devce = {
331 /*HANNSTAR_P1003 touch*/
332 #if defined (CONFIG_HANNSTAR_P1003)
333 #define TOUCH_RESET_PIN RK29_PIN6_PC3
334 #define TOUCH_INT_PIN RK29_PIN4_PD5
336 int p1003_init_platform_hw(void)
338 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
339 gpio_free(TOUCH_RESET_PIN);
340 printk("p1003_init_platform_hw gpio_request error\n");
344 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
345 gpio_free(TOUCH_INT_PIN);
346 printk("p1003_init_platform_hw gpio_request error\n");
349 gpio_pull_updown(TOUCH_INT_PIN, 1);
350 gpio_direction_output(TOUCH_RESET_PIN, 0);
352 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
354 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
360 struct p1003_platform_data p1003_info = {
362 .init_platform_hw= p1003_init_platform_hw,
366 #if defined (CONFIG_EETI_EGALAX)
367 #define TOUCH_RESET_PIN RK29_PIN6_PC3
368 #define TOUCH_INT_PIN RK29_PIN4_PD5
370 static int EETI_EGALAX_init_platform_hw(void)
372 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
373 gpio_free(TOUCH_RESET_PIN);
374 printk("p1003_init_platform_hw gpio_request error\n");
378 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
379 gpio_free(TOUCH_INT_PIN);
380 printk("p1003_init_platform_hw gpio_request error\n");
383 gpio_pull_updown(TOUCH_INT_PIN, 1);
384 gpio_direction_output(TOUCH_RESET_PIN, 0);
386 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
388 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
394 static struct eeti_egalax_platform_data eeti_egalax_info = {
396 .init_platform_hw= EETI_EGALAX_init_platform_hw,
401 #if defined (CONFIG_GS_MMA8452)
402 #define MMA8452_INT_PIN RK29_PIN6_PC4
404 static int mma8452_init_platform_hw(void)
407 if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
408 gpio_free(MMA8452_INT_PIN);
409 printk("mma8452_init_platform_hw gpio_request error\n");
412 gpio_pull_updown(MMA8452_INT_PIN, 1);
417 static struct mma8452_platform_data mma8452_info = {
420 .init_platform_hw= mma8452_init_platform_hw,
425 #if defined(CONFIG_GPIO_WM831X)
426 struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = {
428 .gpio_num =WM831X_P01,// tp3
429 .pin_type = GPIO_OUT,
430 .pin_value =GPIO_HIGH,
434 .gpio_num =WM831X_P02,//tp4
435 .pin_type = GPIO_OUT,
436 .pin_value =GPIO_HIGH,
439 .gpio_num =WM831X_P03,//tp2
440 .pin_type = GPIO_OUT,
441 .pin_value =GPIO_HIGH,
444 .gpio_num =WM831X_P04,//tp1
445 .pin_type = GPIO_OUT,
446 .pin_value =GPIO_HIGH,
449 .gpio_num =WM831X_P05,//tp1
450 .pin_type = GPIO_OUT,
451 .pin_value =GPIO_HIGH,
454 .gpio_num =WM831X_P06,//tp1
455 .pin_type = GPIO_OUT,
456 .pin_value =GPIO_HIGH,
459 .gpio_num =WM831X_P07,//tp1
460 .pin_type = GPIO_OUT,
461 .pin_value =GPIO_HIGH,
464 .gpio_num =WM831X_P08,//tp1
465 .pin_type = GPIO_OUT,
466 .pin_value =GPIO_HIGH,
469 .gpio_num =WM831X_P09,//tp1
470 .pin_type = GPIO_OUT,
471 .pin_value =GPIO_HIGH,
474 .gpio_num =WM831X_P10,//tp1
475 .pin_type = GPIO_OUT,
476 .pin_value =GPIO_HIGH,
479 .gpio_num =WM831X_P11,//tp1
480 .pin_type = GPIO_OUT,
481 .pin_value =GPIO_HIGH,
484 .gpio_num =WM831X_P12,
485 .pin_type = GPIO_OUT,
486 .pin_value =GPIO_HIGH,
494 #if defined(CONFIG_MFD_WM831X)
496 int wm831x_pre_init(struct wm831x *parm)
499 printk("%s\n", __FUNCTION__);
502 ret = wm831x_reg_read(parm, WM831X_POWER_STATE) & 0xffff;
503 wm831x_reg_write(parm, WM831X_POWER_STATE, (ret&0xfff8) | 0x04);
505 wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 3), 0);
506 wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 7), 0);
507 printk("%s:disable ldo4 and ldo8 because they are enabled in uboot\n",__FUNCTION__);
511 int wm831x_post_init(struct wm831x *parm)
513 struct regulator *dcdc;
514 struct regulator *ldo;
517 dcdc = regulator_get(NULL, "dcdc3"); // 1th IO
518 regulator_set_voltage(dcdc,3000000,3000000);
519 regulator_enable(dcdc);
520 printk("%s set dcdc3=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
524 ldo = regulator_get(NULL, "ldo10"); // 1th modem IO
525 regulator_set_voltage(ldo,3000000,3000000);
526 regulator_enable(ldo);
527 printk("%s set ldo10=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
531 dcdc = regulator_get(NULL, "dcdc2"); // 2th CORE
532 regulator_set_voltage(dcdc,1300000,1300000);
533 regulator_enable(dcdc);
534 printk("%s set dcdc2=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
538 dcdc = regulator_get(NULL, "dcdc1"); // 3th ddr
539 regulator_set_voltage(dcdc,1800000,1800000);
540 regulator_enable(dcdc);
541 printk("%s set dcdc1=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
545 ldo = regulator_get(NULL, "ldo1"); // 3th nand
546 regulator_set_voltage(ldo,1800000,1800000);
547 regulator_enable(ldo);
548 printk("%s set ldo1=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
552 ldo = regulator_get(NULL, "ldo4"); // 4th usb
553 regulator_set_voltage(ldo,2500000,2500000);
554 regulator_enable(ldo);
555 printk("%s set ldo4=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
559 ldo = regulator_get(NULL, "ldo7"); // 5th usb
560 regulator_set_voltage(ldo,3300000,3300000);
561 regulator_enable(ldo);
562 printk("%s set ldo7=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
566 dcdc = regulator_get(NULL, "dcdc4"); // backlight
567 regulator_set_voltage(dcdc,20000000,20000000);
568 regulator_enable(dcdc);
569 printk("%s set dcdc4=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
574 ldo = regulator_get(NULL, "ldo2"); //lcd
575 regulator_set_voltage(ldo,3000000,3000000);
576 regulator_enable(ldo);
577 printk("%s set ldo2=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
580 ldo = regulator_get(NULL, "ldo3"); //sram
581 regulator_set_voltage(ldo,1800000,1800000);
582 regulator_enable(ldo);
583 printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
586 ldo = regulator_get(NULL, "ldo5"); //tf
587 regulator_set_voltage(ldo,3000000,3000000);
588 regulator_enable(ldo);
589 printk("%s set ldo5=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
592 ldo = regulator_get(NULL, "ldo6"); //camera
593 regulator_set_voltage(ldo,2800000,2800000);
594 regulator_enable(ldo);
595 printk("%s set ldo6=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
598 ldo = regulator_get(NULL, "ldo8"); //cmmb
599 regulator_set_voltage(ldo,1200000,1200000);
600 regulator_enable(ldo);
601 printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
604 ldo = regulator_get(NULL, "ldo9"); //cmmb
605 regulator_set_voltage(ldo,3000000,3000000);
606 regulator_enable(ldo);
607 printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
612 ldo = regulator_get(NULL, "ldo11");
613 //regulator_enable(ldo);
614 printk("%s set ldo11=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
621 extern void wm831x_enter_sleep(void);
622 extern void wm831x_exit_sleep(void);
624 void pmu_wm831x_set_suspend_voltage(void)
628 EXPORT_SYMBOL_GPL(pmu_wm831x_set_suspend_voltage);
630 void pmu_wm831x_set_resume_voltage(void)
634 EXPORT_SYMBOL_GPL(pmu_wm831x_set_resume_voltage);
636 int wm831x_last_deinit(struct wm831x *parm)
638 printk("%s\n", __FUNCTION__);
643 struct wm831x_backlight_pdata wm831x_backlight_platdata = {
644 .isink = 1, /** ISINK to use, 1 or 2 */
645 .max_uA = 5000, /** Maximum current to allow */
648 struct wm831x_backup_pdata wm831x_backup_platdata = {
650 .no_constant_voltage = 0, /** Disable constant voltage charging */
651 .vlim = 3100, /** Voltage limit in milivolts */
652 .ilim = 300, /** Current limit in microamps */
655 struct wm831x_battery_pdata wm831x_battery_platdata = {
656 .enable = 1, /** Enable charging */
657 .fast_enable = 1, /** Enable fast charging */
658 .off_mask = 1, /** Mask OFF while charging */
659 .trickle_ilim = 200, /** Trickle charge current limit, in mA */
660 .vsel = 4200, /** Target voltage, in mV */
661 .eoc_iterm = 90, /** End of trickle charge current, in mA */
662 .fast_ilim = 1000, /** Fast charge current limit, in mA */
663 .timeout = 180, /** Charge cycle timeout, in minutes */
664 .syslo = 3300, /* syslo threshold, in mV*/
665 .sysok = 3500, /* sysko threshold, in mV*/
668 struct wm831x_status_pdata wm831x_status_platdata[WM831X_MAX_STATUS] = {
670 .default_src = WM831X_STATUS_OTP,
671 .name = "wm831x_status0",
672 .default_trigger = "wm831x_otp",
675 .default_src = WM831X_STATUS_POWER,
676 .name = "wm831x_status1",
677 .default_trigger = "wm831x_power",
682 static struct regulator_consumer_supply dcdc1_consumers[] = {
687 static struct regulator_consumer_supply dcdc2_consumers[] = {
692 static struct regulator_consumer_supply dcdc3_consumers[] = {
697 static struct regulator_consumer_supply dcdc4_consumers[] = {
702 static struct regulator_consumer_supply epe1_consumers[] = {
707 static struct regulator_consumer_supply epe2_consumers[] = {
712 static struct regulator_consumer_supply ldo1_consumers[] = {
717 static struct regulator_consumer_supply ldo2_consumers[] = {
722 static struct regulator_consumer_supply ldo3_consumers[] = {
727 static struct regulator_consumer_supply ldo4_consumers[] = {
732 static struct regulator_consumer_supply ldo5_consumers[] = {
737 static struct regulator_consumer_supply ldo6_consumers[] = {
742 static struct regulator_consumer_supply ldo7_consumers[] = {
747 static struct regulator_consumer_supply ldo8_consumers[] = {
752 static struct regulator_consumer_supply ldo9_consumers[] = {
757 static struct regulator_consumer_supply ldo10_consumers[] = {
762 static struct regulator_consumer_supply ldo11_consumers[] = {
767 static struct regulator_consumer_supply isink1_consumers[] = {
772 static struct regulator_consumer_supply isink2_consumers[] = {
778 struct regulator_init_data wm831x_regulator_init_dcdc[WM831X_MAX_DCDC] = {
783 .max_uV = 1800000,//0.6-1.8V
785 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
787 .num_consumer_supplies = ARRAY_SIZE(dcdc1_consumers),
788 .consumer_supplies = dcdc1_consumers,
794 .max_uV = 1800000,//0.6-1.8V
796 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
798 .num_consumer_supplies = ARRAY_SIZE(dcdc2_consumers),
799 .consumer_supplies = dcdc2_consumers,
805 .max_uV = 3400000,//0.85-3.4V
807 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
809 .num_consumer_supplies = ARRAY_SIZE(dcdc3_consumers),
810 .consumer_supplies = dcdc3_consumers,
816 .max_uV = 30000000,//30V/40mA
818 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
820 .num_consumer_supplies = ARRAY_SIZE(dcdc4_consumers),
821 .consumer_supplies = dcdc4_consumers,
825 struct regulator_init_data wm831x_regulator_init_epe[WM831X_MAX_EPE] = {
832 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
834 .num_consumer_supplies = ARRAY_SIZE(epe1_consumers),
835 .consumer_supplies = epe1_consumers,
843 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
845 .num_consumer_supplies = ARRAY_SIZE(epe2_consumers),
846 .consumer_supplies = epe2_consumers,
850 struct regulator_init_data wm831x_regulator_init_ldo[WM831X_MAX_LDO] = {
857 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
859 .num_consumer_supplies = ARRAY_SIZE(ldo1_consumers),
860 .consumer_supplies = ldo1_consumers,
868 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
870 .num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
871 .consumer_supplies = ldo2_consumers,
879 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
881 .num_consumer_supplies = ARRAY_SIZE(ldo3_consumers),
882 .consumer_supplies = ldo3_consumers,
890 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
892 .num_consumer_supplies = ARRAY_SIZE(ldo4_consumers),
893 .consumer_supplies = ldo4_consumers,
901 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
903 .num_consumer_supplies = ARRAY_SIZE(ldo5_consumers),
904 .consumer_supplies = ldo5_consumers,
912 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
914 .num_consumer_supplies = ARRAY_SIZE(ldo6_consumers),
915 .consumer_supplies = ldo6_consumers,
923 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
925 .num_consumer_supplies = ARRAY_SIZE(ldo7_consumers),
926 .consumer_supplies = ldo7_consumers,
934 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
936 .num_consumer_supplies = ARRAY_SIZE(ldo8_consumers),
937 .consumer_supplies = ldo8_consumers,
945 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
947 .num_consumer_supplies = ARRAY_SIZE(ldo9_consumers),
948 .consumer_supplies = ldo9_consumers,
956 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
958 .num_consumer_supplies = ARRAY_SIZE(ldo10_consumers),
959 .consumer_supplies = ldo10_consumers,
967 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
969 .num_consumer_supplies = ARRAY_SIZE(ldo11_consumers),
970 .consumer_supplies = ldo11_consumers,
974 struct regulator_init_data wm831x_regulator_init_isink[WM831X_MAX_ISINK] = {
982 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
984 .num_consumer_supplies = ARRAY_SIZE(isink1_consumers),
985 .consumer_supplies = isink1_consumers,
993 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
995 .num_consumer_supplies = ARRAY_SIZE(isink2_consumers),
996 .consumer_supplies = isink2_consumers,
1000 static int wm831x_checkrange(int start,int num,int val)
1002 if((val<(start+num))&&(val>=start))
1008 static int wm831x_init_pin_type(struct wm831x *wm831x)
1011 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
1012 struct rk29_gpio_expander_info *wm831x_gpio_settinginfo;
1013 uint16_t offset = 0;
1014 uint16_t wm831x_settingpin_num = 0;
1020 wm831x_gpio_settinginfo=pdata->settinginfo;
1021 if(wm831x_gpio_settinginfo)
1023 wm831x_settingpin_num = pdata->settinginfolen;
1024 for(i=0;i<wm831x_settingpin_num;i++)
1026 if(!wm831x_checkrange(pdata->gpio_base,pdata->gpio_pin_num,wm831x_gpio_settinginfo[i].gpio_num))
1028 offset = wm831x_gpio_settinginfo[i].gpio_num - pdata->gpio_base;
1030 if(wm831x_gpio_settinginfo[i].pin_type==GPIO_IN)
1032 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);
1036 wm831x_set_bits(wm831x,(WM831X_GPIO1_CONTROL+offset), WM831X_GPN_DIR_MASK|WM831X_GPN_TRI_MASK, 1<<WM831X_GPN_TRI_SHIFT);
1037 if(wm831x_gpio_settinginfo[i].pin_value==GPIO_HIGH)
1039 wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, (1 << offset),(1 << offset));
1043 wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, (1 << offset),(0 << offset));
1052 for(i=0;i<pdata->gpio_pin_num;i++)
1054 wm831x_set_bits(wm831x,(WM831X_GPIO1_CONTROL+i),
1055 WM831X_GPN_PULL_MASK|WM831X_GPN_POL_MASK|WM831X_GPN_OD_MASK|WM831X_GPN_TRI_MASK,
1056 1<<WM831X_GPN_POL_SHIFT|1<<WM831X_GPN_TRI_SHIFT);
1057 ret = wm831x_reg_read(wm831x, WM831X_GPIO1_CONTROL+i);
1058 printk("Gpio%d Pin Configuration = %x\n",i,ret);
1067 #if defined(CONFIG_KEYBOARD_WM831X_GPIO)
1068 static struct wm831x_gpio_keys_button wm831x_gpio_buttons[] = {
1071 .gpio = TCA6424_P21,
1075 .debounce_interval = 120,
1078 .code= KEY_VOLUMEUP,
1092 .code= KEY_VOLUMEDOWN,
1095 .desc= "volume_down",
1128 struct wm831x_gpio_keys_pdata wm831x_gpio_keys_platdata = {
1129 .buttons = wm831x_gpio_buttons,
1130 .nbuttons = ARRAY_SIZE(wm831x_gpio_buttons),
1134 struct wm831x_pdata wm831x_platdata = {
1135 /** Called before subdevices are set up */
1136 .pre_init= wm831x_pre_init,
1137 /** Called after subdevices are set up */
1138 .post_init = wm831x_post_init,
1139 /** Called before subdevices are power down */
1140 .last_deinit = wm831x_last_deinit,
1142 #if defined(CONFIG_GPIO_WM831X)
1143 .gpio_base=WM831X_GPIO_EXPANDER_BASE,
1144 .gpio_pin_num=WM831X_TOTOL_GPIO_NUM,
1145 .settinginfo=wm831x_gpio_settinginfo,
1146 .settinginfolen=ARRAY_SIZE(wm831x_gpio_settinginfo),
1147 .pin_type_init = wm831x_init_pin_type,
1148 .irq_base= NR_AIC_IRQS + 2*NUM_GROUP + TCA6424_TOTOL_GPIO_IRQ_NUM + CONFIG_SPI_FPGA_GPIO_IRQ_NUM,
1151 .backlight = &wm831x_backlight_platdata,
1153 .backup = &wm831x_backup_platdata,
1155 .battery = &wm831x_battery_platdata,
1156 //.wm831x_touch_pdata = NULL,
1159 #if defined(CONFIG_KEYBOARD_WM831X_GPIO)
1160 .gpio_keys = &wm831x_gpio_keys_platdata,
1163 /** LED1 = 0 and so on */
1164 .status = {&wm831x_status_platdata[0], &wm831x_status_platdata[1]},
1166 /** DCDC1 = 0 and so on */
1167 .dcdc = {&wm831x_regulator_init_dcdc[0], &wm831x_regulator_init_dcdc[1], &wm831x_regulator_init_dcdc[2], &wm831x_regulator_init_dcdc[3]},
1169 /** EPE1 = 0 and so on */
1170 .epe = {&wm831x_regulator_init_epe[0], &wm831x_regulator_init_epe[1]},
1172 /** LDO1 = 0 and so on */
1173 .ldo = {&wm831x_regulator_init_ldo[0], &wm831x_regulator_init_ldo[1], &wm831x_regulator_init_ldo[2], &wm831x_regulator_init_ldo[3],
1174 &wm831x_regulator_init_ldo[4], &wm831x_regulator_init_ldo[5], &wm831x_regulator_init_ldo[6], &wm831x_regulator_init_ldo[7],
1175 &wm831x_regulator_init_ldo[8], &wm831x_regulator_init_ldo[9], &wm831x_regulator_init_ldo[10]},
1177 /** ISINK1 = 0 and so on*/
1178 .isink = {&wm831x_regulator_init_isink[0], &wm831x_regulator_init_isink[1]},
1184 #if defined(CONFIG_RK29_GPS)
1186 #define RK29_GPS_POWER_PIN RK29_PIN6_PB2
1187 #define RK29_GPS_RESET_PIN RK29_PIN6_PC1
1189 static int gps_open =0;
1191 int rk29_gps_power_up(void)
1194 printk("%s \n", __FUNCTION__);
1195 gpio_request(RK29_GPS_POWER_PIN, NULL);
1196 gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_HIGH);
1197 gpio_request(RK29_GPS_RESET_PIN, NULL);
1198 gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_LOW);
1199 rk29_mux_api_set(GPIO2B3_UART3SOUT_NAME, GPIO2L_UART3_SOUT);
1200 rk29_mux_api_set(GPIO2B2_UART3SIN_NAME, GPIO2L_UART3_SIN);
1202 gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_HIGH);
1206 int rk29_gps_power_down(void)
1209 printk("%s \n", __FUNCTION__);
1210 gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_LOW);
1212 gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_LOW); //uart1
1217 struct rk29_gps_data rk29_gps_info = {
1218 .power_up = rk29_gps_power_up,
1219 .power_down = rk29_gps_power_down,
1221 .powerpin = RK29_GPS_POWER_PIN,
1225 struct platform_device rk29_device_gps = {
1229 .platform_data = &rk29_gps_info,
1235 #if defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
1236 #include "../../../drivers/input/touchscreen/ili2102_ts.h"
1237 #define GT801_GPIO_INT RK29_PIN4_PD5
1238 #define GT801_GPIO_RESET RK29_PIN6_PC3
1239 static struct ili2102_platform_data ili2102_info = {
1246 .gpio_reset = GT801_GPIO_RESET,
1247 .gpio_reset_active_low = 1,
1248 .gpio_pendown = GT801_GPIO_INT,
1249 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
1250 .resetpin_iomux_name = NULL,
1251 .pendown_iomux_mode = GPIO4H_GPIO4D5,
1252 .resetpin_iomux_mode = 0,
1257 /*****************************************************************************************
1259 * author: kfx@rock-chips.com
1260 *****************************************************************************************/
1261 static int rk29_i2c0_io_init(void)
1263 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
1264 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
1268 static int rk29_i2c1_io_init(void)
1270 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
1271 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
1274 static int rk29_i2c2_io_init(void)
1276 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
1277 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
1281 static int rk29_i2c3_io_init(void)
1283 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
1284 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
1288 struct rk29_i2c_platform_data default_i2c0_data = {
1292 .scl_rate = 400*1000,
1293 .mode = I2C_MODE_IRQ,
1294 .io_init = rk29_i2c0_io_init,
1297 struct rk29_i2c_platform_data default_i2c1_data = {
1301 .scl_rate = 400*1000,
1302 .mode = I2C_MODE_POLL,
1303 .io_init = rk29_i2c1_io_init,
1306 struct rk29_i2c_platform_data default_i2c2_data = {
1310 .scl_rate = 400*1000,
1311 .mode = I2C_MODE_IRQ,
1312 .io_init = rk29_i2c2_io_init,
1315 struct rk29_i2c_platform_data default_i2c3_data = {
1319 .scl_rate = 400*1000,
1320 .mode = I2C_MODE_POLL,
1321 .io_init = rk29_i2c3_io_init,
1324 #ifdef CONFIG_I2C0_RK29
1325 static struct i2c_board_info __initdata board_i2c0_devices[] = {
1326 #if defined (CONFIG_RK1000_CONTROL)
1328 .type = "rk1000_control",
1333 #if defined (CONFIG_SND_SOC_RK1000)
1335 .type = "rk1000_i2c_codec",
1340 #if defined (CONFIG_SND_SOC_WM8900)
1347 #if defined (CONFIG_SND_SOC_WM8994)
1354 #if defined (CONFIG_BATTERY_STC3100)
1361 #if defined (CONFIG_BATTERY_BQ27510)
1368 #if defined (CONFIG_RTC_HYM8563)
1370 .type = "rtc_hym8563",
1373 .irq = RK29_PIN0_PA1,
1376 #if defined (CONFIG_GS_MMA8452)
1378 .type = "gs_mma8452",
1381 .irq = MMA8452_INT_PIN,
1382 .platform_data = &mma8452_info,
1385 #if defined (CONFIG_SENSORS_AK8973)
1390 .irq = RK29_PIN0_PA4,
1393 #if defined (CONFIG_SENSORS_AK8975)
1398 .irq = RK29_PIN0_PA4,
1401 #if defined (CONFIG_INPUT_LPSENSOR_ISL29028)
1406 .irq = RK29_PIN4_PD3,
1409 #if defined (CONFIG_ANX7150)
1412 .addr = 0x39, //0x39, 0x3d
1414 .irq = RK29_PIN2_PA3,
1420 #ifdef CONFIG_I2C1_RK29
1421 static struct i2c_board_info __initdata board_i2c1_devices[] = {
1422 #if defined (CONFIG_RK1000_CONTROL1)
1424 .type = "rk1000_control",
1433 #ifdef CONFIG_I2C2_RK29
1434 static struct i2c_board_info __initdata board_i2c2_devices[] = {
1435 #if defined (CONFIG_TOUCHSCREEN_ILI2102_IIC)
1437 .type = "ili2102_ts",
1440 .irq = RK29_PIN4_PD5,
1441 .platform_data = &ili2102_info,
1444 #if defined (CONFIG_MFD_WM831X_I2C)
1449 .irq = RK29_PIN4_PD0,
1450 .platform_data = &wm831x_platdata,
1453 #if defined (CONFIG_HANNSTAR_P1003)
1455 .type = "p1003_touch",
1458 .irq = RK29_PIN0_PA2,
1459 .platform_data = &p1003_info,
1462 #if defined (CONFIG_EETI_EGALAX)
1464 .type = "egalax_i2c",
1467 .irq = RK29_PIN4_PD5,
1468 .platform_data = &eeti_egalax_info,
1474 #ifdef CONFIG_I2C3_RK29
1475 static struct i2c_board_info __initdata board_i2c3_devices[] = {
1479 /*****************************************************************************************
1481 * author: ddl@rock-chips.com
1482 *****************************************************************************************/
1483 #ifdef CONFIG_VIDEO_RK29
1484 #define SENSOR_NAME_0 RK29_CAM_SENSOR_NAME_OV5642 /* back camera sensor */
1485 #define SENSOR_IIC_ADDR_0 0x78
1486 #define SENSOR_IIC_ADAPTER_ID_0 1
1487 #define SENSOR_POWER_PIN_0 INVALID_GPIO
1488 #define SENSOR_RESET_PIN_0 INVALID_GPIO
1489 #define SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
1490 #define SENSOR_FALSH_PIN_0 INVALID_GPIO
1491 #define SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
1492 #define SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
1493 #define SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
1494 #define SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
1496 #define SENSOR_NAME_1 RK29_CAM_SENSOR_NAME_OV2659 /* front camera sensor */
1497 #define SENSOR_IIC_ADDR_1 0x60
1498 #define SENSOR_IIC_ADAPTER_ID_1 1
1499 #define SENSOR_POWER_PIN_1 INVALID_GPIO
1500 #define SENSOR_RESET_PIN_1 INVALID_GPIO
1501 #define SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
1502 #define SENSOR_FALSH_PIN_1 INVALID_GPIO
1503 #define SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
1504 #define SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
1505 #define SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
1506 #define SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
1508 static int rk29_sensor_io_init(void);
1509 static int rk29_sensor_io_deinit(int sensor);
1510 static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
1512 static struct rk29camera_platform_data rk29_camera_platform_data = {
1513 .io_init = rk29_sensor_io_init,
1514 .io_deinit = rk29_sensor_io_deinit,
1515 .sensor_ioctrl = rk29_sensor_ioctrl,
1518 .gpio_reset = SENSOR_RESET_PIN_0,
1519 .gpio_power = SENSOR_POWER_PIN_0,
1520 .gpio_powerdown = SENSOR_POWERDN_PIN_0,
1521 .gpio_flash = SENSOR_FALSH_PIN_0,
1522 .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_0|SENSOR_RESETACTIVE_LEVEL_0|SENSOR_POWERDNACTIVE_LEVEL_0|SENSOR_FLASHACTIVE_LEVEL_0),
1524 .dev_name = SENSOR_NAME_0,
1526 .gpio_reset = SENSOR_RESET_PIN_1,
1527 .gpio_power = SENSOR_POWER_PIN_1,
1528 .gpio_powerdown = SENSOR_POWERDN_PIN_1,
1529 .gpio_flash = SENSOR_FALSH_PIN_1,
1530 .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_1|SENSOR_RESETACTIVE_LEVEL_1|SENSOR_POWERDNACTIVE_LEVEL_1|SENSOR_FLASHACTIVE_LEVEL_1),
1532 .dev_name = SENSOR_NAME_1,
1535 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
1537 .name = "camera_ipp_mem",
1538 .start = MEM_CAMIPP_BASE,
1539 .size = MEM_CAMIPP_SIZE,
1544 static int rk29_sensor_io_init(void)
1547 unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
1548 unsigned int camera_powerdown = INVALID_GPIO, camera_flash = INVALID_GPIO;
1549 unsigned int camera_ioflag;
1551 for (i=0; i<2; i++) {
1552 camera_reset = rk29_camera_platform_data.gpio_res[i].gpio_reset;
1553 camera_power = rk29_camera_platform_data.gpio_res[i].gpio_power;
1554 camera_powerdown = rk29_camera_platform_data.gpio_res[i].gpio_powerdown;
1555 camera_flash = rk29_camera_platform_data.gpio_res[i].gpio_flash;
1556 camera_ioflag = rk29_camera_platform_data.gpio_res[i].gpio_flag;
1557 rk29_camera_platform_data.gpio_res[i].gpio_init = 0;
1559 if (camera_power != INVALID_GPIO) {
1560 ret = gpio_request(camera_power, "camera power");
1562 goto sensor_io_int_loop_end;
1563 rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_POWERACTIVE_MASK;
1564 gpio_set_value(camera_reset, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1565 gpio_direction_output(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1567 //printk("\n%s....power pin(%d) init success(0x%x) \n",__FUNCTION__,camera_power,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1571 if (camera_reset != INVALID_GPIO) {
1572 ret = gpio_request(camera_reset, "camera reset");
1574 goto sensor_io_int_loop_end;
1575 rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_RESETACTIVE_MASK;
1576 gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1577 gpio_direction_output(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1579 //printk("\n%s....reset pin(%d) init success(0x%x)\n",__FUNCTION__,camera_reset,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1583 if (camera_powerdown != INVALID_GPIO) {
1584 ret = gpio_request(camera_powerdown, "camera powerdown");
1586 goto sensor_io_int_loop_end;
1587 rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_POWERDNACTIVE_MASK;
1588 gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1589 gpio_direction_output(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1591 //printk("\n%s....powerdown pin(%d) init success(0x%x) \n",__FUNCTION__,camera_powerdown,((camera_ioflag&RK29_CAM_POWERDNACTIVE_BITPOS)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1595 if (camera_flash != INVALID_GPIO) {
1596 ret = gpio_request(camera_flash, "camera flash");
1598 goto sensor_io_int_loop_end;
1599 rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_FLASHACTIVE_MASK;
1600 gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1601 gpio_direction_output(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1603 //printk("\n%s....flash pin(%d) init success(0x%x) \n",__FUNCTION__,camera_flash,((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1607 sensor_io_int_loop_end:
1608 rk29_sensor_io_deinit(i);
1615 static int rk29_sensor_io_deinit(int sensor)
1617 unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
1618 unsigned int camera_powerdown = INVALID_GPIO, camera_flash = INVALID_GPIO;
1620 camera_reset = rk29_camera_platform_data.gpio_res[sensor].gpio_reset;
1621 camera_power = rk29_camera_platform_data.gpio_res[sensor].gpio_power;
1622 camera_powerdown = rk29_camera_platform_data.gpio_res[sensor].gpio_powerdown;
1623 camera_flash = rk29_camera_platform_data.gpio_res[sensor].gpio_flash;
1625 if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_POWERACTIVE_MASK) {
1626 if (camera_power != INVALID_GPIO) {
1627 gpio_direction_input(camera_power);
1628 gpio_free(camera_power);
1632 if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_RESETACTIVE_MASK) {
1633 if (camera_reset != INVALID_GPIO) {
1634 gpio_direction_input(camera_reset);
1635 gpio_free(camera_reset);
1639 if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_POWERDNACTIVE_MASK) {
1640 if (camera_powerdown != INVALID_GPIO) {
1641 gpio_direction_input(camera_powerdown);
1642 gpio_free(camera_powerdown);
1646 if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_FLASHACTIVE_MASK) {
1647 if (camera_flash != INVALID_GPIO) {
1648 gpio_direction_input(camera_flash);
1649 gpio_free(camera_flash);
1653 rk29_camera_platform_data.gpio_res[sensor].gpio_init = 0;
1656 static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, int on)
1658 unsigned int camera_power=INVALID_GPIO,camera_reset=INVALID_GPIO, camera_powerdown=INVALID_GPIO,camera_flash = INVALID_GPIO;
1659 unsigned int camera_ioflag,camera_io_init;
1660 int ret = RK29_CAM_IO_SUCCESS;
1662 if(rk29_camera_platform_data.gpio_res[0].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[0].dev_name, dev_name(dev)) == 0)) {
1663 camera_power = rk29_camera_platform_data.gpio_res[0].gpio_power;
1664 camera_reset = rk29_camera_platform_data.gpio_res[0].gpio_reset;
1665 camera_powerdown = rk29_camera_platform_data.gpio_res[0].gpio_powerdown;
1666 camera_flash = rk29_camera_platform_data.gpio_res[0].gpio_flash;
1667 camera_ioflag = rk29_camera_platform_data.gpio_res[0].gpio_flag;
1668 camera_io_init = rk29_camera_platform_data.gpio_res[0].gpio_init;
1669 } else if (rk29_camera_platform_data.gpio_res[1].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[1].dev_name, dev_name(dev)) == 0)) {
1670 camera_power = rk29_camera_platform_data.gpio_res[1].gpio_power;
1671 camera_reset = rk29_camera_platform_data.gpio_res[1].gpio_reset;
1672 camera_powerdown = rk29_camera_platform_data.gpio_res[1].gpio_powerdown;
1673 camera_flash = rk29_camera_platform_data.gpio_res[1].gpio_flash;
1674 camera_ioflag = rk29_camera_platform_data.gpio_res[1].gpio_flag;
1675 camera_io_init = rk29_camera_platform_data.gpio_res[1].gpio_init;
1682 if (camera_power != INVALID_GPIO) {
1683 if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {
1685 gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1686 //printk("\n%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1689 gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1690 //printk("\n%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
1693 ret = RK29_CAM_EIO_REQUESTFAIL;
1694 printk("\n%s..%s..ResetPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
1697 ret = RK29_CAM_EIO_INVALID;
1703 if (camera_reset != INVALID_GPIO) {
1704 if (camera_io_init & RK29_CAM_RESETACTIVE_MASK) {
1706 gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1707 //printk("\n%s..%s..ResetPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1709 gpio_set_value(camera_reset,(((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1710 //printk("\n%s..%s..ResetPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_reset, (((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
1713 ret = RK29_CAM_EIO_REQUESTFAIL;
1714 printk("\n%s..%s..ResetPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
1717 ret = RK29_CAM_EIO_INVALID;
1724 if (camera_powerdown != INVALID_GPIO) {
1725 if (camera_io_init & RK29_CAM_POWERDNACTIVE_MASK) {
1727 gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1728 //printk("\n%s..%s..PowerDownPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1730 gpio_set_value(camera_powerdown,(((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1731 //printk("\n%s..%s..PowerDownPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_powerdown, (((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
1734 ret = RK29_CAM_EIO_REQUESTFAIL;
1735 printk("\n%s..%s..PowerDownPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_powerdown);
1738 ret = RK29_CAM_EIO_INVALID;
1745 if (camera_flash != INVALID_GPIO) {
1746 if (camera_io_init & RK29_CAM_FLASHACTIVE_MASK) {
1748 gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1749 //printk("\n%s..%s..FlashPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1751 gpio_set_value(camera_flash,(((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1752 //printk("\n%s..%s..FlashPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_flash, (((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
1755 ret = RK29_CAM_EIO_REQUESTFAIL;
1756 printk("\n%s..%s..FlashPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_flash);
1759 ret = RK29_CAM_EIO_INVALID;
1766 printk("%s cmd(0x%x) is unknown!\n",__FUNCTION__, cmd);
1772 static int rk29_sensor_power(struct device *dev, int on)
1774 rk29_sensor_ioctrl(dev,Cam_Power,on);
1777 static int rk29_sensor_reset(struct device *dev)
1779 rk29_sensor_ioctrl(dev,Cam_Reset,1);
1781 rk29_sensor_ioctrl(dev,Cam_Reset,0);
1784 static int rk29_sensor_powerdown(struct device *dev, int on)
1786 return rk29_sensor_ioctrl(dev,Cam_PowerDown,on);
1788 #if (SENSOR_IIC_ADDR_0 != 0x00)
1789 static struct i2c_board_info rk29_i2c_cam_info_0[] = {
1791 I2C_BOARD_INFO(SENSOR_NAME_0, SENSOR_IIC_ADDR_0>>1)
1795 static struct soc_camera_link rk29_iclink_0 = {
1796 .bus_id = RK29_CAM_PLATFORM_DEV_ID,
1797 .power = rk29_sensor_power,
1798 .powerdown = rk29_sensor_powerdown,
1799 .board_info = &rk29_i2c_cam_info_0[0],
1800 .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_0,
1801 .module_name = SENSOR_NAME_0,
1804 /*platform_device : soc-camera need */
1805 static struct platform_device rk29_soc_camera_pdrv_0 = {
1806 .name = "soc-camera-pdrv",
1809 .init_name = SENSOR_NAME_0,
1810 .platform_data = &rk29_iclink_0,
1814 static struct i2c_board_info rk29_i2c_cam_info_1[] = {
1816 I2C_BOARD_INFO(SENSOR_NAME_1, SENSOR_IIC_ADDR_1>>1)
1820 static struct soc_camera_link rk29_iclink_1 = {
1821 .bus_id = RK29_CAM_PLATFORM_DEV_ID,
1822 .power = rk29_sensor_power,
1823 .powerdown = rk29_sensor_powerdown,
1824 .board_info = &rk29_i2c_cam_info_1[0],
1825 .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_1,
1826 .module_name = SENSOR_NAME_1,
1829 /*platform_device : soc-camera need */
1830 static struct platform_device rk29_soc_camera_pdrv_1 = {
1831 .name = "soc-camera-pdrv",
1834 .init_name = SENSOR_NAME_1,
1835 .platform_data = &rk29_iclink_1,
1840 static u64 rockchip_device_camera_dmamask = 0xffffffffUL;
1841 static struct resource rk29_camera_resource[] = {
1843 .start = RK29_VIP_PHYS,
1844 .end = RK29_VIP_PHYS + RK29_VIP_SIZE - 1,
1845 .flags = IORESOURCE_MEM,
1850 .flags = IORESOURCE_IRQ,
1854 /*platform_device : */
1855 static struct platform_device rk29_device_camera = {
1856 .name = RK29_CAM_DRV_NAME,
1857 .id = RK29_CAM_PLATFORM_DEV_ID, /* This is used to put cameras on this interface */
1858 .num_resources = ARRAY_SIZE(rk29_camera_resource),
1859 .resource = rk29_camera_resource,
1861 .dma_mask = &rockchip_device_camera_dmamask,
1862 .coherent_dma_mask = 0xffffffffUL,
1863 .platform_data = &rk29_camera_platform_data,
1867 /*****************************************************************************************
1869 * author: nzy@rock-chips.com
1870 *****************************************************************************************/
1871 #ifdef CONFIG_BACKLIGHT_RK29_BL
1873 GPIO1B5_PWM0_NAME, GPIO1L_PWM0
1874 GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_PWM1
1875 GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME, GPIO2L_PWM2
1876 GPIO1A5_EMMCPWREN_PWM3_NAME, GPIO1L_PWM3
1880 #define PWM_MUX_NAME GPIO1B5_PWM0_NAME
1881 #define PWM_MUX_MODE GPIO1L_PWM0
1882 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
1883 #define PWM_EFFECT_VALUE 1
1885 //#define LCD_DISP_ON_PIN
1887 #ifdef LCD_DISP_ON_PIN
1888 #define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
1889 #define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
1891 #define BL_EN_PIN GPIO0L_GPIO0A5
1892 #define BL_EN_VALUE GPIO_HIGH
1894 static int rk29_backlight_io_init(void)
1898 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1899 #ifdef LCD_DISP_ON_PIN
1900 rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
1902 ret = gpio_request(BL_EN_PIN, NULL);
1905 gpio_free(BL_EN_PIN);
1908 gpio_direction_output(BL_EN_PIN, 0);
1909 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
1914 static int rk29_backlight_io_deinit(void)
1917 #ifdef LCD_DISP_ON_PIN
1918 gpio_free(BL_EN_PIN);
1920 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1923 struct rk29_bl_info rk29_bl_info = {
1925 .bl_ref = PWM_EFFECT_VALUE,
1926 .io_init = rk29_backlight_io_init,
1927 .io_deinit = rk29_backlight_io_deinit,
1930 /*****************************************************************************************
1931 * pwm voltage regulator devices
1932 ******************************************************************************************/
1933 #if defined (CONFIG_RK29_PWM_REGULATOR)
1935 #define REGULATOR_PWM_ID 2
1936 #define REGULATOR_PWM_MUX_NAME GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
1937 #define REGULATOR_PWM_MUX_MODE GPIO2L_PWM2
1938 #define REGULATOR_PWM_MUX_MODE_GPIO GPIO2L_GPIO2A3
1939 #define REGULATOR_PWM_GPIO RK29_PIN2_PA3
1941 static struct regulator_consumer_supply pwm_consumers[] = {
1947 static struct regulator_init_data rk29_pwm_regulator_data = {
1953 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1955 .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
1956 .consumer_supplies = pwm_consumers,
1959 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
1960 .pwm_id = REGULATOR_PWM_ID,
1961 .pwm_gpio = REGULATOR_PWM_GPIO,
1962 //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
1963 .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
1964 .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
1965 .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
1966 .init_data = &rk29_pwm_regulator_data,
1969 static struct platform_device rk29_device_pwm_regulator = {
1970 .name = "pwm-voltage-regulator",
1973 .platform_data = &rk29_regulator_pwm_platform_data,
1979 /*****************************************************************************************
1981 *****************************************************************************************/
1982 #ifdef CONFIG_SDMMC0_RK29
1983 static int rk29_sdmmc0_cfg_gpio(void)
1985 rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
1986 rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
1987 rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
1988 rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
1989 rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
1990 rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
1991 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);
1992 rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
1993 gpio_request(RK29_PIN5_PD5,"sdmmc");
1994 gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
1996 gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
2000 #define CONFIG_SDMMC0_USE_DMA
2001 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
2002 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
2003 MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
2004 MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
2005 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
2006 .io_init = rk29_sdmmc0_cfg_gpio,
2007 .dma_name = "sd_mmc",
2008 #ifdef CONFIG_SDMMC0_USE_DMA
2015 #ifdef CONFIG_SDMMC1_RK29
2016 #define CONFIG_SDMMC1_USE_DMA
2017 static int rk29_sdmmc1_cfg_gpio(void)
2019 rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
2020 rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
2021 rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
2022 rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
2023 rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
2024 rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
2025 //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
2029 #ifdef CONFIG_WIFI_CONTROL_FUNC
2030 static int rk29sdk_wifi_status(struct device *dev);
2031 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
2034 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
2036 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
2037 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
2038 MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
2039 MMC_VDD_32_33|MMC_VDD_33_34),
2040 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
2041 MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
2042 .io_init = rk29_sdmmc1_cfg_gpio,
2044 #ifdef CONFIG_SDMMC1_USE_DMA
2049 #ifdef CONFIG_WIFI_CONTROL_FUNC
2050 .status = rk29sdk_wifi_status,
2051 .register_status_notify = rk29sdk_wifi_status_register,
2054 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
2059 #ifdef CONFIG_WIFI_CONTROL_FUNC
2060 #define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
2061 #define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
2062 #define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC7
2064 static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
2065 static void (*wifi_status_cb)(int card_present, void *dev_id);
2066 static void *wifi_status_cb_devid;
2067 int rk29sdk_wifi_power_state = 0;
2068 int rk29sdk_bt_power_state = 0;
2070 static int rk29sdk_wifi_status(struct device *dev)
2072 return rk29sdk_wifi_cd;
2075 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
2079 wifi_status_cb = callback;
2080 wifi_status_cb_devid = dev_id;
2084 static int rk29sdk_wifi_bt_gpio_control_init(void)
2086 if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
2087 pr_info("%s: request wifi_bt power gpio failed\n", __func__);
2091 if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
2092 pr_info("%s: request wifi reset gpio failed\n", __func__);
2093 gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
2097 if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
2098 pr_info("%s: request bt reset gpio failed\n", __func__);
2099 gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
2103 gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
2104 gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
2105 gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
2107 pr_info("%s: init finished\n",__func__);
2112 static int rk29sdk_wifi_power(int on)
2114 pr_info("%s: %d\n", __func__, on);
2116 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
2118 pr_info("wifi turn on power\n");
2120 if (!rk29sdk_bt_power_state){
2121 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
2123 pr_info("wifi shut off power\n");
2126 pr_info("wifi shouldn't shut off power, bt is using it!\n");
2131 rk29sdk_wifi_power_state = on;
2135 static int rk29sdk_wifi_reset_state;
2136 static int rk29sdk_wifi_reset(int on)
2138 pr_info("%s: %d\n", __func__, on);
2139 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
2141 rk29sdk_wifi_reset_state = on;
2145 int rk29sdk_wifi_set_carddetect(int val)
2147 pr_info("%s:%d\n", __func__, val);
2148 rk29sdk_wifi_cd = val;
2149 if (wifi_status_cb){
2150 wifi_status_cb(val, wifi_status_cb_devid);
2152 pr_warning("%s, nobody to notify\n", __func__);
2156 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
2158 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
2159 {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
2160 {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
2161 {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
2162 {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
2165 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
2167 if (section == PREALLOC_WLAN_SEC_NUM)
2168 return wlan_static_skb;
2170 if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
2173 if (wifi_mem_array[section].size < size)
2176 return wifi_mem_array[section].mem_ptr;
2179 int __init rk29sdk_init_wifi_mem(void)
2184 for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
2185 wlan_static_skb[i] = dev_alloc_skb(
2186 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
2188 if (!wlan_static_skb[i])
2192 for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
2193 wifi_mem_array[i].mem_ptr =
2194 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
2196 if (!wifi_mem_array[i].mem_ptr)
2202 pr_err("Failed to mem_alloc for WLAN\n");
2203 for (j = 0 ; j < i ; j++)
2204 kfree(wifi_mem_array[j].mem_ptr);
2206 i = WLAN_SKB_BUF_NUM;
2209 pr_err("Failed to skb_alloc for WLAN\n");
2210 for (j = 0 ; j < i ; j++)
2211 dev_kfree_skb(wlan_static_skb[j]);
2216 static struct wifi_platform_data rk29sdk_wifi_control = {
2217 .set_power = rk29sdk_wifi_power,
2218 .set_reset = rk29sdk_wifi_reset,
2219 .set_carddetect = rk29sdk_wifi_set_carddetect,
2220 .mem_prealloc = rk29sdk_mem_prealloc,
2222 static struct platform_device rk29sdk_wifi_device = {
2223 .name = "bcm4329_wlan",
2226 .platform_data = &rk29sdk_wifi_control,
2232 /* bluetooth rfkill device */
2233 static struct platform_device rk29sdk_rfkill = {
2234 .name = "rk29sdk_rfkill",
2239 #ifdef CONFIG_VIVANTE
2240 static struct resource resources_gpu[] = {
2245 .flags = IORESOURCE_IRQ,
2249 .start = RK29_GPU_PHYS,
2250 .end = RK29_GPU_PHYS + RK29_GPU_SIZE,
2251 .flags = IORESOURCE_MEM,
2255 .start = PMEM_GPU_BASE,
2256 .end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
2257 .flags = IORESOURCE_MEM,
2260 static struct platform_device rk29_device_gpu = {
2263 .num_resources = ARRAY_SIZE(resources_gpu),
2264 .resource = resources_gpu,
2267 #ifdef CONFIG_KEYS_RK29
2268 extern struct rk29_keys_platform_data rk29_keys_pdata;
2269 static struct platform_device rk29_device_keys = {
2270 .name = "rk29-keypad",
2273 .platform_data = &rk29_keys_pdata,
2278 static void __init rk29_board_iomux_init(void)
2280 #ifdef CONFIG_UART0_RK29
2281 rk29_mux_api_set(GPIO1B7_UART0SOUT_NAME, GPIO1L_UART0_SOUT);
2282 rk29_mux_api_set(GPIO1B6_UART0SIN_NAME, GPIO1L_UART0_SIN);
2283 #ifdef CONFIG_UART0_CTS_RTS_RK29
2284 rk29_mux_api_set(GPIO1C1_UART0RTSN_SDMMC1WRITEPRT_NAME, GPIO1H_UART0_RTS_N);
2285 rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_UART0_CTS_N);
2288 #ifdef CONFIG_UART1_RK29
2289 rk29_mux_api_set(GPIO2A5_UART1SOUT_NAME, GPIO2L_UART1_SOUT);
2290 rk29_mux_api_set(GPIO2A4_UART1SIN_NAME, GPIO2L_UART1_SIN);
2292 #ifdef CONFIG_UART2_RK29
2293 rk29_mux_api_set(GPIO2B1_UART2SOUT_NAME, GPIO2L_UART2_SOUT);
2294 rk29_mux_api_set(GPIO2B0_UART2SIN_NAME, GPIO2L_UART2_SIN);
2295 #ifdef CONFIG_UART2_CTS_RTS_RK29
2296 rk29_mux_api_set(GPIO2A7_UART2RTSN_NAME, GPIO2L_UART2_RTS_N);
2297 rk29_mux_api_set(GPIO2A6_UART2CTSN_NAME, GPIO2L_UART2_CTS_N);
2300 #ifdef CONFIG_UART3_RK29
2301 rk29_mux_api_set(GPIO2B3_UART3SOUT_NAME, GPIO2L_UART3_SOUT);
2302 rk29_mux_api_set(GPIO2B2_UART3SIN_NAME, GPIO2L_UART3_SIN);
2303 #ifdef CONFIG_UART3_CTS_RTS_RK29
2304 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_UART3_RTS_N);
2305 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_UART3_CTS_N);
2308 #ifdef CONFIG_SPIM0_RK29
2309 rk29_mux_api_set(GPIO2C0_SPI0CLK_NAME, GPIO2H_SPI0_CLK);
2310 rk29_mux_api_set(GPIO2C1_SPI0CSN0_NAME, GPIO2H_SPI0_CSN0);
2311 rk29_mux_api_set(GPIO2C2_SPI0TXD_NAME, GPIO2H_SPI0_TXD);
2312 rk29_mux_api_set(GPIO2C3_SPI0RXD_NAME, GPIO2H_SPI0_RXD);
2314 #ifdef CONFIG_SPIM1_RK29
2315 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME, GPIO2H_SPI1_CLK);
2316 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME, GPIO2H_SPI1_CSN0);
2317 rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME, GPIO2H_SPI1_TXD);
2318 rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME, GPIO2H_SPI1_RXD);
2320 #ifdef CONFIG_RK29_VMAC
2321 rk29_mux_api_set(GPIO4C0_RMIICLKOUT_RMIICLKIN_NAME, GPIO4H_RMII_CLKOUT);
2322 rk29_mux_api_set(GPIO4C1_RMIITXEN_MIITXEN_NAME, GPIO4H_RMII_TX_EN);
2323 rk29_mux_api_set(GPIO4C2_RMIITXD1_MIITXD1_NAME, GPIO4H_RMII_TXD1);
2324 rk29_mux_api_set(GPIO4C3_RMIITXD0_MIITXD0_NAME, GPIO4H_RMII_TXD0);
2325 rk29_mux_api_set(GPIO4C4_RMIIRXERR_MIIRXERR_NAME, GPIO4H_RMII_RX_ERR);
2326 rk29_mux_api_set(GPIO4C5_RMIICSRDVALID_MIIRXDVALID_NAME, GPIO4H_RMII_CSR_DVALID);
2327 rk29_mux_api_set(GPIO4C6_RMIIRXD1_MIIRXD1_NAME, GPIO4H_RMII_RXD1);
2328 rk29_mux_api_set(GPIO4C7_RMIIRXD0_MIIRXD0_NAME, GPIO4H_RMII_RXD0);
2330 rk29_mux_api_set(GPIO0A7_MIIMDCLK_NAME, GPIO0L_MII_MDCLK);
2331 rk29_mux_api_set(GPIO0A6_MIIMD_NAME, GPIO0L_MII_MD);
2333 #ifdef CONFIG_RK29_PWM_REGULATOR
2334 rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
2338 static struct platform_device *devices[] __initdata = {
2339 #ifdef CONFIG_UART1_RK29
2342 #ifdef CONFIG_UART0_RK29
2345 #ifdef CONFIG_UART2_RK29
2349 #ifdef CONFIG_RK29_PWM_REGULATOR
2350 &rk29_device_pwm_regulator,
2352 #ifdef CONFIG_SPIM0_RK29
2353 &rk29xx_device_spi0m,
2355 #ifdef CONFIG_SPIM1_RK29
2356 &rk29xx_device_spi1m,
2358 #ifdef CONFIG_ADC_RK29
2361 #ifdef CONFIG_I2C0_RK29
2364 #ifdef CONFIG_I2C1_RK29
2367 #ifdef CONFIG_I2C2_RK29
2370 #ifdef CONFIG_I2C3_RK29
2374 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
2375 &rk29_device_iis_2ch,
2377 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
2378 &rk29_device_iis_8ch,
2381 #ifdef CONFIG_KEYS_RK29
2384 #ifdef CONFIG_SDMMC0_RK29
2385 &rk29_device_sdmmc0,
2387 #ifdef CONFIG_SDMMC1_RK29
2388 &rk29_device_sdmmc1,
2391 #ifdef CONFIG_MTD_NAND_RK29XX
2392 &rk29xx_device_nand,
2395 #ifdef CONFIG_WIFI_CONTROL_FUNC
2396 &rk29sdk_wifi_device,
2403 #ifdef CONFIG_MTD_NAND_RK29
2407 #ifdef CONFIG_FB_RK29
2409 &rk29_device_dma_cpy,
2411 #ifdef CONFIG_BACKLIGHT_RK29_BL
2412 &rk29_device_backlight,
2414 #ifdef CONFIG_RK29_VMAC
2417 #ifdef CONFIG_VIVANTE
2420 #ifdef CONFIG_VIDEO_RK29
2421 &rk29_device_camera, /* ddl@rock-chips.com : camera support */
2422 #if (SENSOR_IIC_ADDR_0 != 0x00)
2423 &rk29_soc_camera_pdrv_0,
2425 &rk29_soc_camera_pdrv_1,
2426 &android_pmem_cam_device,
2428 &android_pmem_device,
2429 &rk29_vpu_mem_device,
2430 #ifdef CONFIG_USB20_OTG
2431 &rk29_device_usb20_otg,
2433 #ifdef CONFIG_USB20_HOST
2434 &rk29_device_usb20_host,
2436 #ifdef CONFIG_USB11_HOST
2437 &rk29_device_usb11_host,
2439 #ifdef CONFIG_USB_ANDROID
2440 &android_usb_device,
2441 &usb_mass_storage_device,
2443 #ifdef CONFIG_RK29_IPP
2446 #ifdef CONFIG_VIDEO_RK29XX_VOUT
2447 &rk29_v4l2_output_devce,
2451 #ifdef CONFIG_RK29_VMAC
2452 /*****************************************************************************************
2454 * author: lyx@rock-chips.com
2455 *****************************************************************************************/
2456 static int rk29_vmac_register_set(void)
2458 //config rk29 vmac as rmii, 100MHz
2459 u32 value= readl(RK29_GRF_BASE + 0xbc);
2460 value = (value & 0xfff7ff) | (0x400);
2461 writel(value, RK29_GRF_BASE + 0xbc);
2465 static int rk29_rmii_io_init(void)
2470 err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
2472 gpio_free(RK29_PIN6_PB0);
2473 printk("-------request RK29_PIN6_PB0 fail--------\n");
2477 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2478 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2483 static int rk29_rmii_io_deinit(void)
2486 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2487 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2489 gpio_free(RK29_PIN6_PB0);
2493 static int rk29_rmii_power_control(int enable)
2497 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
2498 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
2501 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2502 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2507 struct rk29_vmac_platform_data rk29_vmac_pdata = {
2508 .vmac_register_set = rk29_vmac_register_set,
2509 .rmii_io_init = rk29_rmii_io_init,
2510 .rmii_io_deinit = rk29_rmii_io_deinit,
2511 .rmii_power_control = rk29_rmii_power_control,
2515 /*****************************************************************************************
2517 * author: cmc@rock-chips.com
2518 *****************************************************************************************/
2519 #define SPI_CHIPSELECT_NUM 2
2520 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
2523 .cs_gpio = RK29_PIN2_PC1,
2524 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
2525 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
2529 .cs_gpio = RK29_PIN1_PA4,
2530 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
2531 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
2535 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
2538 .cs_gpio = RK29_PIN2_PC5,
2539 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
2540 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
2544 .cs_gpio = RK29_PIN1_PA3,
2545 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
2546 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
2550 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
2555 for (i=0; i<cs_num; i++) {
2556 rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
2563 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
2568 static int spi_io_fix_leakage_bug(void)
2571 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
2576 static int spi_io_resume_leakage_bug(void)
2579 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
2584 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
2585 .num_chipselect = SPI_CHIPSELECT_NUM,
2586 .chipselect_gpios = rk29xx_spi0_cs_gpios,
2587 .io_init = spi_io_init,
2588 .io_deinit = spi_io_deinit,
2589 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2590 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2593 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
2594 .num_chipselect = SPI_CHIPSELECT_NUM,
2595 .chipselect_gpios = rk29xx_spi1_cs_gpios,
2596 .io_init = spi_io_init,
2597 .io_deinit = spi_io_deinit,
2598 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2599 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2603 /*****************************************************************************************
2604 * xpt2046 touch panel
2605 * author: hhb@rock-chips.com
2606 *****************************************************************************************/
2607 #define XPT2046_GPIO_INT RK29_PIN4_PD5 //ä¸æ–è„š
2608 #define DEBOUNCE_REPTIME 3
2610 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
2611 static struct xpt2046_platform_data xpt2046_info = {
2616 .debounce_rep = DEBOUNCE_REPTIME,
2618 .gpio_pendown = XPT2046_GPIO_INT,
2619 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
2620 .pendown_iomux_mode = GPIO4H_GPIO4D5,
2621 .touch_virtualkey_length = 60,
2622 .penirq_recheck_delay_usecs = 1,
2623 #if defined(CONFIG_TOUCHSCREEN_480X800)
2628 .touch_ad_top = 3940,
2629 .touch_ad_bottom = 310,
2630 .touch_ad_left = 3772,
2631 .touch_ad_right = 340,
2632 #elif defined(CONFIG_TOUCHSCREEN_800X480)
2637 .touch_ad_top = 2447,
2638 .touch_ad_bottom = 207,
2639 .touch_ad_left = 5938,
2640 .touch_ad_right = 153,
2641 #elif defined(CONFIG_TOUCHSCREEN_320X480)
2646 .touch_ad_top = 3166,
2647 .touch_ad_bottom = 256,
2648 .touch_ad_left = 3658,
2649 .touch_ad_right = 380,
2652 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2653 static struct xpt2046_platform_data xpt2046_info = {
2658 .debounce_rep = DEBOUNCE_REPTIME,
2660 .gpio_pendown = XPT2046_GPIO_INT,
2661 .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
2662 .pendown_iomux_mode = GPIO4H_GPIO4D5,
2663 .touch_virtualkey_length = 60,
2664 .penirq_recheck_delay_usecs = 1,
2666 #if defined(CONFIG_TOUCHSCREEN_480X800)
2671 .screen_x = { 70, 410, 70, 410, 240},
2672 .screen_y = { 50, 50, 740, 740, 400},
2673 .uncali_x_default = { 3267, 831, 3139, 715, 1845 },
2674 .uncali_y_default = { 3638, 3664, 564, 591, 2087 },
2675 #elif defined(CONFIG_TOUCHSCREEN_800X480)
2680 .screen_x[5] = { 50, 750, 50, 750, 400};
2681 .screen_y[5] = { 40, 40, 440, 440, 240};
2682 .uncali_x_default[5] = { 438, 565, 3507, 3631, 2105 };
2683 .uncali_y_default[5] = { 3756, 489, 3792, 534, 2159 };
2684 #elif defined(CONFIG_TOUCHSCREEN_320X480)
2689 .screen_x[5] = { 50, 270, 50, 270, 160};
2690 .screen_y[5] = { 40, 40, 440, 440, 240};
2691 .uncali_x_default[5] = { 812, 3341, 851, 3371, 2183 };
2692 .uncali_y_default[5] = { 442, 435, 3193, 3195, 2004 };
2697 static struct spi_board_info board_spi_devices[] = {
2698 #if defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2700 .modalias = "xpt2046_ts",
2701 .chip_select = 0,// 2,
2702 .max_speed_hz = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
2704 .irq = XPT2046_GPIO_INT,
2705 .platform_data = &xpt2046_info,
2709 #if defined(CONFIG_MFD_WM831X_SPI)
2711 .modalias = "wm8310",
2713 .max_speed_hz = 12*1000*1000,
2715 .irq = RK29_PIN4_PD0,
2716 .platform_data = &wm831x_platdata,
2723 static void __init rk29_gic_init_irq(void)
2725 gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
2726 gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
2729 static void __init machine_rk29_init_irq(void)
2731 rk29_gic_init_irq();
2735 #define POWER_ON_PIN RK29_PIN4_PA4
2736 static void rk29_pm_power_off(void)
2738 printk(KERN_ERR "rk29_pm_power_off start...\n");
2739 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
2743 static void __init machine_rk29_board_init(void)
2745 rk29_board_iomux_init();
2747 gpio_request(POWER_ON_PIN,"poweronpin");
2748 gpio_set_value(POWER_ON_PIN, GPIO_HIGH);
2749 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
2750 pm_power_off = rk29_pm_power_off;
2752 #ifdef CONFIG_WIFI_CONTROL_FUNC
2753 rk29sdk_wifi_bt_gpio_control_init();
2756 platform_add_devices(devices, ARRAY_SIZE(devices));
2757 #ifdef CONFIG_I2C0_RK29
2758 i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
2759 ARRAY_SIZE(board_i2c0_devices));
2761 #ifdef CONFIG_I2C1_RK29
2762 i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
2763 ARRAY_SIZE(board_i2c1_devices));
2765 #ifdef CONFIG_I2C2_RK29
2766 i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
2767 ARRAY_SIZE(board_i2c2_devices));
2769 #ifdef CONFIG_I2C3_RK29
2770 i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
2771 ARRAY_SIZE(board_i2c3_devices));
2774 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2776 rk29sdk_init_wifi_mem();
2779 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
2780 char **cmdline, struct meminfo *mi)
2783 mi->bank[0].start = RK29_SDRAM_PHYS;
2784 mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
2785 mi->bank[0].size = LINUX_SIZE;
2788 static void __init machine_rk29_mapio(void)
2790 rk29_map_common_io();
2791 rk29_setup_early_printk();
2797 MACHINE_START(RK29, "RK29board")
2798 /* UART for LL DEBUG */
2799 .phys_io = RK29_UART1_PHYS,
2800 .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
2801 .boot_params = RK29_SDRAM_PHYS + 0x88000,
2802 .fixup = machine_rk29_fixup,
2803 .map_io = machine_rk29_mapio,
2804 .init_irq = machine_rk29_init_irq,
2805 .init_machine = machine_rk29_board_init,
2806 .timer = &rk29_timer,