aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-05-19 04:56:40 -0400
committerWolfram Sang <wsa@the-dreams.de>2017-05-19 08:36:24 -0400
commit9d6408433019bfae15e2d0d5f4498c4ff70b86c0 (patch)
tree7475c97c5a420f29f4f867ddf6256a9dba75d7aa
parent8b4822de59d5d9919b9b045183a36c673ce20b73 (diff)
i2c: designware: don't infer timings described by ACPI from clock rate
Commit bd698d24b1b57 ("i2c: designware: Get selected speed mode sda-hold-time via ACPI") updated the logic that reads the timing parameters for various I2C bus rates from the DSDT, to only read the timing parameters for the currently selected mode. This causes a WARN_ON() splat on platforms that legally omit the clock frequency from the ACPI description, because in the new situation, the core I2C designware driver still accesses the fields in the driver struct that we no longer populate, and proceeds to calculate them from the clock frequency. Since the clock frequency is unspecified, the driver complains loudly using a WARN_ON(). So revert back to the old situation, where the struct fields for all timings are populated, but retain the new logic which chooses the SDA hold time from the timing mode that is currently in use. Fixes: bd698d24b1b57 ("i2c: designware: Get selected speed mode ...") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reported-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index f2acd4b6bf01..6283b99d2b17 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -96,6 +96,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
96 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 96 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
97 acpi_handle handle = ACPI_HANDLE(&pdev->dev); 97 acpi_handle handle = ACPI_HANDLE(&pdev->dev);
98 const struct acpi_device_id *id; 98 const struct acpi_device_id *id;
99 u32 ss_ht, fp_ht, hs_ht, fs_ht;
99 struct acpi_device *adev; 100 struct acpi_device *adev;
100 const char *uid; 101 const char *uid;
101 102
@@ -107,23 +108,24 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
107 * Try to get SDA hold time and *CNT values from an ACPI method for 108 * Try to get SDA hold time and *CNT values from an ACPI method for
108 * selected speed modes. 109 * selected speed modes.
109 */ 110 */
111 dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, &ss_ht);
112 dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, &fp_ht);
113 dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, &hs_ht);
114 dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, &fs_ht);
115
110 switch (dev->clk_freq) { 116 switch (dev->clk_freq) {
111 case 100000: 117 case 100000:
112 dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, 118 dev->sda_hold_time = ss_ht;
113 &dev->sda_hold_time);
114 break; 119 break;
115 case 1000000: 120 case 1000000:
116 dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, 121 dev->sda_hold_time = fp_ht;
117 &dev->sda_hold_time);
118 break; 122 break;
119 case 3400000: 123 case 3400000:
120 dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, 124 dev->sda_hold_time = hs_ht;
121 &dev->sda_hold_time);
122 break; 125 break;
123 case 400000: 126 case 400000:
124 default: 127 default:
125 dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, 128 dev->sda_hold_time = fs_ht;
126 &dev->sda_hold_time);
127 break; 129 break;
128 } 130 }
129 131