All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel@vger.kernel.org, wsa@the-dreams.de,
	linus.walleij@linaro.org, linux-sh@vger.kernel.org,
	horms@verge.net.au
Subject: Re: [PATCH 02/03] pinctrl: sh-pfc: r7s72100 SCIF2 macro conversion
Date: Wed, 27 Nov 2013 11:02:02 +0000	[thread overview]
Message-ID: <2205310.zYhAriYNC0@avalon> (raw)
In-Reply-To: <20131127080630.18384.55139.sendpatchset@w520>

Hi Magnus,

Thank you for the patch.

On Wednesday 27 November 2013 17:06:30 Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Convert from rather verbose description of single pin groups
> to making use of macros to describe one pin per line. The
> actual bulk of the SCIF2 description is kept in the SCIF2 macro.
> 
> Compresses the description of each pin from 9 to 1 line.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
> 
>  drivers/pinctrl/sh-pfc/pfc-r7s72100.c |   64 +++++++++++++-----------------
>  1 file changed, 28 insertions(+), 36 deletions(-)
> 
> --- 0007/drivers/pinctrl/sh-pfc/pfc-r7s72100.c
> +++ work/drivers/pinctrl/sh-pfc/pfc-r7s72100.c	2013-11-27 
14:19:24.000000000
> +0900 @@ -103,48 +103,40 @@ static struct sh_pfc_pin pinmux_pins[] >  	_P_ALL(_P_GPIO),
>  };
> 
> -/* - SCIF2 ------------------------------------------------------------- */
> -static const unsigned int scif2_txd_p3_0_pins[] = {
> -	/* TX */
> -	RZ_PORT_PIN(3, 0),
> -};
> -static const unsigned int scif2_txd_p3_0_mux[] = {
> -	P_3_0_MARK_FN6,
> -};
> -static const unsigned int scif2_txd_p3_1_pins[] = {
> -	/* TX */
> -	RZ_PORT_PIN(3, 1),
> -};
> -static const unsigned int scif2_txd_p3_1_mux[] = {
> -	P_3_1_MARK_FN4,
> -};
> -static const unsigned int scif2_rxd_p3_2_pins[] = {
> -	/* RX */
> -	RZ_PORT_PIN(3, 2),
> -};
> -static const unsigned int scif2_rxd_p3_2_mux[] = {
> -	P_3_2_MARK_FN4,
> -};
> -static const unsigned int scif2_clk_p3_0_pins[] = {
> -	/* SCK */
> -	RZ_PORT_PIN(3, 0),
> -};
> -static const unsigned int scif2_clk_p3_0_mux[] = {
> -	P_3_0_MARK_FN4,
> +#define __RZ_STR(pfx, hw, bank, pin, sfx)		\
> +	pfx##_##hw##_p##bank##_##pin####sfx
> +
> +#define RZ_PIN_AND_MUX(pfx, hw, bank, pin, fn)				\
> +static const unsigned int __RZ_STR(pfx, hw, bank, pin, _pins)[] = {	\
> +	RZ_PORT_PIN(bank, pin),						\
> +};									\
> +static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = {	\
> +	P_##bank##_##pin##_MARK_FN##fn,					\
>  };
> 
> +#define RZ_PMX_GRP(pfx, hw, bank, pin, fn) \
> +	SH_PFC_PIN_GROUP(pfx##_##hw##_p##bank##_##pin),
> +
> +#define __RZ_GPRS(x) #x
> +
> +#define RZ_GRPS(pfx, hw, bank, pin, fn) \
> +	__RZ_GPRS(pfx##_##hw##_p##bank##_##pin),

I believe the code would be more readable if you didn't abbreviate GRP and 
GRPS. I would use GROUP and GROUPS instead.

> +
> +
> +#define SCIF2(fn)			\
> +	fn(scif2, txd, 3, 0, 6)		\
> +	fn(scif2, txd, 3, 1, 4)		\
> +	fn(scif2, rxd, 3, 2, 4)		\
> +	fn(scif2, clk, 3, 0, 4)
> +
> +SCIF2(RZ_PIN_AND_MUX)
> +
>  static const struct sh_pfc_pin_group pinmux_groups[] = {
> -	SH_PFC_PIN_GROUP(scif2_txd_p3_0),
> -	SH_PFC_PIN_GROUP(scif2_txd_p3_1),
> -	SH_PFC_PIN_GROUP(scif2_rxd_p3_2),
> -	SH_PFC_PIN_GROUP(scif2_clk_p3_0),
> +	SCIF2(RZ_PMX_GRP)
>  };
> 
>  static const char * const scif2_groups[] = {
> -	"scif2_txd_p3_0",
> -	"scif2_txd_p3_1",
> -	"scif2_rxd_p3_2",
> -	"scif2_clk_p3_0",
> +	SCIF2(RZ_GRPS)
>  };
>  static const struct sh_pfc_function pinmux_functions[] = {
>  	SH_PFC_FUNCTION(scif2),

Once again it would help if I could access the datasheet.

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel@vger.kernel.org, wsa@the-dreams.de,
	linus.walleij@linaro.org, linux-sh@vger.kernel.org,
	horms@verge.net.au
Subject: Re: [PATCH 02/03] pinctrl: sh-pfc: r7s72100 SCIF2 macro conversion
Date: Wed, 27 Nov 2013 12:02:02 +0100	[thread overview]
Message-ID: <2205310.zYhAriYNC0@avalon> (raw)
In-Reply-To: <20131127080630.18384.55139.sendpatchset@w520>

Hi Magnus,

Thank you for the patch.

On Wednesday 27 November 2013 17:06:30 Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Convert from rather verbose description of single pin groups
> to making use of macros to describe one pin per line. The
> actual bulk of the SCIF2 description is kept in the SCIF2 macro.
> 
> Compresses the description of each pin from 9 to 1 line.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
> 
>  drivers/pinctrl/sh-pfc/pfc-r7s72100.c |   64 +++++++++++++-----------------
>  1 file changed, 28 insertions(+), 36 deletions(-)
> 
> --- 0007/drivers/pinctrl/sh-pfc/pfc-r7s72100.c
> +++ work/drivers/pinctrl/sh-pfc/pfc-r7s72100.c	2013-11-27 
14:19:24.000000000
> +0900 @@ -103,48 +103,40 @@ static struct sh_pfc_pin pinmux_pins[] =
>  	_P_ALL(_P_GPIO),
>  };
> 
> -/* - SCIF2 ------------------------------------------------------------- */
> -static const unsigned int scif2_txd_p3_0_pins[] = {
> -	/* TX */
> -	RZ_PORT_PIN(3, 0),
> -};
> -static const unsigned int scif2_txd_p3_0_mux[] = {
> -	P_3_0_MARK_FN6,
> -};
> -static const unsigned int scif2_txd_p3_1_pins[] = {
> -	/* TX */
> -	RZ_PORT_PIN(3, 1),
> -};
> -static const unsigned int scif2_txd_p3_1_mux[] = {
> -	P_3_1_MARK_FN4,
> -};
> -static const unsigned int scif2_rxd_p3_2_pins[] = {
> -	/* RX */
> -	RZ_PORT_PIN(3, 2),
> -};
> -static const unsigned int scif2_rxd_p3_2_mux[] = {
> -	P_3_2_MARK_FN4,
> -};
> -static const unsigned int scif2_clk_p3_0_pins[] = {
> -	/* SCK */
> -	RZ_PORT_PIN(3, 0),
> -};
> -static const unsigned int scif2_clk_p3_0_mux[] = {
> -	P_3_0_MARK_FN4,
> +#define __RZ_STR(pfx, hw, bank, pin, sfx)		\
> +	pfx##_##hw##_p##bank##_##pin####sfx
> +
> +#define RZ_PIN_AND_MUX(pfx, hw, bank, pin, fn)				\
> +static const unsigned int __RZ_STR(pfx, hw, bank, pin, _pins)[] = {	\
> +	RZ_PORT_PIN(bank, pin),						\
> +};									\
> +static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = {	\
> +	P_##bank##_##pin##_MARK_FN##fn,					\
>  };
> 
> +#define RZ_PMX_GRP(pfx, hw, bank, pin, fn) \
> +	SH_PFC_PIN_GROUP(pfx##_##hw##_p##bank##_##pin),
> +
> +#define __RZ_GPRS(x) #x
> +
> +#define RZ_GRPS(pfx, hw, bank, pin, fn) \
> +	__RZ_GPRS(pfx##_##hw##_p##bank##_##pin),

I believe the code would be more readable if you didn't abbreviate GRP and 
GRPS. I would use GROUP and GROUPS instead.

> +
> +
> +#define SCIF2(fn)			\
> +	fn(scif2, txd, 3, 0, 6)		\
> +	fn(scif2, txd, 3, 1, 4)		\
> +	fn(scif2, rxd, 3, 2, 4)		\
> +	fn(scif2, clk, 3, 0, 4)
> +
> +SCIF2(RZ_PIN_AND_MUX)
> +
>  static const struct sh_pfc_pin_group pinmux_groups[] = {
> -	SH_PFC_PIN_GROUP(scif2_txd_p3_0),
> -	SH_PFC_PIN_GROUP(scif2_txd_p3_1),
> -	SH_PFC_PIN_GROUP(scif2_rxd_p3_2),
> -	SH_PFC_PIN_GROUP(scif2_clk_p3_0),
> +	SCIF2(RZ_PMX_GRP)
>  };
> 
>  static const char * const scif2_groups[] = {
> -	"scif2_txd_p3_0",
> -	"scif2_txd_p3_1",
> -	"scif2_rxd_p3_2",
> -	"scif2_clk_p3_0",
> +	SCIF2(RZ_GRPS)
>  };
>  static const struct sh_pfc_function pinmux_functions[] = {
>  	SH_PFC_FUNCTION(scif2),

Once again it would help if I could access the datasheet.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2013-11-27 11:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27  8:06 [PATCH 00/03] pinctrl: sh-pfc: r7s72100 SCIF2 support Magnus Damm
2013-11-27  8:06 ` Magnus Damm
2013-11-27  8:06 ` [PATCH 01/03] pinctrl: sh-pfc: r7s72100 SCIF2 port3 support Magnus Damm
2013-11-27  8:06   ` Magnus Damm
2013-11-27 10:56   ` Laurent Pinchart
2013-11-27 10:56     ` Laurent Pinchart
2013-11-29 10:29   ` Linus Walleij
2013-11-29 10:29     ` Linus Walleij
2013-11-29 13:53     ` Laurent Pinchart
2013-11-29 13:53       ` Laurent Pinchart
2013-11-27  8:06 ` [PATCH 02/03] pinctrl: sh-pfc: r7s72100 SCIF2 macro conversion Magnus Damm
2013-11-27  8:06   ` Magnus Damm
2013-11-27 11:02   ` Laurent Pinchart [this message]
2013-11-27 11:02     ` Laurent Pinchart
2013-11-27  8:06 ` [PATCH 03/03] pinctrl: sh-pfc: r7s72100 SCIF2 port4, 6 and 8 support Magnus Damm
2013-11-27  8:06   ` Magnus Damm
2013-12-03  9:36   ` Linus Walleij
2013-12-03  9:36     ` Linus Walleij
2013-12-03 12:18     ` Simon Horman
2013-12-03 12:18       ` Simon Horman
2013-12-04  1:09     ` Laurent Pinchart
2013-12-04  1:09       ` Laurent Pinchart

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=2205310.zYhAriYNC0@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=horms@verge.net.au \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.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 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.