linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	James Hogan <jhogan@kernel.org>
Cc: Paul Burton <paul.burton@mips.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Allan Nielsen <allan.nielsen@microsemi.com>
Subject: Re: [PATCH 2/5] i2c: designware: allow IP specific sda_hold_time
Date: Tue, 17 Jul 2018 17:33:37 +0300	[thread overview]
Message-ID: <1cdb4985f9d5fbd461bacf0e04eb7c10bfb7f6f9.camel@linux.intel.com> (raw)
In-Reply-To: <20180717114837.21839-3-alexandre.belloni@bootlin.com>

On Tue, 2018-07-17 at 13:48 +0200, Alexandre Belloni wrote:
> Because some old designware IPs were not supporting setting an SDA
> hold
> time, vendors developed their own solution. Add a way for the final
> driver
> to provide its own SDA hold time handling.
> 

Thanks for information you provided. See my comment below.
After addressing it, 

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  drivers/i2c/busses/i2c-designware-common.c | 6 ++++++
>  drivers/i2c/busses/i2c-designware-core.h   | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-common.c
> b/drivers/i2c/busses/i2c-designware-common.c
> index 9afc3e075b33..545b69d6be3c 100644
> --- a/drivers/i2c/busses/i2c-designware-common.c
> +++ b/drivers/i2c/busses/i2c-designware-common.c
> @@ -297,6 +297,12 @@ void i2c_dw_set_sda_hold_time(struct dw_i2c_dev
> *dev)
>  {
>  	u32 reg;
> 

>  
> +	if (dev->set_sda_hold_time) {
> +		dev->set_sda_hold_time(dev);
> +
> +		return;
> +	}

I would rather inject this, for now (*), into if-else-if ladder, i.e.

if (reg >= DW_IC_SDA_HOLD_MIN_VERS) {
 ...
} else if (dev->set_sda_hold_time) { // <<<
 ...
} else if (dev->sda_hold_time) {
 ...

(*) Since your IP is of v1.10a I don't believe any new version of IP
would shadow existing DW IP registers, thus version check is okay to
have first in my opinion.

> +
>  	/* Configure SDA Hold Time if required. */
>  	reg = dw_readl(dev, DW_IC_COMP_VERSION);
>  	if (reg >= DW_IC_SDA_HOLD_MIN_VERS) {
> diff --git a/drivers/i2c/busses/i2c-designware-core.h
> b/drivers/i2c/busses/i2c-designware-core.h
> index bc43fb9ac1cf..b2778b6d8aca 100644
> --- a/drivers/i2c/busses/i2c-designware-core.h
> +++ b/drivers/i2c/busses/i2c-designware-core.h
> @@ -283,6 +283,7 @@ struct dw_i2c_dev {
>  	void			(*disable)(struct dw_i2c_dev
> *dev);
>  	void			(*disable_int)(struct dw_i2c_dev
> *dev);
>  	int			(*init)(struct dw_i2c_dev *dev);
> +	int			(*set_sda_hold_time)(struct
> dw_i2c_dev *dev);
>  	int			mode;
>  	struct i2c_bus_recovery_info rinfo;
>  };

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2018-07-17 14:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 11:48 [PATCH 0/5] Add support for MSCC Ocelot i2c Alexandre Belloni
2018-07-17 11:48 ` [PATCH 1/5] i2c: designware: factorize setting SDA hold time Alexandre Belloni
2018-07-17 12:11   ` Andy Shevchenko
2018-07-17 12:31     ` Alexandre Belloni
2018-07-17 11:48 ` [PATCH 2/5] i2c: designware: allow IP specific sda_hold_time Alexandre Belloni
2018-07-17 14:33   ` Andy Shevchenko [this message]
2018-07-17 11:48 ` [PATCH 3/5] i2c: designware: add MSCC Ocelot support Alexandre Belloni
2018-07-17 12:19   ` Andy Shevchenko
2018-07-17 12:40     ` Alexandre Belloni
2018-07-17 15:16   ` Andy Shevchenko
2018-07-17 15:26     ` Andy Shevchenko
2018-07-20 17:56   ` Rob Herring
2018-07-17 11:48 ` [PATCH 4/5] mips: dts: mscc: Add i2c on ocelot Alexandre Belloni
2018-07-17 11:48 ` [PATCH 5/5] mips: dts: mscc: enable i2c on ocelot_pcb123 Alexandre Belloni
2018-07-17 12:21 ` [PATCH 0/5] Add support for MSCC Ocelot i2c Andy Shevchenko
2018-07-17 12:46   ` Alexandre Belloni

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=1cdb4985f9d5fbd461bacf0e04eb7c10bfb7f6f9.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microsemi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jhogan@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=paul.burton@mips.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).