Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp306349lqt; Thu, 6 Jun 2024 04:25:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4kgxM5LTKkdp8j4MddzzeBCeo+E2fV/x5MhXt5b8WULfNLXme2GT8+MlRKcAagcs6k3usRpbStvyHx60gE9ATLXWL+L4evFvNayCB2w== X-Google-Smtp-Source: AGHT+IGvHqrHJGmhLq069E9DWSm+EsLqBcCAsGrq0zAiGSeCnY/9PtZ7iysWU7UMA817dOzc5wKg X-Received: by 2002:a17:906:4091:b0:a68:f1ca:db46 with SMTP id a640c23a62f3a-a699ffffd0amr315862866b.64.1717673134833; Thu, 06 Jun 2024 04:25:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717673134; cv=pass; d=google.com; s=arc-20160816; b=nWUrViLVx5CBLV+SAFk+Y3e5dVUX3lnzQQhp5y+2V9nSp8voef3PG6/HVcY0i+C3eX LbEO5RD8gTdEGLgHDPXYlkVwXkFzhE8q2E8LtSeb9FAnvXvPQmysJS8efKofTVORAmpW Kc+LaLEcDwHkERpA9gzPkRUdeujw6lzgbtlMVp8qxFkmWJu6/wrZyfuLunIYUezB6WgM 0ebCaO1P8n3GAMl34FSQd4w2DiRZOfijovbJQPydzDJKo0t611XEbv1KsxdAU1DM8YzD huljs+pRxyPqb043IWrGAZIlt3caH3fo/zvTZLZnGI882+q8aHGRahwLJvnYk2CS0pQ2 BCIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=00XnzfKyvFc8UCi5vg7ycZAPYKRfP4qnEUVe/4uYGYc=; fh=oQJ5hMnNsPSt3tr4UoEvRyobchCub1+KzYfkczgrgb8=; b=pinPRBoIuSxiwGyGxMMccDvxgcjlc3iChkOYQdvdrG7WZdPiq66WlRkxEtxwKHEbpU Rso4/HSOSbDOOZGcCYA2r7u4DoKiBPxNCgk568YS+xJqzba72n83Z33Yx8yqNeQnPo8o T9Iqu3eWr0OObK43jHo5N5pJ2qqPH/RdVTLwqMIRIQac3vynyicmsf3E7MHG9FBubjD1 1Bk+h8rW7h4yx3UdyOA9+jjG91knXgTN93Xs+SsWm2YlpYbA3L0auPihx6K8xKhDSKKZ //a0xeSeREzkDaoLkvVZD9+noUAeeuojoBJBrvjHIwZQvr1Iv4Vb4JRT2lVvUnrlGGil F5Bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@eh5.me header.s=dkim header.b=feYgjcSG; arc=pass (i=1 spf=pass spfdomain=eh5.me dkim=pass dkdomain=eh5.me dmarc=pass fromdomain=eh5.me); spf=pass (google.com: domain of linux-kernel+bounces-204168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=eh5.me Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80725408si57957766b.709.2024.06.06.04.25.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 04:25:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@eh5.me header.s=dkim header.b=feYgjcSG; arc=pass (i=1 spf=pass spfdomain=eh5.me dkim=pass dkdomain=eh5.me dmarc=pass fromdomain=eh5.me); spf=pass (google.com: domain of linux-kernel+bounces-204168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=eh5.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8BB7A1F256AF for ; Thu, 6 Jun 2024 11:25:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F045A1957F8; Thu, 6 Jun 2024 11:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=eh5.me header.i=@eh5.me header.b="feYgjcSG" Received: from mail.eh5.me (mail.eh5.me [45.76.111.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2525A160865; Thu, 6 Jun 2024 11:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.76.111.223 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717673126; cv=none; b=Yl8ldJcJZgHIyoeW15BI8T2/COpBu3Cg1TBFAKN7eo4OiUkeNZErCP0c7vBue9a0heLgVNlKA/X4OuhLkB+dikfK7IlpxUoNM3d2MFxvF5BnW9KFpLdvjAMiAUwYkan7dZv2AWtdVBrx0Z8FSGk/BksKlumUTQTMXNe6CxfuV8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717673126; c=relaxed/simple; bh=h/xa4eI3k6X86KwGTxpdw1YXWi5nn9xiWeQAYUex1Ts=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=icdoBuxR0H2nuWPhMEPImXtxO9TvE9KdURhlzmPagxjCV+ONMj/BrcjCiW3WkJ0gbu1OaUa2QID39vOoEZAyrJVuXXxKVXquIegV7uTvWVZ0cQq/LZmlaewKttoeLxU7bmxnMuoUjtiNYSkCk5n3GWedzzjrFoVfqgMeppkp6B4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=eh5.me; spf=pass smtp.mailfrom=eh5.me; dkim=pass (1024-bit key) header.d=eh5.me header.i=@eh5.me header.b=feYgjcSG; arc=none smtp.client-ip=45.76.111.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=eh5.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=eh5.me Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eh5.me; s=dkim; t=1717673121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=00XnzfKyvFc8UCi5vg7ycZAPYKRfP4qnEUVe/4uYGYc=; b=feYgjcSGrXSBzYcCMRnEjsfaeVtDHixqKtJOI1H6dUdgZP5sOU+sqNyV+fB+P6b5td39fw FbmOs60EQFuB978YYMf8NrV1egw8JdOO5l55Asl8TGbu1gVuT/Q0ZwrekbhJAke2iY08EU /K+WNCJxAfJ/gaYnrpOV3DhLkFlNsng= Date: Thu, 6 Jun 2024 19:25:13 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/3] pinctrl: rockchip: fix RK3328 pinmux bits To: =?UTF-8?Q?Heiko_St=C3=BCbner?= , Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240606060435.765716-1-i@eh5.me> <20240606060435.765716-2-i@mail.eh5.me> <3862456.FjKLVJYuhi@diego> Content-Language: en-US From: Huang-Huang Bao In-Reply-To: <3862456.FjKLVJYuhi@diego> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/6/24 18:08, Heiko Stübner wrote: > Hi, > > Am Donnerstag, 6. Juni 2024, 08:04:33 CEST schrieb Huang-Huang Bao: >> The pinmux bits for GPIO2-B0 to GPIO2-B6 actually have 2 bits width, >> correct the bank flag for GPIO2-B. The pinmux bits for GPIO2-B7 is >> recalculated so it remain unchanged. > > I've verified the gpio2-related pin settings via the TRM, so this part > looks good :-) > > >> The pinmux bits for GPIO3-B1 to GPIO3-B6 have different register offset >> than common rockhip pinmux, set the correct value for those pins in >> rk3328_mux_recalced_data. >> >> The pinmux bits for those pins are not explicitly specified in RK3328 >> TRM, however we can get hint from pad name and its correspinding IOMUX >> setting for pins in interface descriptions, e.g. >> IO_SPIclkm0_GPIO2B0vccio5 with GRF_GPIO2B_IOMUX[1:0]=2'b01 setting. >> >> This fix has been tested on NanoPi R2S for fixing confliting pinmux bits >> between GPIO2-15 with GPIO2-13. > > As you said, the gpio3-based pins are not documented in the TRM, > but in your description above you're talking about pins in the gpio2- > group? > > So where did the gpio3-related pin information come from? Sorry I didn't explained it clearly, gpio3 information is inferred from pad name in interface descriptions similar to gpio2's, all those pad name has format of "*GPIO*". So I just search up interface description rows with pad name from "GPIO2B0" to "GPIO2B6" and from "GPIO3B1" to "GPIO4B7" to find potential IOMUX bits definitions. For example, there is IO_TSPd5m0_CIFdata5m0_GPIO3B1vccio6 with GRF_GPIO3BH_iomux[3:2] = 2'b01 setting for GPIO3B1. Maybe I can list all these occurrences in v2. > > Also, could you please split this patch in two pieces, one fixing the > gpio2-area and one for the new gpio3 pins please? Sure. > > > Thanks > Heiko > >> Signed-off-by: Huang-Huang Bao >> --- >> drivers/pinctrl/pinctrl-rockchip.c | 59 ++++++++++++++++++++++++++---- >> 1 file changed, 52 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c >> index 3bedf36a0019..23531ea0d088 100644 >> --- a/drivers/pinctrl/pinctrl-rockchip.c >> +++ b/drivers/pinctrl/pinctrl-rockchip.c >> @@ -634,23 +634,68 @@ static struct rockchip_mux_recalced_data rk3308_mux_recalced_data[] = { >> >> static struct rockchip_mux_recalced_data rk3328_mux_recalced_data[] = { >> { >> - .num = 2, >> - .pin = 12, >> - .reg = 0x24, >> - .bit = 8, >> - .mask = 0x3 >> - }, { >> + /* gpio2_b7_sel */ >> .num = 2, >> .pin = 15, >> .reg = 0x28, >> .bit = 0, >> .mask = 0x7 >> }, { >> + /* gpio2_c7_sel */ >> .num = 2, >> .pin = 23, >> .reg = 0x30, >> .bit = 14, >> .mask = 0x3 >> + }, { >> + /* gpio3_b1_sel */ >> + .num = 3, >> + .pin = 9, >> + .reg = 0x44, >> + .bit = 2, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b2_sel */ >> + .num = 3, >> + .pin = 10, >> + .reg = 0x44, >> + .bit = 4, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b3_sel */ >> + .num = 3, >> + .pin = 11, >> + .reg = 0x44, >> + .bit = 6, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b4_sel */ >> + .num = 3, >> + .pin = 12, >> + .reg = 0x44, >> + .bit = 8, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b5_sel */ >> + .num = 3, >> + .pin = 13, >> + .reg = 0x44, >> + .bit = 10, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b6_sel */ >> + .num = 3, >> + .pin = 14, >> + .reg = 0x44, >> + .bit = 12, >> + .mask = 0x3 >> + }, { >> + /* gpio3_b7_sel */ >> + .num = 3, >> + .pin = 15, >> + .reg = 0x44, >> + .bit = 14, >> + .mask = 0x3 >> }, >> }; >> >> @@ -3763,7 +3808,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { >> PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), >> PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), >> PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, >> - IOMUX_WIDTH_3BIT, >> + 0, >> IOMUX_WIDTH_3BIT, >> 0), >> PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", >> > > > >