* [PATCH] nvmem: qfprom: Fix to support single byte read/write
@ 2016-11-15 14:04 Vivek Gautam
2016-11-15 18:59 ` Stephen Boyd
0 siblings, 1 reply; 7+ messages in thread
From: Vivek Gautam @ 2016-11-15 14:04 UTC (permalink / raw)
To: srinivas.kandagatla, maxime.ripard
Cc: gregkh, sboyd, rnayak, linux-kernel, Vivek Gautam
The nvmem core driver supports to read and write single
byte. This helps in extracting a required value based
on bit-offset and number of bits for the required value
in the nvmem cell.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
---
Based on torvalds's master branch.
- Tested on db410c for thermal sensors, and
on db820c for qusb2 phy with tree [1] based on linaro qcom landing
team's integration tree.
[1] https://github.com/vivekgautam1/linux/tree/linaro/integration-linux-qcomlt-qcom-phy-upstream
drivers/nvmem/qfprom.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
index b5305f0..2bdb6c3 100644
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context,
unsigned int reg, void *_val, size_t bytes)
{
void __iomem *base = context;
- u32 *val = _val;
- int i = 0, words = bytes / 4;
+ u8 *val = _val;
+ int i = 0, words = bytes;
while (words--)
- *val++ = readl(base + reg + (i++ * 4));
+ *val++ = readb(base + reg + i++);
return 0;
}
@@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context,
unsigned int reg, void *_val, size_t bytes)
{
void __iomem *base = context;
- u32 *val = _val;
- int i = 0, words = bytes / 4;
+ u8 *val = _val;
+ int i = 0, words = bytes;
while (words--)
- writel(*val++, base + reg + (i++ * 4));
+ writeb(*val++, base + reg + i++);
return 0;
}
@@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
static struct nvmem_config econfig = {
.name = "qfprom",
.owner = THIS_MODULE,
- .stride = 4,
+ .stride = 1,
.word_size = 1,
.reg_read = qfprom_reg_read,
.reg_write = qfprom_reg_write,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] nvmem: qfprom: Fix to support single byte read/write
2016-11-15 14:04 [PATCH] nvmem: qfprom: Fix to support single byte read/write Vivek Gautam
@ 2016-11-15 18:59 ` Stephen Boyd
2016-11-16 4:30 ` Vivek Gautam
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2016-11-15 18:59 UTC (permalink / raw)
To: Vivek Gautam
Cc: srinivas.kandagatla, maxime.ripard, gregkh, rnayak, linux-kernel
On 11/15, Vivek Gautam wrote:
> @@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
> static struct nvmem_config econfig = {
> .name = "qfprom",
> .owner = THIS_MODULE,
> - .stride = 4,
> + .stride = 1,
Are we certain that all qfproms support byte accesses?
> .word_size = 1,
> .reg_read = qfprom_reg_read,
> .reg_write = qfprom_reg_write,
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] nvmem: qfprom: Fix to support single byte read/write
2016-11-15 18:59 ` Stephen Boyd
@ 2016-11-16 4:30 ` Vivek Gautam
2016-11-16 22:23 ` Stephen Boyd
0 siblings, 1 reply; 7+ messages in thread
From: Vivek Gautam @ 2016-11-16 4:30 UTC (permalink / raw)
To: Stephen Boyd
Cc: Srinivas Kandagatla, Maxime Ripard, Greg KH, Rajendra Nayak,
linux-kernel
Hi Stephen,
On Wed, Nov 16, 2016 at 12:29 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 11/15, Vivek Gautam wrote:
>> @@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
>> static struct nvmem_config econfig = {
>> .name = "qfprom",
>> .owner = THIS_MODULE,
>> - .stride = 4,
>> + .stride = 1,
>
> Are we certain that all qfproms support byte accesses?
I have tested on 8916 and 8996. Will give a try on older targets as
well.
For a note: we had been using the reg_stride = 1, before removing
regmap support for nvmem access [1].
[1] 382c62f nvmem: qfprom: remove nvmem regmap dependency
Thanks
Vivek
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] nvmem: qfprom: Fix to support single byte read/write
2016-11-16 4:30 ` Vivek Gautam
@ 2016-11-16 22:23 ` Stephen Boyd
2016-11-17 5:59 ` [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write Vivek Gautam
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2016-11-16 22:23 UTC (permalink / raw)
To: Vivek Gautam
Cc: Srinivas Kandagatla, Maxime Ripard, Greg KH, Rajendra Nayak,
linux-kernel
On 11/16, Vivek Gautam wrote:
> Hi Stephen,
>
> On Wed, Nov 16, 2016 at 12:29 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 11/15, Vivek Gautam wrote:
> >> @@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
> >> static struct nvmem_config econfig = {
> >> .name = "qfprom",
> >> .owner = THIS_MODULE,
> >> - .stride = 4,
> >> + .stride = 1,
> >
> > Are we certain that all qfproms support byte accesses?
>
> I have tested on 8916 and 8996. Will give a try on older targets as
> well.
>
> For a note: we had been using the reg_stride = 1, before removing
> regmap support for nvmem access [1].
>
> [1] 382c62f nvmem: qfprom: remove nvmem regmap dependency
>
>
Ah ok. If we were doing byte accesses before then I have no
concerns.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write
2016-11-16 22:23 ` Stephen Boyd
@ 2016-11-17 5:59 ` Vivek Gautam
2017-01-04 14:07 ` Srinivas Kandagatla
0 siblings, 1 reply; 7+ messages in thread
From: Vivek Gautam @ 2016-11-17 5:59 UTC (permalink / raw)
To: srinivas.kandagatla
Cc: maxime.ripard, gregkh, sboyd, rnayak, linux-kernel,
linux-arm-msm, Vivek Gautam
The nvmem core driver supports to read and write single
byte. So, allow qfprom to support this feature.
This change helps in extracting a required value based
on bit-offset and number of bits for the required value
in the nvmem cell.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Based on torvalds's master branch.
- Tested on db410c (apq8016) and ifc6410 (apq 8064) targets
for thermal sensors (could read the core temperatures); and
on db820c (msm8996) for qusb2 phy, with tree [1] based on
linaro qcom landing team's integration tree.
Changes in v2:
- Updated commit title, since the patch does extend the feature,
rather than fixing any kind of bug in the code.
Original title (v1): nvmem: qfprom: Fix to support single byte read/write
Update title (v2): nvmem: qfprom: Allow single byte accesses for read/write.
- Added some more info in the commit message as well.
** NO change in the code.
[1] https://github.com/vivekgautam1/linux/tree/linaro/integration-linux-qcomlt-qcom-phy-upstream
drivers/nvmem/qfprom.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
index b5305f0..2bdb6c3 100644
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context,
unsigned int reg, void *_val, size_t bytes)
{
void __iomem *base = context;
- u32 *val = _val;
- int i = 0, words = bytes / 4;
+ u8 *val = _val;
+ int i = 0, words = bytes;
while (words--)
- *val++ = readl(base + reg + (i++ * 4));
+ *val++ = readb(base + reg + i++);
return 0;
}
@@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context,
unsigned int reg, void *_val, size_t bytes)
{
void __iomem *base = context;
- u32 *val = _val;
- int i = 0, words = bytes / 4;
+ u8 *val = _val;
+ int i = 0, words = bytes;
while (words--)
- writel(*val++, base + reg + (i++ * 4));
+ writeb(*val++, base + reg + i++);
return 0;
}
@@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
static struct nvmem_config econfig = {
.name = "qfprom",
.owner = THIS_MODULE,
- .stride = 4,
+ .stride = 1,
.word_size = 1,
.reg_read = qfprom_reg_read,
.reg_write = qfprom_reg_write,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write
2016-11-17 5:59 ` [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write Vivek Gautam
@ 2017-01-04 14:07 ` Srinivas Kandagatla
2017-01-05 4:27 ` Vivek Gautam
0 siblings, 1 reply; 7+ messages in thread
From: Srinivas Kandagatla @ 2017-01-04 14:07 UTC (permalink / raw)
To: Vivek Gautam
Cc: maxime.ripard, gregkh, sboyd, rnayak, linux-kernel, linux-arm-msm
Thanks for the Patch,
I will queue this up!!
On 17/11/16 05:59, Vivek Gautam wrote:
> The nvmem core driver supports to read and write single
> byte. So, allow qfprom to support this feature.
> This change helps in extracting a required value based
> on bit-offset and number of bits for the required value
> in the nvmem cell.
>
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>
> Based on torvalds's master branch.
> - Tested on db410c (apq8016) and ifc6410 (apq 8064) targets
> for thermal sensors (could read the core temperatures); and
> on db820c (msm8996) for qusb2 phy, with tree [1] based on
> linaro qcom landing team's integration tree.
>
> Changes in v2:
> - Updated commit title, since the patch does extend the feature,
> rather than fixing any kind of bug in the code.
>
> Original title (v1): nvmem: qfprom: Fix to support single byte read/write
> Update title (v2): nvmem: qfprom: Allow single byte accesses for read/write.
>
> - Added some more info in the commit message as well.
>
> ** NO change in the code.
>
> [1] https://github.com/vivekgautam1/linux/tree/linaro/integration-linux-qcomlt-qcom-phy-upstream
>
> drivers/nvmem/qfprom.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
> index b5305f0..2bdb6c3 100644
> --- a/drivers/nvmem/qfprom.c
> +++ b/drivers/nvmem/qfprom.c
> @@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context,
> unsigned int reg, void *_val, size_t bytes)
> {
> void __iomem *base = context;
> - u32 *val = _val;
> - int i = 0, words = bytes / 4;
> + u8 *val = _val;
> + int i = 0, words = bytes;
>
> while (words--)
> - *val++ = readl(base + reg + (i++ * 4));
> + *val++ = readb(base + reg + i++);
>
> return 0;
> }
> @@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context,
> unsigned int reg, void *_val, size_t bytes)
> {
> void __iomem *base = context;
> - u32 *val = _val;
> - int i = 0, words = bytes / 4;
> + u8 *val = _val;
> + int i = 0, words = bytes;
>
> while (words--)
> - writel(*val++, base + reg + (i++ * 4));
> + writeb(*val++, base + reg + i++);
>
> return 0;
> }
> @@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
> static struct nvmem_config econfig = {
> .name = "qfprom",
> .owner = THIS_MODULE,
> - .stride = 4,
> + .stride = 1,
> .word_size = 1,
> .reg_read = qfprom_reg_read,
> .reg_write = qfprom_reg_write,
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write
2017-01-04 14:07 ` Srinivas Kandagatla
@ 2017-01-05 4:27 ` Vivek Gautam
0 siblings, 0 replies; 7+ messages in thread
From: Vivek Gautam @ 2017-01-05 4:27 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Maxime Ripard, Greg KH, Stephen Boyd, Rajendra Nayak,
linux-kernel, linux-arm-msm
On Wed, Jan 4, 2017 at 7:37 PM, Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> wrote:
> Thanks for the Patch,
>
> I will queue this up!!
Thanks Srinivas.
[snip]
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-01-05 4:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-15 14:04 [PATCH] nvmem: qfprom: Fix to support single byte read/write Vivek Gautam
2016-11-15 18:59 ` Stephen Boyd
2016-11-16 4:30 ` Vivek Gautam
2016-11-16 22:23 ` Stephen Boyd
2016-11-17 5:59 ` [PATCH v2] nvmem: qfprom: Allow single byte accesses for read/write Vivek Gautam
2017-01-04 14:07 ` Srinivas Kandagatla
2017-01-05 4:27 ` Vivek Gautam
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).