It's not clear why the commit fe20ff5c7e9c ("i2c-designware: Add support for Designware core behind PCI devices.") followed by commit b61b14154b19 ("i2c-designware: add support for Intel Lynxpoint") chose to hard code FIFO depth size. The FIFO depth on all hardware, I have tested on, can be nicely detected automatically. Thus, we may safely drop hard coded FIFO sizes from the driver.
Unified · Split
| @@ -200,9 +200,6 @@ int i2c_dw_acpi_configure(struct device *device) · 199 unmodified lines | |||
| 200 | struct i2c_timings *t = &dev->timings; | 200 | struct i2c_timings *t = &dev->timings; |
| 201 | u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0; | 201 | u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0; |
| 202 | 202 | ||
| 203 | dev->tx_fifo_depth = 32; | ||
| 204 | dev->rx_fifo_depth = 32; | ||
| 205 | |||
| 206 | /* | 203 | /* |
| 207 | * Try to get SDA hold time and *CNT values from an ACPI method for | 204 | * Try to get SDA hold time and *CNT values from an ACPI method for |
| 208 | * selected speed modes. | 205 | * selected speed modes. |
| @@ -46,8 +46,6 @@ struct dw_scl_sda_cfg { · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | struct dw_pci_controller { | 47 | struct dw_pci_controller { |
| 48 | u32 bus_num; | 48 | u32 bus_num; |
| 49 | u32 tx_fifo_depth; | ||
| 50 | u32 rx_fifo_depth; | ||
| 51 | u32 flags; | 49 | u32 flags; |
| 52 | struct dw_scl_sda_cfg *scl_sda_cfg; | 50 | struct dw_scl_sda_cfg *scl_sda_cfg; |
| 53 | int (*setup)(struct pci_dev *pdev, struct dw_pci_controller *c); | 51 | int (*setup)(struct pci_dev *pdev, struct dw_pci_controller *c); |
| @@ -133,41 +131,29 @@ static u32 ehl_get_clk_rate_khz(struct dw_i2c_dev *dev) · 79 unmodified lines | |||
| 133 | static struct dw_pci_controller dw_pci_controllers[] = { | 131 | static struct dw_pci_controller dw_pci_controllers[] = { |
| 134 | [medfield] = { | 132 | [medfield] = { |
| 135 | .bus_num = -1, | 133 | .bus_num = -1, |
| 136 | .tx_fifo_depth = 32, | ||
| 137 | .rx_fifo_depth = 32, | ||
| 138 | .setup = mfld_setup, | 134 | .setup = mfld_setup, |
| 139 | .get_clk_rate_khz = mfld_get_clk_rate_khz, | 135 | .get_clk_rate_khz = mfld_get_clk_rate_khz, |
| 140 | }, | 136 | }, |
| 141 | [merrifield] = { | 137 | [merrifield] = { |
| 142 | .bus_num = -1, | 138 | .bus_num = -1, |
| 143 | .tx_fifo_depth = 64, | ||
| 144 | .rx_fifo_depth = 64, | ||
| 145 | .scl_sda_cfg = &mrfld_config, | 139 | .scl_sda_cfg = &mrfld_config, |
| 146 | .setup = mrfld_setup, | 140 | .setup = mrfld_setup, |
| 147 | }, | 141 | }, |
| 148 | [baytrail] = { | 142 | [baytrail] = { |
| 149 | .bus_num = -1, | 143 | .bus_num = -1, |
| 150 | .tx_fifo_depth = 32, | ||
| 151 | .rx_fifo_depth = 32, | ||
| 152 | .scl_sda_cfg = &byt_config, | 144 | .scl_sda_cfg = &byt_config, |
| 153 | }, | 145 | }, |
| 154 | [haswell] = { | 146 | [haswell] = { |
| 155 | .bus_num = -1, | 147 | .bus_num = -1, |
| 156 | .tx_fifo_depth = 32, | ||
| 157 | .rx_fifo_depth = 32, | ||
| 158 | .scl_sda_cfg = &hsw_config, | 148 | .scl_sda_cfg = &hsw_config, |
| 159 | }, | 149 | }, |
| 160 | [cherrytrail] = { | 150 | [cherrytrail] = { |
| 161 | .bus_num = -1, | 151 | .bus_num = -1, |
| 162 | .tx_fifo_depth = 32, | ||
| 163 | .rx_fifo_depth = 32, | ||
| 164 | .flags = MODEL_CHERRYTRAIL, | 152 | .flags = MODEL_CHERRYTRAIL, |
| 165 | .scl_sda_cfg = &byt_config, | 153 | .scl_sda_cfg = &byt_config, |
| 166 | }, | 154 | }, |
| 167 | [elkhartlake] = { | 155 | [elkhartlake] = { |
| 168 | .bus_num = -1, | 156 | .bus_num = -1, |
| 169 | .tx_fifo_depth = 32, | ||
| 170 | .rx_fifo_depth = 32, | ||
| 171 | .get_clk_rate_khz = ehl_get_clk_rate_khz, | 157 | .get_clk_rate_khz = ehl_get_clk_rate_khz, |
| 172 | }, | 158 | }, |
| 173 | }; | 159 | }; |
| @@ -277,9 +263,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, · 103 unmodified lines | |||
| 277 | dev->sda_hold_time = cfg->sda_hold; | 263 | dev->sda_hold_time = cfg->sda_hold; |
| 278 | } | 264 | } |
| 279 | 265 | ||
| 280 | dev->tx_fifo_depth = controller->tx_fifo_depth; | ||
| 281 | dev->rx_fifo_depth = controller->rx_fifo_depth; | ||
| 282 | |||
| 283 | adap = &dev->adapter; | 266 | adap = &dev->adapter; |
| 284 | adap->owner = THIS_MODULE; | 267 | adap->owner = THIS_MODULE; |
| 285 | adap->class = 0; | 268 | adap->class = 0; |