|
@@ -176,9 +176,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
|
|
|
dev->irq = irq;
|
|
|
platform_set_drvdata(pdev, dev);
|
|
|
|
|
|
- /* fast mode by default because of legacy reasons */
|
|
|
- dev->clk_freq = 400000;
|
|
|
-
|
|
|
if (pdata) {
|
|
|
dev->clk_freq = pdata->i2c_scl_freq;
|
|
|
} else {
|
|
@@ -193,8 +190,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
|
|
|
}
|
|
|
|
|
|
acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
|
|
|
- if (acpi_speed)
|
|
|
- dev->clk_freq = acpi_speed;
|
|
|
+ /*
|
|
|
+ * Find bus speed from the "clock-frequency" device property, ACPI
|
|
|
+ * or by using fast mode if neither is set.
|
|
|
+ */
|
|
|
+ if (acpi_speed && dev->clk_freq)
|
|
|
+ dev->clk_freq = min(dev->clk_freq, acpi_speed);
|
|
|
+ else if (acpi_speed || dev->clk_freq)
|
|
|
+ dev->clk_freq = max(dev->clk_freq, acpi_speed);
|
|
|
+ else
|
|
|
+ dev->clk_freq = 400000;
|
|
|
|
|
|
if (has_acpi_companion(&pdev->dev))
|
|
|
dw_i2c_acpi_configure(pdev);
|