diff options
author | Vladimir Barinov <vladimir.barinov@cogentembedded.com> | 2018-02-16 22:19:30 +0300 |
---|---|---|
committer | Vladimir Barinov <vladimir.barinov@cogentembedded.com> | 2018-02-26 23:24:57 +0300 |
commit | ea8f876b1ec11533ea57492fa4ec06be73a80763 (patch) | |
tree | 288f848e16988525536a6508be4cd7aada9944b3 /meta-rcar-gen3-adas/recipes-bsp | |
parent | 630c6b51f35ac186937319a9e4761cfc3f83175c (diff) |
RCAR I2C UBOOT: add 16 bit addressing
This adds 16bit addressing for RCAR I2C in uboot
Diffstat (limited to 'meta-rcar-gen3-adas/recipes-bsp')
-rw-r--r-- | meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/00121-i2c-rcar_i2c-add-16bit-addressing.patch | 88 | ||||
-rw-r--r-- | meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend | 1 |
2 files changed, 89 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/00121-i2c-rcar_i2c-add-16bit-addressing.patch b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/00121-i2c-rcar_i2c-add-16bit-addressing.patch new file mode 100644 index 0000000..ccd0dcd --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/00121-i2c-rcar_i2c-add-16bit-addressing.patch @@ -0,0 +1,88 @@ +From ae18804d5b0542066b92d6f269748cd0e860b37f Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov <vladimir.barinov@cogentembedded.com> +Date: Fri, 16 Feb 2018 22:13:02 +0300 +Subject: [PATCH] i2c: rcar_i2c: add 16bit addressing + +This adds 16bit addressing for RCAR I2C + +Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com> +--- + drivers/i2c/rcar_i2c.c | 37 +++++++++++++++++++++++++++++++------ + 1 file changed, 31 insertions(+), 6 deletions(-) + +diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c +index 90ad116..017ae0b 100644 +--- a/drivers/i2c/rcar_i2c.c ++++ b/drivers/i2c/rcar_i2c.c +@@ -88,9 +88,21 @@ static void rcar_i2c_raw_rw_finish(struct rcar_i2c *dev) + } + + static int +-rcar_i2c_raw_write(struct rcar_i2c *dev, u8 chip, uint addr, u8 *val, int size) ++rcar_i2c_raw_write(struct rcar_i2c *dev, u8 chip, uint addr, int alen, u8 *val, int size) + { +- rcar_i2c_raw_rw_common(dev, chip, addr); ++ if (alen == sizeof(u8)) { ++ rcar_i2c_raw_rw_common(dev, chip, addr); ++ } else { ++ rcar_i2c_raw_rw_common(dev, chip, addr >> 8); ++ ++ /* set send date */ ++ writel(addr & 0xff, &dev->icrxdtxd); ++ /* start SCLclk */ ++ writel(~MSR_MDE, &dev->icmsr); ++ ++ while (!(readl(&dev->icmsr) & MSR_MDE)) ++ udelay(10); ++ } + + /* set send date */ + writel(*val, &dev->icrxdtxd); +@@ -111,11 +123,23 @@ rcar_i2c_raw_write(struct rcar_i2c *dev, u8 chip, uint addr, u8 *val, int size) + } + + static u8 +-rcar_i2c_raw_read(struct rcar_i2c *dev, u8 chip, uint addr) ++rcar_i2c_raw_read(struct rcar_i2c *dev, u8 chip, uint addr, int alen) + { + u8 ret; + +- rcar_i2c_raw_rw_common(dev, chip, addr); ++ if (alen == sizeof(u8)) { ++ rcar_i2c_raw_rw_common(dev, chip, addr); ++ } else { ++ rcar_i2c_raw_rw_common(dev, chip, addr >> 8); ++ ++ /* set send date */ ++ writel(addr & 0xff, &dev->icrxdtxd); ++ /* start SCLclk */ ++ writel(~MSR_MDE, &dev->icmsr); ++ ++ while (!(readl(&dev->icmsr) & MSR_MDE)) ++ udelay(10); ++ } + + /* set slave address, receive */ + writel((chip << 1) | 1, &dev->icmar); +@@ -236,7 +260,7 @@ static int rcar_i2c_read(struct i2c_adapter *adap, uint8_t chip, + int i; + + for (i = 0; i < len; i++) +- data[i] = rcar_i2c_raw_read(dev, chip, addr + i); ++ data[i] = rcar_i2c_raw_read(dev, chip, addr + i, alen); + + return 0; + } +@@ -245,7 +269,8 @@ static int rcar_i2c_write(struct i2c_adapter *adap, uint8_t chip, uint addr, + int alen, u8 *data, int len) + { + struct rcar_i2c *dev = (struct rcar_i2c *)i2c_dev[adap->hwadapnr]; +- return rcar_i2c_raw_write(dev, chip, addr, data, len); ++ ++ return rcar_i2c_raw_write(dev, chip, addr, alen, data, len); + } + + static int +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend index 146c392..0896fde 100644 --- a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend +++ b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend @@ -13,6 +13,7 @@ SRC_URI_append = " \ file://0010-configs-rcar-gen3-common-Enable-hush-parser.patch \ file://0011-configs-rcar-gen3-common-Enable-GPT-support.patch \ file://0012-ARM-rcar_gen3-Add-I2C-definitions.patch \ + file://00121-i2c-rcar_i2c-add-16bit-addressing.patch \ file://0013-mtd-spi-QSPI-flash-support.patch \ file://0014-arm-renesas-Add-Renesas-R8A7797-SoC-support.patch \ file://0015-board-renesas-Add-V3M-Eagle-board.patch \ |