From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Sudarshan Ravula <sudarshan.ravula@intel.com>
Cc: wsa@kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, jarkko.nikula@linux.intel.com,
pandith.n@intel.com, lakshmi.sowjanya.d@intel.com
Subject: Re: [PATCH v1] i2c: designware: Add support to get I2C related timing parameters from firmware.
Date: Wed, 7 Sep 2022 19:26:22 +0300 [thread overview]
Message-ID: <YxjGLi6J4jBBZkcG@smile.fi.intel.com> (raw)
In-Reply-To: <20220907160920.22006-1-sudarshan.ravula@intel.com>
On Wed, Sep 07, 2022 at 09:39:20PM +0530, Sudarshan Ravula wrote:
> 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 <sudarshan.ravula@intel.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/i2c/busses/i2c-designware-pcidrv.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
> index 608e61209455..c001719209be 100644
> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> @@ -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);
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().
> +
> pci_set_drvdata(pdev, dev);
>
> if (controller->setup) {
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-09-07 16:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 16:09 [PATCH v1] i2c: designware: Add support to get I2C related timing parameters from firmware Sudarshan Ravula
2022-09-07 16:26 ` Andy Shevchenko [this message]
2022-09-07 19:53 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxjGLi6J4jBBZkcG@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lakshmi.sowjanya.d@intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pandith.n@intel.com \
--cc=sudarshan.ravula@intel.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox