From patchwork Thu Jul 11 04:19:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 11039253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 049EA138B for ; Thu, 11 Jul 2019 04:20:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77692881C for ; Thu, 11 Jul 2019 04:20:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAC1E28876; Thu, 11 Jul 2019 04:20:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DD7E28837 for ; Thu, 11 Jul 2019 04:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z/dfj7LuaiwJUCL3wYObTxdQUEkHb2ei+YappVDROsk=; b=dO+JYhZjT9o3Pr /3M/O4/EOvv/3TE09PJcmOdYYMeAt93BjrDNHptydWSMj8cduM03iS4Z7dVwWFV7JPzvUviAsSBuY eVCL7E3XbcNNosME7Z2yCEAp11NAx7CJeJ2bUAZxxuqS6vr1JOcodwIuPVBV5vTcbnQI2KY9V/0KO WkcCF0/5Vm7dJxqz4920DpV/2SgOT4tpC2UkRsI8XZj3a2IFhv4JIVsmSZ9yaBB33ptWi0rM87NBy aA3nK7pQc3fga5Tck21MgV32MDdBrlPmVgTZPAGaovgnLTuk/TuhM1F6zjyLwT/9upcpWZb5eKtUV GORWlRYvNOJuZ3netGxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlQZZ-0008Da-H5; Thu, 11 Jul 2019 04:20:45 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlQYz-00077O-9Q for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2019 04:20:11 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id C84A62F17; Thu, 11 Jul 2019 00:20:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 11 Jul 2019 00:20:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=X7ftRY0n/ppqJ obOZqCX51ux9OAohStr29ZTJLcVjmQ=; b=cGoviOEEGwngfl6VLqBvD9tiTy+gn 5Z5a3WRS4Jp+DhIPj9NCeJ+FOceFEGaby0LVjS8GPNDesOjagd+nqS3FBtxK/53t MgArao16EwjPNtcdSfCqq3tgB9XlapxIZ3nLZvH42soA1Uf+2QiHgKk9Qe+r+Smk Zd09Estv6fuJawoAkUVDJejc14sz34VpIuN7U3Y7mEll4HsYm6FRHizPDHGV5IZR t96aAGYDKgr7SPYh98Ancjrc4voIfX/E70R/R3jJyk40FW2JgiSmi8xTKbbXFNhP ihDOyu6c5swp9yxWTpPKMCxqB6xGgZ9/Z7qxb3fpUNDU49WjSZNJY691g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=X7ftRY0n/ppqJobOZqCX51ux9OAohStr29ZTJLcVjmQ=; b=UgY7pz68 LTye52h5TiicEDEpqC9kIgHe78P6MqZ1z4BtIVmInsFFpGjXKcK4wuVc2TNx52N/ zxLMOjAS+UTtTY3pYZq6MOMJFffT9eiHZa+Fb/Yi+2IE6mK5HAiCnIht6SDQGIG3 gY4gxvQMKMpd7tQtIc32NrnJBrBIv/osIzubYmXvhzvPvC8i++0ywi7TcIXBgzL4 /RhK5wcaUG2HfbJNOySVAR+E/9OmdlHZg43t3+HdJuiP14pG0SYGw8PqLFSLY/tU N8NYwQ4c8Zck5G2vwFzU/9CU10HfAPld883+R/rf5rLwsonEX3M4hCD94u5Eekhi 3aNWRzo935K2kw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgeejgdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetnhgurhgvficulfgvfhhfvghrhicuoegrnhgurhgvfiesrghj rdhiugdrrghuqeenucfkphepvddtvddrkedurddukedrfedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrnhgurhgvfiesrghjrdhiugdrrghunecuvehluhhsthgvrhfuihiivgep ud X-ME-Proxy: Received: from mistburn.au.ibm.com (bh02i525f01.au.ibm.com [202.81.18.30]) by mail.messagingengine.com (Postfix) with ESMTPA id 67E8780060; Thu, 11 Jul 2019 00:20:02 -0400 (EDT) From: Andrew Jeffery To: linux-gpio@vger.kernel.org Subject: [PATCH 3/6] pinctrl: aspeed: Add PIN_DECL_3() helper Date: Thu, 11 Jul 2019 13:49:39 +0930 Message-Id: <20190711041942.23202-4-andrew@aj.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190711041942.23202-1-andrew@aj.id.au> References: <20190711041942.23202-1-andrew@aj.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190710_212009_535005_33D795AC X-CRM114-Status: UNSURE ( 9.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, johnny_huang@aspeedtech.com, linux-aspeed@lists.ozlabs.org, Andrew Jeffery , linus.walleij@linaro.org, ryanchen.aspeed@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, joel@jms.id.au, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This case is common in the AST2600, so add to the collection. Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/pinmux-aspeed.h | 72 ++++++++++++++------------ 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h index 0406beedd5ba..964dd5b242ac 100644 --- a/drivers/pinctrl/aspeed/pinmux-aspeed.h +++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h @@ -604,38 +604,6 @@ struct aspeed_pin_desc { static const struct aspeed_pin_desc PIN_SYM(pin) = \ { #pin, PIN_EXPRS_PTR(pin) } -/** - * Declare a two-signal pin - * - * @pin: The pin number - * @other: Macro name for "other" functionality (subjected to stringification) - * @high: Macro name for the highest priority signal functions - * @low: Macro name for the low signal functions - * - * For example: - * - * #define A8 56 - * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); - * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), - * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); - * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), - * SIG_EXPR_PTR(ROMD8, ROM16S)); - * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); - * PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6); - */ -#define PIN_DECL_2(pin, other, high, low) \ - SIG_EXPR_LIST_DECL_SINGLE(other, other); \ - PIN_DECL_(pin, \ - SIG_EXPR_LIST_PTR(high), \ - SIG_EXPR_LIST_PTR(low), \ - SIG_EXPR_LIST_PTR(other)) - -#define PIN_GROUP_SYM(func) pins_ ## func -#define FUNC_GROUP_SYM(func) groups_ ## func -#define FUNC_GROUP_DECL(func, ...) \ - static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \ - static const char *FUNC_GROUP_SYM(func)[] = { #func } - /** * Declare a single signal pin * @@ -670,6 +638,46 @@ struct aspeed_pin_desc { SIG_EXPR_LIST_DECL_SINGLE(other, other); \ PIN_DECL_(pin, SIG_EXPR_LIST_PTR(sig), SIG_EXPR_LIST_PTR(other)); \ FUNC_GROUP_DECL(sig, pin) +/** + * Declare a two-signal pin + * + * @pin: The pin number + * @other: Macro name for "other" functionality (subjected to stringification) + * @high: Macro name for the highest priority signal functions + * @low: Macro name for the low signal functions + * + * For example: + * + * #define A8 56 + * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); + * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), + * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); + * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), + * SIG_EXPR_PTR(ROMD8, ROM16S)); + * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); + * PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6); + */ +#define PIN_DECL_2(pin, other, high, low) \ + SIG_EXPR_LIST_DECL_SINGLE(other, other); \ + PIN_DECL_(pin, \ + SIG_EXPR_LIST_PTR(high), \ + SIG_EXPR_LIST_PTR(low), \ + SIG_EXPR_LIST_PTR(other)) + +#define PIN_DECL_3(pin, other, high, medium, low) \ + SIG_EXPR_LIST_DECL_SINGLE(other, other); \ + PIN_DECL_(pin, \ + SIG_EXPR_LIST_PTR(high), \ + SIG_EXPR_LIST_PTR(medium), \ + SIG_EXPR_LIST_PTR(low), \ + SIG_EXPR_LIST_PTR(other)) + +#define PIN_GROUP_SYM(func) pins_ ## func +#define FUNC_GROUP_SYM(func) groups_ ## func +#define FUNC_GROUP_DECL(func, ...) \ + static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \ + static const char *FUNC_GROUP_SYM(func)[] = { #func } + #define GPIO_PIN_DECL(pin, gpio) \ SIG_EXPR_LIST_DECL_SINGLE(gpio, gpio); \