diff options
| -rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 57248bccadbc..2b98a173136f 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
| @@ -256,7 +256,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) | |||
| 256 | struct dw_i2c_dev *dev; | 256 | struct dw_i2c_dev *dev; |
| 257 | u32 acpi_speed, ht = 0; | 257 | u32 acpi_speed, ht = 0; |
| 258 | struct resource *mem; | 258 | struct resource *mem; |
| 259 | int irq, ret; | 259 | int i, irq, ret; |
| 260 | const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 }; | ||
| 260 | 261 | ||
| 261 | irq = platform_get_irq(pdev, 0); | 262 | irq = platform_get_irq(pdev, 0); |
| 262 | if (irq < 0) | 263 | if (irq < 0) |
| @@ -297,9 +298,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) | |||
| 297 | } | 298 | } |
| 298 | 299 | ||
| 299 | acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); | 300 | acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); |
| 300 | /* Some broken DSTDs use 1MiHz instead of 1MHz */ | 301 | /* |
| 301 | if (acpi_speed == 1048576) | 302 | * Some DSTDs use a non standard speed, round down to the lowest |
| 302 | acpi_speed = 1000000; | 303 | * standard speed. |
| 304 | */ | ||
| 305 | for (i = 1; i < ARRAY_SIZE(supported_speeds); i++) { | ||
| 306 | if (acpi_speed < supported_speeds[i]) | ||
| 307 | break; | ||
| 308 | } | ||
| 309 | acpi_speed = supported_speeds[i - 1]; | ||
| 310 | |||
| 303 | /* | 311 | /* |
| 304 | * Find bus speed from the "clock-frequency" device property, ACPI | 312 | * Find bus speed from the "clock-frequency" device property, ACPI |
| 305 | * or by using fast mode if neither is set. | 313 | * or by using fast mode if neither is set. |
