* [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock
@ 2014-04-01 13:44 Peter Ujfalusi
2014-04-01 13:44 ` [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch Peter Ujfalusi
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Peter Ujfalusi @ 2014-04-01 13:44 UTC (permalink / raw)
To: lee.jones; +Cc: linux-kernel, linux-omap, sameo, nm
Hi,
While looking into a report by Florian Vaussard [1] I have noticed couple of most
likely unrelated issues:
- all boards using twl6040 configures the i2c bus to 400KHz while twl6040 is set
to 100KHz as default.
- if I set the audpwron GPIO high [2] in the bootloader the i2c communication towards
twl6040 will be broken
- got confirmation from HW design teams that twl6040 can work on a bus with
400KHz even if after hard reset but it is optimal to swithc to 400KHz mode as
soon as possible.
The solution or these are:
set the twl6040 to i2c fast mode with regmap patch
Clear the INTID register right after we request the audpwron GPIO and set it to
low.
Generated on top of:
git://git.linaro.org/people/lee.jones/mfd.git for-mfd-next
Tested on PandaBoard, PandaBoardES, OMAP4-blaze (SDP)
[1] http://www.spinics.net/lists/arm-kernel/msg310725.html
[2] Command in u-boot to enable the audpwron on PandaBoards: gpio set 127
Regards,
Peter
---
Peter Ujfalusi (3):
mfd: twl6040: Select i2c fast mode as default with regmap patch
mfd: twl6040: Move register patching earlier in probe
mfd: twl6040: Clear the interrupt ID register before requesting IRQ
drivers/mfd/twl6040.c | 19 +++++++++++++------
include/linux/mfd/twl6040.h | 1 +
2 files changed, 14 insertions(+), 6 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch
2014-04-01 13:44 [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
@ 2014-04-01 13:44 ` Peter Ujfalusi
2014-04-28 10:42 ` Lee Jones
2014-04-01 13:45 ` [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe Peter Ujfalusi
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Peter Ujfalusi @ 2014-04-01 13:44 UTC (permalink / raw)
To: lee.jones; +Cc: linux-kernel, linux-omap, sameo, nm
All boards using twl6040 configures the i2c bus to 400KHz. While twl6040's
defaults to normal mode (100KHz). So far twl6040 has no problem with i2c
communication in this configuration it is safer to select fast i2c mode.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mfd/twl6040.c | 9 +++++++--
include/linux/mfd/twl6040.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 6e88f25832fb..2c308750f40f 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -87,8 +87,13 @@ static struct reg_default twl6040_defaults[] = {
};
static struct reg_default twl6040_patch[] = {
- /* Select I2C bus access to dual access registers */
- { TWL6040_REG_ACCCTL, 0x09 },
+ /*
+ * Select I2C bus access to dual access registers
+ * Interrupt register is cleared on read
+ * Select fast mode for i2c (400KHz)
+ */
+ { TWL6040_REG_ACCCTL,
+ TWL6040_I2CSEL | TWL6040_INTCLRMODE | TWL6040_I2CMODE(1) },
};
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 81f639bc1ae6..a69d16b30c18 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -157,6 +157,7 @@
#define TWL6040_I2CSEL 0x01
#define TWL6040_RESETSPLIT 0x04
#define TWL6040_INTCLRMODE 0x08
+#define TWL6040_I2CMODE(x) ((x & 0x3) << 4)
/* STATUS (0x2E) fields */
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe
2014-04-01 13:44 [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
2014-04-01 13:44 ` [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch Peter Ujfalusi
@ 2014-04-01 13:45 ` Peter Ujfalusi
2014-04-28 10:42 ` Lee Jones
2014-04-01 13:45 ` [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ Peter Ujfalusi
2014-04-24 9:12 ` [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
3 siblings, 1 reply; 8+ messages in thread
From: Peter Ujfalusi @ 2014-04-01 13:45 UTC (permalink / raw)
To: lee.jones; +Cc: linux-kernel, linux-omap, sameo, nm
Make sure that we patch the ACCCTL register as the first thing when the
driver loads, thus configuring I2C fast mode and i2c access for dual access
registers.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mfd/twl6040.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 2c308750f40f..dc5c05940e96 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -665,6 +665,9 @@ static int twl6040_probe(struct i2c_client *client,
mutex_init(&twl6040->mutex);
init_completion(&twl6040->ready);
+ regmap_register_patch(twl6040->regmap, twl6040_patch,
+ ARRAY_SIZE(twl6040_patch));
+
twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
if (twl6040->rev < 0) {
dev_err(&client->dev, "Failed to read revision register: %d\n",
@@ -712,10 +715,6 @@ static int twl6040_probe(struct i2c_client *client,
goto readyirq_err;
}
- /* dual-access registers controlled by I2C only */
- regmap_register_patch(twl6040->regmap, twl6040_patch,
- ARRAY_SIZE(twl6040_patch));
-
/*
* The main functionality of twl6040 to provide audio on OMAP4+ systems.
* We can add the ASoC codec child whenever this driver has been loaded.
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ
2014-04-01 13:44 [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
2014-04-01 13:44 ` [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch Peter Ujfalusi
2014-04-01 13:45 ` [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe Peter Ujfalusi
@ 2014-04-01 13:45 ` Peter Ujfalusi
2014-04-28 10:43 ` Lee Jones
2014-04-24 9:12 ` [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
3 siblings, 1 reply; 8+ messages in thread
From: Peter Ujfalusi @ 2014-04-01 13:45 UTC (permalink / raw)
To: lee.jones; +Cc: linux-kernel, linux-omap, sameo, nm
If for some reason the boot loader enabled the audpwron GPIO we will have
pending IRQs to be handled. This seams to break twl6040 for some reason
leading to non working i2c communication (i2c timeouts). Clearing the INTID
register after we requested the audpwron GPIO (and set it to low) will
ensure that the chip will operate normally in this case as well.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/mfd/twl6040.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index dc5c05940e96..2e6504a8e1e3 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -687,6 +687,9 @@ static int twl6040_probe(struct i2c_client *client,
GPIOF_OUT_INIT_LOW, "audpwron");
if (ret)
goto gpio_err;
+
+ /* Clear any pending interrupt */
+ twl6040_reg_read(twl6040, TWL6040_REG_INTID);
}
ret = regmap_add_irq_chip(twl6040->regmap, twl6040->irq, IRQF_ONESHOT,
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock
2014-04-01 13:44 [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
` (2 preceding siblings ...)
2014-04-01 13:45 ` [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ Peter Ujfalusi
@ 2014-04-24 9:12 ` Peter Ujfalusi
3 siblings, 0 replies; 8+ messages in thread
From: Peter Ujfalusi @ 2014-04-24 9:12 UTC (permalink / raw)
To: lee.jones; +Cc: linux-kernel, linux-omap, sameo, nm
Lee,
On 04/01/2014 04:44 PM, Peter Ujfalusi wrote:
> Hi,
>
> While looking into a report by Florian Vaussard [1] I have noticed couple of most
> likely unrelated issues:
> - all boards using twl6040 configures the i2c bus to 400KHz while twl6040 is set
> to 100KHz as default.
> - if I set the audpwron GPIO high [2] in the bootloader the i2c communication towards
> twl6040 will be broken
> - got confirmation from HW design teams that twl6040 can work on a bus with
> 400KHz even if after hard reset but it is optimal to swithc to 400KHz mode as
> soon as possible.
>
> The solution or these are:
> set the twl6040 to i2c fast mode with regmap patch
> Clear the INTID register right after we request the audpwron GPIO and set it to
> low.
Do you want me to resend this series again?
Thanks,
Péter
>
> Generated on top of:
> git://git.linaro.org/people/lee.jones/mfd.git for-mfd-next
>
> Tested on PandaBoard, PandaBoardES, OMAP4-blaze (SDP)
>
> [1] http://www.spinics.net/lists/arm-kernel/msg310725.html
> [2] Command in u-boot to enable the audpwron on PandaBoards: gpio set 127
>
> Regards,
> Peter
> ---
> Peter Ujfalusi (3):
> mfd: twl6040: Select i2c fast mode as default with regmap patch
> mfd: twl6040: Move register patching earlier in probe
> mfd: twl6040: Clear the interrupt ID register before requesting IRQ
>
> drivers/mfd/twl6040.c | 19 +++++++++++++------
> include/linux/mfd/twl6040.h | 1 +
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch
2014-04-01 13:44 ` [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch Peter Ujfalusi
@ 2014-04-28 10:42 ` Lee Jones
0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2014-04-28 10:42 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: linux-kernel, linux-omap, sameo, nm
> All boards using twl6040 configures the i2c bus to 400KHz. While twl6040's
> defaults to normal mode (100KHz). So far twl6040 has no problem with i2c
> communication in this configuration it is safer to select fast i2c mode.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> drivers/mfd/twl6040.c | 9 +++++++--
> include/linux/mfd/twl6040.h | 1 +
> 2 files changed, 8 insertions(+), 2 deletions(-)
Applied, thanks.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe
2014-04-01 13:45 ` [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe Peter Ujfalusi
@ 2014-04-28 10:42 ` Lee Jones
0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2014-04-28 10:42 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: linux-kernel, linux-omap, sameo, nm
> Make sure that we patch the ACCCTL register as the first thing when the
> driver loads, thus configuring I2C fast mode and i2c access for dual access
> registers.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> drivers/mfd/twl6040.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Applied, thanks.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ
2014-04-01 13:45 ` [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ Peter Ujfalusi
@ 2014-04-28 10:43 ` Lee Jones
0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2014-04-28 10:43 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: linux-kernel, linux-omap, sameo, nm
> If for some reason the boot loader enabled the audpwron GPIO we will have
> pending IRQs to be handled. This seams to break twl6040 for some reason
> leading to non working i2c communication (i2c timeouts). Clearing the INTID
> register after we requested the audpwron GPIO (and set it to low) will
> ensure that the chip will operate normally in this case as well.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> drivers/mfd/twl6040.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied, thanks.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-28 10:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 13:44 [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
2014-04-01 13:44 ` [RESEND 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch Peter Ujfalusi
2014-04-28 10:42 ` Lee Jones
2014-04-01 13:45 ` [RESEND 2/3] mfd: twl6040: Move register patching earlier in probe Peter Ujfalusi
2014-04-28 10:42 ` Lee Jones
2014-04-01 13:45 ` [RESEND 3/3] mfd: twl6040: Clear the interrupt ID register before requesting IRQ Peter Ujfalusi
2014-04-28 10:43 ` Lee Jones
2014-04-24 9:12 ` [RESEND 0/3] mfd: twl6040: Updates for i2s speed and fix for chip deadlock Peter Ujfalusi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox