Skip to content

Commit 4c730a0

Browse files
gclementWolfram Sang
authored andcommitted
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>
1 parent 2f641a8 commit 4c730a0

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ Required properties :
66
- reg : Offset and length of the register set for the device
77
- compatible : Should be "marvell,mv64xxx-i2c"
88
- interrupts : The interrupt number
9-
- clock-frequency : Desired I2C bus clock frequency in Hz.
9+
10+
Optional properties :
11+
12+
- clock-frequency : Desired I2C bus clock frequency in Hz. If not set the
13+
default frequency is 100kHz
1014

1115
Examples:
1216

‎drivers/i2c/busses/i2c-mv64xxx.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,11 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
578578
goto out;
579579
}
580580
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+
582586
if (!mv64xxx_find_baud_factors(bus_freq, tclk,
583587
&drv_data->freq_n, &drv_data->freq_m)) {
584588
rc = -EINVAL;

0 commit comments

Comments
 (0)