rk2928: update rk2928 tb config
authorkfx <kfx@rock-chips.com>
Thu, 18 Oct 2012 08:09:15 +0000 (16:09 +0800)
committerkfx <kfx@rock-chips.com>
Thu, 18 Oct 2012 08:09:15 +0000 (16:09 +0800)
arch/arm/configs/rk2928_tb_defconfig
arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c
arch/arm/mach-rk2928/board-rk2928-tb-key.c [new file with mode: 0755]
arch/arm/mach-rk2928/board-rk2928-tb.c

index c7e17964db3355ff6cc0c63a8a7ca3fff24fecbd..da309299382e5d2b3b26a5eab7cdc10be0cf40e9 100644 (file)
@@ -238,21 +238,12 @@ CONFIG_EETI_EGALAX_MAX_Y=800
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_KEYCHORD=y
 CONFIG_INPUT_UINPUT=y
-CONFIG_COMPASS_AK8975=y
 CONFIG_GS_MMA8452=y
-CONFIG_GYRO_L3G4200D=y
-CONFIG_LS_CM3217=y
 CONFIG_SENSOR_DEVICE=y
 CONFIG_GSENSOR_DEVICE=y
-CONFIG_COMPASS_DEVICE=y
-CONFIG_GYROSCOPE_DEVICE=y
-CONFIG_LIGHT_DEVICE=y
 # CONFIG_SERIO is not set
 # CONFIG_CONSOLE_TRANSLATIONS is not set
 # CONFIG_LEGACY_PTYS is not set
-CONFIG_SERIAL_RK29=y
-CONFIG_UART0_RK29=y
-CONFIG_UART0_CTS_RTS_RK29=y
 # CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 # CONFIG_I2C_COMPAT is not set
@@ -267,7 +258,6 @@ CONFIG_EXPANDED_GPIO_IRQ_NUM=0
 CONFIG_SPI_FPGA_GPIO_NUM=0
 CONFIG_SPI_FPGA_GPIO_IRQ_NUM=0
 CONFIG_POWER_SUPPLY=y
-CONFIG_TEST_POWER=y
 # CONFIG_HWMON is not set
 CONFIG_MFD_TPS65910=y
 CONFIG_MFD_TPS65090=y
@@ -376,6 +366,7 @@ CONFIG_USB_SERIAL_OPTION=y
 CONFIG_USB_GADGET=y
 CONFIG_USB20_HOST=y
 CONFIG_USB20_OTG=y
+CONFIG_DWC_OTG_BOTH_HOST_SLAVE=y
 CONFIG_MMC=y
 CONFIG_MMC_UNSAFE_RESUME=y
 CONFIG_MMC_EMBEDDED_SDIO=y
index 7215da55b8b73345a5279a6ee4ef7242324041cf..b79c8ce8f3bb0897810b5974f3c5fed5342d0a58 100755 (executable)
@@ -7,22 +7,53 @@
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 
-#define gpio_readl(offset)     readl_relaxed(RK2928_GPIO1_BASE + offset)
-#define gpio_writel(v, offset) do { writel_relaxed(v, RK2928_GPIO1_BASE + offset); dsb(); } while (0)
-
-#define GPIO_SWPORTA_DR  0x0000
-#define GPIO_SWPORTA_DDR 0x0004
-
-#define GPIO1_A1_OUTPUT  (1<<1)
-#define GPIO1_A1_OUTPUT_HIGH  (1<<1)
-#define GPIO1_A1_OUTPUT_LOW  (~(1<<1))
-
 #ifdef CONFIG_MFD_TPS65910
+
 #if defined(CONFIG_MACH_RK2928_SDK)
 #define PMU_POWER_SLEEP RK2928_PIN0_PD0        
+#elif defined(CONFIG_MACH_RK2928_TB)
+#define PMU_POWER_SLEEP RK2928_PIN3_PD2
 #else
-#define PMU_POWER_SLEEP RK2928_PIN1_PA1        
+#define PMU_POWER_SLEEP RK2928_PIN1_PA1
 #endif
