Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5642683img; Wed, 27 Mar 2019 12:17:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqz02V5XABHKgKjfq8mjigp//Rh1ZVM9XKrb+x5IWRLurZixQwLNjuwrapF2YLdRmX7UWnLt X-Received: by 2002:a63:bd52:: with SMTP id d18mr11530059pgp.52.1553714240389; Wed, 27 Mar 2019 12:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714240; cv=none; d=google.com; s=arc-20160816; b=Fiu4E4NWqMzKvSvfKV8/q1xtLxUGmjvJZIlYcmVkvayll4mc+fyI6YX/GngcAAccEB ZzGGbPhZ99pb+2pdKDCv91d/uTkESlDwLPPd1UWngdQ6UtrPiFoVJG0IK+ib4Kt/zETW m+o1F1Zr0x6DLpb5C/+PHIoOUyAWvRpA9UciYupVomCaQjyMv+QCzWRNpyUSFz7ET/bN uBgo2UgAmNIDLCPGPuN77RB/zF3463eIQEPojOfaStkxjRV7fzgu51lbF9slkwQeIp9G h0IBRKPbQhKhBABZPOakcU6B9C4ghdZOVQ/jY1yOD9CE0VNu/gDB8Q3tEX2tOVS/+InC TFOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3NEhN7TPQzxjbWZorZoj0cEciaIMp6sTEMcZQBFsE2U=; b=tPgaKG9eu2wdSoeAyR7UDecQmkYMQ/S1s6JEDWqEx/AkX0xfefjbFBXAk8gxi+vcS/ zXizOg67XZO5T2Z2U9nTt6RMPKGWkL2cW+DpnIwqxW2tn9eArxlVD1galcPo/3k296/F fl5/TcLRAE/Tb2J8iy/wzx3F54PtB6n397XLHACtfmnWzWQpHmqlrMXE4XgAVxGuHF4X 27i0wIvCZOPN5MnBkx5d/wyWfy+4CWwFutaWEwCDzVKuMcT4e+FDS0j1S0GJEWURhQpM 8oX8ktOI9kHr7n9/WOyIjpSJbGNKs23rJtVysqTSgmmLHQ0sEeEyJXFY+rAMGDwef6F2 yH2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JZMjpd3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f32si20962966plf.24.2019.03.27.12.17.05; Wed, 27 Mar 2019 12:17:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JZMjpd3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388711AbfC0TPX (ORCPT + 99 others); Wed, 27 Mar 2019 15:15:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:51192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388554AbfC0SJX (ORCPT ); Wed, 27 Mar 2019 14:09:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDC782183F; Wed, 27 Mar 2019 18:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710161; bh=cIpuZnpyq/TmAYcpoMyCiTg7Gr/A4hgnYe6oTwNUWjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZMjpd3IU3LkNux5wLAe5kkAhW2fJYYYzPc0JkHoiVlddX+fKLv8PRV8pwXI6jevx 5nplDOBxJIb3Hr5NkoiEft6pTghifRRV3uyTxpzYF79EBUjDq9wyVN7ehEO7KjirNI iAsKrvW55BsHLD4cULzmCKPgfMjW5sMamA0Qrzi4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takeshi Kihara , Yoshihiro Shimoda , Geert Uytterhoeven , Sasha Levin , linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 228/262] pinctrl: sh-pfc: r8a77995: Fix MOD_SEL bit numbering Date: Wed, 27 Mar 2019 14:01:23 -0400 Message-Id: <20190327180158.10245-228-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takeshi Kihara [ Upstream commit 5219aa33caec2f7b68eda2b7e4ab8e276f323254 ] MOD_SEL register bit numbering was different from R-Car D3 SoC and R-Car H3/M3-[WN] SoCs. MOD_SEL 1-bit H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'0 b'0 Set Value = H'1 b'1 b'1 MOD_SEL 2-bits H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'00 b'00 Set Value = H'1 b'01 b'10 Set Value = H'2 b'10 b'01 Set Value = H'3 b'11 b'11 MOD_SEL 3-bits H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'000 b'000 Set Value = H'1 b'001 b'100 Set Value = H'2 b'010 b'010 Set Value = H'3 b'011 b'110 Set Value = H'4 b'100 b'001 Set Value = H'5 b'101 b'101 Set Value = H'6 b'110 b'011 Set Value = H'7 b'111 b'111 This patch replaces the #define name and value of MOD_SEL. Signed-off-by: Takeshi Kihara Fixes: 794a67117646 ("pinctrl: sh-pfc: Initial R8A77995 PFC support") [shimoda: split a patch per SoC and revise the commit log] Signed-off-by: Yoshihiro Shimoda [geert: Use a macro to do the actual reordering] Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman Signed-off-by: Sasha Levin --- drivers/pinctrl/sh-pfc/pfc-r8a77995.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77995.c b/drivers/pinctrl/sh-pfc/pfc-r8a77995.c index 84d78db381e3..9e377e3b9cb3 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a77995.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77995.c @@ -381,6 +381,9 @@ FM(IP12_23_20) IP12_23_20 \ FM(IP12_27_24) IP12_27_24 \ FM(IP12_31_28) IP12_31_28 \ +/* The bit numbering in MOD_SEL fields is reversed */ +#define REV4(f0, f1, f2, f3) f0 f2 f1 f3 + /* MOD_SEL0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ #define MOD_SEL0_30 FM(SEL_MSIOF2_0) FM(SEL_MSIOF2_1) #define MOD_SEL0_29 FM(SEL_I2C3_0) FM(SEL_I2C3_1) @@ -388,10 +391,10 @@ FM(IP12_31_28) IP12_31_28 \ #define MOD_SEL0_27 FM(SEL_MSIOF3_0) FM(SEL_MSIOF3_1) #define MOD_SEL0_26 FM(SEL_HSCIF3_0) FM(SEL_HSCIF3_1) #define MOD_SEL0_25 FM(SEL_SCIF4_0) FM(SEL_SCIF4_1) -#define MOD_SEL0_24_23 FM(SEL_PWM0_0) FM(SEL_PWM0_1) FM(SEL_PWM0_2) F_(0, 0) -#define MOD_SEL0_22_21 FM(SEL_PWM1_0) FM(SEL_PWM1_1) FM(SEL_PWM1_2) F_(0, 0) -#define MOD_SEL0_20_19 FM(SEL_PWM2_0) FM(SEL_PWM2_1) FM(SEL_PWM2_2) F_(0, 0) -#define MOD_SEL0_18_17 FM(SEL_PWM3_0) FM(SEL_PWM3_1) FM(SEL_PWM3_2) F_(0, 0) +#define MOD_SEL0_24_23 REV4(FM(SEL_PWM0_0), FM(SEL_PWM0_1), FM(SEL_PWM0_2), F_(0, 0)) +#define MOD_SEL0_22_21 REV4(FM(SEL_PWM1_0), FM(SEL_PWM1_1), FM(SEL_PWM1_2), F_(0, 0)) +#define MOD_SEL0_20_19 REV4(FM(SEL_PWM2_0), FM(SEL_PWM2_1), FM(SEL_PWM2_2), F_(0, 0)) +#define MOD_SEL0_18_17 REV4(FM(SEL_PWM3_0), FM(SEL_PWM3_1), FM(SEL_PWM3_2), F_(0, 0)) #define MOD_SEL0_15 FM(SEL_IRQ_0_0) FM(SEL_IRQ_0_1) #define MOD_SEL0_14 FM(SEL_IRQ_1_0) FM(SEL_IRQ_1_1) #define MOD_SEL0_13 FM(SEL_IRQ_2_0) FM(SEL_IRQ_2_1) -- 2.19.1