Commit 163b0de0 authored by Nancy Chen's avatar Nancy Chen Committed by Jason Liu

ENGR00161124 [dvfs, cpufreq] Use regulator API to set cpu voltage

Change dvfs driver and cpufreq driver to use regulator API to set cpu voltage.
Signed-off-by: default avatarNancy Chen <Nancy.Chen@freescale.com>
parent b55227ff
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Object file lists. # Object file lists.
obj-y := cpu.o mm.o devices.o ehci.o bus_freq.o sdram_autogating.o \ obj-y := cpu.o mm.o devices.o ehci.o bus_freq.o sdram_autogating.o \
pm.o system.o suspend.o usb_dr.o usb_h1.o usb_h2.o pm.o system.o suspend.o usb_dr.o usb_h1.o usb_h2.o cpu_regulator-mx5.o
obj-$(CONFIG_SOC_IMX50) += clock_mx50.o mm-mx50.o mx50_wfi.o mx50_suspend.o mx50_freq.o mx50_ddr_freq.o obj-$(CONFIG_SOC_IMX50) += clock_mx50.o mm-mx50.o mx50_wfi.o mx50_suspend.o mx50_freq.o mx50_ddr_freq.o
obj-$(CONFIG_SOC_IMX51) += clock.o obj-$(CONFIG_SOC_IMX51) += clock.o
......
...@@ -93,15 +93,10 @@ ...@@ -93,15 +93,10 @@
#define MX50_RDP_SD3_WP IMX_GPIO_NR(5, 28) /*GPIO_5_28 */ #define MX50_RDP_SD3_WP IMX_GPIO_NR(5, 28) /*GPIO_5_28 */
#define MX50_RDP_USB_OTG_PWR IMX_GPIO_NR(6, 25) /*GPIO_6_25*/ #define MX50_RDP_USB_OTG_PWR IMX_GPIO_NR(6, 25) /*GPIO_6_25*/
extern int (*set_cpu_voltage)(u32 volt);
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt);
extern int mx50_rdp_init_mc13892(void); extern int mx50_rdp_init_mc13892(void);
extern void mx5_cpu_regulator_init(void);
extern char *lp_reg_id; extern char *lp_reg_id;
extern char *gp_reg_id;
static char *gp_reg_id;
static struct regulator *cpu_regulator;
static int max17135_regulator_init(struct max17135 *max17135); static int max17135_regulator_init(struct max17135 *max17135);
static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = { static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = {
...@@ -795,18 +790,6 @@ static struct mxc_regulator_platform_data rdp_regulator_data = { ...@@ -795,18 +790,6 @@ static struct mxc_regulator_platform_data rdp_regulator_data = {
.vcc_reg_id = "lp_vcc", .vcc_reg_id = "lp_vcc",
}; };
static int mx50_rdp_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static const struct esdhc_platform_data mx50_rdp_sd1_data __initconst = { static const struct esdhc_platform_data mx50_rdp_sd1_data __initconst = {
.cd_gpio = MX50_RDP_SD1_CD, .cd_gpio = MX50_RDP_SD1_CD,
.wp_gpio = MX50_RDP_SD1_WP, .wp_gpio = MX50_RDP_SD1_WP,
...@@ -825,7 +808,6 @@ static const struct esdhc_platform_data mx50_rdp_sd3_data __initconst = { ...@@ -825,7 +808,6 @@ static const struct esdhc_platform_data mx50_rdp_sd3_data __initconst = {
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx50_rdp_set_cpu_voltage;
} }
static void mx50_rdp_usbotg_vbus(bool on) static void mx50_rdp_usbotg_vbus(bool on)
...@@ -900,6 +882,8 @@ static void __init mx50_rdp_board_init(void) ...@@ -900,6 +882,8 @@ static void __init mx50_rdp_board_init(void)
imx50_add_busfreq(); imx50_add_busfreq();
mx50_rdp_init_usb(); mx50_rdp_init_usb();
mx5_cpu_regulator_init();
} }
static void __init mx50_rdp_timer_init(void) static void __init mx50_rdp_timer_init(void)
......
...@@ -84,11 +84,8 @@ ...@@ -84,11 +84,8 @@
#define MX51_USB_PLL_DIV_24_MHZ 0x02 #define MX51_USB_PLL_DIV_24_MHZ 0x02
extern char *lp_reg_id; extern char *lp_reg_id;
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt); extern void mx5_cpu_regulator_init(void);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static struct gpio_keys_button babbage_buttons[] = { static struct gpio_keys_button babbage_buttons[] = {
{ {
...@@ -562,19 +559,6 @@ static struct i2c_board_info mxc_i2c_hs_board_info[] __initdata = { ...@@ -562,19 +559,6 @@ static struct i2c_board_info mxc_i2c_hs_board_info[] __initdata = {
static struct mxc_gpu_platform_data gpu_data __initdata; static struct mxc_gpu_platform_data gpu_data __initdata;
static int mx51_bbg_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
...@@ -586,8 +570,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, ...@@ -586,8 +570,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
int fb_mem = 0; int fb_mem = 0;
char *str; char *str;
set_cpu_voltage = mx51_bbg_set_cpu_voltage;
for_each_tag(mem_tag, tags) { for_each_tag(mem_tag, tags) {
if (mem_tag->hdr.tag == ATAG_MEM) { if (mem_tag->hdr.tag == ATAG_MEM) {
total_mem = mem_tag->u.mem.size; total_mem = mem_tag->u.mem.size;
...@@ -826,6 +808,7 @@ static void __init mx51_babbage_init(void) ...@@ -826,6 +808,7 @@ static void __init mx51_babbage_init(void)
imx51_add_dvfs_core(&bbg_dvfscore_data); imx51_add_dvfs_core(&bbg_dvfscore_data);
imx51_add_busfreq(); imx51_add_busfreq();
mx5_cpu_regulator_init();
} }
static void __init mx51_babbage_timer_init(void) static void __init mx51_babbage_timer_init(void)
......
...@@ -61,12 +61,9 @@ ...@@ -61,12 +61,9 @@
#define ARD_SSI_STEERING (MAX7310_BASE_ADDR + 6) #define ARD_SSI_STEERING (MAX7310_BASE_ADDR + 6)
#define ARD_GPS_RST_B (MAX7310_BASE_ADDR + 7) #define ARD_GPS_RST_B (MAX7310_BASE_ADDR + 7)
static struct regulator *cpu_regulator; extern char *gp_reg_id;
static char *gp_reg_id;
extern char *lp_reg_id; extern char *lp_reg_id;
extern void (*set_cpu_voltage)(u32 volt); extern void mx5_cpu_regulator_init(void);
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt);
static iomux_v3_cfg_t mx53_ard_pads[] = { static iomux_v3_cfg_t mx53_ard_pads[] = {
/* UART */ /* UART */
...@@ -354,22 +351,9 @@ static struct mxc_regulator_platform_data ard_regulator_data = { ...@@ -354,22 +351,9 @@ static struct mxc_regulator_platform_data ard_regulator_data = {
.cpu_reg_id = "SW1", .cpu_reg_id = "SW1",
}; };
static int mx53_ard_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx53_ard_set_cpu_voltage;
} }
static inline void mx53_ard_init_uart(void) static inline void mx53_ard_init_uart(void)
...@@ -501,6 +485,8 @@ static void __init mx53_ard_board_init(void) ...@@ -501,6 +485,8 @@ static void __init mx53_ard_board_init(void)
imx53_init_audio(); imx53_init_audio();
mx5_cpu_regulator_init();
/* this call required to release SCC RAM partition held by ROM /* this call required to release SCC RAM partition held by ROM
* during boot, even if SCC2 driver is not part of the image * during boot, even if SCC2 driver is not part of the image
*/ */
......
...@@ -80,11 +80,8 @@ ...@@ -80,11 +80,8 @@
#define ARM2_LCD_CONTRAST IMX_GPIO_NR(4, 20) /* GPIO_4_20 */ #define ARM2_LCD_CONTRAST IMX_GPIO_NR(4, 20) /* GPIO_4_20 */
extern char *lp_reg_id; extern char *lp_reg_id;
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt); extern void mx5_cpu_regulator_init(void);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx53common_pads[] = { static iomux_v3_cfg_t mx53common_pads[] = {
MX53_PAD_EIM_WAIT__GPIO5_0, MX53_PAD_EIM_WAIT__GPIO5_0,
...@@ -728,22 +725,9 @@ static struct mxc_regulator_platform_data evk_regulator_data = { ...@@ -728,22 +725,9 @@ static struct mxc_regulator_platform_data evk_regulator_data = {
.vcc_reg_id = "SW2", .vcc_reg_id = "SW2",
}; };
static int mx53_evk_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx53_evk_set_cpu_voltage;
} }
static void __init mx53_evk_board_init(void) static void __init mx53_evk_board_init(void)
...@@ -797,6 +781,8 @@ static void __init mx53_evk_board_init(void) ...@@ -797,6 +781,8 @@ static void __init mx53_evk_board_init(void)
imx53_add_spdif_dai(); imx53_add_spdif_dai();
imx53_add_spdif_audio_device(); imx53_add_spdif_audio_device();
mx5_cpu_regulator_init();
/* this call required to release SCC RAM partition held by ROM /* this call required to release SCC RAM partition held by ROM
* during boot, even if SCC2 driver is not part of the image * during boot, even if SCC2 driver is not part of the image
*/ */
......
...@@ -73,15 +73,11 @@ extern void __iomem *gpc_base; ...@@ -73,15 +73,11 @@ extern void __iomem *gpc_base;
extern void __iomem *ccm_base; extern void __iomem *ccm_base;
extern void __iomem *imx_otg_base; extern void __iomem *imx_otg_base;
extern char *lp_reg_id; extern char *lp_reg_id;
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt); extern void mx5_cpu_regulator_init(void);
extern int __init mx53_loco_init_da9052(void); extern int __init mx53_loco_init_da9052(void);
extern int __init mx53_loco_init_mc34708(u32 int_gpio); extern int __init mx53_loco_init_mc34708(u32 int_gpio);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx53_loco_pads[] = { static iomux_v3_cfg_t mx53_loco_pads[] = {
/* FEC */ /* FEC */
MX53_PAD_FEC_MDC__FEC_MDC, MX53_PAD_FEC_MDC__FEC_MDC,
...@@ -599,17 +595,6 @@ static struct mxc_regulator_platform_data loco_regulator_data = { ...@@ -599,17 +595,6 @@ static struct mxc_regulator_platform_data loco_regulator_data = {
.cpu_reg_id = "cpu_vddgp", .cpu_reg_id = "cpu_vddgp",
}; };
static int mx53_loco_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
...@@ -621,8 +606,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, ...@@ -621,8 +606,6 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
int fb_mem = SZ_32M; int fb_mem = SZ_32M;
char *str; char *str;
set_cpu_voltage = mx53_loco_set_cpu_voltage;
for_each_tag(mem_tag, tags) { for_each_tag(mem_tag, tags) {
if (mem_tag->hdr.tag == ATAG_MEM) { if (mem_tag->hdr.tag == ATAG_MEM) {
total_mem = mem_tag->u.mem.size; total_mem = mem_tag->u.mem.size;
...@@ -782,6 +765,7 @@ static void __init mx53_loco_board_init(void) ...@@ -782,6 +765,7 @@ static void __init mx53_loco_board_init(void)
imx53_add_mxc_scc2(); imx53_add_mxc_scc2();
imx53_add_dvfs_core(&loco_dvfs_core_data); imx53_add_dvfs_core(&loco_dvfs_core_data);
imx53_add_busfreq(); imx53_add_busfreq();
mx5_cpu_regulator_init();
} }
static void __init mx53_loco_timer_init(void) static void __init mx53_loco_timer_init(void)
......
...@@ -84,13 +84,10 @@ ...@@ -84,13 +84,10 @@
static struct clk *sata_clk, *sata_ref_clk; static struct clk *sata_clk, *sata_ref_clk;
extern char *lp_reg_id; extern char *lp_reg_id;
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt); extern void mx5_cpu_regulator_init(void);
extern int mx53_smd_init_da9052(void); extern int mx53_smd_init_da9052(void);
extern void mx5_cpu_regulator_init(void);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx53_smd_pads[] = { static iomux_v3_cfg_t mx53_smd_pads[] = {
MX53_PAD_CSI0_DAT10__UART1_TXD_MUX, MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
...@@ -745,22 +742,9 @@ static struct mxc_regulator_platform_data smd_regulator_data = { ...@@ -745,22 +742,9 @@ static struct mxc_regulator_platform_data smd_regulator_data = {
.cpu_reg_id = "DA9052_BUCK_CORE", .cpu_reg_id = "DA9052_BUCK_CORE",
}; };
static int mx53_smd_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = mx5_set_cpu_voltage(cpu_regulator, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx53_smd_set_cpu_voltage;
} }
static void __init mx53_smd_board_init(void) static void __init mx53_smd_board_init(void)
...@@ -848,6 +832,8 @@ static void __init mx53_smd_board_init(void) ...@@ -848,6 +832,8 @@ static void __init mx53_smd_board_init(void)
* during boot, even if SCC2 driver is not part of the image * during boot, even if SCC2 driver is not part of the image
*/ */
imx53_add_mxc_scc2(); imx53_add_mxc_scc2();
mx5_cpu_regulator_init();
} }
static void __init mx53_smd_timer_init(void) static void __init mx53_smd_timer_init(void)
......
...@@ -172,18 +172,6 @@ static int get_mx50_srev(void) ...@@ -172,18 +172,6 @@ static int get_mx50_srev(void)
return 0; return 0;
} }
int mx5_set_cpu_voltage(struct regulator *gp_reg, u32 cpu_volt)
{
u32 ret = 0;
if (!IS_ERR(gp_reg)) {
ret = regulator_set_voltage(gp_reg, cpu_volt, cpu_volt);
if (ret < 0)
printk(KERN_DEBUG "COULD NOT SET GP VOLTAGE!!!!\n");
}
return ret;
}
/* /*
* Returns: * Returns:
* the silicon revision of the cpu * the silicon revision of the cpu
......
/*
* Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <mach/hardware.h>
#include <linux/err.h>
#include <linux/regulator/consumer.h>
struct regulator *cpu_regulator;
char *gp_reg_id;
void mx5_cpu_regulator_init(void)
{
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (IS_ERR(cpu_regulator))
printk(KERN_ERR "%s: failed to get cpu regulator\n", __func__);
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Object file lists. # Object file lists.
obj-y := cpu.o mm.o system.o devices.o dummy_gpio.o irq.o bus_freq.o usb_dr.o usb_h1.o usb_h2.o usb_h3.o pm.o cpu_op-mx6.o mx6_wfi.o mx6_fec.o mx6_anatop_regulator.o obj-y := cpu.o mm.o system.o devices.o dummy_gpio.o irq.o bus_freq.o usb_dr.o usb_h1.o usb_h2.o usb_h3.o pm.o cpu_op-mx6.o mx6_wfi.o mx6_fec.o mx6_anatop_regulator.o cpu_regulator-mx6.o
obj-$(CONFIG_ARCH_MX6) += clock.o mx6q_suspend.o obj-$(CONFIG_ARCH_MX6) += clock.o mx6q_suspend.o
obj-$(CONFIG_MACH_MX6Q_ARM2) += board-mx6q_arm2.o obj-$(CONFIG_MACH_MX6Q_ARM2) += board-mx6q_arm2.o
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/regulator/consumer.h>
#include <linux/pmic_external.h> #include <linux/pmic_external.h>
#include <linux/pmic_status.h> #include <linux/pmic_status.h>
#include <linux/ipu.h> #include <linux/ipu.h>
...@@ -114,10 +113,8 @@ static int flexcan_en; ...@@ -114,10 +113,8 @@ static int flexcan_en;
extern struct regulator *(*get_cpu_regulator)(void); extern struct regulator *(*get_cpu_regulator)(void);
extern void (*put_cpu_regulator)(void); extern void (*put_cpu_regulator)(void);
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx6_set_cpu_voltage(u32 cpu_volt); extern void mx6_cpu_regulator_init(void);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx6q_arm2_pads[] = { static iomux_v3_cfg_t mx6q_arm2_pads[] = {
...@@ -1379,23 +1376,9 @@ static struct mxc_dvfs_platform_data arm2_dvfscore_data = { ...@@ -1379,23 +1376,9 @@ static struct mxc_dvfs_platform_data arm2_dvfscore_data = {
.delay_time = 80, .delay_time = 80,
}; };
static int mx6_arm2_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = regulator_set_voltage(cpu_regulator,
cpu_volt, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx6_arm2_set_cpu_voltage;
} }
static int __init early_enable_spdif(char *p) static int __init early_enable_spdif(char *p)
...@@ -1525,6 +1508,8 @@ static void __init mx6_board_init(void) ...@@ -1525,6 +1508,8 @@ static void __init mx6_board_init(void)
imx6q_add_vpu(); imx6q_add_vpu();
imx6q_init_audio(); imx6q_init_audio();
platform_device_register(&arm2_vmmc_reg_devices); platform_device_register(&arm2_vmmc_reg_devices);
mx6_cpu_regulator_init();
imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk"); imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk");
imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk"); imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk");
imx6q_add_asrc(&imx_asrc_data); imx6q_add_asrc(&imx_asrc_data);
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/regulator/consumer.h>
#include <linux/pmic_external.h> #include <linux/pmic_external.h>
#include <linux/pmic_status.h> #include <linux/pmic_status.h>
#include <linux/ipu.h> #include <linux/ipu.h>
...@@ -112,10 +111,8 @@ static int mipi_sensor; ...@@ -112,10 +111,8 @@ static int mipi_sensor;
extern struct regulator *(*get_cpu_regulator)(void); extern struct regulator *(*get_cpu_regulator)(void);
extern void (*put_cpu_regulator)(void); extern void (*put_cpu_regulator)(void);
extern int (*set_cpu_voltage)(u32 volt); extern char *gp_reg_id;
extern int mx6_set_cpu_voltage(u32 cpu_volt); extern void mx6_cpu_regulator_init(void);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx6q_sabreauto_pads[] = { static iomux_v3_cfg_t mx6q_sabreauto_pads[] = {
...@@ -1294,23 +1291,9 @@ static struct mxc_dvfs_platform_data sabreauto_dvfscore_data = { ...@@ -1294,23 +1291,9 @@ static struct mxc_dvfs_platform_data sabreauto_dvfscore_data = {
.delay_time = 80, .delay_time = 80,
}; };
static int mx6_sabreauto_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = regulator_set_voltage(cpu_regulator,
cpu_volt, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx6_sabreauto_set_cpu_voltage;
} }
static int __init early_enable_mipi_sensor(char *p) static int __init early_enable_mipi_sensor(char *p)
...@@ -1457,6 +1440,7 @@ static void __init mx6_board_init(void) ...@@ -1457,6 +1440,7 @@ static void __init mx6_board_init(void)
imx6q_add_vpu(); imx6q_add_vpu();
imx6q_init_audio(); imx6q_init_audio();
platform_device_register(&sabreauto_vmmc_reg_devices); platform_device_register(&sabreauto_vmmc_reg_devices);
mx6_cpu_regulator_init();
imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk"); imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk");
imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk"); imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk");
imx6q_add_asrc(&imx_asrc_data); imx6q_add_asrc(&imx_asrc_data);
......
...@@ -92,12 +92,11 @@ ...@@ -92,12 +92,11 @@
void __init early_console_setup(unsigned long base, struct clk *clk); void __init early_console_setup(unsigned long base, struct clk *clk);
static struct clk *sata_clk; static struct clk *sata_clk;
extern char *gp_reg_id;
extern struct regulator *(*get_cpu_regulator)(void); extern struct regulator *(*get_cpu_regulator)(void);
extern void (*put_cpu_regulator)(void); extern void (*put_cpu_regulator)(void);
extern int (*set_cpu_voltage)(u32 volt); extern void mx6_cpu_regulator_init(void);
extern int mx6_set_cpu_voltage(u32 cpu_volt);
static struct regulator *cpu_regulator;
static char *gp_reg_id;
static iomux_v3_cfg_t mx6q_sabrelite_pads[] = { static iomux_v3_cfg_t mx6q_sabrelite_pads[] = {
/* AUDMUX */ /* AUDMUX */
...@@ -945,23 +944,9 @@ static struct mxc_dvfs_platform_data sabrelite_dvfscore_data = { ...@@ -945,23 +944,9 @@ static struct mxc_dvfs_platform_data sabrelite_dvfscore_data = {
.delay_time = 80, .delay_time = 80,
}; };
static int mx6_sabre_set_cpu_voltage(u32 cpu_volt)
{
int ret = -EINVAL;
if (cpu_regulator == NULL)
cpu_regulator = regulator_get(NULL, gp_reg_id);
if (!IS_ERR(cpu_regulator))
ret = regulator_set_voltage(cpu_regulator,
cpu_volt, cpu_volt);
return ret;
}
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi) char **cmdline, struct meminfo *mi)
{ {
set_cpu_voltage = mx6_sabre_set_cpu_voltage;
} }
/*! /*!
...@@ -1037,6 +1022,7 @@ static void __init mx6_sabrelite_board_init(void) ...@@ -1037,6 +1022,7 @@ static void __init mx6_sabrelite_board_init(void)
imx6q_add_dma(); imx6q_add_dma();
imx6q_add_dvfs_core(&sabrelite_dvfscore_data); imx6q_add_dvfs_core(&sabrelite_dvfscore_data);
mx6_cpu_regulator_init();
imx6q_add_hdmi_soc(); imx6q_add_hdmi_soc();
imx6q_add_hdmi_soc_dai(); imx6q_add_hdmi_soc_dai();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/regulator/consumer.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/common.h> #include <mach/common.h>
...@@ -39,9 +40,8 @@ ...@@ -39,9 +40,8 @@