i2c: designware: Add support to get I2C related timing parameters from firmware.
Subsystems (3)
PATCH 1/1 i2c: designware: Add support to get I2C related timing parameters from firmware.
Similar to I2C designware platform driver add i2c_parse_fw_timings() in PCI driver, to get I2C related timing parameters from firmware.
--- drivers/i2c/busses/i2c-designware-pcidrv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-pcidrv.c +4 -1
@@ -243,6 +243,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,int r;struct dw_pci_controller *controller;struct dw_scl_sda_cfg *cfg; +struct i2c_timings *t;if (id->driver_data >=ARRAY_SIZE (dw_pci_controllers)) return dev_err_probe(&pdev->dev, -EINVAL,
@@ -272,12 +273,14 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,return r; dev->get_clk_rate_khz = controller->get_clk_rate_khz; - dev->timings.bus_freq_hz =I2C_MAX_FAST_MODE_FREQ ; dev->base =pcim_iomap_table (pdev)[0 ]; dev->dev = &pdev->dev; dev->irq =pci_irq_vector (pdev,0 ); dev->flags |= controller->flags; + t = &dev->timings; +i2c_parse_fw_timings (&pdev->dev, t, false); +pci_set_drvdata (pdev, dev);if (controller->setup) {
Signature · 1 line
2.17.1
Andy Shevchenko
reviewerQuoted 24 lines · Sudarshan Ravula
Similar to I2C designware platform driver add
i2c_parse_fw_timings()in PCI driver, to get I2C related timing parameters from firmware.Signed-off-by Sudarshan Ravula <[email protected]>Acked-by Jarkko Nikula <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>--- drivers/i2c/busses/i2c-designware-pcidrv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/i2c/busses/i2c-designware-pcidrv.c +1
-0@@ -243,6 +243,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,int r;struct dw_pci_controller *controller;struct dw_scl_sda_cfg *cfg; +struct i2c_timings *t;if (id->driver_data >=ARRAY_SIZE (dw_pci_controllers)) return dev_err_probe(&pdev->dev, -EINVAL,@@ -272,12 +273,14 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,return r;
drivers/i2c/busses/i2c-designware-pcidrv.c static int i2c_dw_pci_probe(struct pci_dev *pdev, · line 282
Quoted 10 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +2
-1dev->get_clk_rate_khz = controller->get_clk_rate_khz; - dev->timings.bus_freq_hz =I2C_MAX_FAST_MODE_FREQ ; dev->base =pcim_iomap_table (pdev)[0 ]; dev->dev = &pdev->dev; dev->irq =pci_irq_vector (pdev,0 ); dev->flags |= controller->flags; + t = &dev->timings; +i2c_parse_fw_timings (&pdev->dev, t, false);
Note that this is safe to drop above assignment with 'false' given here since i2c_dw_adjust_bus_speed(), which is called after, will set that default and if nothing is read from firmware the value of bus_freq_hz will be 0 as guaranteed by kzalloc().
Quoted 7 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +1
-0+pci_set_drvdata (pdev, dev);if (controller->setup) {Signature · 1 line
2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Wolfram Sang
AppliedQuoted 6 lines · Sudarshan Ravula
Similar to I2C designware platform driver add
i2c_parse_fw_timings()in PCI driver, to get I2C related timing parameters from firmware.Signed-off-by Sudarshan Ravula <[email protected]>Acked-by Jarkko Nikula <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Applied to for-next, thanks!