* [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver
@ 2015-06-09 7:14 Wolfram Sang
2015-06-09 7:14 ` [PATCH 2/2] ARM: shmobile: r8a7740: remove I2C errata handling Wolfram Sang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Wolfram Sang @ 2015-06-09 7:14 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, Kuninori Morimoto
This series moves the errata handling from the setup function into the driver.
It has been tested that this changeset does not cause a regression on the
armadillo board we had access to. Unfortunately, this board did not need the
workaround at all, only some revisions of the r8a7740 are affected.
After a short discussion with Simon, we agreed this should go via I2C.
Wolfram Sang (2):
i2c: sh_mobile: add errata workaround
ARM: shmobile: r8a7740: remove I2C errata handling
arch/arm/mach-shmobile/setup-r8a7740.c | 55 ----------------------------------
drivers/i2c/busses/i2c-sh_mobile.c | 40 +++++++++++++++++++++++++
2 files changed, 40 insertions(+), 55 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/2] ARM: shmobile: r8a7740: remove I2C errata handling 2015-06-09 7:14 [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Wolfram Sang @ 2015-06-09 7:14 ` Wolfram Sang 2015-06-09 14:29 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Laurent Pinchart ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-09 7:14 UTC (permalink / raw) To: linux-i2c Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang, Kuninori Morimoto From: Wolfram Sang <wsa+renesas@sang-engineering.com> This is now done in the I2C driver. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- arch/arm/mach-shmobile/setup-r8a7740.c | 55 ---------------------------------- 1 file changed, 55 deletions(-) diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 9832e48396a40a..00291cc1772df9 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -13,7 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/kernel.h> #include <linux/init.h> @@ -690,56 +689,6 @@ void __init r8a7740_meram_workaround(void) } } -#define ICCR 0x0004 -#define ICSTART 0x0070 - -#define i2c_read(reg, offset) ioread8(reg + offset) -#define i2c_write(reg, offset, data) iowrite8(data, reg + offset) - -/* - * r8a7740 chip has lasting errata on I2C I/O pad reset. - * this is work-around for it. - */ -static void r8a7740_i2c_workaround(struct platform_device *pdev) -{ - struct resource *res; - void __iomem *reg; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (unlikely(!res)) { - pr_err("r8a7740 i2c workaround fail (cannot find resource)\n"); - return; - } - - reg = ioremap(res->start, resource_size(res)); - if (unlikely(!reg)) { - pr_err("r8a7740 i2c workaround fail (cannot map IO)\n"); - return; - } - - i2c_write(reg, ICCR, i2c_read(reg, ICCR) | 0x80); - i2c_read(reg, ICCR); /* dummy read */ - - i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10); - i2c_read(reg, ICSTART); /* dummy read */ - - udelay(10); - - i2c_write(reg, ICCR, 0x01); - i2c_write(reg, ICSTART, 0x00); - - udelay(10); - - i2c_write(reg, ICCR, 0x10); - udelay(10); - i2c_write(reg, ICCR, 0x00); - udelay(10); - i2c_write(reg, ICCR, 0x10); - udelay(10); - - iounmap(reg); -} - void __init r8a7740_add_standard_devices(void) { static struct pm_domain_device domain_devices[] __initdata = { @@ -766,10 +715,6 @@ void __init r8a7740_add_standard_devices(void) { "A3SP", &usb_dma_device }, }; - /* I2C work-around */ - r8a7740_i2c_workaround(&i2c0_device); - r8a7740_i2c_workaround(&i2c1_device); - r8a7740_init_pm_domains(); /* add devices */ -- 2.1.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver 2015-06-09 7:14 [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Wolfram Sang 2015-06-09 7:14 ` [PATCH 2/2] ARM: shmobile: r8a7740: remove I2C errata handling Wolfram Sang @ 2015-06-09 14:29 ` Laurent Pinchart 2015-06-11 2:38 ` Simon Horman [not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 3 siblings, 0 replies; 7+ messages in thread From: Laurent Pinchart @ 2015-06-09 14:29 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Geert Uytterhoeven, Kuninori Morimoto Hi Wolfram, Thank you for the patches. On Tuesday 09 June 2015 16:14:38 Wolfram Sang wrote: > This series moves the errata handling from the setup function into the > driver. It has been tested that this changeset does not cause a regression > on the armadillo board we had access to. Unfortunately, this board did not > need the workaround at all, only some revisions of the r8a7740 are > affected. > > After a short discussion with Simon, we agreed this should go via I2C. Looks good to me. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Wolfram Sang (2): > i2c: sh_mobile: add errata workaround > ARM: shmobile: r8a7740: remove I2C errata handling > > arch/arm/mach-shmobile/setup-r8a7740.c | 55 ------------------------------- > drivers/i2c/busses/i2c-sh_mobile.c | 40 +++++++++++++++++++++++++ > 2 files changed, 40 insertions(+), 55 deletions(-) -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver 2015-06-09 7:14 [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Wolfram Sang 2015-06-09 7:14 ` [PATCH 2/2] ARM: shmobile: r8a7740: remove I2C errata handling Wolfram Sang 2015-06-09 14:29 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Laurent Pinchart @ 2015-06-11 2:38 ` Simon Horman [not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 3 siblings, 0 replies; 7+ messages in thread From: Simon Horman @ 2015-06-11 2:38 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c, linux-sh, Magnus Damm, Laurent Pinchart, Geert Uytterhoeven, Kuninori Morimoto On Tue, Jun 09, 2015 at 04:14:38PM +0900, Wolfram Sang wrote: > This series moves the errata handling from the setup function into the driver. > It has been tested that this changeset does not cause a regression on the > armadillo board we had access to. Unfortunately, this board did not need the > workaround at all, only some revisions of the r8a7740 are affected. > > After a short discussion with Simon, we agreed this should go via I2C. Acked-by: Simon Horman <horms+renesas@verge.net.au> > > Wolfram Sang (2): > i2c: sh_mobile: add errata workaround > ARM: shmobile: r8a7740: remove I2C errata handling > > arch/arm/mach-shmobile/setup-r8a7740.c | 55 ---------------------------------- > drivers/i2c/busses/i2c-sh_mobile.c | 40 +++++++++++++++++++++++++ > 2 files changed, 40 insertions(+), 55 deletions(-) > > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sh" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>]
* [PATCH 1/2] i2c: sh_mobile: add errata workaround [not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> @ 2015-06-09 7:14 ` Wolfram Sang 2015-06-11 0:43 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Kuninori Morimoto 2015-06-17 10:43 ` Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-09 7:14 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang, Kuninori Morimoto From: Wolfram Sang <wsa+renesas@sang-engineering.com> This used to be in platform init code. We want it to do in the driver now. This is basically a code move and a new compatible added. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/busses/i2c-sh_mobile.c | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 007818b3e1745b..7193bcfdd94013 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -150,6 +150,7 @@ struct sh_mobile_i2c_data { struct sh_mobile_dt_config { int clks_per_count; + void (*setup)(struct sh_mobile_i2c_data *pd); }; #define IIC_FLAG_HAS_ICIC67 (1 << 0) @@ -164,6 +165,7 @@ struct sh_mobile_dt_config { #define ICIC 0x0c #define ICCL 0x10 #define ICCH 0x14 +#define ICSTART 0x70 /* Register bits */ #define ICCR_ICE 0x80 @@ -190,6 +192,8 @@ struct sh_mobile_dt_config { #define ICIC_WAITE 0x02 #define ICIC_DTEE 0x01 +#define ICSTART_ICSTART 0x10 + static void iic_wr(struct sh_mobile_i2c_data *pd, int offs, unsigned char data) { if (offs = ICIC) @@ -782,6 +786,33 @@ static struct i2c_algorithm sh_mobile_i2c_algorithm = { .master_xfer = sh_mobile_i2c_xfer, }; +/* + * r8a7740 chip has lasting errata on I2C I/O pad reset. + * this is work-around for it. + */ +static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd) +{ + iic_set_clr(pd, ICCR, ICCR_ICE, 0); + iic_rd(pd, ICCR); /* dummy read */ + + iic_set_clr(pd, ICSTART, ICSTART_ICSTART, 0); + iic_rd(pd, ICSTART); /* dummy read */ + + udelay(10); + + iic_wr(pd, ICCR, ICCR_SCP); + iic_wr(pd, ICSTART, 0); + + udelay(10); + + iic_wr(pd, ICCR, ICCR_TRS); + udelay(10); + iic_wr(pd, ICCR, 0); + udelay(10); + iic_wr(pd, ICCR, ICCR_TRS); + udelay(10); +} + static const struct sh_mobile_dt_config default_dt_config = { .clks_per_count = 1, }; @@ -790,9 +821,15 @@ static const struct sh_mobile_dt_config fast_clock_dt_config = { .clks_per_count = 2, }; +static const struct sh_mobile_dt_config r8a7740_dt_config = { + .clks_per_count = 1, + .setup = sh_mobile_i2c_r8a7740_workaround, +}; + static const struct of_device_id sh_mobile_i2c_dt_ids[] = { { .compatible = "renesas,rmobile-iic", .data = &default_dt_config }, { .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config }, + { .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config }, { .compatible = "renesas,iic-r8a7790", .data = &fast_clock_dt_config }, { .compatible = "renesas,iic-r8a7791", .data = &fast_clock_dt_config }, { .compatible = "renesas,iic-r8a7792", .data = &fast_clock_dt_config }, @@ -885,6 +922,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) config = match->data; pd->clks_per_count = config->clks_per_count; + + if (config->setup) + config->setup(pd); } } else { if (pdata && pdata->bus_speed) -- 2.1.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver [not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 2015-06-09 7:14 ` [PATCH 1/2] i2c: sh_mobile: add errata workaround Wolfram Sang @ 2015-06-11 0:43 ` Kuninori Morimoto 2015-06-17 10:43 ` Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Kuninori Morimoto @ 2015-06-11 0:43 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Kuninori Morimoto Hi Wolfram > This series moves the errata handling from the setup function into the driver. > It has been tested that this changeset does not cause a regression on the > armadillo board we had access to. Unfortunately, this board did not need the > workaround at all, only some revisions of the r8a7740 are affected. > > After a short discussion with Simon, we agreed this should go via I2C. > > Wolfram Sang (2): > i2c: sh_mobile: add errata workaround > ARM: shmobile: r8a7740: remove I2C errata handling > > arch/arm/mach-shmobile/setup-r8a7740.c | 55 ---------------------------------- > drivers/i2c/busses/i2c-sh_mobile.c | 40 +++++++++++++++++++++++++ > 2 files changed, 40 insertions(+), 55 deletions(-) Thank you for your patches For all patches Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Best regards --- Kuninori Morimoto ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver [not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 2015-06-09 7:14 ` [PATCH 1/2] i2c: sh_mobile: add errata workaround Wolfram Sang 2015-06-11 0:43 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Kuninori Morimoto @ 2015-06-17 10:43 ` Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-17 10:43 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Kuninori Morimoto [-- Attachment #1: Type: text/plain, Size: 613 bytes --] On Tue, Jun 09, 2015 at 04:14:38PM +0900, Wolfram Sang wrote: > This series moves the errata handling from the setup function into the driver. > It has been tested that this changeset does not cause a regression on the > armadillo board we had access to. Unfortunately, this board did not need the > workaround at all, only some revisions of the r8a7740 are affected. > > After a short discussion with Simon, we agreed this should go via I2C. > > Wolfram Sang (2): > i2c: sh_mobile: add errata workaround > ARM: shmobile: r8a7740: remove I2C errata handling > Applied to for-next, thanks! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-06-17 10:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 7:14 [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Wolfram Sang
2015-06-09 7:14 ` [PATCH 2/2] ARM: shmobile: r8a7740: remove I2C errata handling Wolfram Sang
2015-06-09 14:29 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Laurent Pinchart
2015-06-11 2:38 ` Simon Horman
[not found] ` <1433834080-5630-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-06-09 7:14 ` [PATCH 1/2] i2c: sh_mobile: add errata workaround Wolfram Sang
2015-06-11 0:43 ` [PATCH 0/2] ARM: shmobile: r8a7740: move I2C errata handling into the driver Kuninori Morimoto
2015-06-17 10:43 ` Wolfram Sang
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).