From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Ian Molton <ian@mnementh.co.uk>,
linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@lists.codethink.co.uk,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Simon Horman <horms@verge.net.au>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: Re: [PATCH v4 2/8] pinctrl: sh-pfc: r8a7790: Implement voltage switching for SDHI
Date: Wed, 03 Feb 2016 11:59:34 +0200 [thread overview]
Message-ID: <3375560.xz1gJhmReB@avalon> (raw)
In-Reply-To: <1435879310.7541.2.camel@codethink.co.uk>
Hi Ben,
Just realized this mail thread fell through the cracks, sorry :-/
On Friday 03 July 2015 00:21:50 Ben Hutchings wrote:
> On Wed, 2015-07-01 at 10:37 +0300, Laurent Pinchart wrote:
> [...]
>
> > > +#define PIN_IO_VOLTAGE(bank, _pin, _name, sfx) \
> > > + [RCAR_GP_PIN(bank, _pin)].configs = SH_PFC_PIN_CFG_IO_VOLTAGE
> > > +
> > >
> > > static const struct sh_pfc_pin pinmux_pins[] = {
> > >
> > > PINMUX_GPIO_GP_ALL(),
> > >
> > > - /* Pins not associated with a GPIO port */
> > > + /*
> > > + * All pins assigned to GPIO bank 3 can be used for SD interfaces
> > > + * in which case they support both 3.3V and 1.8V signalling.
> > > + */
> > > + PORT_GP_32(3, PIN_IO_VOLTAGE, unused),
> > > +
> > > + /* Pins not associated with a GPIO port, placed after all the GPIOs
*/
> > > + [RCAR_GP_PIN(5, 31) + 1] =
> >
> > I'm sorry but I still don't like this. gcc outputs a warning when
> > overriding an initializer if you enable -Wextra, which leads me to
> > believe this construct is dubious. It should at least be tested with
> > LLVM.
> >
> > I'd much prefer replacing PINMUX_GPIO_GP_ALL() with a version that will
> > initialize the pins correctly right away.
>
> [...]
>
> Something like this?
>
> diff --git a/drivers/pinctrl/sh-pfc/pfc-emev2.c
> b/drivers/pinctrl/sh-pfc/pfc-emev2.c index 849c6943ed30..ad1a8281a91b
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-emev2.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-emev2.c
> @@ -228,7 +228,7 @@ enum {
>
> /* Expand to a list of sh_pfc_pin entries (named PORT#).
> * NOTE: No config are recorded since the driver do not handle pinconf. */
> -#define __PIN_CFG(pn, pfx, sfx) SH_PFC_PIN_CFG(pfx, 0)
> +#define __PIN_CFG(pn, pfx, sfx) SH_PFC_PORT_CFG(pfx, 0)
> #define PINMUX_EMEV_GPIO_ALL() CPU_ALL_PORT(__PIN_CFG, , unused)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c index 280a56f97786..ca1538371563
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> @@ -1272,8 +1272,8 @@ static const u16 pinmux_data[] = {
> #define __IO (SH_PFC_PIN_CFG_INPUT | SH_PFC_PIN_CFG_OUTPUT)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define R8A73A4_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define R8A73A4_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> +#define R8A73A4_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define R8A73A4_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> R8A73A4_PIN_IO_PU_PD(0), R8A73A4_PIN_IO_PU_PD(1),
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index b486e9d20cc2..92939cbd7ad0
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -1535,15 +1535,15 @@ static const u16 pinmux_data[] = {
> #define __PU (SH_PFC_PIN_CFG_PULL_UP)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define R8A7740_PIN_I_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PD)
> -#define R8A7740_PIN_I_PU(pin) SH_PFC_PIN_CFG(pin, __I | __PU)
> -#define R8A7740_PIN_I_PU_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PUD)
> -#define R8A7740_PIN_IO(pin) SH_PFC_PIN_CFG(pin, __IO)
> -#define R8A7740_PIN_IO_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PD)
> -#define R8A7740_PIN_IO_PU(pin) SH_PFC_PIN_CFG(pin, __IO | __PU)
> -#define R8A7740_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define R8A7740_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> -#define R8A7740_PIN_O_PU_PD(pin) SH_PFC_PIN_CFG(pin, __O | __PUD)
> +#define R8A7740_PIN_I_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PD)
> +#define R8A7740_PIN_I_PU(pin) SH_PFC_PORT_CFG(pin, __I | __PU)
> +#define R8A7740_PIN_I_PU_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PUD)
> +#define R8A7740_PIN_IO(pin) SH_PFC_PORT_CFG(pin, __IO)
> +#define R8A7740_PIN_IO_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PD)
> +#define R8A7740_PIN_IO_PU(pin) SH_PFC_PORT_CFG(pin, __IO | __PU)
> +#define R8A7740_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define R8A7740_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
> +#define R8A7740_PIN_O_PU_PD(pin) SH_PFC_PORT_CFG(pin, __O | __PUD)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> /* Table 56-1 (I/O and Pull U/D) */
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index 1137bbc810cd..1e59e1775374
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> @@ -1740,20 +1740,23 @@ static const u16 pinmux_data[] = {
> #define PIN_NUMBER(r, c) (((r) - 'A') * 31 + (c) + 200)
> #define PIN_A_NUMBER(r, c) PIN_NUMBER(ROW_GROUP_A(r), c)
>
> -#define PIN_IO_VOLTAGE(bank, _pin, _name, sfx) \
> - [RCAR_GP_PIN(bank, _pin)].configs = SH_PFC_PIN_CFG_IO_VOLTAGE
> +/*
> + * All pins assigned to GPIO bank 3 can be used for SD interfaces in
> + * which case they support both 3.3V and 1.8V signalling.
> + */
> +#define GP_GPIO_IO_VOLTAGE(bank, _pin, _name, sfx) \
> + [RCAR_GP_PIN(bank, _pin)] = \
> + SH_PFC_GPIO_CFG(bank, _pin, _name, SH_PFC_PIN_CFG_IO_VOLTAGE)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> - PINMUX_GPIO_GP_ALL(),
> -
> - /*
> - * All pins assigned to GPIO bank 3 can be used for SD interfaces
> - * in which case they support both 3.3V and 1.8V signalling.
> - */
> - PORT_GP_32(3, PIN_IO_VOLTAGE, unused),
> + PORT_GP_32(0, _GP_GPIO, unused),
> + PORT_GP_32(1, _GP_GPIO, unused),
> + PORT_GP_32(2, _GP_GPIO, unused),
> + PORT_GP_32(3, GP_GPIO_IO_VOLTAGE, unused),
> + PORT_GP_32(4, _GP_GPIO, unused),
> + PORT_GP_32(5, _GP_GPIO, unused),
>
> /* Pins not associated with a GPIO port, placed after all the GPIOs */
> - [RCAR_GP_PIN(5, 31) + 1] =
> SH_PFC_PIN_NAMED(ROW_GROUP_A('F'), 15, AF15),
> SH_PFC_PIN_NAMED(ROW_GROUP_A('G'), 15, AG15),
> SH_PFC_PIN_NAMED(ROW_GROUP_A('H'), 15, AH15),
> diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index d2efbfb776ac..2c798550cd8c
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> @@ -1166,14 +1166,14 @@ static const u16 pinmux_data[] = {
> #define __PU (SH_PFC_PIN_CFG_PULL_UP)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define SH73A0_PIN_I_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PD)
> -#define SH73A0_PIN_I_PU(pin) SH_PFC_PIN_CFG(pin, __I | __PU)
> -#define SH73A0_PIN_I_PU_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PUD)
> -#define SH73A0_PIN_IO(pin) SH_PFC_PIN_CFG(pin, __IO)
> -#define SH73A0_PIN_IO_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PD)
> -#define SH73A0_PIN_IO_PU(pin) SH_PFC_PIN_CFG(pin, __IO | __PU)
> -#define SH73A0_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define SH73A0_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> +#define SH73A0_PIN_I_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PD)
> +#define SH73A0_PIN_I_PU(pin) SH_PFC_PORT_CFG(pin, __I | __PU)
> +#define SH73A0_PIN_I_PU_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PUD)
> +#define SH73A0_PIN_IO(pin) SH_PFC_PORT_CFG(pin, __IO)
> +#define SH73A0_PIN_IO_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PD)
> +#define SH73A0_PIN_IO_PU(pin) SH_PFC_PORT_CFG(pin, __IO | __PU)
> +#define SH73A0_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define SH73A0_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
>
> /* Pin numbers for pins without a corresponding GPIO port number are
> computed * from the row and column numbers with a 1000 offset to avoid
> collisions with diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h
> b/drivers/pinctrl/sh-pfc/sh_pfc.h index 734f7a92229c..3eca740bba02 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -272,14 +272,18 @@ struct sh_pfc_soc_info {
> .enum_id = _pin##_DATA, \
> }
>
> -/* SH_PFC_PIN_CFG - Expand to a sh_pfc_pin entry (named PORT#) with config
> */
> -#define SH_PFC_PIN_CFG(_pin, cfgs) \
> +/* SH_PFC_{PORT,GPIO}_CFG - Expand to a sh_pfc_pin entry with config */
> +#define _SH_PFC_PIN_CFG(_pin, _name, cfgs) \
> { \
> .pin = _pin, \
> - .name = __stringify(PORT##_pin), \
> - .enum_id = PORT##_pin##_DATA, \
> + .name = __stringify(_name), \
> + .enum_id = _name##_DATA, \
> .configs = cfgs, \
> }
> +#define SH_PFC_PORT_CFG(_pin, cfgs) \
> + _SH_PFC_PIN_CFG(PORT##_pin, PORT##_pin, cfgs)
> +#define SH_PFC_GPIO_CFG(bank, _pin, _name, cfgs) \
> + _SH_PFC_PIN_CFG((bank * 32) + _pin, _name, cfgs)
>
> /* SH_PFC_PIN_NAMED - Expand to a sh_pfc_pin entry with the given name */
> #define SH_PFC_PIN_NAMED(row, col, _name) \
> --- END ---
>
> If you're happy with that, I'll re-send the series (hopefully for the
> last time!) with the r8a7790 changes squashed into "pinctrl: sh-pfc:
> r8a7790: Implement voltage switching for SDHI" and the SH_PFC_PIN_CFG
> macro change as a new patch before it.
That looks good to me. I'd split it in two patches though, one that reworks
the existing macros (the drivers/pinctrl/sh-pfc/sh_pfc.h changes) and one that
implements voltage switching for SDHI on r8a7790.
I would also avoid renaming SH_PFC_PIN_CFG to SH_PFC_PORT_CFG to avoid
modifying unrelated files, you can name the low-level macro __SH_PFC_PIN_CFG
and add
#define SH_PFC_PIN_CFG(_pin, cfgs) \
__SH_PFC_PIN_CFG(PORT##_pin, PORT##_pin, cfgs)
Additionally, your new SH_PFC_GPIO_CFG macro seems identical to _GP_GPIO now.
It would make sense to merge the two.
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Ian Molton <ian@mnementh.co.uk>,
linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@lists.codethink.co.uk,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Simon Horman <horms@verge.net.au>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: Re: [PATCH v4 2/8] pinctrl: sh-pfc: r8a7790: Implement voltage switching for SDHI
Date: Wed, 03 Feb 2016 09:59:34 +0000 [thread overview]
Message-ID: <3375560.xz1gJhmReB@avalon> (raw)
In-Reply-To: <1435879310.7541.2.camel@codethink.co.uk>
Hi Ben,
Just realized this mail thread fell through the cracks, sorry :-/
On Friday 03 July 2015 00:21:50 Ben Hutchings wrote:
> On Wed, 2015-07-01 at 10:37 +0300, Laurent Pinchart wrote:
> [...]
>
> > > +#define PIN_IO_VOLTAGE(bank, _pin, _name, sfx) \
> > > + [RCAR_GP_PIN(bank, _pin)].configs = SH_PFC_PIN_CFG_IO_VOLTAGE
> > > +
> > >
> > > static const struct sh_pfc_pin pinmux_pins[] = {
> > >
> > > PINMUX_GPIO_GP_ALL(),
> > >
> > > - /* Pins not associated with a GPIO port */
> > > + /*
> > > + * All pins assigned to GPIO bank 3 can be used for SD interfaces
> > > + * in which case they support both 3.3V and 1.8V signalling.
> > > + */
> > > + PORT_GP_32(3, PIN_IO_VOLTAGE, unused),
> > > +
> > > + /* Pins not associated with a GPIO port, placed after all the GPIOs
*/
> > > + [RCAR_GP_PIN(5, 31) + 1] > >
> > I'm sorry but I still don't like this. gcc outputs a warning when
> > overriding an initializer if you enable -Wextra, which leads me to
> > believe this construct is dubious. It should at least be tested with
> > LLVM.
> >
> > I'd much prefer replacing PINMUX_GPIO_GP_ALL() with a version that will
> > initialize the pins correctly right away.
>
> [...]
>
> Something like this?
>
> diff --git a/drivers/pinctrl/sh-pfc/pfc-emev2.c
> b/drivers/pinctrl/sh-pfc/pfc-emev2.c index 849c6943ed30..ad1a8281a91b
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-emev2.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-emev2.c
> @@ -228,7 +228,7 @@ enum {
>
> /* Expand to a list of sh_pfc_pin entries (named PORT#).
> * NOTE: No config are recorded since the driver do not handle pinconf. */
> -#define __PIN_CFG(pn, pfx, sfx) SH_PFC_PIN_CFG(pfx, 0)
> +#define __PIN_CFG(pn, pfx, sfx) SH_PFC_PORT_CFG(pfx, 0)
> #define PINMUX_EMEV_GPIO_ALL() CPU_ALL_PORT(__PIN_CFG, , unused)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c index 280a56f97786..ca1538371563
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> @@ -1272,8 +1272,8 @@ static const u16 pinmux_data[] = {
> #define __IO (SH_PFC_PIN_CFG_INPUT | SH_PFC_PIN_CFG_OUTPUT)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define R8A73A4_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define R8A73A4_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> +#define R8A73A4_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define R8A73A4_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> R8A73A4_PIN_IO_PU_PD(0), R8A73A4_PIN_IO_PU_PD(1),
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index b486e9d20cc2..92939cbd7ad0
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -1535,15 +1535,15 @@ static const u16 pinmux_data[] = {
> #define __PU (SH_PFC_PIN_CFG_PULL_UP)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define R8A7740_PIN_I_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PD)
> -#define R8A7740_PIN_I_PU(pin) SH_PFC_PIN_CFG(pin, __I | __PU)
> -#define R8A7740_PIN_I_PU_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PUD)
> -#define R8A7740_PIN_IO(pin) SH_PFC_PIN_CFG(pin, __IO)
> -#define R8A7740_PIN_IO_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PD)
> -#define R8A7740_PIN_IO_PU(pin) SH_PFC_PIN_CFG(pin, __IO | __PU)
> -#define R8A7740_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define R8A7740_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> -#define R8A7740_PIN_O_PU_PD(pin) SH_PFC_PIN_CFG(pin, __O | __PUD)
> +#define R8A7740_PIN_I_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PD)
> +#define R8A7740_PIN_I_PU(pin) SH_PFC_PORT_CFG(pin, __I | __PU)
> +#define R8A7740_PIN_I_PU_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PUD)
> +#define R8A7740_PIN_IO(pin) SH_PFC_PORT_CFG(pin, __IO)
> +#define R8A7740_PIN_IO_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PD)
> +#define R8A7740_PIN_IO_PU(pin) SH_PFC_PORT_CFG(pin, __IO | __PU)
> +#define R8A7740_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define R8A7740_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
> +#define R8A7740_PIN_O_PU_PD(pin) SH_PFC_PORT_CFG(pin, __O | __PUD)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> /* Table 56-1 (I/O and Pull U/D) */
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index 1137bbc810cd..1e59e1775374
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> @@ -1740,20 +1740,23 @@ static const u16 pinmux_data[] = {
> #define PIN_NUMBER(r, c) (((r) - 'A') * 31 + (c) + 200)
> #define PIN_A_NUMBER(r, c) PIN_NUMBER(ROW_GROUP_A(r), c)
>
> -#define PIN_IO_VOLTAGE(bank, _pin, _name, sfx) \
> - [RCAR_GP_PIN(bank, _pin)].configs = SH_PFC_PIN_CFG_IO_VOLTAGE
> +/*
> + * All pins assigned to GPIO bank 3 can be used for SD interfaces in
> + * which case they support both 3.3V and 1.8V signalling.
> + */
> +#define GP_GPIO_IO_VOLTAGE(bank, _pin, _name, sfx) \
> + [RCAR_GP_PIN(bank, _pin)] = \
> + SH_PFC_GPIO_CFG(bank, _pin, _name, SH_PFC_PIN_CFG_IO_VOLTAGE)
>
> static const struct sh_pfc_pin pinmux_pins[] = {
> - PINMUX_GPIO_GP_ALL(),
> -
> - /*
> - * All pins assigned to GPIO bank 3 can be used for SD interfaces
> - * in which case they support both 3.3V and 1.8V signalling.
> - */
> - PORT_GP_32(3, PIN_IO_VOLTAGE, unused),
> + PORT_GP_32(0, _GP_GPIO, unused),
> + PORT_GP_32(1, _GP_GPIO, unused),
> + PORT_GP_32(2, _GP_GPIO, unused),
> + PORT_GP_32(3, GP_GPIO_IO_VOLTAGE, unused),
> + PORT_GP_32(4, _GP_GPIO, unused),
> + PORT_GP_32(5, _GP_GPIO, unused),
>
> /* Pins not associated with a GPIO port, placed after all the GPIOs */
> - [RCAR_GP_PIN(5, 31) + 1] > SH_PFC_PIN_NAMED(ROW_GROUP_A('F'), 15, AF15),
> SH_PFC_PIN_NAMED(ROW_GROUP_A('G'), 15, AG15),
> SH_PFC_PIN_NAMED(ROW_GROUP_A('H'), 15, AH15),
> diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index d2efbfb776ac..2c798550cd8c
> 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> @@ -1166,14 +1166,14 @@ static const u16 pinmux_data[] = {
> #define __PU (SH_PFC_PIN_CFG_PULL_UP)
> #define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
>
> -#define SH73A0_PIN_I_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PD)
> -#define SH73A0_PIN_I_PU(pin) SH_PFC_PIN_CFG(pin, __I | __PU)
> -#define SH73A0_PIN_I_PU_PD(pin) SH_PFC_PIN_CFG(pin, __I | __PUD)
> -#define SH73A0_PIN_IO(pin) SH_PFC_PIN_CFG(pin, __IO)
> -#define SH73A0_PIN_IO_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PD)
> -#define SH73A0_PIN_IO_PU(pin) SH_PFC_PIN_CFG(pin, __IO | __PU)
> -#define SH73A0_PIN_IO_PU_PD(pin) SH_PFC_PIN_CFG(pin, __IO | __PUD)
> -#define SH73A0_PIN_O(pin) SH_PFC_PIN_CFG(pin, __O)
> +#define SH73A0_PIN_I_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PD)
> +#define SH73A0_PIN_I_PU(pin) SH_PFC_PORT_CFG(pin, __I | __PU)
> +#define SH73A0_PIN_I_PU_PD(pin) SH_PFC_PORT_CFG(pin, __I | __PUD)
> +#define SH73A0_PIN_IO(pin) SH_PFC_PORT_CFG(pin, __IO)
> +#define SH73A0_PIN_IO_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PD)
> +#define SH73A0_PIN_IO_PU(pin) SH_PFC_PORT_CFG(pin, __IO | __PU)
> +#define SH73A0_PIN_IO_PU_PD(pin) SH_PFC_PORT_CFG(pin, __IO | __PUD)
> +#define SH73A0_PIN_O(pin) SH_PFC_PORT_CFG(pin, __O)
>
> /* Pin numbers for pins without a corresponding GPIO port number are
> computed * from the row and column numbers with a 1000 offset to avoid
> collisions with diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h
> b/drivers/pinctrl/sh-pfc/sh_pfc.h index 734f7a92229c..3eca740bba02 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -272,14 +272,18 @@ struct sh_pfc_soc_info {
> .enum_id = _pin##_DATA, \
> }
>
> -/* SH_PFC_PIN_CFG - Expand to a sh_pfc_pin entry (named PORT#) with config
> */
> -#define SH_PFC_PIN_CFG(_pin, cfgs) \
> +/* SH_PFC_{PORT,GPIO}_CFG - Expand to a sh_pfc_pin entry with config */
> +#define _SH_PFC_PIN_CFG(_pin, _name, cfgs) \
> { \
> .pin = _pin, \
> - .name = __stringify(PORT##_pin), \
> - .enum_id = PORT##_pin##_DATA, \
> + .name = __stringify(_name), \
> + .enum_id = _name##_DATA, \
> .configs = cfgs, \
> }
> +#define SH_PFC_PORT_CFG(_pin, cfgs) \
> + _SH_PFC_PIN_CFG(PORT##_pin, PORT##_pin, cfgs)
> +#define SH_PFC_GPIO_CFG(bank, _pin, _name, cfgs) \
> + _SH_PFC_PIN_CFG((bank * 32) + _pin, _name, cfgs)
>
> /* SH_PFC_PIN_NAMED - Expand to a sh_pfc_pin entry with the given name */
> #define SH_PFC_PIN_NAMED(row, col, _name) \
> --- END ---
>
> If you're happy with that, I'll re-send the series (hopefully for the
> last time!) with the r8a7790 changes squashed into "pinctrl: sh-pfc:
> r8a7790: Implement voltage switching for SDHI" and the SH_PFC_PIN_CFG
> macro change as a new patch before it.
That looks good to me. I'd split it in two patches though, one that reworks
the existing macros (the drivers/pinctrl/sh-pfc/sh_pfc.h changes) and one that
implements voltage switching for SDHI on r8a7790.
I would also avoid renaming SH_PFC_PIN_CFG to SH_PFC_PORT_CFG to avoid
modifying unrelated files, you can name the low-level macro __SH_PFC_PIN_CFG
and add
#define SH_PFC_PIN_CFG(_pin, cfgs) \
__SH_PFC_PIN_CFG(PORT##_pin, PORT##_pin, cfgs)
Additionally, your new SH_PFC_GPIO_CFG macro seems identical to _GP_GPIO now.
It would make sense to merge the two.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2016-02-03 9:59 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 16:52 [PATCH v4 0/8] UHS-I support for sh_mobile_sdhi Ben Hutchings
2015-06-30 16:52 ` Ben Hutchings
2015-06-30 16:53 ` [PATCH v4 1/8] pinctrl: sh-pfc: Implement pinconf power-source param for voltage switching Ben Hutchings
2015-06-30 16:53 ` Ben Hutchings
2015-07-01 7:24 ` Laurent Pinchart
2015-07-01 7:24 ` Laurent Pinchart
2015-08-24 8:45 ` Linus Walleij
2015-08-24 8:45 ` Linus Walleij
2015-06-30 16:54 ` [PATCH v4 2/8] pinctrl: sh-pfc: r8a7790: Implement voltage switching for SDHI Ben Hutchings
2015-06-30 16:54 ` Ben Hutchings
2015-07-01 7:37 ` Laurent Pinchart
2015-07-01 7:37 ` Laurent Pinchart
2015-07-02 23:21 ` Ben Hutchings
2015-07-02 23:21 ` Ben Hutchings
2015-07-09 12:34 ` Ben Hutchings
2015-07-09 12:34 ` Ben Hutchings
2015-11-13 8:38 ` Kuninori Morimoto
2015-11-13 8:38 ` Kuninori Morimoto
2016-02-03 9:59 ` Laurent Pinchart [this message]
2016-02-03 9:59 ` Laurent Pinchart
2016-02-11 13:53 ` Wolfram Sang
2016-02-11 13:53 ` Wolfram Sang
2015-06-30 16:54 ` [PATCH v4 3/8] mmc: tmio, sh_mobile_sdhi: Pass tmio_mmc_host ptr to clk_{enable,disable} ops Ben Hutchings
2015-06-30 16:54 ` Ben Hutchings
2015-06-30 16:56 ` [PATCH v4 4/8] mmc: tmio, sh_mobile_sdhi: Add support for variable input clock frequency Ben Hutchings
2015-06-30 16:56 ` Ben Hutchings
2015-06-30 16:56 ` [PATCH v4 5/8] mmc: tmio: Add UHS-I mode support Ben Hutchings
2015-06-30 16:56 ` Ben Hutchings
2015-06-30 16:57 ` [PATCH v4 6/8] mmc: sh_mobile_sdhi: " Ben Hutchings
2015-06-30 16:57 ` Ben Hutchings
2015-06-30 16:57 ` [PATCH v4 7/8] ARM: shmobile: r8a7790: Set maximum frequencies for SDHI clocks Ben Hutchings
2015-06-30 16:57 ` Ben Hutchings
2015-07-07 0:39 ` Simon Horman
2015-07-07 0:39 ` Simon Horman
2015-07-07 1:19 ` Kuninori Morimoto
2015-07-07 1:19 ` Kuninori Morimoto
2015-07-08 1:25 ` Simon Horman
2015-07-08 1:25 ` Simon Horman
2015-07-07 1:19 ` Kuninori Morimoto
2015-07-07 1:19 ` Kuninori Morimoto
2015-06-30 16:57 ` [PATCH v4 8/8] ARM: shmobile: lager: Enable UHS-I SDR-50 Ben Hutchings
2015-06-30 16:57 ` Ben Hutchings
2015-07-01 0:28 ` [PATCH v4 0/8] UHS-I support for sh_mobile_sdhi Kuninori Morimoto
2015-07-01 0:28 ` Kuninori Morimoto
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=3375560.xz1gJhmReB@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=ben.hutchings@codethink.co.uk \
--cc=horms@verge.net.au \
--cc=ian@mnementh.co.uk \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/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.