]>
Commit | Line | Data |
---|---|---|
cd033818 SL |
1 | From 91f2d31a311fa0f5a43a3ef007612585da041412 Mon Sep 17 00:00:00 2001 |
2 | From: Tony Lindgren <tony@atomide.com> | |
3 | Date: Thu, 14 Feb 2019 08:03:45 -0800 | |
4 | Subject: mfd: twl6040: Fix device init errors for ACCCTL register | |
5 | ||
6 | [ Upstream commit 48171d0ea7caccf21c9ee3ae75eb370f2a756062 ] | |
7 | ||
8 | I noticed that we can get a -EREMOTEIO errors on at least omap4 duovero: | |
9 | ||
10 | twl6040 0-004b: Failed to write 2d = 19: -121 | |
11 | ||
12 | And then any following register access will produce errors. | |
13 | ||
14 | There 2d offset above is register ACCCTL that gets written on twl6040 | |
15 | powerup. With error checking added to the related regcache_sync() call, | |
16 | the -EREMOTEIO error is reproducable on twl6040 powerup at least | |
17 | duovero. | |
18 | ||
19 | To fix the error, we need to wait until twl6040 is accessible after the | |
20 | powerup. Based on tests on omap4 duovero, we need to wait over 8ms after | |
21 | powerup before register write will complete without failures. Let's also | |
22 | make sure we warn about possible errors too. | |
23 | ||
24 | Note that we have twl6040_patch[] reg_sequence with the ACCCTL register | |
25 | configuration and regcache_sync() will write the new value to ACCCTL. | |
26 | ||
27 | Signed-off-by: Tony Lindgren <tony@atomide.com> | |
28 | Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> | |
29 | Signed-off-by: Lee Jones <lee.jones@linaro.org> | |
30 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
31 | --- | |
32 | drivers/mfd/twl6040.c | 13 ++++++++++++- | |
33 | 1 file changed, 12 insertions(+), 1 deletion(-) | |
34 | ||
35 | diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c | |
36 | index 72aab60ae846..db8684430f02 100644 | |
37 | --- a/drivers/mfd/twl6040.c | |
38 | +++ b/drivers/mfd/twl6040.c | |
39 | @@ -316,8 +316,19 @@ int twl6040_power(struct twl6040 *twl6040, int on) | |
40 | } | |
41 | } | |
42 | ||
43 | + /* | |
44 | + * Register access can produce errors after power-up unless we | |
45 | + * wait at least 8ms based on measurements on duovero. | |
46 | + */ | |
47 | + usleep_range(10000, 12000); | |
48 | + | |
49 | /* Sync with the HW */ | |
50 | - regcache_sync(twl6040->regmap); | |
51 | + ret = regcache_sync(twl6040->regmap); | |
52 | + if (ret) { | |
53 | + dev_err(twl6040->dev, "Failed to sync with the HW: %i\n", | |
54 | + ret); | |
55 | + goto out; | |
56 | + } | |
57 | ||
58 | /* Default PLL configuration after power up */ | |
59 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; | |
60 | -- | |
61 | 2.20.1 | |
62 |