aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2013-06-21 09:32:06 -0400
committerWolfram Sang <wsa@the-dreams.de>2013-06-25 17:43:37 -0400
commit4c730a06c19bb83d2fa4308ee4cbb23abc84c9ca (patch)
tree756a378f3e7ec8fae98aed6ab79631bb5bd914a9
parent2f641a8bdb1b808b9bf1d0ca7d169d199aaf6ff4 (diff)
i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided
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>
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt6
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
index f46d928aa73d..a1ee681942cc 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
@@ -6,7 +6,11 @@ Required properties :
6 - reg : Offset and length of the register set for the device 6 - reg : Offset and length of the register set for the device
7 - compatible : Should be "marvell,mv64xxx-i2c" 7 - compatible : Should be "marvell,mv64xxx-i2c"
8 - interrupts : The interrupt number 8 - interrupts : The interrupt number
9 - clock-frequency : Desired I2C bus clock frequency in Hz. 9
10Optional properties :
11
12 - clock-frequency : Desired I2C bus clock frequency in Hz. If not set the
13default frequency is 100kHz
10 14
11Examples: 15Examples:
12 16
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index ed854573b427..b1f42bf40963 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,
578 goto out; 578 goto out;
579 } 579 }
580 tclk = clk_get_rate(drv_data->clk); 580 tclk = clk_get_rate(drv_data->clk);
581 of_property_read_u32(np, "clock-frequency", &bus_freq); 581
582 rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
583 if (rc)
584 bus_freq = 100000; /* 100kHz by default */
585
582 if (!mv64xxx_find_baud_factors(bus_freq, tclk, 586 if (!mv64xxx_find_baud_factors(bus_freq, tclk,
583 &drv_data->freq_n, &drv_data->freq_m)) { 587 &drv_data->freq_n, &drv_data->freq_m)) {
584 rc = -EINVAL; 588 rc = -EINVAL;