All of lore.kernel.org
 help / color / mirror / Atom feed
From: maitysanchayan@gmail.com
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	andrew@lunn.ch, Heiko Stuebner <heiko@sntech.de>,
	Wolfram Sang <wsa@the-dreams.de>,
	Joachim Eastwood <manabian@gmail.com>,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	Chen-Yu Tsai <wens@csie.org>, Mark Brown <broonie@kernel.org>,
	linux-i2c@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-mediatek@lists.infradead.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org, stefan@agner.ch
Subject: Re: [PATCH 05/12] nvmem: vif610-ocotp: remove nvmem regmap dependency
Date: Wed, 27 Apr 2016 11:06:00 +0530	[thread overview]
Message-ID: <20160427053600.GB2048@Sanchayan-Arch.localdomain> (raw)
In-Reply-To: <1461526096-29584-6-git-send-email-srinivas.kandagatla@linaro.org>

Hello Srinivas,

On 16-04-24 20:28:09, Srinivas Kandagatla wrote:
> This patch moves to nvmem support in the driver to use callback
> instead of regmap.

Minor nit, it says "vif610-octop" it should have been vf610-ocotp.

For what it's worth, I tested this on Colibri Vybrid VF61 for a while and
all seems to work fine.

So with the testing for vf610-ocotp driver other than the minor nit

Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>

