#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){
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);
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);
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);
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);
};
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 = {
#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"
.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
},
};
#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
**************************************************************************************************/
.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[] = {
.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
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();
#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();
* 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},
};