diff options
author | Xiubo Li <Li.Xiubo@freescale.com> | 2014-04-11 02:28:05 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:36:14 (GMT) |
commit | 9221a86587283541a8709c3431c1b95cf5c8be4c (patch) | |
tree | d5ca34d65c99a9732fd56638c08674595cf79068 /drivers | |
parent | d641a9f768d7b1312a6ee85226512daddd7c29a1 (diff) | |
download | linux-fsl-qoriq-9221a86587283541a8709c3431c1b95cf5c8be4c.tar.xz |
regmap: mmio: Add regmap_mmio_regbits_check.
Fix the support for 1/2/8 bytes wide register address checking.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
---
This patch is pulled back from upstream:
commit 451485ba6bfbed36220b9e710fca0525f62e771d
Change-Id: I3950b3721b3998d3cdb7e6cac69ec0b4a65c3efb
Reviewed-on: http://git.am.freescale.net:8181/19675
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index b9da278..1f95f8b 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -47,6 +47,21 @@ static inline void regmap_mmio_regsize_check(size_t reg_size) } } +static int regmap_mmio_regbits_check(size_t reg_bits) +{ + switch (reg_bits) { + case 8: + case 16: + case 32: +#ifdef CONFIG_64BIT + case 64: +#endif + return 0; + default: + return -EINVAL; + } +} + static inline void regmap_mmio_count_check(size_t count) { BUG_ON(count % 2 != 0); @@ -210,8 +225,9 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, int min_stride; int ret; - if (config->reg_bits != 32) - return ERR_PTR(-EINVAL); + ret = regmap_mmio_regbits_check(config->reg_bits); + if (ret) + return ERR_PTR(ret); if (config->pad_bits) return ERR_PTR(-EINVAL); |