Regards,
Sanchayan.

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/nvmem/vf610-ocotp.c | 44 ++++++++++----------------------------------
>  1 file changed, 10 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c
> index 8641319..72e4faa 100644
> --- a/drivers/nvmem/vf610-ocotp.c
> +++ b/drivers/nvmem/vf610-ocotp.c
> @@ -25,7 +25,6 @@
>  #include <linux/nvmem-provider.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> -#include <linux/regmap.h>
>  #include <linux/slab.h>
>  
>  /* OCOTP Register Offsets */
> @@ -152,23 +151,16 @@ static int vf610_get_fuse_address(int base_addr_offset)
>  	return -EINVAL;
>  }
>  
> -static int vf610_ocotp_write(void *context, const void *data, size_t count)
> -{
> -	return 0;
> -}
> -
> -static int vf610_ocotp_read(void *context,
> -			const void *off, size_t reg_size,
> -			void *val, size_t val_size)
> +static int vf610_ocotp_read(void *context, unsigned int offset,
> +			void *val, size_t bytes)
>  {
>  	struct vf610_ocotp *ocotp = context;
>  	void __iomem *base = ocotp->base;
> -	unsigned int offset = *(u32 *)off;
>  	u32 reg, *buf = val;
>  	int fuse_addr;
>  	int ret;
>  
> -	while (val_size > 0) {
> +	while (bytes > 0) {
>  		fuse_addr = vf610_get_fuse_address(offset);
>  		if (fuse_addr > 0) {
>  			writel(ocotp->timing, base + OCOTP_TIMING);
> @@ -205,29 +197,19 @@ static int vf610_ocotp_read(void *context,
>  		}
>  
>  		buf++;
> -		val_size--;
> -		offset += reg_size;
> +		bytes -= 4;
> +		offset += 4;
>  	}
>  
>  	return 0;
>  }
>  
> -static struct regmap_bus vf610_ocotp_bus = {
> -	.read = vf610_ocotp_read,
> -	.write = vf610_ocotp_write,
> -	.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
> -	.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
> -};
> -
> -static struct regmap_config ocotp_regmap_config = {
> -	.reg_bits = 32,
> -	.val_bits = 32,
> -	.reg_stride = 4,
> -};
> -
>  static struct nvmem_config ocotp_config = {
>  	.name = "ocotp",
>  	.owner = THIS_MODULE,
> +	.stride = 4,
> +	.word_size = 4,
> +	.reg_read = vf610_ocotp_read,
>  };
>  
>  static const struct of_device_id ocotp_of_match[] = {
> @@ -247,7 +229,6 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct resource *res;
> -	struct regmap *regmap;
>  	struct vf610_ocotp *ocotp_dev;
>  
>  	ocotp_dev = devm_kzalloc(&pdev->dev,
> @@ -267,13 +248,8 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
>  		return PTR_ERR(ocotp_dev->clk);
>  	}
>  
> -	ocotp_regmap_config.max_register = resource_size(res);
> -	regmap = devm_regmap_init(dev,
> -		&vf610_ocotp_bus, ocotp_dev, &ocotp_regmap_config);
> -	if (IS_ERR(regmap)) {
> -		dev_err(dev, "regmap init failed\n");
> -		return PTR_ERR(regmap);
> -	}
> +	ocotp_config.size = resource_size(res);
> +	ocotp_config.priv = ocotp_dev;
>  	ocotp_config.dev = dev;
>  
>  	ocotp_dev->nvmem = nvmem_register(&ocotp_config);
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: maitysanchayan@gmail.com (maitysanchayan at gmail.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/12] nvmem: vif610-ocotp: remove nvmem regmap dependency
Date: Wed, 27 Apr 2016 11:06:00 +0530	[thread overview]
Message-ID: <20160427053600.GB2048@Sanchayan-Arch.localdomain> (raw)
In-Reply-To: <1461526096-29584-6-git-send-email-srinivas.kandagatla@linaro.org>

Hello Srinivas,

On 16-04-24 20:28:09, Srinivas Kandagatla wrote:
> This patch moves to nvmem support in the driver to use callback
> instead of regmap.

Minor nit, it says "vif610-octop" it should have been vf610-ocotp.

For what it's worth, I tested this on Colibri Vybrid VF61 for a while and
all seems to work fine.

So with the testing for vf610-ocotp driver other than the minor nit

Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>

Regards,
Sanchayan.

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/nvmem/vf610-ocotp.c | 44 ++++++++++----------------------------------
>  1 file changed, 10 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c
> index 8641319..72e4faa 100644
> --- a/drivers/nvmem/vf610-ocotp.c
> +++ b/drivers/nvmem/vf610-ocotp.c
> @@ -25,7 +25,6 @@
>  #include <linux/nvmem-provider.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> -#include <linux/regmap.h>
>  #include <linux/slab.h>
>  
>  /* OCOTP Register Offsets */
> @@ -152,23 +151,16 @@ static int vf610_get_fuse_address(int base_addr_offset)
>  	return -EINVAL;
>  }
>  
> -static int vf610_ocotp_write(void *context, const void *data, size_t count)
> -{
> -	return 0;
> -}
> -
> -static int vf610_ocotp_read(void *context,
> -			const void *off, size_t reg_size,
> -			void *val, size_t val_size)
> +static int vf610_ocotp_read(void *context, unsigned int offset,
> +			void *val, size_t bytes)
>  {
>  	struct vf610_ocotp *ocotp = context;
>  	void __iomem *base = ocotp->base;
> -	unsigned int offset = *(u32 *)off;
>  	u32 reg, *buf = val;
>  	int fuse_addr;
>  	int ret;
>  
> -	while (val_size > 0) {
> +	while (bytes > 0) {
>  		fuse_addr = vf610_get_fuse_address(offset);
>  		if (fuse_addr > 0) {
>  			writel(ocotp->timing, base + OCOTP_TIMING);
> @@ -205,29 +197,19 @@ static int vf610_ocotp_read(void *context,
>  		}
>  
>  		buf++;
> -		val_size--;
> -		offset += reg_size;
> +		bytes -= 4;
> +		offset += 4;
>  	}
>  
>  	return 0;
>  }
>  
> -static struct regmap_bus vf610_ocotp_bus = {
> -	.read = vf610_ocotp_read,
> -	.write = vf610_ocotp_write,
> -	.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
> -	.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
> -};
> -
> -static struct regmap_config ocotp_regmap_config = {
> -	.reg_bits = 32,
> -	.val_bits = 32,
> -	.reg_stride = 4,
> -};
> -
>  static struct nvmem_config ocotp_config = {
>  	.name = "ocotp",
>  	.owner = THIS_MODULE,
> +	.stride = 4,
> +	.word_size = 4,
> +	.reg_read = vf610_ocotp_read,
>  };
>  
>  static const struct of_device_id ocotp_of_match[] = {
> @@ -247,7 +229,6 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct resource *res;
> -	struct regmap *regmap;
>  	struct vf610_ocotp *ocotp_dev;
>  
>  	ocotp_dev = devm_kzalloc(&pdev->dev,
> @@ -267,13 +248,8 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
>  		return PTR_ERR(ocotp_dev->clk);
>  	}
>  
> -	ocotp_regmap_config.max_register = resource_size(res);
> -	regmap = devm_regmap_init(dev,
> -		&vf610_ocotp_bus, ocotp_dev, &ocotp_regmap_config);
> -	if (IS_ERR(regmap)) {
> -		dev_err(dev, "regmap init failed\n");
> -		return PTR_ERR(regmap);
> -	}
> +	ocotp_config.size = resource_size(res);
> +	ocotp_config.priv = ocotp_dev;
>  	ocotp_config.dev = dev;
>  
>  	ocotp_dev->nvmem = nvmem_register(&ocotp_config);
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2016-04-27  5:42 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 19:28 [PATCH 00/12] nvmem: remove regmap dependency Srinivas Kandagatla
2016-04-24 19:28 ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 01/12] nvmem: core: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 02/12] eeprom: at24: remove nvmem " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-05-02  7:32   ` Wolfram Sang
2016-05-02  7:32     ` Wolfram Sang
2016-05-02  7:32     ` Wolfram Sang
2016-05-04  1:32     ` Andrew Lunn
2016-05-04  1:32       ` Andrew Lunn
2016-04-24 19:28 ` [PATCH 03/12] eeprom: at25: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 04/12] nvmem: qfprom: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 05/12] nvmem: vif610-ocotp: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-27  5:36   ` maitysanchayan [this message]
2016-04-27  5:36     ` maitysanchayan at gmail.com
2016-04-24 19:28 ` [PATCH 06/12] nvmem: sunxi-sid: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 07/12] nvmem: rockchip-efuse: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 08/12] nvmem: mtk-efuse: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-27  6:30   ` andrew-ct chen
2016-04-27  6:30     ` andrew-ct chen
2016-04-27  6:30     ` andrew-ct chen
2016-05-01 21:01   ` Greg Kroah-Hartman
2016-05-01 21:01     ` Greg Kroah-Hartman
2016-04-24 19:28 ` [PATCH 09/12] nvmem: imx-ocotp: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 10/12] nvmem: lpc18xx-eeprom: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-24 19:28 ` [PATCH 11/12] nvmem: mxs-ocotp: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla
2016-04-28  6:50   ` Stefan Wahren
2016-04-28  6:50     ` Stefan Wahren
2016-04-28  6:50     ` Stefan Wahren
2016-04-24 19:28 ` [PATCH 12/12] nvmem: 93xx46: " Srinivas Kandagatla
2016-04-24 19:28   ` Srinivas Kandagatla

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=20160427053600.GB2048@Sanchayan-Arch.localdomain \
    --to=maitysanchayan@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=manabian@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stefan@agner.ch \
    --cc=wens@csie.org \
    --cc=wsa@the-dreams.de \
    /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.