All of lore.kernel.org
 help / color / mirror / Atom feed
From: "A.s. Dong" <aisheng.dong@nxp.com>
To: Stefan Agner <stefan@agner.ch>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	Jacky Bai <ping.bai@nxp.com>, Andy Duan <fugang.duan@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Alexandre Courbot <gnurou@gmail.com>
Subject: RE: [PATCH V4 5/7] pinctrl: imx: remove gpio_request_enable and gpio_disable_free
Date: Tue, 27 Jun 2017 05:27:57 +0000	[thread overview]
Message-ID: <AM3PR04MB3065FE9A282899398C35E6B80DC0@AM3PR04MB306.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <804b1d3135af76ed8d26ecd5c3dd1f80@agner.ch>

> -----Original Message-----
> From: Stefan Agner [mailto:stefan@agner.ch]
> Sent: Tuesday, June 27, 2017 11:48 AM
> To: A.s. Dong
> Cc: linux-gpio@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linus.walleij@linaro.org; shawnguo@kernel.org; Jacky Bai; Andy Duan;
> kernel@pengutronix.de; Alexandre Courbot
> Subject: Re: [PATCH V4 5/7] pinctrl: imx: remove gpio_request_enable and
> gpio_disable_free
> 
> On 2017-06-21 04:59, Dong Aisheng wrote:
> > gpio_request_enable/disable_free actually are not quite necessary as
> > standard IMX pinctrl binding already sets GPIO mux from device tree,
> > e.g. VF610_PAD_PTB20__GPIO_42 or MX7D_PAD_SD2_CD_B__GPIO5_IO9 No need
> > to do it again in gpio_request_enable.
> >
> > And according to Stefan:
> > "For all GPIO I checked in upstream device trees we assign a pinctrl
> > to the same node, so in all cases gpio_request_enable/disable is
> > really unnecessary."
> >
> > So it should be safe to simply remove it.
> 
> Thanks looks good.
> 
> I would add a comment that this changes semantics for Vybrid, e.g.
> 
> "The two functions have been introduced for Vybrid (through
> SHARE_MUX_CONF_REG) and mux pins as GPIOs automatically when a GPIO gets
> requested. The automatic mux is optional by the pinmux/gpio subsystem
> semantics, and other NXP devices do not use it, instead an explicit
> pinctrl node is added in the device tree to mux GPIOs where required.
> Hence this change aligns Vybrid to other NXP (i.MX) devices.
> 
> Note that all upstream device tree assign proper pinctrl properties where
> GPIOs are used so no change is necessary for device trees."
> 

The comments looks ok to me.

Linus,
Would you help append it when pick the patch?

Stefan,
Would you help review imx7ulp GPIO patches as well after this pinctrl change?

Regards
Dong Aisheng

