From patchwork Wed Jun 5 08:25:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 2666371 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0B0ADDFE82 for ; Wed, 5 Jun 2013 08:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752865Ab3FEI13 (ORCPT ); Wed, 5 Jun 2013 04:27:29 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:33862 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604Ab3FEI1V (ORCPT ); Wed, 5 Jun 2013 04:27:21 -0400 Received: from ayumi.isobedori.kobe.vergenet.net (p5212-ipbfp1903kobeminato.hyogo.ocn.ne.jp [114.172.132.212]) by kirsty.vergenet.net (Postfix) with ESMTP id A5DB726716C; Wed, 5 Jun 2013 18:27:15 +1000 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id 3B5166CE06C; Wed, 5 Jun 2013 17:27:13 +0900 (JST) From: Simon Horman To: Arnd Bergmann , Olof Johansson Cc: linux-sh@vger.kernel.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org, Magnus Damm , Kuninori Morimoto , Simon Horman Subject: [PATCH 021/130] sh-pfc: r8a7778: add common PFC macro helper Date: Wed, 5 Jun 2013 17:25:12 +0900 Message-Id: <1370420821-28420-22-git-send-email-horms+renesas@verge.net.au> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1370420821-28420-1-git-send-email-horms+renesas@verge.net.au> References: <1370420821-28420-1-git-send-email-horms+renesas@verge.net.au> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Kuninori Morimoto pfc-r8a7778 will have many devices pfc support in the future, and current pfc-r8a7778 is using pin/mux definition macro for SCIF. The device definition style using macro is readable code IMO, but creating new macro for each devices is not good sense. This patch adds common SH_PFC_xx() macro for each new feature devices Signed-off-by: Kuninori Morimoto Signed-off-by: Simon Horman --- drivers/pinctrl/sh-pfc/pfc-r8a7778.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c index ddbd27b..139f9dd 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c @@ -1303,15 +1303,25 @@ static struct sh_pfc_pin pinmux_pins[] = { */ #define PIN_NUMBER(row, col) (1000+((row)-1)*25+(col)-1) -/* - SCIF macro ------------------------------------------------------------- */ -#define SCIF_PFC_PIN(name, args...) \ +/* - macro */ +#define SH_PFC_PINS(name, args...) \ static const unsigned int name ##_pins[] = { args } -#define SCIF_PFC_DAT(name, tx, rx) \ - static const unsigned int name ##_mux[] = { tx##_MARK, rx##_MARK, } -#define SCIF_PFC_CTR(name, cts, rts) \ - static const unsigned int name ##_mux[] = { cts##_MARK, rts##_MARK, } -#define SCIF_PFC_CLK(name, sck) \ - static const unsigned int name ##_mux[] = { sck##_MARK, } +#define SH_PFC_MUX1(name, arg1) \ + static const unsigned int name ##_mux[] = { arg1##_MARK } +#define SH_PFC_MUX2(name, arg1, arg2) \ + static const unsigned int name ##_mux[] = { arg1##_MARK, arg2##_MARK, } +#define SH_PFC_MUX3(name, arg1, arg2, arg3) \ + static const unsigned int name ##_mux[] = { arg1##_MARK, arg2##_MARK, \ + arg3##_MARK } +#define SH_PFC_MUX4(name, arg1, arg2, arg3, arg4) \ + static const unsigned int name ##_mux[] = { arg1##_MARK, arg2##_MARK, \ + arg3##_MARK, arg4##_MARK } + +/* - SCIF macro ------------------------------------------------------------- */ +#define SCIF_PFC_PIN(name, args...) SH_PFC_PINS(name, args) +#define SCIF_PFC_DAT(name, tx, rx) SH_PFC_MUX2(name, tx, rx) +#define SCIF_PFC_CTR(name, cts, rts) SH_PFC_MUX2(name, cts, rts) +#define SCIF_PFC_CLK(name, sck) SH_PFC_MUX1(name, sck) /* - HSCIF0 ----------------------------------------------------------------- */ SCIF_PFC_PIN(hscif0_data_a, RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18));