diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2020-10-27 12:41:32 +0300 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2020-11-19 11:34:22 +0300 |
commit | f594d01bb4aff35dc582f5418e6823f79e28834b (patch) | |
tree | 3ec2d734db41c1c080d544f11dca4eaf94d34565 /drivers/mfd | |
parent | 1cd7b935d298c6497581f86c3f74d2d2be54f294 (diff) | |
download | linux-f594d01bb4aff35dc582f5418e6823f79e28834b.tar.xz |
mfd: madera: Add special errata reset handling for cs47l15
An errata exists for cs47l15 where the reset must be handled
differently and removed before DCVDD is applied. A soft reset is used
for situations where a reset is required to reset state. This does
however, make this part unsuitable for DCVDD supplies with a rise time
greater than 2mS.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/madera-core.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c index a9c6f0833f32..a2abc0094def 100644 --- a/drivers/mfd/madera-core.c +++ b/drivers/mfd/madera-core.c @@ -38,6 +38,9 @@ #define MADERA_RESET_MIN_US 2000 #define MADERA_RESET_MAX_US 3000 +#define ERRATA_DCVDD_MIN_US 10000 +#define ERRATA_DCVDD_MAX_US 15000 + static const char * const madera_core_supplies[] = { "AVDD", "DBVDD1", @@ -291,7 +294,8 @@ static int __maybe_unused madera_runtime_resume(struct device *dev) dev_dbg(dev, "Leaving sleep mode\n"); - madera_enable_hard_reset(madera); + if (!madera->reset_errata) + madera_enable_hard_reset(madera); ret = regulator_enable(madera->dcvdd); if (ret) { @@ -302,9 +306,12 @@ static int __maybe_unused madera_runtime_resume(struct device *dev) regcache_cache_only(madera->regmap, false); regcache_cache_only(madera->regmap_32bit, false); - madera_disable_hard_reset(madera); + if (madera->reset_errata) + usleep_range(ERRATA_DCVDD_MIN_US, ERRATA_DCVDD_MAX_US); + else + madera_disable_hard_reset(madera); - if (!madera->pdata.reset) { + if (!madera->pdata.reset || madera->reset_errata) { ret = madera_wait_for_boot(madera); if (ret) goto err; @@ -503,6 +510,8 @@ int madera_dev_init(struct madera *madera) */ switch (madera->type) { case CS47L15: + madera->reset_errata = true; + break; case CS47L35: case CS47L90: case CS47L91: @@ -553,13 +562,19 @@ int madera_dev_init(struct madera *madera) goto err_dcvdd; } + if (madera->reset_errata) + madera_disable_hard_reset(madera); + ret = regulator_enable(madera->dcvdd); if (ret) { dev_err(dev, "Failed to enable DCVDD: %d\n", ret); goto err_enable; } - madera_disable_hard_reset(madera); + if (madera->reset_errata) + usleep_range(ERRATA_DCVDD_MIN_US, ERRATA_DCVDD_MAX_US); + else + madera_disable_hard_reset(madera); regcache_cache_only(madera->regmap, false); regcache_cache_only(madera->regmap_32bit, false); @@ -667,7 +682,7 @@ int madera_dev_init(struct madera *madera) * It looks like a device we support. If we don't have a hard reset * we can now attempt a soft reset. */ - if (!madera->pdata.reset) { + if (!madera->pdata.reset || madera->reset_errata) { ret = madera_soft_reset(madera); if (ret) goto err_reset; |