All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Romain Perier <romain.perier@free-electrons.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Kumar Gala <galak@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Nadav Haklai <nadavh@marvell.com>, Omri Itach <omrii@marvell.com>,
	Shadi Ammouri <shadi@marvell.com>,
	Yahuda Yitschak <yehuday@marvell.com>,
	Hanna Hawa <hannah@marvell.com>,
	Neta Zur Hershkovits <neta@marvell.com>,
	Igal Liberman <igall@marvell.com>,
	Marcin
Subject: Re: [PATCH v6 2/4] i2c: pxa: Add support for the I2C units found in Armada 3700
Date: Wed, 30 Nov 2016 16:43:14 +0100	[thread overview]
Message-ID: <87wpflkm7h.fsf@free-electrons.com> (raw)
In-Reply-To: <20161130140017.26307-3-romain.perier@free-electrons.com> (Romain Perier's message of "Wed, 30 Nov 2016 15:00:15 +0100")

Hi Romain,
 
 On mer., nov. 30 2016, Romain Perier <romain.perier@free-electrons.com> wrote:

> The Armada 3700 has two I2C controllers that is compliant with the I2C
> Bus Specificiation 2.1, supports multi-master and different bus speed:
> Standard mode (up to 100 KHz), Fast mode (up to 400 KHz),
> High speed mode (up to 3.4 Mhz).
>
> This IP block has a lot of similarity with the PXA, except some register
> offsets and bitfield. This commits adds a basic support for this I2C
> unit.
>
> Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

As the code had changed I tested it agin and it continues to work, so
you can keep my Tested-by.

However I have a small remark, see below:

> ---
>
> Changes in v6:
>  - Revert back A3700_REGS, as asked by Wolfram and define fm_mask
>    and hs_mask in the register layout. I moved the generic code
>    for fm_mask and hs_mask to a seperated commit (1/4)
>
> Changes in v5:
>  - Don't define registers for armada-3700, we can re-use the ones
>    for PXA3XX.
>  - Define registers mask when OF is not used, in probe_pdata. 
>
> Changes in v4:
>  - Replaced the type of hs_mask and fm_mask by u32, instead of
>    unsigned int, As writel() take an u32 as first argument...
>
> Changes in v3:
>  - Replaced the type of hs_mask and fm_mask by unsigned int,
>    instead of unsigned long.
>
>  drivers/i2c/busses/Kconfig   |  2 +-
>  drivers/i2c/busses/i2c-pxa.c | 15 +++++++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index d252276..2f56a26 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -763,7 +763,7 @@ config I2C_PUV3
>  
>  config I2C_PXA
>  	tristate "Intel PXA2XX I2C adapter"
> -	depends on ARCH_PXA || ARCH_MMP || (X86_32 && PCI && OF)
> +	depends on ARCH_PXA || ARCH_MMP || ARCH_MVEBU || (X86_32 && PCI && OF)
>  	help
>  	  If you have devices in the PXA I2C bus, say yes to this option.
>  	  This driver can also be built as a module.  If so, the module

Maybe you could add that this driver is no longer only for the PXA
family but also for the Armada 37xx.

Gregory

> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index dc9d0a6..0ded4bc 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -57,8 +57,12 @@ enum pxa_i2c_types {
>  	REGS_PXA3XX,
>  	REGS_CE4100,
>  	REGS_PXA910,
> +	REGS_A3700,
>  };
>  
> +#define ICR_BUSMODE_FM	(1 << 16)	   /* shifted fast mode for armada-3700 */
> +#define ICR_BUSMODE_HS	(1 << 17)	   /* shifted high speed mode for armada-3700 */
> +
>  /*
>   * I2C registers definitions
>   */
> @@ -93,6 +97,15 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
>  		.ilcr = 0x28,
>  		.iwcr = 0x30,
>  	},
> +	[REGS_A3700] = {
> +		.ibmr =	0x00,
> +		.idbr =	0x04,
> +		.icr =	0x08,
> +		.isr =	0x0c,
> +		.isar =	0x10,
> +		.fm = ICR_BUSMODE_FM,
> +		.hs = ICR_BUSMODE_HS,
> +	},
>  };
>  
>  static const struct platform_device_id i2c_pxa_id_table[] = {
> @@ -100,6 +113,7 @@ static const struct platform_device_id i2c_pxa_id_table[] = {
>  	{ "pxa3xx-pwri2c",	REGS_PXA3XX },
>  	{ "ce4100-i2c",		REGS_CE4100 },
>  	{ "pxa910-i2c",		REGS_PXA910 },
> +	{ "armada-3700-i2c",	REGS_A3700  },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table);
> @@ -1141,6 +1155,7 @@ static const struct of_device_id i2c_pxa_dt_ids[] = {
>  	{ .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX },
>  	{ .compatible = "mrvl,pwri2c", .data = (void *)REGS_PXA3XX },
>  	{ .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA910 },
> +	{ .compatible = "marvell,armada-3700-i2c", .data = (void *)REGS_A3700 },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
> -- 
> 2.9.3
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/4] i2c: pxa: Add support for the I2C units found in Armada 3700
Date: Wed, 30 Nov 2016 16:43:14 +0100	[thread overview]
Message-ID: <87wpflkm7h.fsf@free-electrons.com> (raw)
In-Reply-To: <20161130140017.26307-3-romain.perier@free-electrons.com> (Romain Perier's message of "Wed, 30 Nov 2016 15:00:15 +0100")

Hi Romain,
 
 On mer., nov. 30 2016, Romain Perier <romain.perier@free-electrons.com> wrote:

> The Armada 3700 has two I2C controllers that is compliant with the I2C
> Bus Specificiation 2.1, supports multi-master and different bus speed:
> Standard mode (up to 100 KHz), Fast mode (up to 400 KHz),
> High speed mode (up to 3.4 Mhz).
>
> This IP block has a lot of similarity with the PXA, except some register
> offsets and bitfield. This commits adds a basic support for this I2C
> unit.
>
> Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

As the code had changed I tested it agin and it continues to work, so
you can keep my Tested-by.

However I have a small remark, see below:

> ---
>
> Changes in v6:
>  - Revert back A3700_REGS, as asked by Wolfram and define fm_mask
>    and hs_mask in the register layout. I moved the generic code
>    for fm_mask and hs_mask to a seperated commit (1/4)
>
> Changes in v5:
>  - Don't define registers for armada-3700, we can re-use the ones
>    for PXA3XX.
>  - Define registers mask when OF is not used, in probe_pdata. 
>
> Changes in v4:
>  - Replaced the type of hs_mask and fm_mask by u32, instead of
>    unsigned int, As writel() take an u32 as first argument...
>
> Changes in v3:
>  - Replaced the type of hs_mask and fm_mask by unsigned int,
>    instead of unsigned long.
>
>  drivers/i2c/busses/Kconfig   |  2 +-
>  drivers/i2c/busses/i2c-pxa.c | 15 +++++++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index d252276..2f56a26 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -763,7 +763,7 @@ config I2C_PUV3
>  
>  config I2C_PXA
>  	tristate "Intel PXA2XX I2C adapter"
> -	depends on ARCH_PXA || ARCH_MMP || (X86_32 && PCI && OF)
> +	depends on ARCH_PXA || ARCH_MMP || ARCH_MVEBU || (X86_32 && PCI && OF)
>  	help
>  	  If you have devices in the PXA I2C bus, say yes to this option.
>  	  This driver can also be built as a module.  If so, the module

Maybe you could add that this driver is no longer only for the PXA
family but also for the Armada 37xx.

Gregory

> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index dc9d0a6..0ded4bc 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -57,8 +57,12 @@ enum pxa_i2c_types {
>  	REGS_PXA3XX,
>  	REGS_CE4100,
>  	REGS_PXA910,
> +	REGS_A3700,
>  };
>  
> +#define ICR_BUSMODE_FM	(1 << 16)	   /* shifted fast mode for armada-3700 */
> +#define ICR_BUSMODE_HS	(1 << 17)	   /* shifted high speed mode for armada-3700 */
> +
>  /*
>   * I2C registers definitions
>   */
> @@ -93,6 +97,15 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
>  		.ilcr = 0x28,
>  		.iwcr = 0x30,
>  	},
> +	[REGS_A3700] = {
> +		.ibmr =	0x00,
> +		.idbr =	0x04,
> +		.icr =	0x08,
> +		.isr =	0x0c,
> +		.isar =	0x10,
> +		.fm = ICR_BUSMODE_FM,
> +		.hs = ICR_BUSMODE_HS,
> +	},
>  };
>  
>  static const struct platform_device_id i2c_pxa_id_table[] = {
> @@ -100,6 +113,7 @@ static const struct platform_device_id i2c_pxa_id_table[] = {
>  	{ "pxa3xx-pwri2c",	REGS_PXA3XX },
>  	{ "ce4100-i2c",		REGS_CE4100 },
>  	{ "pxa910-i2c",		REGS_PXA910 },
> +	{ "armada-3700-i2c",	REGS_A3700  },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table);
> @@ -1141,6 +1155,7 @@ static const struct of_device_id i2c_pxa_dt_ids[] = {
>  	{ .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX },
>  	{ .compatible = "mrvl,pwri2c", .data = (void *)REGS_PXA3XX },
>  	{ .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA910 },
> +	{ .compatible = "marvell,armada-3700-i2c", .data = (void *)REGS_A3700 },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
> -- 
> 2.9.3
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2016-11-30 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 14:00 [PATCH v6 0/4] Add basic support for the I2C units of the Armada 3700 Romain Perier
2016-11-30 14:00 ` Romain Perier
2016-11-30 14:00 ` [PATCH v6 1/4] i2c: pxa: Add definition of fast and high speed modes via the regs layout Romain Perier
2016-11-30 14:00   ` Romain Perier
     [not found]   ` <20161130140017.26307-2-romain.perier-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-11-30 15:49     ` Thomas Petazzoni
2016-11-30 15:49       ` Thomas Petazzoni
     [not found] ` <20161130140017.26307-1-romain.perier-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-11-30 14:00   ` [PATCH v6 2/4] i2c: pxa: Add support for the I2C units found in Armada 3700 Romain Perier
2016-11-30 14:00     ` Romain Perier
2016-11-30 15:43     ` Gregory CLEMENT [this message]
2016-11-30 15:43       ` Gregory CLEMENT
2016-11-30 14:00 ` [PATCH v6 3/4] arm64: dts: marvell: Add I2C definitions for the " Romain Perier
2016-11-30 14:00   ` Romain Perier
2016-11-30 14:00 ` [PATCH v6 4/4] dt-bindings: i2c: pxa: Update the documentation " Romain Perier
2016-11-30 14:00   ` Romain Perier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpflkm7h.fsf@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=hannah@marvell.com \
    --cc=igall@marvell.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nadavh@marvell.com \
    --cc=neta@marvell.com \
    --cc=omrii@marvell.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=romain.perier@free-electrons.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shadi@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wsa@the-dreams.de \
    --cc=yehuday@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.