Skip to contentSkip to conversation

mfd: da9062: Make vbuck_a registers volatile

PATCH In review Andrej Picej 2 participants 5 messages Nov 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mfd: da9062: Make vbuck_a registers volatile

From: Stefan Riedmueller <[email protected]>

The VBUCK1_A, VBUCK2_A, VBUCK3_A and VBUCK4_A registers are used to set the desired output voltage of the BUCK 1-4 buck regulators. These values can be critical if used as input for core voltages. Thus make them volatile so they do not get cached.

---
 drivers/mfd/da9062-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/da9062-core.c +2 -0
index 2774b2cbaea6..c0dad5461946 100644
@@ -572,6 +572,8 @@ static const struct regmap_range da9062_aa_volatile_ranges[] = {
 	regmap_reg_range(DA9062AA_COUNT_S, DA9062AA_SECOND_D),
 	regmap_reg_range(DA9062AA_SEQ, DA9062AA_SEQ),
 	regmap_reg_range(DA9062AA_EN_32K, DA9062AA_EN_32K),
+	regmap_reg_range(DA9062AA_VBUCK2_A, DA9062AA_VBUCK2_A),
+	regmap_reg_range(DA9062AA_VBUCK3_A, DA9062AA_VBUCK3_A),
 };
 
 static const struct regmap_access_table da9062_aa_readable_table = {
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 mfd: da9063: Make vbcore registers volatile

From: Stefan Riedmueller <[email protected]>

The VBCORE1_A and VBCORE2_A registers are used to set the desired output voltage of the BCORE 1 and 2 buck regulators. These values can be critical if used as input for core voltages. Thus make them volatile so they do not get cached.

---
 drivers/mfd/da9063-i2c.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/da9063-i2c.c +2 -0
index 343ed6e96d87..8a3629c30382 100644
@@ -161,6 +161,7 @@ static const struct regmap_range da9063_ad_volatile_ranges[] = {
 	regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_AD_REG_SECOND_D),
 	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
 	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A, DA9063_REG_VBCORE2_A),
 	regmap_reg_range(DA9063_AD_REG_MON_REG_5, DA9063_AD_REG_MON_REG_6),
 };
 
@@ -206,6 +207,7 @@ static const struct regmap_range da9063_bb_da_volatile_ranges[] = {
 	regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_BB_REG_SECOND_D),
 	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
 	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A, DA9063_REG_VBCORE2_A),
 	regmap_reg_range(DA9063_BB_REG_MON_REG_5, DA9063_BB_REG_MON_REG_6),
 };
 
Signature · 1 line
2.25.1
#2 lore raw

RE: [PATCH 2/2] mfd: da9063: Make vbcore registers volatile

Quoted 6 lines · Andrej Picej

From: Stefan Riedmueller <[email protected]>

The VBCORE1_A and VBCORE2_A registers are used to set the desired output voltage of the BCORE 1 and 2 buck regulators. These values can be critical if used as input for core voltages. Thus make them volatile so they do not get cached.

I don't understand the need for this change. What is this fixing? As I understand it the registers in question aren't volatile so should persist.

Quoted 36 lines
---
 drivers/mfd/da9063-i2c.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/da9063-i2c.c +1 -0
index 343ed6e96d87..8a3629c30382 100644
@@ -161,6 +161,7 @@ static const struct regmap_range
 da9063_ad_volatile_ranges[] = {
 	regmap_reg_range(DA9063_REG_ADC_RES_L,
 DA9063_AD_REG_SECOND_D),
 	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
 	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A,
 DA9063_REG_VBCORE2_A),

regmap_reg_range(DA9063_AD_REG_MON_REG_5,
DA9063_AD_REG_MON_REG_6),
};

drivers/mfd/da9063-i2c.c +1 -0
@@ -206,6 +207,7 @@ static const struct regmap_range
 da9063_bb_da_volatile_ranges[] = {
 	regmap_reg_range(DA9063_REG_ADC_RES_L,
 DA9063_BB_REG_SECOND_D),
 	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
 	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A,
 DA9063_REG_VBCORE2_A),

regmap_reg_range(DA9063_BB_REG_MON_REG_5,
DA9063_BB_REG_MON_REG_6),
};

--
2.25.1

#3 lore raw

Re: [PATCH 2/2] mfd: da9063: Make vbcore registers volatile

Hi Adam,

Quoted 11 lines · Adam Thomson
Quoted 6 lines · Andrej Picej

From: Stefan Riedmueller <[email protected]>

The VBCORE1_A and VBCORE2_A registers are used to set the desired output voltage of the BCORE 1 and 2 buck regulators. These values can be critical if used as input for core voltages. Thus make them volatile so they do not get cached.

I don't understand the need for this change. What is this fixing? As I understand it the registers in question aren't volatile so should persist.

So basically this two patches were needed because we needed to enable internal LDOs bypass mode on the imx6 and in the process this PMICs regs needed to be somehow adjusted, which only worked if this regs were marked as volatile. Long story short, this method was only introduced in Phytec's version so upstreaming really doesn't make much sense.

I apologize for any inconvenience, but this two patches somehow slipped through the process and landed on the "send-to-upstream" list. I also talked with @Stefan Rieadmueller and he agreed that this two patches can be dropped.

Thanks for your time.

Quoted 38 lines
Quoted 37 lines
---
  drivers/mfd/da9063-i2c.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/mfd/da9063-i2c.c +1 -0
index 343ed6e96d87..8a3629c30382 100644
@@ -161,6 +161,7 @@ static const struct regmap_range
 da9063_ad_volatile_ranges[] = {
  	regmap_reg_range(DA9063_REG_ADC_RES_L,
 DA9063_AD_REG_SECOND_D),
  	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
  	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A,
 DA9063_REG_VBCORE2_A),

regmap_reg_range(DA9063_AD_REG_MON_REG_5,
DA9063_AD_REG_MON_REG_6),
};

drivers/mfd/da9063-i2c.c +1 -0
@@ -206,6 +207,7 @@ static const struct regmap_range
 da9063_bb_da_volatile_ranges[] = {
  	regmap_reg_range(DA9063_REG_ADC_RES_L,
 DA9063_BB_REG_SECOND_D),
  	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
  	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_REG_VBCORE2_A,
 DA9063_REG_VBCORE2_A),

regmap_reg_range(DA9063_BB_REG_MON_REG_5,
DA9063_BB_REG_MON_REG_6),
};

--
2.25.1

#4 lore raw

RE: [PATCH 2/2] mfd: da9063: Make vbcore registers volatile

Quoted 9 lines · Andrej Picej
Quoted 2 lines

I don't understand the need for this change. What is this fixing? As I understand it the registers in question aren't volatile so should persist.

So basically this two patches were needed because we needed to enable internal LDOs bypass mode on the imx6 and in the process this PMICs regs needed to be somehow adjusted, which only worked if this regs were marked as volatile. Long story short, this method was only introduced in Phytec's version so upstreaming really doesn't make much sense.

Quoted 6 lines

I apologize for any inconvenience, but this two patches somehow slipped through the process and landed on the "send-to-upstream" list. I also talked with @Stefan Rieadmueller and he agreed that this two patches can be dropped.

Thanks for your time.

That's no problem and thanks for clarifying. With regmap writes, unless the value you're writing is the same as is in the cache or is outside of the valid range, the write should go through. Obviously something else at play in that platform though. :)