linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, wsa@kernel.org,
	alpawi@amazon.com
Subject: Re: [PATCH] i2c: pxa: move to generic GPIO recovery
Date: Sat, 3 Oct 2020 19:54:04 +0100	[thread overview]
Message-ID: <20201003185404.GH1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20201003162141.925518-1-codrin.ciubotariu@microchip.com>

On Sat, Oct 03, 2020 at 07:21:41PM +0300, Codrin Ciubotariu wrote:
> Starting with
> commit 75820314de26 ("i2c: core: add generic I2C GPIO recovery")
> GPIO bus recovery is supported by the I2C core, so we can remove the
> driver implementation and use that one instead.
> 
> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> ---
> 
> This patch is not tested.
> The only different thing should be the fact that the pinctl state is
> now switched back to the default state after the bus is enabled.
> 
>  drivers/i2c/busses/i2c-pxa.c | 75 +++---------------------------------
>  1 file changed, 6 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index 35ca2c02c9b9..dd357b6e6c61 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -264,9 +264,6 @@ struct pxa_i2c {
>  	u32			hs_mask;
>  
>  	struct i2c_bus_recovery_info recovery;
> -	struct pinctrl		*pinctrl;
> -	struct pinctrl_state	*pinctrl_default;
> -	struct pinctrl_state	*pinctrl_recovery;
>  };
>  
>  #define _IBMR(i2c)	((i2c)->reg_ibmr)
> @@ -1305,8 +1302,6 @@ static void i2c_pxa_prepare_recovery(struct i2c_adapter *adap)
>  	 */
>  	gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS);
>  	gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS);
> -
> -	WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery));
>  }
>  
>  static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap)
> @@ -1325,8 +1320,6 @@ static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap)
>  		i2c_pxa_do_reset(i2c);
>  	}
>  
> -	WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default));
> -

This won't fly. We need to put the pinctrl back into i2c mode _before_
we re-enable the I2C module, otherwise the I2C block will see logic 0
on both SCL and SDA which could confuse the block.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2020-10-03 18:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 16:21 [PATCH] i2c: pxa: move to generic GPIO recovery Codrin Ciubotariu
2020-10-03 18:54 ` Russell King - ARM Linux admin [this message]
2020-10-03 22:46   ` Codrin.Ciubotariu

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=20201003185404.GH1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alpawi@amazon.com \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).