* [PATCH 0/2] i2c-mv64xxx: Various fixes
@ 2013-06-07 15:48 Gregory CLEMENT
[not found] ` <1370620140-17177-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Gregory CLEMENT @ 2013-06-07 15:48 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: Thomas Petazzoni, Ezequiel Garcia, Sebastian Hesselbarth,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper,
Andrew Lunn, Gregory CLEMENT, Nicolas Pitre, Lior Amsalem,
Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi,
Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof,
Dan Frazier, Leif Lindholm, Jon Masters, David Marlin,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hello,
This series contains a real fix for the I2C controller of the Armada
XP SoC and a patch closer to a improvement than a fix.
They are independent and are only in the same series because they are
kind of fixes.
They are based on 3.10-rc4, and they will be small conflicts if they
are applied on top of i2c/for-next branch and on top of the series I
have just sent to add I2C Transaction Generator support. You can have
a look on the branch i2c-mv64xxx-fixes-bridge to get an idea on how to
resolve it. This branch is located at
https://github.com/MISL-EBU-System-SW/mainline-public.git
Thanks,
Zbigniew Bodek (2):
i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889)
i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not
provided
drivers/i2c/busses/i2c-mv64xxx.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
--
1.8.1.2
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <1370620140-17177-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) [not found] ` <1370620140-17177-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2013-06-07 15:48 ` Gregory CLEMENT 2013-06-07 16:25 ` Thomas Petazzoni 2013-06-07 15:49 ` [PATCH 2/2] i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not provided Gregory CLEMENT 1 sibling, 1 reply; 7+ messages in thread From: Gregory CLEMENT @ 2013-06-07 15:48 UTC (permalink / raw) To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: Thomas Petazzoni, Ezequiel Garcia, Sebastian Hesselbarth, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper, Andrew Lunn, Gregory CLEMENT, Nicolas Pitre, Lior Amsalem, Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi, Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof, Dan Frazier, Leif Lindholm, Jon Masters, David Marlin, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Zbigniew Bodek <zb> From: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> All the Armada XP (mv78230, mv78260 and mv78460) have a silicon issue in the I2C controller which violate the i2c repeated start timing. The I2C standard requires a minimum of 4.7us for the repeated start condition whereas the I2C controller of the Armada XP this time is 2.9us. So this patch adds a 5us delay for the start case only if the mv64xxx_i2c_errata_delay flag is set. [gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org: Merge the incoming commits into this single one] [gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org: Reword the commit log] Signed-off-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Signed-off-by: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> --- drivers/i2c/busses/i2c-mv64xxx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 1a3abd6..60cac9f 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -23,6 +23,7 @@ #include <linux/of_i2c.h> #include <linux/clk.h> #include <linux/err.h> +#include <linux/delay.h> /* Register defines */ #define MV64XXX_I2C_REG_SLAVE_ADDR 0x00 @@ -59,6 +60,12 @@ #define MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_NO_ACK 0xe8 #define MV64XXX_I2C_STATUS_NO_STATUS 0xf8 +/* + * 5us delay in order to avoid repeated start + * timing violation on Armada XP SoC. + */ +static int mv64xxx_i2c_errata_delay; + /* Driver states */ enum { MV64XXX_I2C_STATE_INVALID, @@ -252,6 +259,9 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) writel(drv_data->cntl_bits, drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); drv_data->block = 0; + if (mv64xxx_i2c_errata_delay) + udelay(5); + wake_up(&drv_data->waitq); break; @@ -300,6 +310,9 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); drv_data->block = 0; + if (mv64xxx_i2c_errata_delay) + udelay(5); + wake_up(&drv_data->waitq); break; @@ -592,6 +605,10 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, * So hard code the value to 1 second. */ drv_data->adapter.timeout = HZ; + + if (!mv64xxx_i2c_errata_delay && + of_machine_is_compatible("marvell,armadaxp")) + mv64xxx_i2c_errata_delay = 1; out: return rc; #endif -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) 2013-06-07 15:48 ` [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) Gregory CLEMENT @ 2013-06-07 16:25 ` Thomas Petazzoni 2013-06-14 15:24 ` Wolfram Sang 0 siblings, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2013-06-07 16:25 UTC (permalink / raw) To: Gregory CLEMENT Cc: Wolfram Sang, linux-i2c, Ezequiel Garcia, Sebastian Hesselbarth, linux-arm-kernel, Jason Cooper, Andrew Lunn, Nicolas Pitre, Lior Amsalem, Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi, Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof, Dan Frazier, Leif Lindholm, Jon Masters, David Marlin, linux-kernel, Zbigniew Bodek Dear Gregory CLEMENT, On Fri, 7 Jun 2013 17:48:59 +0200, Gregory CLEMENT wrote: > +/* > + * 5us delay in order to avoid repeated start > + * timing violation on Armada XP SoC. > + */ > +static int mv64xxx_i2c_errata_delay; This should probably be a per-I2C controller variable, i.e in mv64xxx_i2c_data. > + if (!mv64xxx_i2c_errata_delay && > + of_machine_is_compatible("marvell,armadaxp")) > + mv64xxx_i2c_errata_delay = 1; I am wondering whether it should be done this way, or using a separate DT property. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) 2013-06-07 16:25 ` Thomas Petazzoni @ 2013-06-14 15:24 ` Wolfram Sang 0 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2013-06-14 15:24 UTC (permalink / raw) To: Thomas Petazzoni Cc: Gregory CLEMENT, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Ezequiel Garcia, Sebastian Hesselbarth, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper, Andrew Lunn, Nicolas Pitre, Lior Amsalem, Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi, Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof, Dan Frazier, Leif Lindholm, Jon Masters, David Marlin, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Zbigniew Bodek [-- Attachment #1: Type: text/plain, Size: 738 bytes --] On Fri, Jun 07, 2013 at 06:25:00PM +0200, Thomas Petazzoni wrote: > Dear Gregory CLEMENT, > > On Fri, 7 Jun 2013 17:48:59 +0200, Gregory CLEMENT wrote: > > > +/* > > + * 5us delay in order to avoid repeated start > > + * timing violation on Armada XP SoC. > > + */ > > +static int mv64xxx_i2c_errata_delay; > > This should probably be a per-I2C controller variable, i.e in > mv64xxx_i2c_data. Yes. > > > > + if (!mv64xxx_i2c_errata_delay && > > + of_machine_is_compatible("marvell,armadaxp")) > > + mv64xxx_i2c_errata_delay = 1; > > I am wondering whether it should be done this way, or using a separate > DT property. Need to think about it. It is similar to the sda-hold-time issue, I guess. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not provided [not found] ` <1370620140-17177-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2013-06-07 15:48 ` [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) Gregory CLEMENT @ 2013-06-07 15:49 ` Gregory CLEMENT [not found] ` <1370620140-17177-3-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Gregory CLEMENT @ 2013-06-07 15:49 UTC (permalink / raw) To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: Thomas Petazzoni, Ezequiel Garcia, Sebastian Hesselbarth, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper, Andrew Lunn, Gregory CLEMENT, Nicolas Pitre, Lior Amsalem, Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi, Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof, Dan Frazier, Leif Lindholm, Jon Masters, David Marlin, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Zbigniew Bodek <zb> From: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> This commit adds checking whether clock-frequency property acquisition has succeeded. Do not waste time to find baud factors if there is no information about the desired bus frequency in dts. [gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org: Reword the commit log] Signed-off-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Signed-off-by: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> --- drivers/i2c/busses/i2c-mv64xxx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 60cac9f..88c2dd0 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -593,7 +593,9 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, goto out; } tclk = clk_get_rate(drv_data->clk); - of_property_read_u32(np, "clock-frequency", &bus_freq); + if ((rc = of_property_read_u32(np, "clock-frequency", &bus_freq)) != 0) + goto out; + if (!mv64xxx_find_baud_factors(bus_freq, tclk, &drv_data->freq_n, &drv_data->freq_m)) { rc = -EINVAL; -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <1370620140-17177-3-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 2/2] i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not provided [not found] ` <1370620140-17177-3-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2013-06-14 15:23 ` Wolfram Sang 0 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2013-06-14 15:23 UTC (permalink / raw) To: Gregory CLEMENT Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Thomas Petazzoni, Ezequiel Garcia, Sebastian Hesselbarth, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper, Andrew Lunn, Nicolas Pitre, Lior Amsalem, Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi, Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof, Dan Frazier, Leif Lindholm, Jon Masters, David Marlin, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Zbigniew Bodek [-- Attachment #1: Type: text/plain, Size: 671 bytes --] On Fri, Jun 07, 2013 at 05:49:00PM +0200, Gregory CLEMENT wrote: > From: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> > > This commit adds checking whether clock-frequency property acquisition > has succeeded. Do not waste time to find baud factors if there is no > information about the desired bus frequency in dts. > > [gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org: Reword the commit log] > > Signed-off-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> > Signed-off-by: Zbigniew Bodek <zbb-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> Please run checkpatch.pl on your patches! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] i2c-mv64xxx: Various fixes
@ 2013-06-07 15:44 Gregory CLEMENT
0 siblings, 0 replies; 7+ messages in thread
From: Gregory CLEMENT @ 2013-06-07 15:44 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: Thomas Petazzoni, Ezequiel Garcia, Sebastian Hesselbarth,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason Cooper,
Andrew Lunn, Gregory CLEMENT, Nicolas Pitre, Lior Amsalem,
Maen Suleiman, Tawfik Bayouk, Shadi Ammouri, Eran Ben-Avi,
Yehuda Yitschak, Nadav Haklai, Ike Pan, Chris Van Hoof,
Dan Frazier, Leif Lindholm, Jon Masters, David Marlin,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hello,
This series contains a real fix for the I2C controller of the Armada
XP SoC and a patch closer to a improvement than a fix.
They are independent and are only in the same series because they are
kind of fixes.
They are based on 3.10-rc4, and they will be small conflicts if they
are applied on top of i2c/for-next branch and on top of the series I
have just sent to add I2C Transaction Generator support. You can have
a look on the branch i2c-mv64xxx-fixes-bridge to get an idea on how to
resolve it. This branch is located at
https://github.com/MISL-EBU-System-SW/mainline-public.git
Thanks,
Zbigniew Bodek (2):
i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889)
i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not
provided
drivers/i2c/busses/i2c-mv64xxx.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
--
1.8.1.2
^ permalink raw reply [flat|nested] 7+ messages in threadend of thread, other threads:[~2013-06-14 15:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 15:48 [PATCH 0/2] i2c-mv64xxx: Various fixes Gregory CLEMENT
[not found] ` <1370620140-17177-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 15:48 ` [PATCH 1/2] i2c-mv64xxx: Fix timing issue on Armada XP (errata FE-8471889) Gregory CLEMENT
2013-06-07 16:25 ` Thomas Petazzoni
2013-06-14 15:24 ` Wolfram Sang
2013-06-07 15:49 ` [PATCH 2/2] i2c-mv64xxx: Abort the mv64xxx_of_config if clock-frequency is not provided Gregory CLEMENT
[not found] ` <1370620140-17177-3-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-14 15:23 ` Wolfram Sang
-- strict thread matches above, loose matches on Subject: below --
2013-06-07 15:44 [PATCH 0/2] i2c-mv64xxx: Various fixes Gregory CLEMENT
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).