Message ID | 1371821529-13791-2-git-send-email-gregory.clement@free-electrons.com |
---|---|
State | Accepted |
Headers | show |
On Fri, Jun 21, 2013 at 03:32:06PM +0200, Gregory CLEMENT wrote: > This commit adds checking whether clock-frequency property acquisition > has succeeded. If not, the frequency is set to 100kHz by default. > > The Device Tree binding documentation is updated accordingly. > > Based on the intials patches from Zbigniew Bodek > > Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> > Signed-off-by: Zbigniew Bodek <zbb@semihalf.com> Applied to for-next, thanks! Rest of the series is 3.12 material.
On 06/25/2013 11:44 PM, Wolfram Sang wrote: > On Fri, Jun 21, 2013 at 03:32:06PM +0200, Gregory CLEMENT wrote: >> This commit adds checking whether clock-frequency property acquisition has succeeded. If not, the frequency is set to 100kHz by default. >> >> The Device Tree binding documentation is updated accordingly. >> >> Based on the intials patches from Zbigniew Bodek >> >> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Zbigniew Bodek <zbb@semihalf.com> > > Applied to for-next, thanks! Rest of the series is 3.12 material. > Thanks! For the rest of the series, does it mean that you agree with it, or that you didn't review it yet?
> For the rest of the series, does it mean that you agree with it, or > that you didn't review it yet? Didn't review. So, other people can still join in ;)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt index f46d928..a1ee681 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt @@ -6,7 +6,11 @@ Required properties : - reg : Offset and length of the register set for the device - compatible : Should be "marvell,mv64xxx-i2c" - interrupts : The interrupt number - - clock-frequency : Desired I2C bus clock frequency in Hz. + +Optional properties : + + - clock-frequency : Desired I2C bus clock frequency in Hz. If not set the +default frequency is 100kHz Examples: diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 7a0e39b..d5d46db 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -578,7 +578,11 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, goto out; } tclk = clk_get_rate(drv_data->clk); - of_property_read_u32(np, "clock-frequency", &bus_freq); + + rc = of_property_read_u32(np, "clock-frequency", &bus_freq); + if (rc) + bus_freq = 100000; /* 100kHz by default */ + if (!mv64xxx_find_baud_factors(bus_freq, tclk, &drv_data->freq_n, &drv_data->freq_m)) { rc = -EINVAL;