i2c: sh_mobile: honor DT bus speed settings
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 2 May 2014 19:15:09 +0000 (21:15 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Thu, 22 May 2014 08:09:23 +0000 (10:09 +0200)
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-sh_mobile.c

index d2fa222df3d134550b3f0cd6bd3dbee7d0c5204c..2e481abd50ce9723dff6b1d98f670e658f05a439 100644 (file)
@@ -657,6 +657,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
        struct resource *res;
        int size;
        int ret;
+       u32 bus_speed;
 
        pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
        if (pd == NULL) {
@@ -697,7 +698,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
        }
 
        /* Use platform data bus speed or STANDARD_MODE */
-       pd->bus_speed = STANDARD_MODE;
+       ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
+       pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
+
        if (pdata && pdata->bus_speed)
                pd->bus_speed = pdata->bus_speed;
        pd->clks_per_count = 1;