--- /dev/null
+/*
+ * Copyright (C) 2012 ROCKCHIP, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/skbuff.h>
+#include <linux/spi/spi.h>
+#include <linux/mmc/host.h>
+#include <linux/ion.h>
+#include <linux/cpufreq.h>
+#include <linux/clk.h>
+
+#include <asm/setup.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/flash.h>
+#include <asm/hardware/gic.h>
+
+#include <mach/board.h>
+#include <mach/hardware.h>
+#include <mach/io.h>
+#include <mach/gpio.h>
+#include <mach/iomux.h>
+#include <linux/fb.h>
+#include <linux/regulator/machine.h>
+#include <linux/rfkill-rk.h>
+#include <linux/sensor-dev.h>
+
+
+#ifdef CONFIG_VIDEO_RK29
+/*---------------- Camera Sensor Macro Define Begin ------------------------*/
+/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
+#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
+#define CONFIG_SENSOR_IIC_ADDR_0 0
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 4
+#define CONFIG_SENSOR_ORIENTATION_0 90
+#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
+
+#define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_01 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
+#define CONFIG_SENSOR_ORIENTATION_01 90
+#define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
+
+#define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_02 0x00
+#define CONFIG_SENSOR_CIF_INDEX_02 0
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
+#define CONFIG_SENSOR_ORIENTATION_02 90
+#define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
+
+#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor 0 */
+#define CONFIG_SENSOR_IIC_ADDR_1 0x60
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
+#define CONFIG_SENSOR_ORIENTATION_1 270
+#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
+
+#define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_11 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
+#define CONFIG_SENSOR_ORIENTATION_11 270
+#define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
+
+#define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2659//RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_12 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
+#define CONFIG_SENSOR_ORIENTATION_12 270
+#define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
+
+
+#endif //#ifdef CONFIG_VIDEO_RK29
+/*---------------- Camera Sensor Configuration Macro End------------------------*/
+#include "../../../drivers/media/video/rk30_camera.c"
+/*---------------- Camera Sensor Macro Define End ---------*/
+
+#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
+/*****************************************************************************************
+ * camera devices
+ * author: ddl@rock-chips.com
+ *****************************************************************************************/
+#ifdef CONFIG_VIDEO_RK29
+#define CONFIG_SENSOR_POWER_IOCTL_USR 0 //define this refer to your board layout
+#define CONFIG_SENSOR_RESET_IOCTL_USR 0
+#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
+#define CONFIG_SENSOR_FLASH_IOCTL_USR 0
+
+static void rk_cif_power(int on)
+{
+ struct regulator *ldo_18,*ldo_28;
+
+ ldo_28 = regulator_get(NULL, "ldo7"); // vcc28_cif
+ ldo_18 = regulator_get(NULL, "ldo1"); // vcc18_cif
+ if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)) {
+ printk("get cif ldo failed!\n");
+ return;
+ }
+ if(on == 0) {
+ regulator_disable(ldo_28);
+ regulator_put(ldo_28);
+ regulator_disable(ldo_18);
+ regulator_put(ldo_18);
+ mdelay(500);
+ } else {
+ regulator_set_voltage(ldo_28, 2800000, 2800000);
+ regulator_enable(ldo_28);
+ // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
+ regulator_put(ldo_28);
+
+ regulator_set_voltage(ldo_18, 1800000, 1800000);
+ // regulator_set_suspend_voltage(ldo, 1800000);
+ regulator_enable(ldo_18);
+ // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18));
+ regulator_put(ldo_18);
+ }
+}
+
+#if CONFIG_SENSOR_POWER_IOCTL_USR
+static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
+{
+ //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
+ rk_cif_power(on);
+}
+#endif
+
+#if CONFIG_SENSOR_RESET_IOCTL_USR
+static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
+{
+ #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
+}
+#endif
+
+#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
+static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
+{
+ #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
+}
+#endif
+
+#if CONFIG_SENSOR_FLASH_IOCTL_USR
+static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
+{
+ #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
+}
+#endif
+
+static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
+ #if CONFIG_SENSOR_POWER_IOCTL_USR
+ .sensor_power_cb = sensor_power_usr_cb,
+ #else
+ .sensor_power_cb = NULL,
+ #endif
+
+ #if CONFIG_SENSOR_RESET_IOCTL_USR
+ .sensor_reset_cb = sensor_reset_usr_cb,
+ #else
+ .sensor_reset_cb = NULL,
+ #endif
+
+ #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
+ .sensor_powerdown_cb = sensor_powerdown_usr_cb,
+ #else
+ .sensor_powerdown_cb = NULL,
+ #endif
+
+ #if CONFIG_SENSOR_FLASH_IOCTL_USR
+ .sensor_flash_cb = sensor_flash_usr_cb,
+ #else
+ .sensor_flash_cb = NULL,
+ #endif
+};
+
+#if CONFIG_SENSOR_IIC_ADDR_0
+static struct reginfo_t rk_init_data_sensor_reg_0[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_0[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+
+#if CONFIG_SENSOR_IIC_ADDR_1
+static struct reginfo_t rk_init_data_sensor_reg_1[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+#if CONFIG_SENSOR_IIC_ADDR_01
+static struct reginfo_t rk_init_data_sensor_reg_01[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_01[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+#if CONFIG_SENSOR_IIC_ADDR_02
+static struct reginfo_t rk_init_data_sensor_reg_02[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_02[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+#if CONFIG_SENSOR_IIC_ADDR_11
+static struct reginfo_t rk_init_data_sensor_reg_11[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_11[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+#if CONFIG_SENSOR_IIC_ADDR_12
+static struct reginfo_t rk_init_data_sensor_reg_12[] =
+{
+ {0x0000, 0x00,0,0}
+};
+static struct reginfo_t rk_init_data_sensor_winseqreg_12[] =
+{
+ {0x0000, 0x00,0,0}
+};
+#endif
+static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
+{
+ #if CONFIG_SENSOR_IIC_ADDR_0
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_0,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_0,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_0) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+ #if CONFIG_SENSOR_IIC_ADDR_1
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_1,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_1,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_1) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+ #if CONFIG_SENSOR_IIC_ADDR_01
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_01,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_01,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_01) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_01) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+ #if CONFIG_SENSOR_IIC_ADDR_02
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_02,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_02,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_02) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_02) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+ #if CONFIG_SENSOR_IIC_ADDR_11
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_11,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_11,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_11) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_11) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+ #if CONFIG_SENSOR_IIC_ADDR_12
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = rk_init_data_sensor_reg_12,
+ .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_12,
+ .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_12) / sizeof(struct reginfo_t),
+ .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_12) / sizeof(struct reginfo_t),
+ },
+ #else
+ {
+ .rk_sensor_init_width = INVALID_VALUE,
+ .rk_sensor_init_height = INVALID_VALUE,
+ .rk_sensor_init_bus_param = INVALID_VALUE,
+ .rk_sensor_init_pixelcode = INVALID_VALUE,
+ .rk_sensor_init_data = NULL,
+ .rk_sensor_init_winseq = NULL,
+ .rk_sensor_winseq_size = 0,
+ .rk_sensor_init_data_size = 0,
+ },
+ #endif
+
+ };
+#include "../../../drivers/media/video/rk30_camera.c"
+
+#endif /* CONFIG_VIDEO_RK29 */
+
+
+
+#define RK_FB_MEM_SIZE 3*SZ_1M
+
+#if defined(CONFIG_FB_ROCKCHIP)
+#define LCD_CS_MUX_NAME GPIO2A7_LCDC1DATA7_SMCDATA7_TRACEDATA7_NAME
+#define LCD_CS_PIN RK30_PIN2_PA7
+#define LCD_CS_VALUE GPIO_HIGH
+
+#define LCD_EN_MUX_NAME GPIO2D7_TESTCLOCKOUT_NAME
+#define LCD_EN_PIN RK30_PIN2_PD7
+#define LCD_EN_VALUE GPIO_LOW
+
+static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
+{
+ int ret = 0;
+ rk30_mux_api_set(LCD_CS_MUX_NAME, GPIO2A_GPIO2A7);
+ ret = gpio_request(LCD_CS_PIN, NULL);
+ if (ret != 0)
+ {
+ gpio_free(LCD_CS_PIN);
+ printk(KERN_ERR "request lcd cs pin fail!\n");
+ return -1;
+ }
+ else
+ {
+ gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
+ }
+ ret = gpio_request(LCD_EN_PIN, NULL);
+ if (ret != 0)
+ {
+ gpio_free(LCD_EN_PIN);
+ printk(KERN_ERR "request lcd en pin fail!\n");
+ return -1;
+ }
+ else
+ {
+ gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
+ }
+ return 0;
+}
+static int rk_fb_io_disable(void)
+{
+ gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE? 0:1);
+ gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE? 0:1);
+ return 0;
+}
+static int rk_fb_io_enable(void)
+{
+ gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
+ gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
+ return 0;
+}
+
+#if defined(CONFIG_LCDC0_RK31)
+struct rk29fb_info lcdc0_screen_info = {
+ .prop = PRMRY, //primary display device
+ .io_init = rk_fb_io_init,
+ .io_disable = rk_fb_io_disable,
+ .io_enable = rk_fb_io_enable,
+ .set_screen_info = set_lcd_info,
+};
+#endif
+
+#if defined(CONFIG_LCDC1_RK31)
+struct rk29fb_info lcdc1_screen_info = {
+ #if defined(CONFIG_HDMI_RK30)
+ .prop = EXTEND, //extend display device
+ .lcd_info = NULL,
+ .set_screen_info = hdmi_init_lcdc,
+ #endif
+};
+#endif
+
+static struct resource resource_fb[] = {
+ [0] = {
+ .name = "fb0 buf",
+ .start = 0,
+ .end = 0,//RK30_FB0_MEM_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .name = "ipp buf", //for rotate
+ .start = 0,
+ .end = 0,//RK30_FB0_MEM_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [2] = {
+ .name = "fb2 buf",
+ .start = 0,
+ .end = 0,//RK30_FB0_MEM_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device device_fb = {
+ .name = "rk-fb",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resource_fb),
+ .resource = resource_fb,
+};
+#endif
+
+//i2c
+#ifdef CONFIG_I2C0_RK30
+static struct i2c_board_info __initdata i2c0_info[] = {
+#if defined (CONFIG_SND_SOC_RK1000)
+ {
+ .type = "rk1000_i2c_codec",
+ .addr = 0x60,
+ .flags = 0,
+ },
+ {
+ .type = "rk1000_control",
+ .addr = 0x40,
+ .flags = 0,
+ },
+#endif
+};
+#endif
+#ifdef CONFIG_I2C1_RK30
+static struct i2c_board_info __initdata i2c1_info[] = {
+};
+#endif
+#ifdef CONFIG_I2C2_RK30
+static struct i2c_board_info __initdata i2c2_info[] = {
+};
+#endif
+#ifdef CONFIG_I2C3_RK30
+static struct i2c_board_info __initdata i2c3_info[] = {
+};
+#endif
+
+#ifdef CONFIG_I2C_GPIO_RK30
+static struct i2c_board_info __initdata i2c_gpio_info[] = {
+};
+#endif
+
+static void __init rk30_i2c_register_board_info(void)
+{
+#ifdef CONFIG_I2C0_RK30
+ i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
+#endif
+#ifdef CONFIG_I2C1_RK30
+ i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
+#endif
+#ifdef CONFIG_I2C2_RK30
+ i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
+#endif
+#ifdef CONFIG_I2C3_RK30
+ i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
+#endif
+#ifdef CONFIG_I2C_GPIO_RK30
+ i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
+#endif
+}
+//end of i2c
+
+static struct spi_board_info board_spi_devices[] = {
+};
+
+/***********************************************************
+* rk30 backlight
+************************************************************/
+#ifdef CONFIG_BACKLIGHT_RK29_BL
+#define PWM_ID 1
+#define PWM_MUX_NAME GPIO0A3_PWM0_NAME
+#define PWM_MUX_MODE GPIO0A_PWM0
+#define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
+#define PWM_GPIO RK30_PIN0_PA3
+#define PWM_EFFECT_VALUE 1
+
+#define LCD_DISP_ON_PIN
+
+#ifdef LCD_DISP_ON_PIN
+
+#define BL_EN_PIN RK30_PIN6_PB3
+#define BL_EN_VALUE GPIO_HIGH
+#endif
+static int rk29_backlight_io_init(void)
+{
+ int ret = 0;
+ return ret;
+}
+
+static int rk29_backlight_io_deinit(void)
+{
+ int ret = 0;
+ return ret;
+}
+
+static int rk29_backlight_pwm_suspend(void)
+{
+ int ret = 0;
+ return ret;
+}
+
+static int rk29_backlight_pwm_resume(void)
+{
+ return 0;
+}
+
+static struct rk29_bl_info rk29_bl_info = {
+ .pwm_id = PWM_ID,
+ .bl_ref = PWM_EFFECT_VALUE,
+ .io_init = rk29_backlight_io_init,
+ .io_deinit = rk29_backlight_io_deinit,
+ .pwm_suspend = rk29_backlight_pwm_suspend,
+ .pwm_resume = rk29_backlight_pwm_resume,
+};
+
+static struct platform_device rk29_device_backlight = {
+ .name = "rk29_backlight",
+ .id = -1,
+ .dev = {
+ .platform_data = &rk29_bl_info,
+ }
+};
+
+#endif
+
+/***********************************************************
+* rk30 ion device
+************************************************************/
+#ifdef CONFIG_ION
+#define ION_RESERVE_SIZE (8 * SZ_1M)
+static struct ion_platform_data rk30_ion_pdata = {
+ .nr = 1,
+ .heaps = {
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .id = ION_NOR_HEAP_ID,
+ .name = "norheap",
+ .size = ION_RESERVE_SIZE,
+ }
+ },
+};
+
+static struct platform_device device_ion = {
+ .name = "ion-rockchip",
+ .id = 0,
+ .dev = {
+ .platform_data = &rk30_ion_pdata,
+ },
+};
+#endif
+
+static struct platform_device *devices[] __initdata = {
+#if defined(CONFIG_FB_ROCKCHIP)
+ &device_fb,
+#endif
+
+#ifdef CONFIG_BACKLIGHT_RK29_BL
+ &rk29_device_backlight,
+#endif
+
+#ifdef CONFIG_ION
+ &device_ion,
+#endif
+
+};
+/**************************************************************************************************
+ * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
+**************************************************************************************************/
+#ifdef CONFIG_SDMMC_RK29
+#include "board-rk3066b-sdk-sdmmc.c"
+
+#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
+#define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
+#endif
+
+#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
+#define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
+#endif
+
+#define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
+
+#endif //endif ---#ifdef CONFIG_SDMMC_RK29
+
+#ifdef CONFIG_SDMMC0_RK29
+static int rk29_sdmmc0_cfg_gpio(void)
+{
+#ifdef CONFIG_SDMMC_RK29_OLD
+ rk30_mux_api_set(GPIO3A3_SDMMC0CMD_NAME, GPIO3A_SDMMC0CMD);
+ rk30_mux_api_set(GPIO3A2_SDMMC0CLKOUT_NAME, GPIO3A_SDMMC0CLKOUT);
+ rk30_mux_api_set(GPIO3A4_SDMMC0DATA0_NAME, GPIO3A_SDMMC0DATA0);
+ rk30_mux_api_set(GPIO3A5_SDMMC0DATA1_NAME, GPIO3A_SDMMC0DATA1);
+ rk30_mux_api_set(GPIO3A6_SDMMC0DATA2_NAME, GPIO3A_SDMMC0DATA2);
+ rk30_mux_api_set(GPIO3A7_SDMMC0DATA3_NAME, GPIO3A_SDMMC0DATA3);
+
+ rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B0);
+
+ rk30_mux_api_set(GPIO3A1_SDMMC0PWREN_NAME, GPIO3A_GPIO3A1);
+ gpio_request(RK30_PIN3_PA1, "sdmmc-power");
+ gpio_direction_output(RK30_PIN3_PA1, GPIO_LOW);
+
+#else
+ rk29_sdmmc_set_iomux(0, 0xFFFF);
+
+ rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0DETECTN);
+
+#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
+ gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
+ gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
+#endif
+
+#endif
+
+ return 0;
+}
+
+#define CONFIG_SDMMC0_USE_DMA
+struct rk29_sdmmc_platform_data default_sdmmc0_data = {
+ .host_ocr_avail =
+ (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
+ MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
+ MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
+ .host_caps =
+ (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+ .io_init = rk29_sdmmc0_cfg_gpio,
+
+#if !defined(CONFIG_SDMMC_RK29_OLD)
+ .set_iomux = rk29_sdmmc_set_iomux,
+#endif
+
+ .dma_name = "sd_mmc",
+#ifdef CONFIG_SDMMC0_USE_DMA
+ .use_dma = 1,
+#else
+ .use_dma = 0,
+#endif
+ .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
+ .enable_sd_wakeup = 0,
+
+#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
+ .write_prt = SDMMC0_WRITE_PROTECT_PIN,
+#else
+ .write_prt = INVALID_GPIO,
+#endif
+};
+#endif // CONFIG_SDMMC0_RK29
+
+#ifdef CONFIG_SDMMC1_RK29
+#define CONFIG_SDMMC1_USE_DMA
+static int rk29_sdmmc1_cfg_gpio(void)
+{
+#if defined(CONFIG_SDMMC_RK29_OLD)
+ rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
+ rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
+ rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
+ rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
+ rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
+ rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
+ //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
+
+#else
+
+#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
+ gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
+ gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
+#endif
+
+#endif
+
+ return 0;
+}
+
+struct rk29_sdmmc_platform_data default_sdmmc1_data = {
+ .host_ocr_avail =
+ (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
+ MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
+ MMC_VDD_33_34),
+
+#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
+ .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
+ MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+#else
+ .host_caps =
+ (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+#endif
+
+ .io_init = rk29_sdmmc1_cfg_gpio,
+
+#if !defined(CONFIG_SDMMC_RK29_OLD)
+ .set_iomux = rk29_sdmmc_set_iomux,
+#endif
+
+ .dma_name = "sdio",
+#ifdef CONFIG_SDMMC1_USE_DMA
+ .use_dma = 1,
+#else
+ .use_dma = 0,
+#endif
+
+#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+ .status = rk29sdk_wifi_status,
+ .register_status_notify = rk29sdk_wifi_status_register,
+#endif
+#if 0
+ .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
+#endif
+
+#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
+ .write_prt = SDMMC1_WRITE_PROTECT_PIN,
+#else
+ .write_prt = INVALID_GPIO,
+#endif
+
+#else
+ .detect_irq = INVALID_GPIO,
+ .enable_sd_wakeup = 0,
+#endif
+
+};
+#endif //endif--#ifdef CONFIG_SDMMC1_RK29
+
+/**************************************************************************************************
+ * the end of setting for SDMMC devices
+**************************************************************************************************/
+
+static void __init rk31_board_init(void)
+{
+ rk30_i2c_register_board_info();
+ spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
+ platform_add_devices(devices, ARRAY_SIZE(devices));
+}
+
+static void __init rk31_reserve(void)
+{
+#if defined(CONFIG_FB_ROCKCHIP)
+ resource_fb[0].start = board_mem_reserve_add("fb0", RK_FB_MEM_SIZE);
+ resource_fb[0].end = resource_fb[0].start + RK_FB_MEM_SIZE - 1;
+#endif
+
+#ifdef CONFIG_ION
+ rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
+#endif
+
+#ifdef CONFIG_VIDEO_RK29
+ rk30_camera_request_reserve_mem();
+#endif
+ board_mem_reserved();
+}
+
+#include <linux/clkdev.h>
+
+struct clk {
+ const char *name;
+ unsigned long rate;
+};
+
+static struct clk xin24m = {
+ .name = "xin24m",
+ .rate = 24000000,
+};
+
+static struct clk xin12m = {
+ .name = "xin12m",
+ .rate = 12000000,
+};
+
+#define CLK(dev, con, ck) \
+ { \
+ .dev_id = dev, \
+ .con_id = con, \
+ .clk = ck, \
+ }
+
+static struct clk_lookup clks[] = {
+ CLK("rk30_i2c.0", "i2c", &xin24m),
+ CLK("rk30_i2c.1", "i2c", &xin24m),
+ CLK("rk30_i2c.2", "i2c", &xin24m),
+ CLK("rk30_i2c.3", "i2c", &xin24m),
+ CLK("rk30_i2c.4", "i2c", &xin24m),
+ CLK("rk29xx_spim.0", "spi", &xin24m),
+ CLK("rk29xx_spim.1", "spi", &xin24m),
+
+ CLK("rk_serial.0", "uart_div", &xin24m),
+ CLK("rk_serial.0", "uart_frac_div", &xin24m),
+ CLK("rk_serial.0", "uart", &xin24m),
+ CLK("rk_serial.0", "pclk_uart", &xin24m),
+ CLK("rk_serial.1", "uart_div", &xin24m),
+ CLK("rk_serial.1", "uart_frac_div", &xin24m),
+ CLK("rk_serial.1", "uart", &xin24m),
+ CLK("rk_serial.1", "pclk_uart", &xin24m),
+ CLK("rk_serial.2", "uart_div", &xin24m),
+ CLK("rk_serial.2", "uart_frac_div", &xin24m),
+ CLK("rk_serial.2", "uart", &xin24m),
+ CLK("rk_serial.2", "pclk_uart", &xin24m),
+
+ CLK("rk29_i2s.1", "i2s_div", &xin24m),
+ CLK("rk29_i2s.1", "i2s_frac_div", &xin24m),
+ CLK("rk29_i2s.1", "i2s", &xin12m),
+ CLK("rk29_i2s.1", "hclk_i2s", &xin24m),
+
+ CLK("rk29_sdmmc.0","mmc",&xin24m),
+ CLK("rk29_sdmmc.0","hclk_mmc",&xin24m),
+ CLK("rk29_sdmmc.1","mmc",&xin24m),
+ CLK("rk29_sdmmc.1","hclk_mmc",&xin24m),
+
+ CLK(NULL,"pd_lcdc0",&xin24m),
+ CLK(NULL,"hclk_lcdc0",&xin24m),
+ CLK(NULL,"aclk_lcdc0",&xin24m),
+ CLK(NULL,"dclk_lcdc0",&xin24m),
+ CLK(NULL,"pd_lcdc1",&xin24m),
+ CLK(NULL,"hclk_lcdc1",&xin24m),
+ CLK(NULL,"aclk_lcdc1",&xin24m),
+ CLK(NULL,"dclk_lcdc1",&xin24m),
+
+ CLK(NULL,"pd_cif0",&xin24m),
+ CLK(NULL,"aclk_cif0",&xin24m),
+ CLK(NULL,"hclk_cif0",&xin24m),
+ CLK(NULL,"cif0_in",&xin24m),
+ CLK(NULL,"cif0_out",&xin24m),
+
+ CLK(NULL,"pwm01",&xin24m),
+};
+
+static void __init rk30_clock_init(void)
+{
+ struct clk_lookup *lk;
+
+ for (lk = clks; lk < clks + ARRAY_SIZE(clks); lk++) {
+ clkdev_add(lk);
+ }
+}
+
+void __init board_clock_init(void)
+{
+ rk30_clock_init();
+}
+
+int __init clk_disable_unused(void)
+{
+ return 0;
+}
+
+int clk_enable(struct clk *clk)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+ if(clk)
+ return clk->rate;
+ else
+ return 24000000;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_set_parent);
+
+#include <mach/gpio.h>
+#include <plat/key.h>
+
+#define EV_ENCALL KEY_F4
+#define EV_MENU KEY_F1
+
+#define PRESS_LEV_LOW 1
+#define PRESS_LEV_HIGH 0
+
+static struct rk29_keys_button key_button[] = {
+ {
+ .desc = "menu",
+ .code = EV_MENU,
+ .gpio = RK30_PIN3_PB2,
+ .active_low = PRESS_LEV_LOW,
+ },
+ {
+ .desc = "vol+",
+ .code = KEY_VOLUMEUP,
+ .gpio = RK30_PIN3_PB1,
+ .active_low = PRESS_LEV_LOW,
+ },
+ {
+ .desc = "vol-",
+ .code = KEY_VOLUMEDOWN,
+ .gpio = RK30_PIN3_PB0,
+ .active_low = PRESS_LEV_LOW,
+ },
+ {
+ .desc = "home",
+ .code = KEY_HOME,
+ .gpio = RK30_PIN3_PB3,
+ .active_low = PRESS_LEV_LOW,
+ },
+ {
+ .desc = "esc",
+ .code = KEY_BACK,
+ .gpio = RK30_PIN3_PB4,
+ .active_low = PRESS_LEV_LOW,
+ },
+ {
+ .desc = "key6",
+ .code = KEY_CAMERA,
+ .gpio = RK30_PIN3_PB5,
+ .active_low = PRESS_LEV_LOW,
+ },
+};
+
+struct rk29_keys_platform_data rk29_keys_pdata = {
+ .buttons = key_button,
+ .nbuttons = ARRAY_SIZE(key_button),
+ .chn = -1, //chn: 0-7, if do not use ADC,set 'chn' -1
+};
+
+static void __init fpga_fixup(struct machine_desc *desc, struct tag *tags,
+ char **cmdline, struct meminfo *mi)
+{
+ mi->nr_banks = 1;
+ mi->bank[0].start = PLAT_PHYS_OFFSET;
+ mi->bank[0].size = SZ_128M;
+}
+
+#include <mach/system.h>
+static void fpga_reset(char mode, const char *cmd)
+{
+ while (1);
+}
+
+static void __init fpga_map_io(void)
+{
+ arch_reset = fpga_reset;
+ rk30_map_common_io();
+ rk29_setup_early_printk();
+ rk29_sram_init();
+ board_clock_init();
+ rk30_iomux_init();
+}
+
+MACHINE_START(RK31, "RK31board")
+ .boot_params = PLAT_PHYS_OFFSET + 0x800,
+ .fixup = fpga_fixup,
+ .reserve = &rk31_reserve,
+ .map_io = fpga_map_io,
+ .init_irq = rk30_init_irq,
+ .timer = &rk30_timer,
+ .init_machine = rk31_board_init,
+MACHINE_END
+++ /dev/null
-/*
- * Copyright (C) 2012 ROCKCHIP, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/input.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/skbuff.h>
-#include <linux/spi/spi.h>
-#include <linux/mmc/host.h>
-#include <linux/ion.h>
-#include <linux/cpufreq.h>
-#include <linux/clk.h>
-
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/flash.h>
-#include <asm/hardware/gic.h>
-
-#include <mach/board.h>
-#include <mach/hardware.h>
-#include <mach/io.h>
-#include <mach/gpio.h>
-#include <mach/iomux.h>
-#include <linux/fb.h>
-#include <linux/regulator/machine.h>
-#include <linux/rfkill-rk.h>
-#include <linux/sensor-dev.h>
-
-
-#ifdef CONFIG_VIDEO_RK29
-/*---------------- Camera Sensor Macro Define Begin ------------------------*/
-/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
-#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
-#define CONFIG_SENSOR_IIC_ADDR_0 0
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 4
-#define CONFIG_SENSOR_ORIENTATION_0 90
-#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_0 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
-
-#define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
-#define CONFIG_SENSOR_IIC_ADDR_01 0x00
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
-#define CONFIG_SENSOR_ORIENTATION_01 90
-#define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_01 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
-
-#define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
-#define CONFIG_SENSOR_IIC_ADDR_02 0x00
-#define CONFIG_SENSOR_CIF_INDEX_02 0
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
-#define CONFIG_SENSOR_ORIENTATION_02 90
-#define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_02 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
-
-#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor 0 */
-#define CONFIG_SENSOR_IIC_ADDR_1 0x60
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
-#define CONFIG_SENSOR_ORIENTATION_1 270
-#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_1 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
-
-#define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
-#define CONFIG_SENSOR_IIC_ADDR_11 0x00
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
-#define CONFIG_SENSOR_ORIENTATION_11 270
-#define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
-
-#define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2659//RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
-#define CONFIG_SENSOR_IIC_ADDR_12 0x00
-#define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
-#define CONFIG_SENSOR_ORIENTATION_12 270
-#define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
-#define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
-#define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO
-#define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
-#define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
-#define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
-#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
-#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
-
-#define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
-#define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
-
-
-#endif //#ifdef CONFIG_VIDEO_RK29
-/*---------------- Camera Sensor Configuration Macro End------------------------*/
-#include "../../../drivers/media/video/rk30_camera.c"
-/*---------------- Camera Sensor Macro Define End ---------*/
-
-#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
-/*****************************************************************************************
- * camera devices
- * author: ddl@rock-chips.com
- *****************************************************************************************/
-#ifdef CONFIG_VIDEO_RK29
-#define CONFIG_SENSOR_POWER_IOCTL_USR 0 //define this refer to your board layout
-#define CONFIG_SENSOR_RESET_IOCTL_USR 0
-#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
-#define CONFIG_SENSOR_FLASH_IOCTL_USR 0
-
-static void rk_cif_power(int on)
-{
- struct regulator *ldo_18,*ldo_28;
-
- ldo_28 = regulator_get(NULL, "ldo7"); // vcc28_cif
- ldo_18 = regulator_get(NULL, "ldo1"); // vcc18_cif
- if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)) {
- printk("get cif ldo failed!\n");
- return;
- }
- if(on == 0) {
- regulator_disable(ldo_28);
- regulator_put(ldo_28);
- regulator_disable(ldo_18);
- regulator_put(ldo_18);
- mdelay(500);
- } else {
- regulator_set_voltage(ldo_28, 2800000, 2800000);
- regulator_enable(ldo_28);
- // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
- regulator_put(ldo_28);
-
- regulator_set_voltage(ldo_18, 1800000, 1800000);
- // regulator_set_suspend_voltage(ldo, 1800000);
- regulator_enable(ldo_18);
- // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18));
- regulator_put(ldo_18);
- }
-}
-
-#if CONFIG_SENSOR_POWER_IOCTL_USR
-static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
- //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
- rk_cif_power(on);
-}
-#endif
-
-#if CONFIG_SENSOR_RESET_IOCTL_USR
-static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
- #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
-}
-#endif
-
-#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
-static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
- #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
-}
-#endif
-
-#if CONFIG_SENSOR_FLASH_IOCTL_USR
-static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
- #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
-}
-#endif
-
-static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
- #if CONFIG_SENSOR_POWER_IOCTL_USR
- .sensor_power_cb = sensor_power_usr_cb,
- #else
- .sensor_power_cb = NULL,
- #endif
-
- #if CONFIG_SENSOR_RESET_IOCTL_USR
- .sensor_reset_cb = sensor_reset_usr_cb,
- #else
- .sensor_reset_cb = NULL,
- #endif
-
- #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
- .sensor_powerdown_cb = sensor_powerdown_usr_cb,
- #else
- .sensor_powerdown_cb = NULL,
- #endif
-
- #if CONFIG_SENSOR_FLASH_IOCTL_USR
- .sensor_flash_cb = sensor_flash_usr_cb,
- #else
- .sensor_flash_cb = NULL,
- #endif
-};
-
-#if CONFIG_SENSOR_IIC_ADDR_0
-static struct reginfo_t rk_init_data_sensor_reg_0[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_0[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-
-#if CONFIG_SENSOR_IIC_ADDR_1
-static struct reginfo_t rk_init_data_sensor_reg_1[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-#if CONFIG_SENSOR_IIC_ADDR_01
-static struct reginfo_t rk_init_data_sensor_reg_01[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_01[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-#if CONFIG_SENSOR_IIC_ADDR_02
-static struct reginfo_t rk_init_data_sensor_reg_02[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_02[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-#if CONFIG_SENSOR_IIC_ADDR_11
-static struct reginfo_t rk_init_data_sensor_reg_11[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_11[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-#if CONFIG_SENSOR_IIC_ADDR_12
-static struct reginfo_t rk_init_data_sensor_reg_12[] =
-{
- {0x0000, 0x00,0,0}
-};
-static struct reginfo_t rk_init_data_sensor_winseqreg_12[] =
-{
- {0x0000, 0x00,0,0}
-};
-#endif
-static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
-{
- #if CONFIG_SENSOR_IIC_ADDR_0
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_0,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_0,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_0) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
- #if CONFIG_SENSOR_IIC_ADDR_1
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_1,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_1,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_1) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
- #if CONFIG_SENSOR_IIC_ADDR_01
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_01,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_01,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_01) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_01) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
- #if CONFIG_SENSOR_IIC_ADDR_02
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_02,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_02,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_02) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_02) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
- #if CONFIG_SENSOR_IIC_ADDR_11
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_11,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_11,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_11) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_11) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
- #if CONFIG_SENSOR_IIC_ADDR_12
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = rk_init_data_sensor_reg_12,
- .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_12,
- .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_12) / sizeof(struct reginfo_t),
- .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_12) / sizeof(struct reginfo_t),
- },
- #else
- {
- .rk_sensor_init_width = INVALID_VALUE,
- .rk_sensor_init_height = INVALID_VALUE,
- .rk_sensor_init_bus_param = INVALID_VALUE,
- .rk_sensor_init_pixelcode = INVALID_VALUE,
- .rk_sensor_init_data = NULL,
- .rk_sensor_init_winseq = NULL,
- .rk_sensor_winseq_size = 0,
- .rk_sensor_init_data_size = 0,
- },
- #endif
-
- };
-#include "../../../drivers/media/video/rk30_camera.c"
-
-#endif /* CONFIG_VIDEO_RK29 */
-
-
-
-#define RK_FB_MEM_SIZE 3*SZ_1M
-
-#if defined(CONFIG_FB_ROCKCHIP)
-#define LCD_CS_MUX_NAME GPIO2A7_LCDC1DATA7_SMCDATA7_TRACEDATA7_NAME
-#define LCD_CS_PIN RK30_PIN2_PA7
-#define LCD_CS_VALUE GPIO_HIGH
-
-#define LCD_EN_MUX_NAME GPIO2D7_TESTCLOCKOUT_NAME
-#define LCD_EN_PIN RK30_PIN2_PD7
-#define LCD_EN_VALUE GPIO_LOW
-
-static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
-{
- int ret = 0;
- rk30_mux_api_set(LCD_CS_MUX_NAME, GPIO2A_GPIO2A7);
- ret = gpio_request(LCD_CS_PIN, NULL);
- if (ret != 0)
- {
- gpio_free(LCD_CS_PIN);
- printk(KERN_ERR "request lcd cs pin fail!\n");
- return -1;
- }
- else
- {
- gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
- }
- ret = gpio_request(LCD_EN_PIN, NULL);
- if (ret != 0)
- {
- gpio_free(LCD_EN_PIN);
- printk(KERN_ERR "request lcd en pin fail!\n");
- return -1;
- }
- else
- {
- gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
- }
- return 0;
-}
-static int rk_fb_io_disable(void)
-{
- gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE? 0:1);
- gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE? 0:1);
- return 0;
-}
-static int rk_fb_io_enable(void)
-{
- gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
- gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
- return 0;
-}
-
-#if defined(CONFIG_LCDC0_RK31)
-struct rk29fb_info lcdc0_screen_info = {
- .prop = PRMRY, //primary display device
- .io_init = rk_fb_io_init,
- .io_disable = rk_fb_io_disable,
- .io_enable = rk_fb_io_enable,
- .set_screen_info = set_lcd_info,
-};
-#endif
-
-#if defined(CONFIG_LCDC1_RK31)
-struct rk29fb_info lcdc1_screen_info = {
- #if defined(CONFIG_HDMI_RK30)
- .prop = EXTEND, //extend display device
- .lcd_info = NULL,
- .set_screen_info = hdmi_init_lcdc,
- #endif
-};
-#endif
-
-static struct resource resource_fb[] = {
- [0] = {
- .name = "fb0 buf",
- .start = 0,
- .end = 0,//RK30_FB0_MEM_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .name = "ipp buf", //for rotate
- .start = 0,
- .end = 0,//RK30_FB0_MEM_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .name = "fb2 buf",
- .start = 0,
- .end = 0,//RK30_FB0_MEM_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct platform_device device_fb = {
- .name = "rk-fb",
- .id = -1,
- .num_resources = ARRAY_SIZE(resource_fb),
- .resource = resource_fb,
-};
-#endif
-
-//i2c
-#ifdef CONFIG_I2C0_RK30
-static struct i2c_board_info __initdata i2c0_info[] = {
-#if defined (CONFIG_SND_SOC_RK1000)
- {
- .type = "rk1000_i2c_codec",
- .addr = 0x60,
- .flags = 0,
- },
- {
- .type = "rk1000_control",
- .addr = 0x40,
- .flags = 0,
- },
-#endif
-};
-#endif
-#ifdef CONFIG_I2C1_RK30
-static struct i2c_board_info __initdata i2c1_info[] = {
-};
-#endif
-#ifdef CONFIG_I2C2_RK30
-static struct i2c_board_info __initdata i2c2_info[] = {
-};
-#endif
-#ifdef CONFIG_I2C3_RK30
-static struct i2c_board_info __initdata i2c3_info[] = {
-};
-#endif
-
-#ifdef CONFIG_I2C_GPIO_RK30
-static struct i2c_board_info __initdata i2c_gpio_info[] = {
-};
-#endif
-
-static void __init rk30_i2c_register_board_info(void)
-{
-#ifdef CONFIG_I2C0_RK30
- i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
-#endif
-#ifdef CONFIG_I2C1_RK30
- i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
-#endif
-#ifdef CONFIG_I2C2_RK30
- i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
-#endif
-#ifdef CONFIG_I2C3_RK30
- i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
-#endif
-#ifdef CONFIG_I2C_GPIO_RK30
- i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
-#endif
-}
-//end of i2c
-
-static struct spi_board_info board_spi_devices[] = {
-};
-
-/***********************************************************
-* rk30 backlight
-************************************************************/
-#ifdef CONFIG_BACKLIGHT_RK29_BL
-#define PWM_ID 1
-#define PWM_MUX_NAME GPIO0A3_PWM0_NAME
-#define PWM_MUX_MODE GPIO0A_PWM0
-#define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
-#define PWM_GPIO RK30_PIN0_PA3
-#define PWM_EFFECT_VALUE 1
-
-#define LCD_DISP_ON_PIN
-
-#ifdef LCD_DISP_ON_PIN
-
-#define BL_EN_PIN RK30_PIN6_PB3
-#define BL_EN_VALUE GPIO_HIGH
-#endif
-static int rk29_backlight_io_init(void)
-{
- int ret = 0;
- return ret;
-}
-
-static int rk29_backlight_io_deinit(void)
-{
- int ret = 0;
- return ret;
-}
-
-static int rk29_backlight_pwm_suspend(void)
-{
- int ret = 0;
- return ret;
-}
-
-static int rk29_backlight_pwm_resume(void)
-{
- return 0;
-}
-
-static struct rk29_bl_info rk29_bl_info = {
- .pwm_id = PWM_ID,
- .bl_ref = PWM_EFFECT_VALUE,
- .io_init = rk29_backlight_io_init,
- .io_deinit = rk29_backlight_io_deinit,
- .pwm_suspend = rk29_backlight_pwm_suspend,
- .pwm_resume = rk29_backlight_pwm_resume,
-};
-
-static struct platform_device rk29_device_backlight = {
- .name = "rk29_backlight",
- .id = -1,
- .dev = {
- .platform_data = &rk29_bl_info,
- }
-};
-
-#endif
-
-/***********************************************************
-* rk30 ion device
-************************************************************/
-#ifdef CONFIG_ION
-#define ION_RESERVE_SIZE (8 * SZ_1M)
-static struct ion_platform_data rk30_ion_pdata = {
- .nr = 1,
- .heaps = {
- {
- .type = ION_HEAP_TYPE_CARVEOUT,
- .id = ION_NOR_HEAP_ID,
- .name = "norheap",
- .size = ION_RESERVE_SIZE,
- }
- },
-};
-
-static struct platform_device device_ion = {
- .name = "ion-rockchip",
- .id = 0,
- .dev = {
- .platform_data = &rk30_ion_pdata,
- },
-};
-#endif
-
-static struct platform_device *devices[] __initdata = {
-#if defined(CONFIG_FB_ROCKCHIP)
- &device_fb,
-#endif
-
-#ifdef CONFIG_BACKLIGHT_RK29_BL
- &rk29_device_backlight,
-#endif
-
-#ifdef CONFIG_ION
- &device_ion,
-#endif
-
-};
-/**************************************************************************************************
- * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
-**************************************************************************************************/
-#ifdef CONFIG_SDMMC_RK29
-#include "board-rk3066b-sdk-sdmmc.c"
-
-#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
-#define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
-#endif
-
-#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
-#define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
-#endif
-
-#define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
-
-#endif //endif ---#ifdef CONFIG_SDMMC_RK29
-
-#ifdef CONFIG_SDMMC0_RK29
-static int rk29_sdmmc0_cfg_gpio(void)
-{
-#ifdef CONFIG_SDMMC_RK29_OLD
- rk30_mux_api_set(GPIO3A3_SDMMC0CMD_NAME, GPIO3A_SDMMC0CMD);
- rk30_mux_api_set(GPIO3A2_SDMMC0CLKOUT_NAME, GPIO3A_SDMMC0CLKOUT);
- rk30_mux_api_set(GPIO3A4_SDMMC0DATA0_NAME, GPIO3A_SDMMC0DATA0);
- rk30_mux_api_set(GPIO3A5_SDMMC0DATA1_NAME, GPIO3A_SDMMC0DATA1);
- rk30_mux_api_set(GPIO3A6_SDMMC0DATA2_NAME, GPIO3A_SDMMC0DATA2);
- rk30_mux_api_set(GPIO3A7_SDMMC0DATA3_NAME, GPIO3A_SDMMC0DATA3);
-
- rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B0);
-
- rk30_mux_api_set(GPIO3A1_SDMMC0PWREN_NAME, GPIO3A_GPIO3A1);
- gpio_request(RK30_PIN3_PA1, "sdmmc-power");
- gpio_direction_output(RK30_PIN3_PA1, GPIO_LOW);
-
-#else
- rk29_sdmmc_set_iomux(0, 0xFFFF);
-
- rk30_mux_api_set(GPIO3B0_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0DETECTN);
-
-#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
- gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
- gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
-#endif
-
-#endif
-
- return 0;
-}
-
-#define CONFIG_SDMMC0_USE_DMA
-struct rk29_sdmmc_platform_data default_sdmmc0_data = {
- .host_ocr_avail =
- (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
- MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
- MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
- .host_caps =
- (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
- .io_init = rk29_sdmmc0_cfg_gpio,
-
-#if !defined(CONFIG_SDMMC_RK29_OLD)
- .set_iomux = rk29_sdmmc_set_iomux,
-#endif
-
- .dma_name = "sd_mmc",
-#ifdef CONFIG_SDMMC0_USE_DMA
- .use_dma = 1,
-#else
- .use_dma = 0,
-#endif
- .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
- .enable_sd_wakeup = 0,
-
-#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
- .write_prt = SDMMC0_WRITE_PROTECT_PIN,
-#else
- .write_prt = INVALID_GPIO,
-#endif
-};
-#endif // CONFIG_SDMMC0_RK29
-
-#ifdef CONFIG_SDMMC1_RK29
-#define CONFIG_SDMMC1_USE_DMA
-static int rk29_sdmmc1_cfg_gpio(void)
-{
-#if defined(CONFIG_SDMMC_RK29_OLD)
- rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
- rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
- rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
- rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
- rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
- rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
- //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
-
-#else
-
-#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
- gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
- gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
-#endif
-
-#endif
-
- return 0;
-}
-
-struct rk29_sdmmc_platform_data default_sdmmc1_data = {
- .host_ocr_avail =
- (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
- MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
- MMC_VDD_33_34),
-
-#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
- .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
- MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-#else
- .host_caps =
- (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-#endif
-
- .io_init = rk29_sdmmc1_cfg_gpio,
-
-#if !defined(CONFIG_SDMMC_RK29_OLD)
- .set_iomux = rk29_sdmmc_set_iomux,
-#endif
-
- .dma_name = "sdio",
-#ifdef CONFIG_SDMMC1_USE_DMA
- .use_dma = 1,
-#else
- .use_dma = 0,
-#endif
-
-#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
-#ifdef CONFIG_WIFI_CONTROL_FUNC
- .status = rk29sdk_wifi_status,
- .register_status_notify = rk29sdk_wifi_status_register,
-#endif
-#if 0
- .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
-#endif
-
-#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
- .write_prt = SDMMC1_WRITE_PROTECT_PIN,
-#else
- .write_prt = INVALID_GPIO,
-#endif
-
-#else
- .detect_irq = INVALID_GPIO,
- .enable_sd_wakeup = 0,
-#endif
-
-};
-#endif //endif--#ifdef CONFIG_SDMMC1_RK29
-
-/**************************************************************************************************
- * the end of setting for SDMMC devices
-**************************************************************************************************/
-
-static void __init rk31_board_init(void)
-{
- rk30_i2c_register_board_info();
- spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
- platform_add_devices(devices, ARRAY_SIZE(devices));
-}
-
-static void __init rk31_reserve(void)
-{
-#if defined(CONFIG_FB_ROCKCHIP)
- resource_fb[0].start = board_mem_reserve_add("fb0", RK_FB_MEM_SIZE);
- resource_fb[0].end = resource_fb[0].start + RK_FB_MEM_SIZE - 1;
-#endif
-
-#ifdef CONFIG_ION
- rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
-#endif
-
-#ifdef CONFIG_VIDEO_RK29
- rk30_camera_request_reserve_mem();
-#endif
- board_mem_reserved();
-}
-
-#include <linux/clkdev.h>
-
-struct clk {
- const char *name;
- unsigned long rate;
-};
-
-static struct clk xin24m = {
- .name = "xin24m",
- .rate = 24000000,
-};
-
-static struct clk xin12m = {
- .name = "xin12m",
- .rate = 12000000,
-};
-
-#define CLK(dev, con, ck) \
- { \
- .dev_id = dev, \
- .con_id = con, \
- .clk = ck, \
- }
-
-static struct clk_lookup clks[] = {
- CLK("rk30_i2c.0", "i2c", &xin24m),
- CLK("rk30_i2c.1", "i2c", &xin24m),
- CLK("rk30_i2c.2", "i2c", &xin24m),
- CLK("rk30_i2c.3", "i2c", &xin24m),
- CLK("rk30_i2c.4", "i2c", &xin24m),
- CLK("rk29xx_spim.0", "spi", &xin24m),
- CLK("rk29xx_spim.1", "spi", &xin24m),
-
- CLK("rk_serial.0", "uart_div", &xin24m),
- CLK("rk_serial.0", "uart_frac_div", &xin24m),
- CLK("rk_serial.0", "uart", &xin24m),
- CLK("rk_serial.0", "pclk_uart", &xin24m),
- CLK("rk_serial.1", "uart_div", &xin24m),
- CLK("rk_serial.1", "uart_frac_div", &xin24m),
- CLK("rk_serial.1", "uart", &xin24m),
- CLK("rk_serial.1", "pclk_uart", &xin24m),
- CLK("rk_serial.2", "uart_div", &xin24m),
- CLK("rk_serial.2", "uart_frac_div", &xin24m),
- CLK("rk_serial.2", "uart", &xin24m),
- CLK("rk_serial.2", "pclk_uart", &xin24m),
-
- CLK("rk29_i2s.1", "i2s_div", &xin24m),
- CLK("rk29_i2s.1", "i2s_frac_div", &xin24m),
- CLK("rk29_i2s.1", "i2s", &xin12m),
- CLK("rk29_i2s.1", "hclk_i2s", &xin24m),
-
- CLK("rk29_sdmmc.0","mmc",&xin24m),
- CLK("rk29_sdmmc.0","hclk_mmc",&xin24m),
- CLK("rk29_sdmmc.1","mmc",&xin24m),
- CLK("rk29_sdmmc.1","hclk_mmc",&xin24m),
-
- CLK(NULL,"pd_lcdc0",&xin24m),
- CLK(NULL,"hclk_lcdc0",&xin24m),
- CLK(NULL,"aclk_lcdc0",&xin24m),
- CLK(NULL,"dclk_lcdc0",&xin24m),
- CLK(NULL,"pd_lcdc1",&xin24m),
- CLK(NULL,"hclk_lcdc1",&xin24m),
- CLK(NULL,"aclk_lcdc1",&xin24m),
- CLK(NULL,"dclk_lcdc1",&xin24m),
-
- CLK(NULL,"pd_cif0",&xin24m),
- CLK(NULL,"aclk_cif0",&xin24m),
- CLK(NULL,"hclk_cif0",&xin24m),
- CLK(NULL,"cif0_in",&xin24m),
- CLK(NULL,"cif0_out",&xin24m),
-
- CLK(NULL,"pwm01",&xin24m),
-};
-
-static void __init rk30_clock_init(void)
-{
- struct clk_lookup *lk;
-
- for (lk = clks; lk < clks + ARRAY_SIZE(clks); lk++) {
- clkdev_add(lk);
- }
-}
-
-void __init board_clock_init(void)
-{
- rk30_clock_init();
-}
-
-int __init clk_disable_unused(void)
-{
- return 0;
-}
-
-int clk_enable(struct clk *clk)
-{
- return 0;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
- if(clk)
- return clk->rate;
- else
- return 24000000;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-int clk_set_rate(struct clk *clk, unsigned long rate)
-{
- return 0;
-}
-EXPORT_SYMBOL(clk_set_rate);
-
-int clk_set_parent(struct clk *clk, struct clk *parent)
-{
- return 0;
-}
-EXPORT_SYMBOL(clk_set_parent);
-
-#include <mach/gpio.h>
-#include <plat/key.h>
-
-#define EV_ENCALL KEY_F4
-#define EV_MENU KEY_F1
-
-#define PRESS_LEV_LOW 1
-#define PRESS_LEV_HIGH 0
-
-static struct rk29_keys_button key_button[] = {
- {
- .desc = "menu",
- .code = EV_MENU,
- .gpio = RK30_PIN3_PB2,
- .active_low = PRESS_LEV_LOW,
- },
- {
- .desc = "vol+",
- .code = KEY_VOLUMEUP,
- .gpio = RK30_PIN3_PB1,
- .active_low = PRESS_LEV_LOW,
- },
- {
- .desc = "vol-",
- .code = KEY_VOLUMEDOWN,
- .gpio = RK30_PIN3_PB0,
- .active_low = PRESS_LEV_LOW,
- },
- {
- .desc = "home",
- .code = KEY_HOME,
- .gpio = RK30_PIN3_PB3,
- .active_low = PRESS_LEV_LOW,
- },
- {
- .desc = "esc",
- .code = KEY_BACK,
- .gpio = RK30_PIN3_PB4,
- .active_low = PRESS_LEV_LOW,
- },
- {
- .desc = "key6",
- .code = KEY_CAMERA,
- .gpio = RK30_PIN3_PB5,
- .active_low = PRESS_LEV_LOW,
- },
-};
-
-struct rk29_keys_platform_data rk29_keys_pdata = {
- .buttons = key_button,
- .nbuttons = ARRAY_SIZE(key_button),
- .chn = -1, //chn: 0-7, if do not use ADC,set 'chn' -1
-};
-
-static void __init fpga_fixup(struct machine_desc *desc, struct tag *tags,
- char **cmdline, struct meminfo *mi)
-{
- mi->nr_banks = 1;
- mi->bank[0].start = PLAT_PHYS_OFFSET;
- mi->bank[0].size = SZ_128M;
-}
-
-#include <mach/system.h>
-static void fpga_reset(char mode, const char *cmd)
-{
- while (1);
-}
-
-static void __init fpga_map_io(void)
-{
- arch_reset = fpga_reset;
- rk30_map_common_io();
- rk29_setup_early_printk();
- rk29_sram_init();
- board_clock_init();
- rk30_iomux_init();
-}
-
-MACHINE_START(RK31, "RK31board")
- .boot_params = PLAT_PHYS_OFFSET + 0x800,
- .fixup = fpga_fixup,
- .reserve = &rk31_reserve,
- .map_io = fpga_map_io,
- .init_irq = rk30_init_irq,
- .timer = &rk30_timer,
- .init_machine = rk31_board_init,
-MACHINE_END