i2c: rcar_i2c: Enable configuring SCL rise and fall times
Subsystems (2)
PATCH 1/1 i2c: rcar_i2c: Enable configuring SCL rise and fall times
The Linux i2c driver supports i2c-scl-rising-time-ns, and i2c-scl-falling-time-ns, but U-Boot uses hard-coded values for these values.
Update the calculation by fetching them from the device tree if present and use the previous values as the default if they are missing.
drivers/i2c/rcar_i2c.c +7 -1
@@ -64,6 +64,8 @@ enum rcar_i2c_type {struct rcar_i2c_priv {void __iomem *base;struct clk clk; +u32 fall_ns; +u32 rise_ns;u32 intdelay;u32 icccr;enum rcar_i2c_type type;
@@ -278,7 +280,7 @@ static int rcar_i2c_set_speed(struct udevice *dev, uint bus_freq_hz)* = F[sum * ick / 1000000000] * = F[(ick / 1000000) * sum / 1000] */ - sum =35 +200 + priv->intdelay; + sum = priv->fall_ns + priv->rise_ns + priv->intdelay; round = (ick +500000 ) /1000000 * sum; round = (round +500 ) /1000 ;
@@ -323,6 +325,10 @@ static int rcar_i2c_probe(struct udevice *dev)int ret; priv->base =dev_read_addr_ptr (dev); + priv->rise_ns =dev_read_u32_default (dev, +"i2c-scl-rising-time-ns" ,200 ); + priv->fall_ns =dev_read_u32_default (dev, +"i2c-scl-falling-time-ns" ,35 ); priv->intdelay =dev_read_u32_default (dev,"i2c-scl-internal-delay-ns" ,5 ); priv->type =dev_get_driver_data (dev);
Signature · 1 line
2.25.1
Quoted 11 lines · Adam Ford
The Linux i2c driver supports i2c-scl-rising-time-ns, and i2c-scl-falling-time-ns, but U-Boot uses hard-coded values for these values.
Update the calculation by fetching them from the device tree if present and use the previous values as the default if they are missing.
Signed-off-by Adam Ford <[email protected]>
Do I have the right people in copy? I was hoping to get some feedback on this. My boards use the i2c-scl-rising-time-ns to help properly set the i2c clocking.
thanks
adam
Quoted 36 lines
drivers/i2c/rcar_i2c.c +7
-2@@ -64,6 +64,8 @@ enum rcar_i2c_type {struct rcar_i2c_priv {void __iomem *base;struct clk clk; +u32 fall_ns; +u32 rise_ns;u32 intdelay;u32 icccr;enum rcar_i2c_type type;@@ -278,7 +280,7 @@ static int rcar_i2c_set_speed(struct udevice *dev, uint bus_freq_hz)* = F[sum * ick / 1000000000] * = F[(ick / 1000000) * sum / 1000] */ - sum =35 +200 + priv->intdelay; + sum = priv->fall_ns + priv->rise_ns + priv->intdelay; round = (ick +500000 ) /1000000 * sum; round = (round +500 ) /1000 ;@@ -323,6 +325,10 @@ static int rcar_i2c_probe(struct udevice *dev)int ret; priv->base =dev_read_addr_ptr (dev); + priv->rise_ns =dev_read_u32_default (dev, +"i2c-scl-rising-time-ns" ,200 ); + priv->fall_ns =dev_read_u32_default (dev, +"i2c-scl-falling-time-ns" ,35 ); priv->intdelay =dev_read_u32_default (dev,"i2c-scl-internal-delay-ns" ,5 ); priv->type =dev_get_driver_data (dev); --2.25.1
Heiko Schocher
Reviewed-byHello Adam,
Quoted 10 lines · Adam Ford
Quoted 9 lines · Adam Ford
The Linux i2c driver supports i2c-scl-rising-time-ns, and i2c-scl-falling-time-ns, but U-Boot uses hard-coded values for these values.
Update the calculation by fetching them from the device tree if present and use the previous values as the default if they are missing.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Adam Ford <[email protected]>Do I have the right people in copy? I was hoping to get some feedback on this. My boards use the i2c-scl-rising-time-ns to help properly set the i2c clocking.
No, I think all fine, for me the patch is okay, so:
Ah, I see, in patchwork the patch is assigned to Marek... added Marek to cc.
@Marek: Is it okay for you, if I pickup the patch, when new u-boot version is out? Else you can pick it up.
Thanks!
bye,
Heiko
Quoted 40 lines
thanks
adamQuoted 36 lines
drivers/i2c/rcar_i2c.c +7
-2@@ -64,6 +64,8 @@ enum rcar_i2c_type {struct rcar_i2c_priv {void __iomem *base;struct clk clk; +u32 fall_ns; +u32 rise_ns;u32 intdelay;u32 icccr;enum rcar_i2c_type type;@@ -278,7 +280,7 @@ static int rcar_i2c_set_speed(struct udevice *dev, uint bus_freq_hz)* = F[sum * ick / 1000000000] * = F[(ick / 1000000) * sum / 1000] */ - sum =35 +200 + priv->intdelay; + sum = priv->fall_ns + priv->rise_ns + priv->intdelay; round = (ick +500000 ) /1000000 * sum; round = (round +500 ) /1000 ;@@ -323,6 +325,10 @@ static int rcar_i2c_probe(struct udevice *dev)int ret; priv->base =dev_read_addr_ptr (dev); + priv->rise_ns =dev_read_u32_default (dev, +"i2c-scl-rising-time-ns" ,200 ); + priv->fall_ns =dev_read_u32_default (dev, +"i2c-scl-falling-time-ns" ,35 ); priv->intdelay =dev_read_u32_default (dev,"i2c-scl-internal-delay-ns" ,5 ); priv->type =dev_get_driver_data (dev); --2.25.1
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Quoted 21 lines · Heiko Schocher
Hello Adam,
Quoted 10 lines · Adam Ford
Quoted 9 lines · Adam Ford
The Linux i2c driver supports i2c-scl-rising-time-ns, and i2c-scl-falling-time-ns, but U-Boot uses hard-coded values for these values.
Update the calculation by fetching them from the device tree if present and use the previous values as the default if they are missing.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Adam Ford <[email protected]>Do I have the right people in copy? I was hoping to get some feedback on this. My boards use the i2c-scl-rising-time-ns to help properly set the i2c clocking.
No, I think all fine, for me the patch is okay, so:
Quoted 7 lines
Reviewed-by Heiko Schocher <[email protected]>Ah, I see, in patchwork the patch is assigned to Marek... added Marek to cc.
@Marek: Is it okay for you, if I pickup the patch, when new u-boot version is out? Else you can pick it up.
Looks good, pick it for next please.
Hello Adam,
Quoted 9 lines · Adam Ford
The Linux i2c driver supports i2c-scl-rising-time-ns, and i2c-scl-falling-time-ns, but U-Boot uses hard-coded values for these values.
Update the calculation by fetching them from the device tree if present and use the previous values as the default if they are missing.
Signed-off-by Adam Ford <[email protected]>
Applied to u-boot-i2c next
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]