diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-03-24 22:32:40 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-04-01 00:17:13 +0900 |
commit | 336399fb63cd43aa9d3c1dc8c71c9a5e0c1270d9 (patch) | |
tree | 3dd44593f5d5753768984d82bdb629a478bdf348 /drivers | |
parent | 45a3b1fd6ca524bebf5b9ce771ad1fb12f3514ce (diff) | |
download | u-boot-imx-336399fb63cd43aa9d3c1dc8c71c9a5e0c1270d9.zip u-boot-imx-336399fb63cd43aa9d3c1dc8c71c9a5e0c1270d9.tar.gz u-boot-imx-336399fb63cd43aa9d3c1dc8c71c9a5e0c1270d9.tar.bz2 |
i2c: uniphier: use devm_get_addr() to get base address
Currently, fdtdec_get_addr_size() does not support the address
translation, so it cannot handle device trees with non-straight
"ranges" properties. (This would be a problem with DTS for UniPhier
ARMv8 SoCs.)
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-uniphier-f.c | 12 | ||||
-rw-r--r-- | drivers/i2c/i2c-uniphier.c | 11 |
2 files changed, 10 insertions, 13 deletions
diff --git a/drivers/i2c/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index b3349af..aebdcfc 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -7,6 +7,7 @@ #include <common.h> #include <linux/types.h> #include <linux/io.h> +#include <linux/sizes.h> #include <asm/errno.h> #include <dm/device.h> #include <dm/root.h> @@ -14,8 +15,6 @@ #include <fdtdec.h> #include <mapmem.h> -DECLARE_GLOBAL_DATA_PTR; - struct uniphier_fi2c_regs { u32 cr; /* control register */ #define I2C_CR_MST (1 << 3) /* master mode */ @@ -112,15 +111,14 @@ static int check_device_busy(struct uniphier_fi2c_regs __iomem *regs) static int uniphier_fi2c_probe(struct udevice *dev) { fdt_addr_t addr; - fdt_size_t size; struct uniphier_fi2c_dev *priv = dev_get_priv(dev); int ret; - addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", - &size); - - priv->regs = map_sysmem(addr, size); + addr = dev_get_addr(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + priv->regs = map_sysmem(addr, SZ_128); if (!priv->regs) return -ENOMEM; diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index 85b9eff..f8221da 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -7,6 +7,7 @@ #include <common.h> #include <linux/types.h> #include <linux/io.h> +#include <linux/sizes.h> #include <asm/errno.h> #include <dm/device.h> #include <dm/root.h> @@ -14,8 +15,6 @@ #include <fdtdec.h> #include <mapmem.h> -DECLARE_GLOBAL_DATA_PTR; - struct uniphier_i2c_regs { u32 dtrm; /* data transmission */ #define I2C_DTRM_STA (1 << 10) @@ -48,13 +47,13 @@ struct uniphier_i2c_dev { static int uniphier_i2c_probe(struct udevice *dev) { fdt_addr_t addr; - fdt_size_t size; struct uniphier_i2c_dev *priv = dev_get_priv(dev); - addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size); - - priv->regs = map_sysmem(addr, size); + addr = dev_get_addr(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + priv->regs = map_sysmem(addr, SZ_64); if (!priv->regs) return -ENOMEM; |