From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Wolfram Sang <wsa@the-dreams.de>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Maxime Ripard <maxime.ripard@free-electrons.com>, Joachim Eastwood <manabian@gmail.com>, Matthias Brugger <matthias.bgg@gmail.com>, Heiko Stuebner <heiko@sntech.de>, Chen-Yu Tsai <wens@csie.org>, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, Mark Brown <broonie@kernel.org>, andrew@lunn.ch Subject: [PATCH 09/12] nvmem: imx-ocotp: remove nvmem regmap dependency Date: Sun, 24 Apr 2016 20:28:13 +0100 [thread overview] Message-ID: <1461526096-29584-10-git-send-email-srinivas.kandagatla@linaro.org> (raw) In-Reply-To: <1461526096-29584-1-git-send-email-srinivas.kandagatla@linaro.org> This patch moves to nvmem support in the driver to use callback instead of regmap. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- drivers/nvmem/imx-ocotp.c | 55 ++++++++++------------------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index d7796eb..75e66ef 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -22,7 +22,6 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> -#include <linux/regmap.h> #include <linux/slab.h> struct ocotp_priv { @@ -31,59 +30,34 @@ struct ocotp_priv { unsigned int nregs; }; -static int imx_ocotp_read(void *context, const void *reg, size_t reg_size, - void *val, size_t val_size) +static int imx_ocotp_read(void *context, unsigned int offset, + void *val, size_t bytes) { struct ocotp_priv *priv = context; - unsigned int offset = *(u32 *)reg; unsigned int count; + u32 *buf = val; int i; u32 index; index = offset >> 2; - count = val_size >> 2; + count = bytes >> 2; if (count > (priv->nregs - index)) count = priv->nregs - index; - for (i = index; i < (index + count); i++) { - *(u32 *)val = readl(priv->base + 0x400 + i * 0x10); - val += 4; - } + for (i = index; i < (index + count); i++) + *buf++ = readl(priv->base + 0x400 + i * 0x10); return 0; } -static int imx_ocotp_write(void *context, const void *data, size_t count) -{ - /* Not implemented */ - return 0; -} - -static struct regmap_bus imx_ocotp_bus = { - .read = imx_ocotp_read, - .write = imx_ocotp_write, - .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, - .val_format_endian_default = REGMAP_ENDIAN_NATIVE, -}; - -static bool imx_ocotp_writeable_reg(struct device *dev, unsigned int reg) -{ - return false; -} - -static struct regmap_config imx_ocotp_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - .writeable_reg = imx_ocotp_writeable_reg, - .name = "imx-ocotp", -}; - static struct nvmem_config imx_ocotp_nvmem_config = { .name = "imx-ocotp", .read_only = true, + .word_size = 4, + .stride = 4, .owner = THIS_MODULE, + .reg_read = imx_ocotp_read, }; static const struct of_device_id imx_ocotp_dt_ids[] = { @@ -99,7 +73,6 @@ static int imx_ocotp_probe(struct platform_device *pdev) const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; - struct regmap *regmap; struct ocotp_priv *priv; struct nvmem_device *nvmem; @@ -114,15 +87,9 @@ static int imx_ocotp_probe(struct platform_device *pdev) of_id = of_match_device(imx_ocotp_dt_ids, dev); priv->nregs = (unsigned int)of_id->data; - imx_ocotp_regmap_config.max_register = 4 * priv->nregs - 4; - - regmap = devm_regmap_init(dev, &imx_ocotp_bus, priv, - &imx_ocotp_regmap_config); - if (IS_ERR(regmap)) { - dev_err(dev, "regmap init failed\n"); - return PTR_ERR(regmap); - } + imx_ocotp_nvmem_config.size = 4 * priv->nregs; imx_ocotp_nvmem_config.dev = dev; + imx_ocotp_nvmem_config.priv = priv; nvmem = nvmem_register(&imx_ocotp_nvmem_config); if (IS_ERR(nvmem)) return PTR_ERR(nvmem); -- 2.5.0
WARNING: multiple messages have this Message-ID (diff)
From: srinivas.kandagatla@linaro.org (Srinivas Kandagatla) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/12] nvmem: imx-ocotp: remove nvmem regmap dependency Date: Sun, 24 Apr 2016 20:28:13 +0100 [thread overview] Message-ID: <1461526096-29584-10-git-send-email-srinivas.kandagatla@linaro.org> (raw) In-Reply-To: <1461526096-29584-1-git-send-email-srinivas.kandagatla@linaro.org> This patch moves to nvmem support in the driver to use callback instead of regmap. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- drivers/nvmem/imx-ocotp.c | 55 ++++++++++------------------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index d7796eb..75e66ef 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -22,7 +22,6 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> -#include <linux/regmap.h> #include <linux/slab.h> struct ocotp_priv { @@ -31,59 +30,34 @@ struct ocotp_priv { unsigned int nregs; }; -static int imx_ocotp_read(void *context, const void *reg, size_t reg_size, - void *val, size_t val_size) +static int imx_ocotp_read(void *context, unsigned int offset, + void *val, size_t bytes) { struct ocotp_priv *priv = context; - unsigned int offset = *(u32 *)reg; unsigned int count; + u32 *buf = val; int i; u32 index; index = offset >> 2; - count = val_size >> 2; + count = bytes >> 2; if (count > (priv->nregs - index)) count = priv->nregs - index; - for (i = index; i < (index + count); i++) { - *(u32 *)val = readl(priv->base + 0x400 + i * 0x10); - val += 4; - } + for (i = index; i < (index + count); i++) + *buf++ = readl(priv->base + 0x400 + i * 0x10); return 0; } -static int imx_ocotp_write(void *context, const void *data, size_t count) -{ - /* Not implemented */ - return 0; -} - -static struct regmap_bus imx_ocotp_bus = { - .read = imx_ocotp_read, - .write = imx_ocotp_write, - .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, - .val_format_endian_default = REGMAP_ENDIAN_NATIVE, -}; - -static bool imx_ocotp_writeable_reg(struct device *dev, unsigned int reg) -{ - return false; -} - -static struct regmap_config imx_ocotp_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - .writeable_reg = imx_ocotp_writeable_reg, - .name = "imx-ocotp", -}; - static struct nvmem_config imx_ocotp_nvmem_config = { .name = "imx-ocotp", .read_only = true, + .word_size = 4, + .stride = 4, .owner = THIS_MODULE, + .reg_read = imx_ocotp_read, }; static const struct of_device_id imx_ocotp_dt_ids[] = { @@ -99,7 +73,6 @@ static int imx_ocotp_probe(struct platform_device *pdev) const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct resource *res; - struct regmap *regmap; struct ocotp_priv *priv; struct nvmem_device *nvmem; @@ -114,15 +87,9 @@ static int imx_ocotp_probe(struct platform_device *pdev) of_id = of_match_device(imx_ocotp_dt_ids, dev); priv->nregs = (unsigned int)of_id->data; - imx_ocotp_regmap_config.max_register = 4 * priv->nregs - 4; - - regmap = devm_regmap_init(dev, &imx_ocotp_bus, priv, - &imx_ocotp_regmap_config); - if (IS_ERR(regmap)) { - dev_err(dev, "regmap init failed\n"); - return PTR_ERR(regmap); - } + imx_ocotp_nvmem_config.size = 4 * priv->nregs; imx_ocotp_nvmem_config.dev = dev; + imx_ocotp_nvmem_config.priv = priv; nvmem = nvmem_register(&imx_ocotp_nvmem_config); if (IS_ERR(nvmem)) return PTR_ERR(nvmem); -- 2.5.0
next prev parent reply other threads:[~2016-04-24 19:28 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 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 ` Srinivas Kandagatla [this message] 2016-04-24 19:28 ` [PATCH 09/12] nvmem: imx-ocotp: " 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=1461526096-29584-10-git-send-email-srinivas.kandagatla@linaro.org \ --to=srinivas.kandagatla@linaro.org \ --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=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: linkBe 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.