aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVivek Gautam <vivek.gautam@codeaurora.org>2017-01-04 11:18:09 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-04 12:22:47 -0500
commit01d0d2c42a14cee8f619d3e9d571ce3469f5ef51 (patch)
tree3d0e97d8e9686e4a453983312c5cdc73d4753847 /drivers
parente09ee853c92011860a4bd2fbdf6126f60fc16bd3 (diff)
nvmem: qfprom: Allow single byte accesses for read/write
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> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvmem/qfprom.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
index b5305f08b184..2bdb6c389328 100644
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context,
21 unsigned int reg, void *_val, size_t bytes) 21 unsigned int reg, void *_val, size_t bytes)
22{ 22{
23 void __iomem *base = context; 23 void __iomem *base = context;
24 u32 *val = _val; 24 u8 *val = _val;
25 int i = 0, words = bytes / 4; 25 int i = 0, words = bytes;
26 26
27 while (words--) 27 while (words--)
28 *val++ = readl(base + reg + (i++ * 4)); 28 *val++ = readb(base + reg + i++);
29 29
30 return 0; 30 return 0;
31} 31}
@@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context,
34 unsigned int reg, void *_val, size_t bytes) 34 unsigned int reg, void *_val, size_t bytes)
35{ 35{
36 void __iomem *base = context; 36 void __iomem *base = context;
37 u32 *val = _val; 37 u8 *val = _val;
38 int i = 0, words = bytes / 4; 38 int i = 0, words = bytes;
39 39
40 while (words--) 40 while (words--)
41 writel(*val++, base + reg + (i++ * 4)); 41 writeb(*val++, base + reg + i++);
42 42
43 return 0; 43 return 0;
44} 44}
@@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
53static struct nvmem_config econfig = { 53static struct nvmem_config econfig = {
54 .name = "qfprom", 54 .name = "qfprom",
55 .owner = THIS_MODULE, 55 .owner = THIS_MODULE,
56 .stride = 4, 56 .stride = 1,
57 .word_size = 1, 57 .word_size = 1,
58 .reg_read = qfprom_reg_read, 58 .reg_read = qfprom_reg_read,
59 .reg_write = qfprom_reg_write, 59 .reg_write = qfprom_reg_write,