@@ -970,29 +970,8 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
if (pwrdm->banks < (bank + 1))
return -EEXIST;
- /*
- * The register bit names below may not correspond to the
- * actual names of the bits in each powerdomain's register,
- * but the type of value returned is the same for each
- * powerdomain.
- */
- switch (bank) {
- case 0:
- m = OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK;
- break;
- case 1:
- m = OMAP3430_L1FLATMEMSTATEST_MASK;
- break;
- case 2:
- m = OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK;
- break;
- case 3:
- m = OMAP3430_L2FLATMEMSTATEST_MASK;
- break;
- default:
- WARN_ON(1); /* should never happen */
- return -EEXIST;
- }
+ m = pwrdm->pwrsts_mem_shift[bank];
+ WARN_ON(!m);
return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, m);
}
@@ -1017,29 +996,8 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
if (pwrdm->banks < (bank + 1))
return -EEXIST;
- /*
- * The register bit names below may not correspond to the
- * actual names of the bits in each powerdomain's register,
- * but the type of value returned is the same for each
- * powerdomain.
- */
- switch (bank) {
- case 0:
- m = OMAP3430_LASTMEM1STATEENTERED_MASK;
- break;
- case 1:
- m = OMAP3430_LASTMEM2STATEENTERED_MASK;
- break;
- case 2:
- m = OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
- break;
- case 3:
- m = OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
- break;
- default:
- WARN_ON(1); /* should never happen */
- return -EEXIST;
- }
+ m = pwrdm->pwrsts_mem_shift[bank];
+ WARN_ON(!m);
return prm_read_mod_bits_shift(pwrdm->prcm_offs,
OMAP3430_PM_PREPWSTST, m);
@@ -191,6 +191,9 @@ static struct powerdomain mpu_34xx_pwrdm = {
.pwrsts = PWRSTS_OFF_RET_ON,
.pwrsts_logic_ret = PWRSTS_OFF_RET,
.banks = 1,
+ .pwrsts_mem_shift = {
+ [0] = OMAP3430_L2CACHESTATEST_SHIFT,
+ },
.pwrsts_mem_ret = {
[0] = PWRSTS_OFF_RET,
},
@@ -106,6 +106,9 @@ struct powerdomain {
/* Number of software-controllable memory banks in this powerdomain */
const u8 banks;
+ /* Memory state shift value for each bank */
+ const u8 pwrsts_mem_shift[PWRDM_MAX_MEM_BANKS];
+
/* Possible memory bank pwrstates when pwrdm in RETENTION */
const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];