> Otherwise:
> Acked-by: Stefan Agner <stefan@agner.ch>
> 
> --
> Stefan
> 
> >
> > Cc: Stefan Agner <stefan@agner.ch>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Alexandre Courbot <gnurou@gmail.com>
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Cc: Fugang Duan <fugang.duan@nxp.com>
> > Cc: Bai Ping <ping.bai@nxp.com>
> > Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> >
> > ---
> > ChangeLog:
> >  * New patch.
> >    Instead of fixing gpio_request_enable/disable, we decided to remove
> it
> >    after dicussion with Stefan (see blow).
> >    https://www.spinics.net/lists/arm-kernel/msg583154.html
> > ---
> >  drivers/pinctrl/freescale/pinctrl-imx.c | 69
> > ---------------------------------
> >  1 file changed, 69 deletions(-)
> >
> > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c
> > b/drivers/pinctrl/freescale/pinctrl-imx.c
> > index fc1ba3c..505fe79 100644
> > --- a/drivers/pinctrl/freescale/pinctrl-imx.c
> > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c
> > @@ -255,73 +255,6 @@ static int imx_pmx_set(struct pinctrl_dev
> > *pctldev, unsigned selector,
> >  	return 0;
> >  }
> >
> > -static int imx_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
> > -			struct pinctrl_gpio_range *range, unsigned offset)
> > -{
> > -	struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
> > -	struct imx_pinctrl_soc_info *info = ipctl->info;
> > -	const struct imx_pin_reg *pin_reg;
> > -	struct group_desc *grp;
> > -	struct imx_pin *imx_pin;
> > -	unsigned int pin, group;
> > -	u32 reg;
> > -
> > -	/* Currently implementation only for shared mux/conf register */
> > -	if (!(info->flags & SHARE_MUX_CONF_REG))
> > -		return 0;
> > -
> > -	pin_reg = &info->pin_regs[offset];
> > -	if (pin_reg->mux_reg == -1)
> > -		return -EINVAL;
> > -
> > -	/* Find the pinctrl config with GPIO mux mode for the requested pin
> */
> > -	for (group = 0; group < pctldev->num_groups; group++) {
> > -		grp = pinctrl_generic_get_group(pctldev, group);
> > -		if (!grp)
> > -			continue;
> > -		for (pin = 0; pin < grp->num_pins; pin++) {
> > -			imx_pin = &((struct imx_pin *)(grp->data))[pin];
> > -			if (imx_pin->pin == offset && !imx_pin->mux_mode)
> > -				goto mux_pin;
> > -		}
> > -	}
> > -
> > -	return -EINVAL;
> > -
> > -mux_pin:
> > -	reg = readl(ipctl->base + pin_reg->mux_reg);
> > -	reg &= ~info->mux_mask;
> > -	reg |= imx_pin->config;
> > -	writel(reg, ipctl->base + pin_reg->mux_reg);
> > -
> > -	return 0;
> > -}
> > -
> > -static void imx_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
> > -			struct pinctrl_gpio_range *range, unsigned offset)
> > -{
> > -	struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
> > -	struct imx_pinctrl_soc_info *info = ipctl->info;
> > -	const struct imx_pin_reg *pin_reg;
> > -	u32 reg;
> > -
> > -	/*
> > -	 * Only Vybrid has the input/output buffer enable flags (IBE/OBE)
> > -	 * They are part of the shared mux/conf register.
> > -	 */
> > -	if (!(info->flags & SHARE_MUX_CONF_REG))
> > -		return;
> > -
> > -	pin_reg = &info->pin_regs[offset];
> > -	if (pin_reg->mux_reg == -1)
> > -		return;
> > -
> > -	/* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
> > -	reg = readl(ipctl->base + pin_reg->mux_reg);
> > -	reg &= ~0x7;
> > -	writel(reg, ipctl->base + pin_reg->mux_reg);
> > -}
> > -
> >  static int imx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
> >  	   struct pinctrl_gpio_range *range, unsigned offset, bool input)
> {
> > @@ -357,8 +290,6 @@ static const struct pinmux_ops imx_pmx_ops = {
> >  	.get_function_name = pinmux_generic_get_function_name,
> >  	.get_function_groups = pinmux_generic_get_function_groups,
> >  	.set_mux = imx_pmx_set,
> > -	.gpio_request_enable = imx_pmx_gpio_request_enable,
> > -	.gpio_disable_free = imx_pmx_gpio_disable_free,
> >  	.gpio_set_direction = imx_pmx_gpio_set_direction,  };

WARNING: multiple messages have this Message-ID (diff)
From: aisheng.dong@nxp.com (A.s. Dong)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 5/7] pinctrl: imx: remove gpio_request_enable and gpio_disable_free
Date: Tue, 27 Jun 2017 05:27:57 +0000	[thread overview]
Message-ID: <AM3PR04MB3065FE9A282899398C35E6B80DC0@AM3PR04MB306.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <804b1d3135af76ed8d26ecd5c3dd1f80@agner.ch>

> -----Original Message-----
> From: Stefan Agner [mailto:stefan at agner.ch]
> Sent: Tuesday, June 27, 2017 11:48 AM
> To: A.s. Dong
> Cc: linux-gpio at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
> linus.walleij at linaro.org; shawnguo at kernel.org; Jacky Bai; Andy Duan;
> kernel at pengutronix.de; Alexandre Courbot
> Subject: Re: [PATCH V4 5/7] pinctrl: imx: remove gpio_request_enable and
> gpio_disable_free
> 
> On 2017-06-21 04:59, Dong Aisheng wrote:
> > gpio_request_enable/disable_free actually are not quite necessary as
> > standard IMX pinctrl binding already sets GPIO mux from device tree,
> > e.g. VF610_PAD_PTB20__GPIO_42 or MX7D_PAD_SD2_CD_B__GPIO5_IO9 No need
> > to do it again in gpio_request_enable.
> >
> > And according to Stefan:
> > "For all GPIO I checked in upstream device trees we assign a pinctrl
> > to the same node, so in all cases gpio_request_enable/disable is
> > really unnecessary."
> >
> > So it should be safe to simply remove it.
> 
> Thanks looks good.
> 
> I would add a comment that this changes semantics for Vybrid, e.g.
> 
> "The two functions have been introduced for Vybrid (through
> SHARE_MUX_CONF_REG) and mux pins as GPIOs automatically when a GPIO gets
> requested. The automatic mux is optional by the pinmux/gpio subsystem
> semantics, and other NXP devices do not use it, instead an explicit
> pinctrl node is added in the device tree to mux GPIOs where required.
> Hence this change aligns Vybrid to other NXP (i.MX) devices.
> 
> Note that all upstream device tree assign proper pinctrl properties where
> GPIOs are used so no change is necessary for device trees."
> 

The comments looks ok to me.

Linus,
Would you help append it when pick the patch?

Stefan,
Would you help review imx7ulp GPIO patches as well after this pinctrl change?

Regards
Dong Aisheng

> Otherwise:
> Acked-by: Stefan Agner <stefan@agner.ch>
> 
> --
> Stefan
> 
> >
> > Cc: Stefan Agner <stefan@agner.ch>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Alexandre Courbot <gnurou@gmail.com>
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Cc: Fugang Duan <fugang.duan@nxp.com>
> > Cc: Bai Ping <ping.bai@nxp.com>
> > Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> >
> > ---
> > ChangeLog:
> >  * New patch.
> >    Instead of fixing gpio_request_enable/disable, we decided to remove
> it
> >    after dicussion with Stefan (see blow).
> >    https://www.spinics.net/lists/arm-kernel/msg583154.html
> > ---
> >  drivers/pinctrl/freescale/pinctrl-imx.c | 69
> > ---------------------------------
> >  1 file changed, 69 deletions(-)
> >
> > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c
> > b/drivers/pinctrl/freescale/pinctrl-imx.c
> > index fc1ba3c..505fe79 100644
> > --- a/drivers/pinctrl/freescale/pinctrl-imx.c
> > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c
> > @@ -255,73 +255,6 @@ static int imx_pmx_set(struct pinctrl_dev
> > *pctldev, unsigned selector,
> >  	return 0;
> >  }
> >
> > -static int imx_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
> > -			struct pinctrl_gpio_range *range, unsigned offset)
> > -{
> > -	struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
> > -	struct imx_pinctrl_soc_info *info = ipctl->info;
> > -	const struct imx_pin_reg *pin_reg;
> > -	struct group_desc *grp;
> > -	struct imx_pin *imx_pin;
> > -	unsigned int pin, group;
> > -	u32 reg;
> > -
> > -	/* Currently implementation only for shared mux/conf register */
> > -	if (!(info->flags & SHARE_MUX_CONF_REG))
> > -		return 0;
> > -
> > -	pin_reg = &info->pin_regs[offset];
> > -	if (pin_reg->mux_reg == -1)
> > -		return -EINVAL;
> > -
> > -	/* Find the pinctrl config with GPIO mux mode for the requested pin
> */
> > -	for (group = 0; group < pctldev->num_groups; group++) {
> > -		grp = pinctrl_generic_get_group(pctldev, group);
> > -		if (!grp)
> > -			continue;
> > -		for (pin = 0; pin < grp->num_pins; pin++) {
> > -			imx_pin = &((struct imx_pin *)(grp->data))[pin];
> > -			if (imx_pin->pin == offset && !imx_pin->mux_mode)
> > -				goto mux_pin;
> > -		}
> > -	}
> > -
> > -	return -EINVAL;
> > -
> > -mux_pin:
> > -	reg = readl(ipctl->base + pin_reg->mux_reg);
> > -	reg &= ~info->mux_mask;
> > -	reg |= imx_pin->config;
> > -	writel(reg, ipctl->base + pin_reg->mux_reg);
> > -
> > -	return 0;
> > -}
> > -
> > -static void imx_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
> > -			struct pinctrl_gpio_range *range, unsigned offset)
> > -{
> > -	struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
> > -	struct imx_pinctrl_soc_info *info = ipctl->info;
> > -	const struct imx_pin_reg *pin_reg;
> > -	u32 reg;
> > -
> > -	/*
> > -	 * Only Vybrid has the input/output buffer enable flags (IBE/OBE)
> > -	 * They are part of the shared mux/conf register.
> > -	 */
> > -	if (!(info->flags & SHARE_MUX_CONF_REG))
> > -		return;
> > -
> > -	pin_reg = &info->pin_regs[offset];
> > -	if (pin_reg->mux_reg == -1)
> > -		return;
> > -
> > -	/* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
> > -	reg = readl(ipctl->base + pin_reg->mux_reg);
> > -	reg &= ~0x7;
> > -	writel(reg, ipctl->base + pin_reg->mux_reg);
> > -}
> > -
> >  static int imx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
> >  	   struct pinctrl_gpio_range *range, unsigned offset, bool input)
> {
> > @@ -357,8 +290,6 @@ static const struct pinmux_ops imx_pmx_ops = {
> >  	.get_function_name = pinmux_generic_get_function_name,
> >  	.get_function_groups = pinmux_generic_get_function_groups,
> >  	.set_mux = imx_pmx_set,
> > -	.gpio_request_enable = imx_pmx_gpio_request_enable,
> > -	.gpio_disable_free = imx_pmx_gpio_disable_free,
> >  	.gpio_set_direction = imx_pmx_gpio_set_direction,  };

  reply	other threads:[~2017-06-27  5:28 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 11:59 [PATCH V4 0/7] pinctrl: imx: add imx7ulp pinctrl support Dong Aisheng
2017-06-21 11:59 ` Dong Aisheng
     [not found] ` <1498046395-30001-1-git-send-email-aisheng.dong-3arQi8VN3Tc@public.gmane.org>
2017-06-21 11:59   ` [PATCH V4 1/7] dt-bindings: pinctrl: extend the pinmux property to support integers array Dong Aisheng
2017-06-21 11:59     ` Dong Aisheng
     [not found]     ` <1498046395-30001-2-git-send-email-aisheng.dong-3arQi8VN3Tc@public.gmane.org>
2017-06-21 21:50       ` jmondi
2017-06-21 21:50         ` jmondi
2017-06-22 14:35         ` A.s. Dong
2017-06-22 14:35           ` A.s. Dong
2017-06-22 14:49     ` [PATCH V5 1/1] " Dong Aisheng
2017-06-22 14:49       ` Dong Aisheng
     [not found]       ` <1498142940-7982-1-git-send-email-aisheng.dong-3arQi8VN3Tc@public.gmane.org>
2017-06-26 18:49         ` Rob Herring
2017-06-26 18:49           ` Rob Herring
2017-06-29 12:35         ` Linus Walleij
2017-06-29 12:35           ` Linus Walleij
2017-06-21 11:59 ` [PATCH V4 2/7] dt-bindings: pinctrl: add imx7ulp pinctrl binding doc Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
     [not found]   ` <1498046395-30001-3-git-send-email-aisheng.dong-3arQi8VN3Tc@public.gmane.org>
2017-06-26 18:02     ` Rob Herring
2017-06-26 18:02       ` Rob Herring
2017-06-21 11:59 ` [PATCH V4 3/7] pinctrl: imx: switch to use the generic pinmux property Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
2017-07-12 13:57   ` A.s. Dong
2017-07-12 13:57     ` A.s. Dong
2017-07-13  8:43   ` Shawn Guo
2017-07-13  8:43     ` Shawn Guo
2017-06-21 11:59 ` [PATCH V4 4/7] pinctrl: imx: add imx7ulp driver Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
2017-06-21 11:59 ` [PATCH V4 5/7] pinctrl: imx: remove gpio_request_enable and gpio_disable_free Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
2017-06-27  3:47   ` Stefan Agner
2017-06-27  3:47     ` Stefan Agner
2017-06-27  5:27     ` A.s. Dong [this message]
2017-06-27  5:27       ` A.s. Dong
2017-06-21 11:59 ` [PATCH V4 6/7] pinctrl: imx: make imx_pmx_ops.gpio_set_direction platform specific callbacks Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
2017-06-27  3:53   ` Stefan Agner
2017-06-27  3:53     ` Stefan Agner
2017-06-21 11:59 ` [PATCH V4 7/7] pinctrl: pinctrl-imx7ulp: add gpio_set_direction support Dong Aisheng
2017-06-21 11:59   ` Dong Aisheng
2017-07-12 13:59   ` A.s. Dong
2017-07-12 13:59     ` A.s. Dong
2017-07-13  8:46   ` Shawn Guo
2017-07-13  8:46     ` Shawn Guo
2017-07-03 10:36 ` [PATCH V4 0/7] pinctrl: imx: add imx7ulp pinctrl support A.s. Dong
2017-07-03 10:36   ` A.s. Dong
2017-07-12 11:59   ` Linus Walleij
2017-07-12 11:59     ` Linus Walleij
2017-07-12 13:54     ` A.s. Dong
2017-07-12 13:54       ` A.s. Dong

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=AM3PR04MB3065FE9A282899398C35E6B80DC0@AM3PR04MB306.eurprd04.prod.outlook.com \
    --to=aisheng.dong@nxp.com \
    --cc=fugang.duan@nxp.com \
    --cc=gnurou@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=ping.bai@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.