1 /* arch/arm/mach-rk29/board-rk29.c
\r
3 * Copyright (C) 2010 ROCKCHIP, Inc.
\r
5 * This software is licensed under the terms of the GNU General Public
\r
6 * License version 2, as published by the Free Software Foundation, and
\r
7 * may be copied, distributed, and modified under those terms.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
16 #include <linux/kernel.h>
\r
17 #include <linux/init.h>
\r
18 #include <linux/platform_device.h>
\r
19 #include <linux/input.h>
\r
20 #include <linux/io.h>
\r
21 #include <linux/delay.h>
\r
22 #include <linux/i2c.h>
\r
23 #include <linux/spi/spi.h>
\r
24 #include <linux/mmc/host.h>
\r
25 #include <linux/android_pmem.h>
\r
26 #include <linux/usb/android_composite.h>
\r
28 #include <mach/hardware.h>
\r
29 #include <asm/setup.h>
\r
30 #include <asm/mach-types.h>
\r
31 #include <asm/mach/arch.h>
\r
32 #include <asm/mach/map.h>
\r
33 #include <asm/mach/flash.h>
\r
34 #include <asm/hardware/gic.h>
\r
36 #include <mach/iomux.h>
\r
37 #include <mach/gpio.h>
\r
38 #include <mach/irqs.h>
\r
39 #include <mach/rk29_iomap.h>
\r
40 #include <mach/board.h>
\r
41 #include <mach/rk29_nand.h>
\r
42 #include <mach/rk29_camera.h> /* ddl@rock-chips.com : camera support */
\r
43 #include <media/soc_camera.h> /* ddl@rock-chips.com : camera support */
\r
44 #include <mach/vpu_mem.h>
\r
47 #include <linux/mtd/nand.h>
\r
48 #include <linux/mtd/partitions.h>
\r
50 #include "devices.h"
\r
51 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
\r
54 /* Set memory size of pmem */
\r
55 #ifdef CONFIG_MACH_RK29SDK_MEM_SIZE_M
56 #define SDRAM_SIZE (CONFIG_MACH_RK29SDK_MEM_SIZE_M * SZ_1M)
58 #define SDRAM_SIZE SZ_512M
60 #define PMEM_GPU_SIZE SZ_48M
\r
61 #define PMEM_UI_SIZE SZ_32M
\r
62 #define PMEM_VPU_SIZE SZ_32M
\r
63 #define PMEM_CAM_SIZE SZ_16M
\r
65 #define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
\r
66 #define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
\r
67 #define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
\r
68 #define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
\r
69 #define LINUX_SIZE (PMEM_CAM_BASE - RK29_SDRAM_PHYS)
\r
71 extern struct sys_timer rk29_timer;
\r
73 int rk29_nand_io_init(void)
\r
78 struct rk29_nand_platform_data rk29_nand_data = {
\r
79 .width = 1, /* data bus width in bytes */
\r
80 .hw_ecc = 1, /* hw ecc 0: soft ecc */
\r
82 .io_init = rk29_nand_io_init,
\r
85 static struct rk29_gpio_bank rk29_gpiobankinit[] = {
\r
87 .id = RK29_ID_GPIO0,
\r
88 .offset = RK29_GPIO0_BASE,
\r
91 .id = RK29_ID_GPIO1,
\r
92 .offset = RK29_GPIO1_BASE,
\r
95 .id = RK29_ID_GPIO2,
\r
96 .offset = RK29_GPIO2_BASE,
\r
99 .id = RK29_ID_GPIO3,
\r
100 .offset = RK29_GPIO3_BASE,
\r
103 .id = RK29_ID_GPIO4,
\r
104 .offset = RK29_GPIO4_BASE,
\r
107 .id = RK29_ID_GPIO5,
\r
108 .offset = RK29_GPIO5_BASE,
\r
111 .id = RK29_ID_GPIO6,
\r
112 .offset = RK29_GPIO6_BASE,
\r
116 /*****************************************************************************************
\r
118 * author: zyw@rock-chips.com
\r
119 *****************************************************************************************/
\r
120 //#ifdef CONFIG_LCD_TD043MGEA1
\r
121 #define LCD_TXD_PIN INVALID_GPIO
\r
122 #define LCD_CLK_PIN INVALID_GPIO
\r
123 #define LCD_CS_PIN INVALID_GPIO
\r
124 /*****************************************************************************************
\r
125 * frame buffe devices
\r
126 * author: zyw@rock-chips.com
\r
127 *****************************************************************************************/
\r
129 #define FB_DISPLAY_ON_PIN RK29_PIN6_PD0
\r
130 #define FB_LCD_STANDBY_PIN RK29_PIN6_PD1
\r
131 #define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
\r
132 #define FB_MCU_FMK_PIN INVALID_GPIO
\r
134 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
\r
135 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
\r
138 static int rk29_lcd_io_init(void)
\r
144 static int rk29_lcd_io_deinit(void)
\r
150 struct rk29lcd_info rk29_lcd_info = {
\r
151 .txd_pin = LCD_TXD_PIN,
\r
152 .clk_pin = LCD_CLK_PIN,
\r
153 .cs_pin = LCD_CS_PIN,
\r
154 .io_init = rk29_lcd_io_init,
\r
155 .io_deinit = rk29_lcd_io_deinit,
\r
159 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
\r
162 if(fb_setting->mcu_fmk_en && (FB_MCU_FMK_PIN != INVALID_GPIO))
\r
164 ret = gpio_request(FB_MCU_FMK_PIN, NULL);
\r
167 gpio_free(FB_MCU_FMK_PIN);
\r
168 printk(">>>>>> FB_MCU_FMK_PIN gpio_request err \n ");
\r
170 gpio_direction_input(FB_MCU_FMK_PIN);
\r
172 if(fb_setting->disp_on_en && (FB_DISPLAY_ON_PIN != INVALID_GPIO))
\r
174 ret = gpio_request(FB_DISPLAY_ON_PIN, NULL);
\r
177 gpio_free(FB_DISPLAY_ON_PIN);
\r
178 printk(">>>>>> FB_DISPLAY_ON_PIN gpio_request err \n ");
\r
182 if(fb_setting->disp_on_en && (FB_LCD_STANDBY_PIN != INVALID_GPIO))
\r
184 ret = gpio_request(FB_LCD_STANDBY_PIN, NULL);
\r
187 gpio_free(FB_LCD_STANDBY_PIN);
\r
188 printk(">>>>>> FB_LCD_STANDBY_PIN gpio_request err \n ");
\r
192 if(FB_LCD_CABC_EN_PIN != INVALID_GPIO)
\r
194 ret = gpio_request(FB_LCD_CABC_EN_PIN, NULL);
\r
197 gpio_free(FB_LCD_CABC_EN_PIN);
\r
198 printk(">>>>>> FB_LCD_CABC_EN_PIN gpio_request err \n ");
\r
200 gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
\r
201 gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
\r
207 struct rk29fb_info rk29_fb_info = {
\r
209 .disp_on_pin = FB_DISPLAY_ON_PIN,
\r
210 .disp_on_value = FB_DISPLAY_ON_VALUE,
\r
211 .standby_pin = FB_LCD_STANDBY_PIN,
\r
212 .standby_value = FB_LCD_STANDBY_VALUE,
\r
213 .mcu_fmk_pin = FB_MCU_FMK_PIN,
\r
214 .lcd_info = &rk29_lcd_info,
\r
215 .io_init = rk29_fb_io_init,
\r
218 static struct android_pmem_platform_data android_pmem_pdata = {
\r
220 .start = PMEM_UI_BASE,
\r
221 .size = PMEM_UI_SIZE,
\r
226 static struct platform_device android_pmem_device = {
\r
227 .name = "android_pmem",
\r
230 .platform_data = &android_pmem_pdata,
\r
235 static struct android_pmem_platform_data android_pmem_cam_pdata = {
\r
236 .name = "pmem_cam",
\r
237 .start = PMEM_CAM_BASE,
\r
238 .size = PMEM_CAM_SIZE,
\r
243 static struct platform_device android_pmem_cam_device = {
\r
244 .name = "android_pmem",
\r
247 .platform_data = &android_pmem_cam_pdata,
\r
252 static struct vpu_mem_platform_data vpu_mem_pdata = {
\r
254 .start = PMEM_VPU_BASE,
\r
255 .size = PMEM_VPU_SIZE,
\r
259 static struct platform_device rk29_vpu_mem_device = {
\r
263 .platform_data = &vpu_mem_pdata,
\r
268 /*HANNSTAR_P1003 touch*/
\r
269 #if defined (CONFIG_HANNSTAR_P1003)
\r
270 #define TOUCH_RESET_PIN RK29_PIN6_PC3
\r
271 #define TOUCH_INT_PIN RK29_PIN0_PA2
\r
273 int p1003_init_platform_hw(void)
\r
275 if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
\r
276 gpio_free(TOUCH_RESET_PIN);
\r
277 printk("p1003_init_platform_hw gpio_request error\n");
\r
281 if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
\r
282 gpio_free(TOUCH_INT_PIN);
\r
283 printk("p1003_init_platform_hw gpio_request error\n");
\r
286 gpio_pull_updown(TOUCH_INT_PIN, 1);
\r
287 gpio_direction_output(TOUCH_RESET_PIN, 0);
\r
289 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
\r
291 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
\r
297 struct p1003_platform_data p1003_info = {
\r
299 .init_platform_hw= p1003_init_platform_hw,
\r
305 /*****************************************************************************************
\r
307 * author: kfx@rock-chips.com
\r
308 *****************************************************************************************/
\r
309 static int rk29_i2c0_io_init(void)
\r
311 rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
\r
312 rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
\r
316 static int rk29_i2c1_io_init(void)
\r
318 rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
\r
319 rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
\r
322 static int rk29_i2c2_io_init(void)
\r
324 rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
\r
325 rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
\r
329 static int rk29_i2c3_io_init(void)
\r
331 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
\r
332 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
\r
336 struct rk29_i2c_platform_data default_i2c0_data = {
\r
339 .slave_addr = 0xff,
\r
340 .scl_rate = 400*1000,
\r
341 .mode = I2C_MODE_IRQ,
\r
342 .io_init = rk29_i2c0_io_init,
\r
345 struct rk29_i2c_platform_data default_i2c1_data = {
\r
348 .slave_addr = 0xff,
\r
349 .scl_rate = 400*1000,
\r
350 .mode = I2C_MODE_POLL,
\r
351 .io_init = rk29_i2c1_io_init,
\r
354 struct rk29_i2c_platform_data default_i2c2_data = {
\r
357 .slave_addr = 0xff,
\r
358 .scl_rate = 400*1000,
\r
359 .mode = I2C_MODE_IRQ,
\r
360 .io_init = rk29_i2c2_io_init,
\r
363 struct rk29_i2c_platform_data default_i2c3_data = {
\r
366 .slave_addr = 0xff,
\r
367 .scl_rate = 400*1000,
\r
368 .mode = I2C_MODE_POLL,
\r
369 .io_init = rk29_i2c3_io_init,
\r
372 #ifdef CONFIG_I2C0_RK29
\r
373 static struct i2c_board_info __initdata board_i2c0_devices[] = {
\r
374 #if defined (CONFIG_RK1000_CONTROL)
\r
376 .type = "rk1000_control",
\r
381 #if defined (CONFIG_SND_SOC_RK1000)
\r
383 .type = "rk1000_i2c_codec",
\r
388 #if defined (CONFIG_SND_SOC_WM8900)
\r
395 #if defined (CONFIG_BATTERY_STC3100)
\r
397 .type = "stc3100-battery",
\r
402 #if defined (CONFIG_BATTERY_BQ27510)
\r
404 .type = "bq27510-battery",
\r
409 #if defined (CONFIG_RTC_HYM8563)
\r
411 .type = "rtc_hym8563",
\r
414 ///.irq = RK2818_PIN_PA4,
\r
420 #ifdef CONFIG_I2C1_RK29
\r
421 static struct i2c_board_info __initdata board_i2c1_devices[] = {
\r
422 #if defined (CONFIG_RK1000_CONTROL1)
\r
424 .type = "rk1000_control",
\r
429 #if defined (CONFIG_SENSORS_AK8973)
\r
434 .irq = RK29_PIN4_PA1,
\r
437 #if defined (CONFIG_SENSORS_AK8975)
\r
442 .irq = RK29_PIN4_PA1,
\r
448 #ifdef CONFIG_I2C2_RK29
\r
449 static struct i2c_board_info __initdata board_i2c2_devices[] = {
\r
450 #if defined (CONFIG_HANNSTAR_P1003)
\r
452 .type = "p1003_touch",
\r
455 .irq = RK29_PIN0_PA2,
\r
456 .platform_data = &p1003_info,
\r
462 #ifdef CONFIG_I2C3_RK29
\r
463 static struct i2c_board_info __initdata board_i2c3_devices[] = {
\r
467 /*****************************************************************************************
\r
469 * author: ddl@rock-chips.com
\r
470 *****************************************************************************************/
\r
471 #ifdef CONFIG_VIDEO_RK29
\r
472 #define SENSOR_NAME_0 RK29_CAM_SENSOR_NAME_OV5642 /* back camera sensor */
\r
473 #define SENSOR_IIC_ADDR_0 0x78
\r
474 #define SENSOR_IIC_ADAPTER_ID_0 1
\r
475 #define SENSOR_POWER_PIN_0 RK29_PIN6_PB7
\r
476 #define SENSOR_RESET_PIN_0 INVALID_GPIO
\r
477 #define SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
\r
478 #define SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
\r
481 #define SENSOR_NAME_1 RK29_CAM_SENSOR_NAME_OV2659 /* front camera sensor */
\r
482 #define SENSOR_IIC_ADDR_1 0x60
\r
483 #define SENSOR_IIC_ADAPTER_ID_1 1
\r
484 #define SENSOR_POWER_PIN_1 RK29_PIN5_PD7
\r
485 #define SENSOR_RESET_PIN_1 INVALID_GPIO
\r
486 #define SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
\r
487 #define SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
\r
489 static int rk29_sensor_io_init(void);
\r
490 static int rk29_sensor_io_deinit(void);
\r
492 struct rk29camera_platform_data rk29_camera_platform_data = {
\r
493 .io_init = rk29_sensor_io_init,
\r
494 .io_deinit = rk29_sensor_io_deinit,
\r
497 .gpio_reset = SENSOR_RESET_PIN_0,
\r
498 .gpio_power = SENSOR_POWER_PIN_0,
\r
499 .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_0|SENSOR_RESETACTIVE_LEVEL_0),
\r
500 .dev_name = SENSOR_NAME_0,
\r
502 .gpio_reset = SENSOR_RESET_PIN_1,
\r
503 .gpio_power = SENSOR_POWER_PIN_1,
\r
504 .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_1|SENSOR_RESETACTIVE_LEVEL_1),
\r
505 .dev_name = SENSOR_NAME_1,
\r
510 static int rk29_sensor_io_init(void)
\r
513 unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
\r
514 unsigned int camera_ioflag;
\r
516 for (i=0; i<2; i++) {
\r
517 camera_reset = rk29_camera_platform_data.gpio_res[i].gpio_reset;
\r
518 camera_power = rk29_camera_platform_data.gpio_res[i].gpio_power;
\r
519 camera_ioflag = rk29_camera_platform_data.gpio_res[i].gpio_flag;
\r
521 if (camera_power != INVALID_GPIO) {
\r
522 ret = gpio_request(camera_power, "camera power");
\r
526 gpio_set_value(camera_reset, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
\r
527 gpio_direction_output(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
\r
529 //printk("\n%s....%d %x \n",__FUNCTION__,__LINE__,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
\r
533 if (camera_reset != INVALID_GPIO) {
\r
534 ret = gpio_request(camera_reset, "camera reset");
\r
536 if (camera_power != INVALID_GPIO)
\r
537 gpio_free(camera_power);
\r
542 gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
\r
543 gpio_direction_output(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
\r
545 //printk("\n%s....%d %x \n",__FUNCTION__,__LINE__,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
\r
553 static int rk29_sensor_io_deinit(void)
\r
556 unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
\r
558 //printk("\n%s....%d ******** ddl *********\n",__FUNCTION__,__LINE__);
\r
560 for (i=0; i<2; i++) {
\r
561 camera_reset = rk29_camera_platform_data.gpio_res[i].gpio_reset;
\r
562 camera_power = rk29_camera_platform_data.gpio_res[i].gpio_power;
\r
564 if (camera_power != INVALID_GPIO){
\r
565 gpio_direction_input(camera_power);
\r
566 gpio_free(camera_power);
\r
569 if (camera_reset != INVALID_GPIO) {
\r
570 gpio_direction_input(camera_reset);
\r
571 gpio_free(camera_reset);
\r
579 static int rk29_sensor_power(struct device *dev, int on)
\r
581 unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
\r
582 unsigned int camera_ioflag;
\r
584 if(rk29_camera_platform_data.gpio_res[0].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[0].dev_name, dev_name(dev)) == 0)) {
\r
585 camera_reset = rk29_camera_platform_data.gpio_res[0].gpio_reset;
\r
586 camera_power = rk29_camera_platform_data.gpio_res[0].gpio_power;
\r
587 camera_ioflag = rk29_camera_platform_data.gpio_res[0].gpio_flag;
\r
588 } 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)) {
\r
589 camera_reset = rk29_camera_platform_data.gpio_res[1].gpio_reset;
\r
590 camera_power = rk29_camera_platform_data.gpio_res[1].gpio_power;
\r
591 camera_ioflag = rk29_camera_platform_data.gpio_res[1].gpio_flag;
\r
594 if (camera_reset != INVALID_GPIO) {
\r
595 gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
\r
596 //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));
\r
598 if (camera_power != INVALID_GPIO) {
\r
600 gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
\r
601 //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));
\r
603 gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
\r
604 //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));
\r
608 if (camera_reset != INVALID_GPIO) {
\r
610 msleep(3); /* delay 3 ms */
\r
611 gpio_set_value(camera_reset,(((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
\r
612 //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));
\r
618 static struct i2c_board_info rk29_i2c_cam_info_0[] = {
\r
620 I2C_BOARD_INFO(SENSOR_NAME_0, SENSOR_IIC_ADDR_0>>1)
\r
624 struct soc_camera_link rk29_iclink_0 = {
\r
625 .bus_id = RK29_CAM_PLATFORM_DEV_ID,
\r
626 .power = rk29_sensor_power,
\r
627 .board_info = &rk29_i2c_cam_info_0[0],
\r
628 .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_0,
\r
629 .module_name = SENSOR_NAME_0,
\r
632 /*platform_device : soc-camera need */
\r
633 struct platform_device rk29_soc_camera_pdrv_0 = {
\r
634 .name = "soc-camera-pdrv",
\r
637 .init_name = SENSOR_NAME_0,
\r
638 .platform_data = &rk29_iclink_0,
\r
642 static struct i2c_board_info rk29_i2c_cam_info_1[] = {
\r
644 I2C_BOARD_INFO(SENSOR_NAME_1, SENSOR_IIC_ADDR_1>>1)
\r
648 struct soc_camera_link rk29_iclink_1 = {
\r
649 .bus_id = RK29_CAM_PLATFORM_DEV_ID,
\r
650 .power = rk29_sensor_power,
\r
651 .board_info = &rk29_i2c_cam_info_1[0],
\r
652 .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_1,
\r
653 .module_name = SENSOR_NAME_1,
\r
656 /*platform_device : soc-camera need */
\r
657 struct platform_device rk29_soc_camera_pdrv_1 = {
\r
658 .name = "soc-camera-pdrv",
\r
661 .init_name = SENSOR_NAME_1,
\r
662 .platform_data = &rk29_iclink_1,
\r
667 extern struct platform_device rk29_device_camera;
\r
669 /*****************************************************************************************
\r
670 * backlight devices
\r
671 * author: nzy@rock-chips.com
\r
672 *****************************************************************************************/
\r
673 #ifdef CONFIG_BACKLIGHT_RK29_BL
\r
675 GPIO1B5_PWM0_NAME, GPIO1L_PWM0
\r
676 GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_PWM1
\r
677 GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME, GPIO2L_PWM2
\r
678 GPIO1A5_EMMCPWREN_PWM3_NAME, GPIO1L_PWM3
\r
682 #define PWM_MUX_NAME GPIO1B5_PWM0_NAME
\r
683 #define PWM_MUX_MODE GPIO1L_PWM0
\r
684 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
\r
685 #define PWM_EFFECT_VALUE 1
\r
687 //#define LCD_DISP_ON_PIN
\r
689 #ifdef LCD_DISP_ON_PIN
\r
690 #define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
\r
691 #define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
\r
693 #define BL_EN_PIN GPIO0L_GPIO0A5
\r
694 #define BL_EN_VALUE GPIO_HIGH
\r
696 static int rk29_backlight_io_init(void)
\r
700 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
\r
701 #ifdef LCD_DISP_ON_PIN
\r
702 rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
\r
704 ret = gpio_request(BL_EN_PIN, NULL);
\r
707 gpio_free(BL_EN_PIN);
\r
710 gpio_direction_output(BL_EN_PIN, 0);
\r
711 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
\r
716 static int rk29_backlight_io_deinit(void)
\r
719 #ifdef LCD_DISP_ON_PIN
\r
720 gpio_free(BL_EN_PIN);
\r
722 rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
\r
725 struct rk29_bl_info rk29_bl_info = {
\r
727 .bl_ref = PWM_EFFECT_VALUE,
\r
728 .io_init = rk29_backlight_io_init,
\r
729 .io_deinit = rk29_backlight_io_deinit,
\r
732 /*****************************************************************************************
\r
734 *****************************************************************************************/
\r
735 #ifdef CONFIG_SDMMC0_RK29
\r
736 static int rk29_sdmmc0_cfg_gpio(void)
\r
738 rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
\r
739 rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
\r
740 rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
\r
741 rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
\r
742 rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
\r
743 rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
\r
744 rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);
\r
745 rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
\r
746 gpio_request(RK29_PIN5_PD5,"sdmmc");
\r
747 gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
\r
749 gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
\r
753 #define CONFIG_SDMMC0_USE_DMA
\r
754 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
\r
755 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
\r
756 MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
\r
757 MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
\r
758 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
\r
759 .io_init = rk29_sdmmc0_cfg_gpio,
\r
760 .dma_name = "sd_mmc",
\r
761 #ifdef CONFIG_SDMMC0_USE_DMA
\r
768 #ifdef CONFIG_SDMMC1_RK29
\r
769 //#define CONFIG_SDMMC1_USE_DMA
\r
770 static int rk29_sdmmc1_cfg_gpio(void)
\r
772 rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
\r
773 rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
\r
774 rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
\r
775 rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
\r
776 rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
\r
777 rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
\r
778 //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
\r
782 #ifdef CONFIG_WIFI_CONTROL_FUNC
783 static int rk29sdk_wifi_status(struct device *dev);
784 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
\r
787 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK29_PIN1_PD6
789 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
\r
790 .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
\r
791 MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
\r
792 MMC_VDD_32_33|MMC_VDD_33_34),
\r
793 .host_caps = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
\r
794 MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
\r
795 .io_init = rk29_sdmmc1_cfg_gpio,
\r
796 .dma_name = "sdio",
\r
797 #ifdef CONFIG_SDMMC1_USE_DMA
\r
802 #ifdef CONFIG_WIFI_CONTROL_FUNC
803 .status = rk29sdk_wifi_status,
804 .register_status_notify = rk29sdk_wifi_status_register,
806 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
810 #ifdef CONFIG_WIFI_CONTROL_FUNC
811 #define RK29SDK_WIFI_BT_GPIO_POWER_N RK29_PIN5_PD6
812 #define RK29SDK_WIFI_GPIO_RESET_N RK29_PIN6_PC0
813 #define RK29SDK_BT_GPIO_RESET_N RK29_PIN6_PC4
815 static int rk29sdk_wifi_cd = 0; /* wifi virtual 'card detect' status */
816 static void (*wifi_status_cb)(int card_present, void *dev_id);
817 static void *wifi_status_cb_devid;
818 int rk29sdk_wifi_power_state = 0;
819 int rk29sdk_bt_power_state = 0;
821 static int rk29sdk_wifi_status(struct device *dev)
823 return rk29sdk_wifi_cd;
826 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
830 wifi_status_cb = callback;
831 wifi_status_cb_devid = dev_id;
835 static int rk29sdk_wifi_bt_gpio_control_init(void)
837 if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
838 pr_info("%s: request wifi_bt power gpio failed\n", __func__);
842 if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
843 pr_info("%s: request wifi reset gpio failed\n", __func__);
844 gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
848 if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
849 pr_info("%s: request bt reset gpio failed\n", __func__);
850 gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
854 gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
855 gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
856 gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
858 pr_info("%s: init finished\n",__func__);
863 static int rk29sdk_wifi_power(int on)
865 pr_info("%s: %d\n", __func__, on);
867 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
869 pr_info("wifi turn on power\n");
871 if (!rk29sdk_bt_power_state){
872 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
874 pr_info("wifi shut off power\n");
877 pr_info("wifi shouldn't shut off power, bt is using it!\n");
882 rk29sdk_wifi_power_state = on;
886 static int rk29sdk_wifi_reset_state;
887 static int rk29sdk_wifi_reset(int on)
889 pr_info("%s: %d\n", __func__, on);
890 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
892 rk29sdk_wifi_reset_state = on;
896 static int rk29sdk_wifi_set_carddetect(int val)
898 pr_info("%s:%d\n", __func__, val);
899 rk29sdk_wifi_cd = val;
901 wifi_status_cb(val, wifi_status_cb_devid);
903 pr_warning("%s, nobody to notify\n", __func__);
908 static struct wifi_platform_data rk29sdk_wifi_control = {
909 .set_power = rk29sdk_wifi_power,
910 .set_reset = rk29sdk_wifi_reset,
911 .set_carddetect = rk29sdk_wifi_set_carddetect,
913 static struct platform_device rk29sdk_wifi_device = {
914 .name = "bcm4329_wlan",
917 .platform_data = &rk29sdk_wifi_control,
922 #ifdef CONFIG_VIVANTE
\r
923 static struct resource resources_gpu[] = {
\r
928 .flags = IORESOURCE_IRQ,
\r
931 .name = "gpu_base",
\r
932 .start = RK29_GPU_PHYS,
\r
933 .end = RK29_GPU_PHYS + (256 << 10),
\r
934 .flags = IORESOURCE_MEM,
\r
938 .start = PMEM_GPU_BASE,
\r
939 .end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
\r
940 .flags = IORESOURCE_MEM,
\r
943 struct platform_device rk29_device_gpu = {
\r
946 .num_resources = ARRAY_SIZE(resources_gpu),
\r
947 .resource = resources_gpu,
\r
950 #ifdef CONFIG_KEYS_RK29
\r
951 extern struct rk29_keys_platform_data rk29_keys_pdata;
\r
952 static struct platform_device rk29_device_keys = {
\r
953 .name = "rk29-keypad",
\r
956 .platform_data = &rk29_keys_pdata,
\r
960 /********************usb*********************/
\r
961 struct usb_mass_storage_platform_data mass_storage_pdata = {
\r
963 .vendor = "RockChip",
\r
964 .product = "rk9 sdk",
\r
968 static void __init rk29_board_iomux_init(void)
\r
970 #ifdef CONFIG_UART0_RK29
\r
971 rk29_mux_api_set(GPIO1B7_UART0SOUT_NAME, GPIO1L_UART0_SOUT);
\r
972 rk29_mux_api_set(GPIO1B6_UART0SIN_NAME, GPIO1L_UART0_SIN);
\r
973 #ifdef CONFIG_UART0_CTS_RTS_RK29
\r
974 rk29_mux_api_set(GPIO1C1_UART0RTSN_SDMMC1WRITEPRT_NAME, GPIO1H_UART0_RTS_N);
\r
975 rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_UART0_CTS_N);
\r
978 #ifdef CONFIG_UART1_RK29
\r
979 rk29_mux_api_set(GPIO2A5_UART1SOUT_NAME, GPIO2L_UART1_SOUT);
\r
980 rk29_mux_api_set(GPIO2A4_UART1SIN_NAME, GPIO2L_UART1_SIN);
\r
982 #ifdef CONFIG_UART2_RK29
\r
983 rk29_mux_api_set(GPIO2B1_UART2SOUT_NAME, GPIO2L_UART2_SOUT);
\r
984 rk29_mux_api_set(GPIO2B0_UART2SIN_NAME, GPIO2L_UART2_SIN);
\r
985 #ifdef CONFIG_UART2_CTS_RTS_RK29
\r
986 rk29_mux_api_set(GPIO2A7_UART2RTSN_NAME, GPIO2L_UART2_RTS_N);
\r
987 rk29_mux_api_set(GPIO2A6_UART2CTSN_NAME, GPIO2L_UART2_CTS_N);
\r
990 #ifdef CONFIG_UART3_RK29
\r
991 rk29_mux_api_set(GPIO2B3_UART3SOUT_NAME, GPIO2L_UART3_SOUT);
\r
992 rk29_mux_api_set(GPIO2B2_UART3SIN_NAME, GPIO2L_UART3_SIN);
\r
993 #ifdef CONFIG_UART3_CTS_RTS_RK29
\r
994 rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_UART3_RTS_N);
\r
995 rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_UART3_CTS_N);
\r
998 #ifdef CONFIG_SPIM0_RK29
\r
999 rk29_mux_api_set(GPIO2C0_SPI0CLK_NAME, GPIO2H_SPI0_CLK);
\r
1000 rk29_mux_api_set(GPIO2C1_SPI0CSN0_NAME, GPIO2H_SPI0_CSN0);
\r
1001 rk29_mux_api_set(GPIO2C2_SPI0TXD_NAME, GPIO2H_SPI0_TXD);
\r
1002 rk29_mux_api_set(GPIO2C3_SPI0RXD_NAME, GPIO2H_SPI0_RXD);
\r
1004 #ifdef CONFIG_SPIM1_RK29
\r
1005 rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME, GPIO2H_SPI1_CLK);
\r
1006 rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME, GPIO2H_SPI1_CSN0);
\r
1007 rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME, GPIO2H_SPI1_TXD);
\r
1008 rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME, GPIO2H_SPI1_RXD);
\r
1012 static struct platform_device *devices[] __initdata = {
\r
1013 #ifdef CONFIG_UART1_RK29
\r
1014 &rk29_device_uart1,
\r
1016 #ifdef CONFIG_SPIM0_RK29
\r
1017 &rk29xx_device_spi0m,
\r
1019 #ifdef CONFIG_SPIM1_RK29
\r
1020 &rk29xx_device_spi1m,
\r
1022 #ifdef CONFIG_ADC_RK29
\r
1025 #ifdef CONFIG_I2C0_RK29
\r
1026 &rk29_device_i2c0,
\r
1028 #ifdef CONFIG_I2C1_RK29
\r
1029 &rk29_device_i2c1,
\r
1031 #ifdef CONFIG_I2C2_RK29
\r
1032 &rk29_device_i2c2,
\r
1034 #ifdef CONFIG_I2C3_RK29
\r
1035 &rk29_device_i2c3,
\r
1038 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
\r
1039 &rk29_device_iis_2ch,
\r
1041 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
\r
1042 &rk29_device_iis_8ch,
\r
1045 #ifdef CONFIG_KEYS_RK29
\r
1046 &rk29_device_keys,
\r
1048 #ifdef CONFIG_SDMMC0_RK29
\r
1049 &rk29_device_sdmmc0,
\r
1051 #ifdef CONFIG_SDMMC1_RK29
\r
1052 &rk29_device_sdmmc1,
\r
1055 #ifdef CONFIG_MTD_NAND_RK29XX
\r
1056 &rk29xx_device_nand,
\r
1059 #ifdef CONFIG_WIFI_CONTROL_FUNC
1060 &rk29sdk_wifi_device,
1062 #ifdef CONFIG_MTD_NAND_RK29
\r
1063 &rk29_device_nand,
\r
1066 #ifdef CONFIG_FB_RK29
\r
1069 #ifdef CONFIG_BACKLIGHT_RK29_BL
\r
1070 &rk29_device_backlight,
\r
1072 #ifdef CONFIG_VIVANTE
\r
1075 #ifdef CONFIG_VIDEO_RK29
\r
1076 &rk29_device_camera, /* ddl@rock-chips.com : camera support */
\r
1077 &rk29_soc_camera_pdrv_0,
\r
1078 &rk29_soc_camera_pdrv_1,
\r
1079 &android_pmem_cam_device,
\r
1081 &android_pmem_device,
\r
1082 &rk29_vpu_mem_device,
\r
1083 #ifdef CONFIG_DWC_OTG
\r
1084 &rk29_device_dwc_otg,
\r
1086 #ifdef CONFIG_USB_ANDROID
\r
1087 &android_usb_device,
\r
1088 &usb_mass_storage_device,
\r
1092 /*****************************************************************************************
\r
1094 * author: cmc@rock-chips.com
\r
1095 *****************************************************************************************/
\r
1096 #define SPI_CHIPSELECT_NUM 2
\r
1097 struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
\r
1099 .name = "spi0 cs0",
\r
1100 .cs_gpio = RK29_PIN2_PC1,
\r
1101 .cs_iomux_name = NULL,
\r
1104 .name = "spi0 cs1",
\r
1105 .cs_gpio = RK29_PIN1_PA4,
\r
1106 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
\r
1107 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
\r
1111 struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
\r
1113 .name = "spi1 cs0",
\r
1114 .cs_gpio = RK29_PIN2_PC5,
\r
1115 .cs_iomux_name = NULL,
\r
1118 .name = "spi1 cs1",
\r
1119 .cs_gpio = RK29_PIN1_PA3,
\r
1120 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
\r
1121 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
\r
1125 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
\r
1132 for (i=0; i<cs_num; i++) {
\r
1133 rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
\r
1134 ret = gpio_request(cs_gpios[i].cs_gpio, cs_gpios[i].name);
\r
1136 for (j=0;j<i;j++) {
\r
1137 gpio_free(cs_gpios[j].cs_gpio);
\r
1138 //rk29_mux_api_mode_resume(cs_gpios[j].cs_iomux_name);
\r
1140 printk("[fun:%s, line:%d], gpio request err\n", __func__, __LINE__);
\r
1143 gpio_direction_output(cs_gpios[i].cs_gpio, GPIO_HIGH);
\r
1150 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
\r
1156 for (i=0; i<cs_num; i++) {
\r
1157 gpio_free(cs_gpios[i].cs_gpio);
\r
1158 //rk29_mux_api_mode_resume(cs_gpios[i].cs_iomux_name);
\r
1165 static int spi_io_fix_leakage_bug(void)
\r
1168 gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
\r
1173 static int spi_io_resume_leakage_bug(void)
\r
1176 gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
\r
1181 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
\r
1182 .num_chipselect = SPI_CHIPSELECT_NUM,
\r
1183 .chipselect_gpios = rk29xx_spi0_cs_gpios,
\r
1184 .io_init = spi_io_init,
\r
1185 .io_deinit = spi_io_deinit,
\r
1186 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
\r
1187 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
\r
1190 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
\r
1191 .num_chipselect = SPI_CHIPSELECT_NUM,
\r
1192 .chipselect_gpios = rk29xx_spi1_cs_gpios,
\r
1193 .io_init = spi_io_init,
\r
1194 .io_deinit = spi_io_deinit,
\r
1195 .io_fix_leakage_bug = spi_io_fix_leakage_bug,
\r
1196 .io_resume_leakage_bug = spi_io_resume_leakage_bug,
\r
1199 /*****************************************************************************************
\r
1200 * xpt2046 touch panel
\r
1201 * author: cmc@rock-chips.com
\r
1202 *****************************************************************************************/
\r
1203 #define XPT2046_GPIO_INT RK29_PIN0_PA3
\r
1204 #define DEBOUNCE_REPTIME 3
\r
1206 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI)
\r
1207 static struct xpt2046_platform_data xpt2046_info = {
\r
1209 .keep_vref_on = 1,
\r
1215 .debounce_max = 7,
\r
1216 .debounce_rep = DEBOUNCE_REPTIME,
\r
1217 .debounce_tol = 20,
\r
1218 .gpio_pendown = XPT2046_GPIO_INT,
\r
1219 .penirq_recheck_delay_usecs = 1,
\r
1221 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
\r
1222 static struct xpt2046_platform_data xpt2046_info = {
\r
1224 .keep_vref_on = 1,
\r
1230 .debounce_max = 7,
\r
1231 .debounce_rep = DEBOUNCE_REPTIME,
\r
1232 .debounce_tol = 20,
\r
1233 .gpio_pendown = XPT2046_GPIO_INT,
\r
1234 .penirq_recheck_delay_usecs = 1,
\r
1236 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
\r
1237 static struct xpt2046_platform_data xpt2046_info = {
\r
1239 .keep_vref_on = 1,
\r
1245 .debounce_max = 7,
\r
1246 .debounce_rep = DEBOUNCE_REPTIME,
\r
1247 .debounce_tol = 20,
\r
1248 .gpio_pendown = XPT2046_GPIO_INT,
\r
1250 .penirq_recheck_delay_usecs = 1,
\r
1252 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
\r
1253 static struct xpt2046_platform_data xpt2046_info = {
\r
1255 .keep_vref_on = 1,
\r
1261 .debounce_max = 7,
\r
1262 .debounce_rep = DEBOUNCE_REPTIME,
\r
1263 .debounce_tol = 20,
\r
1264 .gpio_pendown = XPT2046_GPIO_INT,
\r
1266 .penirq_recheck_delay_usecs = 1,
\r
1270 static struct spi_board_info board_spi_devices[] = {
\r
1271 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\
\r
1272 ||defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
\r
1274 .modalias = "xpt2046_ts",
\r
1276 .max_speed_hz = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
\r
1278 .irq = XPT2046_GPIO_INT,
\r
1279 .platform_data = &xpt2046_info,
\r
1285 static void __init rk29_gic_init_irq(void)
\r
1287 gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
\r
1288 gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
\r
1291 static void __init machine_rk29_init_irq(void)
\r
1293 rk29_gic_init_irq();
\r
1294 rk29_gpio_init(rk29_gpiobankinit, MAX_BANK);
\r
1295 rk29_gpio_irq_setup();
\r
1297 #define POWER_ON_PIN RK29_PIN4_PA4
\r
1298 static void __init machine_rk29_board_init(void)
\r
1300 rk29_board_iomux_init();
\r
1301 gpio_request(POWER_ON_PIN,"poweronpin");
\r
1302 gpio_set_value(POWER_ON_PIN, 1);
\r
1303 gpio_direction_output(POWER_ON_PIN, 1);
\r
1305 #ifdef CONFIG_WIFI_CONTROL_FUNC
1306 rk29sdk_wifi_bt_gpio_control_init();
1309 platform_add_devices(devices, ARRAY_SIZE(devices));
\r
1310 #ifdef CONFIG_I2C0_RK29
\r
1311 i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
\r
1312 ARRAY_SIZE(board_i2c0_devices));
\r
1314 #ifdef CONFIG_I2C1_RK29
\r
1315 i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
\r
1316 ARRAY_SIZE(board_i2c1_devices));
\r
1318 #ifdef CONFIG_I2C2_RK29
\r
1319 i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
\r
1320 ARRAY_SIZE(board_i2c2_devices));
\r
1322 #ifdef CONFIG_I2C3_RK29
\r
1323 i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
\r
1324 ARRAY_SIZE(board_i2c3_devices));
\r
1327 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
\r
1330 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
\r
1331 char **cmdline, struct meminfo *mi)
\r
1334 mi->bank[0].start = RK29_SDRAM_PHYS;
\r
1335 mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
\r
1336 mi->bank[0].size = LINUX_SIZE;
\r
1339 static void __init machine_rk29_mapio(void)
\r
1341 rk29_map_common_io();
\r
1342 rk29_clock_init();
\r
1343 rk29_iomux_init();
\r
1346 MACHINE_START(RK29, "RK29board")
\r
1347 /* UART for LL DEBUG */
\r
1348 .phys_io = RK29_UART1_PHYS,
\r
1349 .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
\r
1350 .boot_params = RK29_SDRAM_PHYS + 0x88000,
\r
1351 .fixup = machine_rk29_fixup,
\r
1352 .map_io = machine_rk29_mapio,
\r
1353 .init_irq = machine_rk29_init_irq,
\r
1354 .init_machine = machine_rk29_board_init,
\r
1355 .timer = &rk29_timer,
\r