aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMattias Nilsson <mattias.i.nilsson@stericsson.com>2011-08-12 04:28:18 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-10-24 08:09:18 -0400
commit0837bb7260a17283b4518e11206546ffc92265fc (patch)
tree2fd7964162981a3c2197d85e7f6a7f0c21960528 /drivers/mfd
parent73180f85f4ffbb66843f8248811b2ade29b22df2 (diff)
mfd: Add db8500-prcmu accessors for PLL and SGA clock
This extends the DB8500 PRCMU driver with accessor calls for the PRCMU PLL and SGA clocks. Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/db8500-prcmu.c83
1 files changed, 82 insertions, 1 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index cea814509a6..af369995b01 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -459,6 +459,35 @@ struct clk_mgt clk_mgt[PRCMU_NUM_REG_CLOCKS] = {
459 CLK_MGT_ENTRY(UICCCLK), 459 CLK_MGT_ENTRY(UICCCLK),
460}; 460};
461 461
462static struct regulator *hwacc_regulator[NUM_HW_ACC];
463static struct regulator *hwacc_ret_regulator[NUM_HW_ACC];
464
465static bool hwacc_enabled[NUM_HW_ACC];
466static bool hwacc_ret_enabled[NUM_HW_ACC];
467
468static const char *hwacc_regulator_name[NUM_HW_ACC] = {
469 [HW_ACC_SVAMMDSP] = "hwacc-sva-mmdsp",
470 [HW_ACC_SVAPIPE] = "hwacc-sva-pipe",
471 [HW_ACC_SIAMMDSP] = "hwacc-sia-mmdsp",
472 [HW_ACC_SIAPIPE] = "hwacc-sia-pipe",
473 [HW_ACC_SGA] = "hwacc-sga",
474 [HW_ACC_B2R2] = "hwacc-b2r2",
475 [HW_ACC_MCDE] = "hwacc-mcde",
476 [HW_ACC_ESRAM1] = "hwacc-esram1",
477 [HW_ACC_ESRAM2] = "hwacc-esram2",
478 [HW_ACC_ESRAM3] = "hwacc-esram3",
479 [HW_ACC_ESRAM4] = "hwacc-esram4",
480};
481
482static const char *hwacc_ret_regulator_name[NUM_HW_ACC] = {
483 [HW_ACC_SVAMMDSP] = "hwacc-sva-mmdsp-ret",
484 [HW_ACC_SIAMMDSP] = "hwacc-sia-mmdsp-ret",
485 [HW_ACC_ESRAM1] = "hwacc-esram1-ret",
486 [HW_ACC_ESRAM2] = "hwacc-esram2-ret",
487 [HW_ACC_ESRAM3] = "hwacc-esram3-ret",
488 [HW_ACC_ESRAM4] = "hwacc-esram4-ret",
489};
490
462/* 491/*
463* Used by MCDE to setup all necessary PRCMU registers 492* Used by MCDE to setup all necessary PRCMU registers
464*/ 493*/
@@ -1023,6 +1052,34 @@ int prcmu_release_usb_wakeup_state(void)
1023 return r; 1052 return r;
1024} 1053}
1025 1054
1055static int request_pll(u8 clock, bool enable)
1056{
1057 int r = 0;
1058
1059 if (clock == PRCMU_PLLSOC1)
1060 clock = (enable ? PLL_SOC1_ON : PLL_SOC1_OFF);
1061 else
1062 return -EINVAL;
1063
1064 mutex_lock(&mb1_transfer.lock);
1065
1066 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
1067 cpu_relax();
1068
1069 writeb(MB1H_PLL_ON_OFF, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
1070 writeb(clock, (tcdm_base + PRCM_REQ_MB1_PLL_ON_OFF));
1071
1072 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
1073 wait_for_completion(&mb1_transfer.work);
1074
1075 if (mb1_transfer.ack.header != MB1H_PLL_ON_OFF)
1076 r = -EIO;
1077
1078 mutex_unlock(&mb1_transfer.lock);
1079
1080 return r;
1081}
1082
1026/** 1083/**
1027 * db8500_prcmu_set_epod - set the state of a EPOD (power domain) 1084 * db8500_prcmu_set_epod - set the state of a EPOD (power domain)
1028 * @epod_id: The EPOD to set 1085 * @epod_id: The EPOD to set
@@ -1220,6 +1277,26 @@ static int request_reg_clock(u8 clock, bool enable)
1220 return 0; 1277 return 0;
1221} 1278}
1222 1279
1280static int request_sga_clock(u8 clock, bool enable)
1281{
1282 u32 val;
1283 int ret;
1284
1285 if (enable) {
1286 val = readl(PRCM_CGATING_BYPASS);
1287 writel(val | PRCM_CGATING_BYPASS_ICN2, PRCM_CGATING_BYPASS);
1288 }
1289
1290 ret = request_reg_clock(clock, enable);
1291
1292 if (!ret && !enable) {
1293 val = readl(PRCM_CGATING_BYPASS);
1294 writel(val & ~PRCM_CGATING_BYPASS_ICN2, PRCM_CGATING_BYPASS);
1295 }
1296
1297 return ret;
1298}
1299
1223/** 1300/**
1224 * db8500_prcmu_request_clock() - Request for a clock to be enabled or disabled. 1301 * db8500_prcmu_request_clock() - Request for a clock to be enabled or disabled.
1225 * @clock: The clock for which the request is made. 1302 * @clock: The clock for which the request is made.
@@ -1230,12 +1307,16 @@ static int request_reg_clock(u8 clock, bool enable)
1230 */ 1307 */
1231int db8500_prcmu_request_clock(u8 clock, bool enable) 1308int db8500_prcmu_request_clock(u8 clock, bool enable)
1232{ 1309{
1233 if (clock < PRCMU_NUM_REG_CLOCKS) 1310 if (clock == PRCMU_SGACLK)
1311 return request_sga_clock(clock, enable);
1312 else if (clock < PRCMU_NUM_REG_CLOCKS)
1234 return request_reg_clock(clock, enable); 1313 return request_reg_clock(clock, enable);
1235 else if (clock == PRCMU_TIMCLK) 1314 else if (clock == PRCMU_TIMCLK)
1236 return request_timclk(enable); 1315 return request_timclk(enable);
1237 else if (clock == PRCMU_SYSCLK) 1316 else if (clock == PRCMU_SYSCLK)
1238 return request_sysclk(enable); 1317 return request_sysclk(enable);
1318 else if (clock == PRCMU_PLLSOC1)
1319 return request_pll(clock, enable);
1239 else 1320 else
1240 return -EINVAL; 1321 return -EINVAL;
1241} 1322}