msm: board-8960: Add regulator support for KS8851 ethernet device
Update existing regulator consumer mappings to use the new KS8851
regulator names: "vdd-io" and "vdd-phy". Also, conditionally
remove the "vdd-phy" consumer mapping from the 8921_lvs6
regulator for CDP targets. This ensures that both regulator_get
calls in the KS8851 driver succeed for CDP and non-CDP targets.
Change-Id: I7c3f3ec25b6a774b89a63955ff7e13f96c9776fa
Signed-off-by: David Collins <collinsd@codeaurora.org>
(cherry picked from commit e68647e762f8b00cc437e922966103a595e35d84)
diff --git a/arch/arm/mach-msm/board-8960-regulator.c b/arch/arm/mach-msm/board-8960-regulator.c
index bcfd558..8fc26ea 100644
--- a/arch/arm/mach-msm/board-8960-regulator.c
+++ b/arch/arm/mach-msm/board-8960-regulator.c
@@ -14,6 +14,7 @@
#include <linux/regulator/pm8xxx-regulator.h>
#include <linux/regulator/msm-gpio-regulator.h>
#include <mach/rpm-regulator.h>
+#include <mach/socinfo.h>
#include "board-8960.h"
@@ -219,9 +220,16 @@
REGULATOR_SUPPLY("cam_vio", "4-0020"),
REGULATOR_SUPPLY("cam_vio", "4-0034"),
};
+/* This mapping is used for CDP only. */
+VREG_CONSUMERS(CDP_LVS6) = {
+ REGULATOR_SUPPLY("8921_lvs6", NULL),
+ REGULATOR_SUPPLY("vdd-io", "spi0.0"),
+};
+/* This mapping is used for non-CDP targets only. */
VREG_CONSUMERS(LVS6) = {
REGULATOR_SUPPLY("8921_lvs6", NULL),
- REGULATOR_SUPPLY("vdd_io", "spi0.0"),
+ REGULATOR_SUPPLY("vdd-io", "spi0.0"),
+ REGULATOR_SUPPLY("vdd-phy", "spi0.0"),
};
VREG_CONSUMERS(LVS7) = {
REGULATOR_SUPPLY("8921_lvs7", NULL),
@@ -241,7 +249,7 @@
};
VREG_CONSUMERS(EXT_L2) = {
REGULATOR_SUPPLY("ext_l2", NULL),
- REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
+ REGULATOR_SUPPLY("vdd-phy", "spi0.0"),
};
VREG_CONSUMERS(EXT_3P3V) = {
REGULATOR_SUPPLY("ext_3p3v", NULL),
@@ -605,3 +613,26 @@
.consumer_map = msm_rpm_regulator_consumer_mapping,
.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
};
+
+/*
+ * Fix up regulator consumer data that moves to a different regulator based on
+ * the current target.
+ */
+void __init configure_msm8960_power_grid(void)
+{
+ static struct rpm_regulator_init_data *rpm_data;
+ int i;
+
+ if (machine_is_msm8960_cdp()) {
+ /* Only modify LVS6 consumers for CDP targets. */
+ for (i = 0; i < ARRAY_SIZE(msm_rpm_regulator_init_data); i++) {
+ rpm_data = &msm_rpm_regulator_init_data[i];
+ if (rpm_data->id == RPM_VREG_ID_PM8921_LVS6) {
+ rpm_data->init_data.consumer_supplies
+ = vreg_consumers_CDP_LVS6;
+ rpm_data->init_data.num_consumer_supplies
+ = ARRAY_SIZE(vreg_consumers_CDP_LVS6);
+ }
+ }
+ }
+}
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index 45c930ce..1c9637e 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -3086,6 +3086,7 @@
regulator_suppress_info_printing();
if (msm_xo_init())
pr_err("Failed to initialize XO votes\n");
+ configure_msm8960_power_grid();
platform_device_register(&msm8960_device_rpm_regulator);
msm_clock_init(&msm8960_clock_init_data);
if (machine_is_msm8960_liquid())
diff --git a/arch/arm/mach-msm/board-8960.h b/arch/arm/mach-msm/board-8960.h
index f6ae841..c526f3d 100644
--- a/arch/arm/mach-msm/board-8960.h
+++ b/arch/arm/mach-msm/board-8960.h
@@ -80,6 +80,7 @@
void msm8960_init_pmic(void);
void msm8960_init_mmc(void);
int msm8960_init_gpiomux(void);
+void __init configure_msm8960_power_grid(void);
unsigned char msm8960_hdmi_as_primary_selected(void);
void msm8960_allocate_fb_region(void);
void msm8960_set_display_params(char *prim_panel, char *ext_panel);