diff mbox

[U-Boot] i2c: fsl: Fix driver initialization

Message ID 1463991131-6961-1-git-send-email-mario.six@gdsys.cc
State Accepted
Commit 27059c3e4d99c134d050be62601afe43171173b3
Delegated to: York Sun
Headers show

Commit Message

Mario Six May 23, 2016, 8:12 a.m. UTC
Due to a oversight in testing, the initialization of the recently
introduced Freescale I2C DM driver works only for 36 bit mode of e.g.
the MPC85XX SoCs (specifically, if the physical addresses are 64 bit
wide and the DT addresses 32 bit wide).

This patch corrects the initialization so that it will work in a more
general setting.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 drivers/i2c/fsl_i2c.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

York Sun July 26, 2016, 8:17 p.m. UTC | #1
On 05/23/2016 01:12 AM, mario.six@gdsys.cc wrote:
> Due to a oversight in testing, the initialization of the recently
> introduced Freescale I2C DM driver works only for 36 bit mode of e.g.
> the MPC85XX SoCs (specifically, if the physical addresses are 64 bit
> wide and the DT addresses 32 bit wide).
>
> This patch corrects the initialization so that it will work in a more
> general setting.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>
> ---
>  drivers/i2c/fsl_i2c.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Applied to fsl-qoriq master. Awaiting upstream.
Thanks.

York
diff mbox

Patch

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index b8cc647..407c4a7 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -583,12 +583,11 @@  static int fsl_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
 static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
 {
 	struct fsl_i2c_dev *dev = dev_get_priv(bus);
-	u64 reg;
-	u32 addr, size;
+	fdt_addr_t addr;
+	fdt_size_t size;
 
-	reg = fdtdec_get_addr(gd->fdt_blob, bus->of_offset, "reg");
-	addr = reg >> 32;
-	size = reg & 0xFFFFFFFF;
+	addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, bus->of_offset,
+						  "reg", 0, &size);
 
 	dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);