i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided
authorGregory CLEMENT <gregory.clement@free-electrons.com>
Fri, 21 Jun 2013 13:32:06 +0000 (15:32 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 25 Jun 2013 21:43:37 +0000 (23:43 +0200)
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>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
drivers/i2c/busses/i2c-mv64xxx.c

index f46d928aa73d648a472de2ed42393c7fb3c3c34e..a1ee681942ccc01aedbd335cc3e2aaa69b036489 100644 (file)
@@ -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:
 
index ed854573b42732f832d0e14d4a9ce7317626b3b7..b1f42bf409638f166f592eba381ac9848dccb46a 100644 (file)
@@ -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;
This page took 0.030631 seconds and 5 git commands to generate.