Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: madera: Wait for boot done before accessing any other registers

It is advised to wait for the boot done bit to be set before reading
any other register, update the driver to respect this.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Charles Keepax and committed by
Lee Jones
7f6d8698 5e2540c1

+15 -2
+15 -2
drivers/mfd/madera-core.c
··· 199 199 #define MADERA_BOOT_POLL_INTERVAL_USEC 5000 200 200 #define MADERA_BOOT_POLL_TIMEOUT_USEC 25000 201 201 202 - static int madera_wait_for_boot(struct madera *madera) 202 + static int madera_wait_for_boot_noack(struct madera *madera) 203 203 { 204 204 ktime_t timeout; 205 205 unsigned int val = 0; ··· 225 225 dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n"); 226 226 ret = -ETIMEDOUT; 227 227 } 228 + 229 + return ret; 230 + } 231 + 232 + static int madera_wait_for_boot(struct madera *madera) 233 + { 234 + int ret = madera_wait_for_boot_noack(madera); 228 235 229 236 /* 230 237 * BOOT_DONE defaults to unmasked on boot so we must ack it. ··· 552 545 regcache_cache_only(madera->regmap, false); 553 546 regcache_cache_only(madera->regmap_32bit, false); 554 547 548 + ret = madera_wait_for_boot_noack(madera); 549 + if (ret) { 550 + dev_err(madera->dev, "Device failed initial boot: %d\n", ret); 551 + goto err_reset; 552 + } 553 + 555 554 /* 556 555 * Now we can power up and verify that this is a chip we know about 557 556 * before we start doing any writes to its registers. ··· 663 650 664 651 ret = madera_wait_for_boot(madera); 665 652 if (ret) { 666 - dev_err(madera->dev, "Device failed initial boot: %d\n", ret); 653 + dev_err(madera->dev, "Failed to clear boot done: %d\n", ret); 667 654 goto err_reset; 668 655 } 669 656