+
+#define GPIO_SWPORTA_DR  0x0000
+#define GPIO_SWPORTA_DDR 0x0004
+struct sram_gpio_data {
+       void __iomem *base;
+       uint offset;
+};
+
+static __sramdata struct sram_gpio_data pmic_sleep;
+static void __iomem *gpio_base[] = {RK2928_GPIO0_BASE, RK2928_GPIO1_BASE, RK2928_GPIO2_BASE, RK2928_GPIO3_BASE};
+
+static int sram_gpio_init(int gpio, struct sram_gpio_data *data)
+{
+       unsigned index;
+
+       if(gpio == INVALID_GPIO)
+               return -EINVAL;
+       index = gpio - PIN_BASE;
+       if(index/NUM_GROUP >= ARRAY_SIZE(gpio_base))
+               return -EINVAL;
+
+       data->base = gpio_base[index/NUM_GROUP];
+       data->offset = index%NUM_GROUP;
+
+       return 0;
+}
+
+static __sramfunc void sram_gpio_set_value(struct sram_gpio_data data, uint value)
+{
+       writel_relaxed(readl_relaxed(data.base + GPIO_SWPORTA_DDR)| (1<<data.offset),
+                       data.offset + GPIO_SWPORTA_DDR);
+       if(value)
+               writel_relaxed(readl_relaxed(data.base + GPIO_SWPORTA_DR) | (1<<data.offset),
+                               data.base + GPIO_SWPORTA_DR);
+       else
+               writel_relaxed(readl_relaxed(data.base + GPIO_SWPORTA_DR) & ~(1<<data.offset),
+                               data.base + GPIO_SWPORTA_DR);
+}
 extern int platform_device_register(struct platform_device *pdev);
 
 int tps65910_pre_init(struct tps65910 *tps65910){
@@ -32,6 +63,11 @@ int tps65910_pre_init(struct tps65910 *tps65910){
        int err = -1;
                
        printk("%s,line=%d\n", __func__,__LINE__);      
+        if(sram_gpio_init(PMU_POWER_SLEEP, &pmic_sleep) < 0){
+                printk(KERN_ERR "PMU_POWER_SLEEP is invalid gpio\n");
+                return -EINVAL;
+        }
+
        gpio_request(PMU_POWER_SLEEP, "NULL");
        gpio_direction_output(PMU_POWER_SLEEP, GPIO_LOW);
 
@@ -248,14 +284,14 @@ int tps65910_post_init(struct tps65910 *tps65910)
        printk("%s set vio vcc_io=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
        udelay(100);
-        /*
+#if defined(CONFIG_MACH_RK2928_TB) || defined(CONFIG_MACH_RK2926_TB)
        ldo = regulator_get(NULL, "vpll");      // vcc25
        regulator_set_voltage(ldo, 2500000, 2500000);
        regulator_enable(ldo);
        printk("%s set vpll vcc25=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
-        */
+#endif
        ldo = regulator_get(NULL, "vdig2");     // vdd12
        regulator_set_voltage(ldo, 1200000, 1200000);
        regulator_enable(ldo);
@@ -285,7 +321,11 @@ int tps65910_post_init(struct tps65910 *tps65910)
        udelay(100);
        
        ldo = regulator_get(NULL, "vdig1");     //vcc18_cif
+#if defined(CONFIG_MACH_RK2928_TB) || defined(CONFIG_MACH_RK2926_TB)
+       regulator_set_voltage(ldo, 1800000, 1800000);
+#else
        regulator_set_voltage(ldo, 1500000, 1500000);
+#endif
        regulator_enable(ldo);
        printk("%s set vdig1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
@@ -304,19 +344,23 @@ int tps65910_post_init(struct tps65910 *tps65910)
        printk("%s set vaux2 vcca33=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
-        /*
+#if defined(CONFIG_MACH_RK2928_TB) || defined(CONFIG_MACH_RK2926_TB)
        ldo = regulator_get(NULL, "vdac"); // vccio_wl
        regulator_set_voltage(ldo,1800000,1800000);
        regulator_enable(ldo); 
        printk("%s set vdac vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
-        */
+#endif
        ldo = regulator_get(NULL, "vmmc");  //vccio_wl
        regulator_set_voltage(ldo,3300000,3300000);
        regulator_enable(ldo); 
        printk("%s set vmmc vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
+#if defined(CONFIG_MACH_RK2928_TB) || defined(CONFIG_MACH_RK2926_TB)
+        //do not disable vccio wl
+#else
        regulator_disable(ldo); 
+#endif
        regulator_put(ldo);
        udelay(100);
 
@@ -580,19 +624,12 @@ static struct regulator_init_data tps65910_ldo8 = {
 };
 void __sramfunc board_pmu_tps65910_suspend(void)
 {      
-       int ret;
-       ret = gpio_readl(GPIO_SWPORTA_DDR);
-       gpio_writel(ret | GPIO1_A1_OUTPUT, GPIO_SWPORTA_DDR);
-       ret = gpio_readl(GPIO_SWPORTA_DR);
-       gpio_writel(ret | GPIO1_A1_OUTPUT_HIGH, GPIO_SWPORTA_DR);  //set pmu_sleep output high
+        sram_gpio_set_value(pmic_sleep, GPIO_HIGH);  
 }
 void __sramfunc board_pmu_tps65910_resume(void)
 {
        int ret;
-       ret = gpio_readl(GPIO_SWPORTA_DDR);
-       gpio_writel(ret | GPIO1_A1_OUTPUT, GPIO_SWPORTA_DDR);
-       ret = gpio_readl(GPIO_SWPORTA_DR);
-       gpio_writel(ret & GPIO1_A1_OUTPUT_LOW, GPIO_SWPORTA_DR);   //set pmu_sleep output low
+        sram_gpio_set_value(pmic_sleep, GPIO_LOW);  
        sram_udelay(2000);
 }
 static struct tps65910_board tps65910_data = {
diff --git a/arch/arm/mach-rk2928/board-rk2928-tb-key.c b/arch/arm/mach-rk2928/board-rk2928-tb-key.c
new file mode 100755 (executable)
index 0000000..2a7c0f3
--- /dev/null
@@ -0,0 +1,67 @@
+#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   = "vol-",
+               .code   = KEY_VOLUMEDOWN,
+               .gpio   = RK2928_PIN0_PD1,
+               .active_low = PRESS_LEV_LOW,
+       },
+       {
+               .desc   = "play",
+               .code   = KEY_POWER,
+               .gpio   = RK2928_PIN3_PC5,
+               .active_low = PRESS_LEV_LOW,
+               //.code_long_press = EV_ENCALL,
+               .wakeup = 1,
+       },
+       {
+               .desc   = "vol+",
+               .code   = KEY_VOLUMEUP,
+               .adc_value      = 1,
+               .gpio = INVALID_GPIO,
+               //.gpio = RK2928_PIN0_PD0,
+               .active_low = PRESS_LEV_LOW,
+       },
+       {
+               .desc   = "menu",
+               .code   = EV_MENU,
+               .adc_value      = 135,
+               .gpio = INVALID_GPIO,
+               .active_low = PRESS_LEV_LOW,
+       },
+       {
+               .desc   = "home",
+               .code   = KEY_HOME,
+               .adc_value      = 550,
+               .gpio = INVALID_GPIO,
+               .active_low = PRESS_LEV_LOW,
+       },
+       {
+               .desc   = "esc",
+               .code   = KEY_BACK,
+               .adc_value      = 334,
+               .gpio = INVALID_GPIO,
+               .active_low = PRESS_LEV_LOW,
+       },
+       {
+               .desc   = "camera",
+               .code   = KEY_CAMERA,
+               .adc_value      = 700,
+               .gpio = INVALID_GPIO,
+               .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
+};
+
index 51ae93133d712a4db3433b527b7b94ace0b56c58..eb1aea9bebc2c37e05c0084d07974e92e7c359df 100755 (executable)
@@ -64,6 +64,8 @@
 #define RK30_FB0_MEM_SIZE 8*SZ_1M
 #endif
 
+int __sramdata g_pmic_type =  0;
+
 #include "board-rk2928-tb-camera.c"
 #include "board-rk2928-tb-key.c"
 
@@ -217,72 +219,6 @@ static struct sensor_platform_data mma8452_info = {
         .init_platform_hw = mma8452_init_platform_hw,
         .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
 };
-#endif
-#if defined (CONFIG_COMPASS_AK8975)
-static struct sensor_platform_data akm8975_info =
-{
-       .type = SENSOR_TYPE_COMPASS,
-       .irq_enable = 1,
-       .poll_delay_ms = 30,
-       .m_layout = 
-       {
-               {
-                       {1, 0, 0},
-                       {0, 1, 0},
-                       {0, 0, 1},
-               },
-
-               {
-                       {1, 0, 0},
-                       {0, 1, 0},
-                       {0, 0, 1},
-               },
-
-               {
-                       {1, 0, 0},
-                       {0, 1, 0},
-                       {0, 0, 1},
-               },
-
-               {
-                       {1, 0, 0},
-                       {0, 1, 0},
-                       {0, 0, 1},
-               },
-       }
-};
-
-#endif
-
-#if defined(CONFIG_GYRO_L3G4200D)
-
-#include <linux/l3g4200d.h>
-
-static int l3g4200d_init_platform_hw(void)
-{
-       return 0;
-}
-
-static struct sensor_platform_data l3g4200d_info = {
-       .type = SENSOR_TYPE_GYROSCOPE,
-       .irq_enable = 1,
-       .poll_delay_ms = 30,
-       .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
-       .init_platform_hw = l3g4200d_init_platform_hw,
-       .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
-       .y_min = 40,
-       .z_min = 20,
-};
-
-#endif
-
-#ifdef CONFIG_LS_CM3217
-static struct sensor_platform_data cm3217_info = {
-       .type = SENSOR_TYPE_LIGHT,
-       .irq_enable = 0,
-       .poll_delay_ms = 500,
-};
-
 #endif
 
 #ifdef CONFIG_FB_ROCKCHIP
@@ -465,6 +401,38 @@ struct platform_device pwm_regulator_device[1] = {
        },
 };
 #endif
+
+/***********************************************************
+*      usb wifi
+************************************************************/
+#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
+
+static void rkusb_wifi_power(int on) {
+       struct regulator *ldo = NULL;
+       
+#if defined(CONFIG_MFD_TPS65910)       
+       if (pmic_is_tps65910() )
+               ldo = regulator_get(NULL, "vmmc");  //vccio_wl
+#endif
+#if defined(CONFIG_REGULATOR_ACT8931)
+       if(pmic_is_act8931() )
+               ldo = regulator_get(NULL, "act_ldo4");  //vccio_wl
+#endif 
+       
+       if(on) {
+               regulator_enable(ldo);
+               printk("%s: vccio_wl enable\n", __func__);
+       } else {
+               printk("%s: vccio_wl disable\n", __func__);
+               regulator_disable(ldo);
+       }
+       
+       regulator_put(ldo);
+       udelay(100);
+}
+
+#endif
+
 /**************************************************************************************************
  * SDMMC devices,  include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
 **************************************************************************************************/
@@ -816,30 +784,12 @@ static struct i2c_board_info __initdata i2c0_info[] = {
                .platform_data = &mma8452_info,
        },
 #endif
-#if defined (CONFIG_COMPASS_AK8975)
-       {
-               .type          = "ak8975",
-               .addr          = 0x0d,
-               .flags         = 0,
-               .irq           = RK2928_PIN3_PD2,
-               .platform_data = &akm8975_info,
-       },
-#endif
-#if defined (CONFIG_GYRO_L3G4200D)
-       {
-               .type          = "l3g4200d_gryo",
-               .addr          = 0x69,
-               .flags         = 0,
-               .irq           = RK2928_PIN3_PD3,
-               .platform_data = &l3g4200d_info,
-       },
-#endif
 };
 #endif
 #ifdef CONFIG_I2C1_RK30
 #ifdef CONFIG_MFD_TPS65910
 #define TPS65910_HOST_IRQ        RK2928_PIN3_PC6
-#include "board-rk2928-tb-tps65910.c"
+#include "board-rk2928-sdk-tps65910.c"
 #endif
 static struct i2c_board_info __initdata i2c1_info[] = {
 
@@ -866,14 +816,6 @@ static struct i2c_board_info __initdata i2c2_info[] = {
                 .platform_data  = &eeti_egalax_info,
         },
 #endif
-#if defined (CONFIG_LS_CM3217)
-       {
-               .type          = "lightsensor",
-               .addr          = 0x10,
-               .flags         = 0,
-               .platform_data = &cm3217_info,
-       },
-#endif
 };
 #endif
 #ifdef CONFIG_I2C3_RK30
@@ -943,8 +885,6 @@ static void __init rk2928_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));
-        //RK2928 USB DETECT IRQ: IRQ_OTG_BVALID
-       //board_usb_detect_init(RK30_PIN6_PA3);
 
 #ifdef CONFIG_WIFI_CONTROL_FUNC
        rk29sdk_wifi_bt_gpio_control_init();
@@ -959,12 +899,6 @@ static void __init rk2928_reserve(void)
 #ifdef CONFIG_FB_ROCKCHIP
        resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
        resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
-#if 0
-       resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
-       resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
-       resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
-       resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
-#endif
 #endif
 #ifdef CONFIG_VIDEO_RK29
        rk30_camera_request_reserve_mem();
@@ -985,22 +919,21 @@ static void __init rk2928_reserve(void)
  * comments    : min arm/logic voltage
  */
 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
-       {.frequency = 216 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 312 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 408 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 504 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 600 * 1000,       .cpu_volt = 1200 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 696 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 816 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
-       {.frequency = 912 * 1000,       .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 216 * 1000,       .cpu_volt =  850 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 312 * 1000,       .cpu_volt =  900 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 408 * 1000,       .cpu_volt =  950 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 504 * 1000,       .cpu_volt = 1000 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 600 * 1000,       .cpu_volt = 1100 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 696 * 1000,       .cpu_volt = 1175 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 816 * 1000,       .cpu_volt = 1250 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 912 * 1000,       .cpu_volt = 1350 * 1000,        .logic_volt = 1200 * 1000},
+       {.frequency = 1008 * 1000,      .cpu_volt = 1450 * 1000,        .logic_volt = 1200 * 1000},
 #if 0
-       {.frequency = 1008 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = 1200 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = 1104 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = 1248 * 1000,      .cpu_volt = 1400 * 1000,        .logic_volt = 1200 * 1000},
 #endif
-       //{.frequency = 1000 * 1000,    .cpu_volt = 1225 * 1000,        .logic_volt = 1200 * 1000},
        {.frequency = CPUFREQ_TABLE_END},
 };