From patchwork Thu May 30 17:38:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800710 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9E164D11D; Thu, 30 May 2024 17:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090908; cv=none; b=QJyVYsym4diRJQzVc0bdxWcqjiG5KOIWqyh5UGgddtyclp1POEtDIuwt/0fmVvjgPXsH0uI8dabvWxUsF0W+8LaCBsG/e9ET3Tt81ckEmB73DNzmkTTGpLzzp9EHJhKdxcvKCsaNII/1dofC14N7uFMAT0jOtj+gJ9HU/Ge5k6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090908; c=relaxed/simple; bh=4OENx/LxivoFi1HZbszwtwrrZJBxkD55Rh2bRKyDcYg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LdTl+2fYumRdgukvQRg0EWqfdxnAXRn0G/EVvH2iuzoBGtaLidwsVX21/sjy/P3OEqkvHUIyOkKpOa1p60uY+FJ25GIw3X+pzvecV/+aN/vdCt7Y91CRDc/tWivw9DmCl7oQVeVRv2JIUZall9suVmZrjfYAgFH48Z+t5gDrgVw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U79W2KKA; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U79W2KKA" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1f62fae8c3cso2421365ad.3; Thu, 30 May 2024 10:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090906; x=1717695706; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rQTcKAwRR2CB7qe7k8+Z7X6rFlGpaxJQngY2sTBYIbo=; b=U79W2KKAvPRyZFIhQu0y9D3G/jMEl/I/v2HUCYQLUjS1nqTSolaNs4FUulCstZloV6 89C2B3M1+FcJPe+CCvJfsbPctvMpmsLKyjATX65e8yrXbVZK3rlGjVGKtLIkVGZ+b/tw 6/iHARUckUJZjNLwn7nJ+4Ypdrr0CZCR5eJl92NVXPkY31ax4bErNDveh+VOHr3elbhP SfaM2kP5gabVFXNKuVy6ceQFRNzpH31wYQtfJwJqdGtPLPPWCpmfYCChiWu53Wh4VVA3 ZkBZybL5m6biONaHqaOfrVZgGsX/mJ+xMpEWnHQm7QBAz4XXf4Moj2SsDqCNFmwTquIK l7Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090906; x=1717695706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rQTcKAwRR2CB7qe7k8+Z7X6rFlGpaxJQngY2sTBYIbo=; b=U4GlO3uK1jqWc+lhAfH0cQ1rf/GVgqZfNbO289E1xLDbK9tVWybhBq4Ooz3yh7Rt9f jQdGnHNxHmSN5SjFpOqz8KFqJ0ukfSJlil+7f2rgH9FGUa0k1mcQWFcB55GKKM0Ra9YC hINMKaKedYd43p653dLwSWspVg5o1yHraqZ2aGfB63t+SvcTf9ylQ9npslm3ZNxnAvkx T+YCFVjIHgizQQKJE3lPQxivUBbm9TTxkKz4pkmtA6i7Er5f4JujqZwHCSxLS0AsWojl 8BLK514B+KbJ6XWM4J0ZFbbHZK1P7a0j4QriNmMaZ/n27Xm0g2UMN/FTF/+QN+Gu8DvZ +/sg== X-Forwarded-Encrypted: i=1; AJvYcCXPVsveiWPnOot/hCqLDh9bzDVxCs0nVV0VfFfaYW8WMZM7QvY+gDt/oPLJ7mGe00eY0QctwiVnJ+lcYA5WlOBOOXass+XX0gMf2OaplV6kmjSe7pH0kTfdaWkLIqkl+1gRoHM4QrQ33lu0LHJgYNRU/tlwwDIR/CHaRmLBhaXb/ZQv8gI= X-Gm-Message-State: AOJu0Yz9l3kneJqshMdlcOPPkChKxHGiCLDXbRaAknez9jOAk578viEt ioEZwjINZGGcugZMw361NdO4AzSLBzjHsZ+IXNe0b2G9cnEZ/ydl X-Google-Smtp-Source: AGHT+IGT/+Dx0zzG5wpCUOY69x3j0CHOVBROUy2MlwSdMlvSMPK1hZTLpvx2BhzABEx0AbQUoPgU1g== X-Received: by 2002:a17:903:124d:b0:1f5:e796:f245 with SMTP id d9443c01a7336-1f6192f144fmr31466605ad.1.1717090905801; Thu, 30 May 2024 10:41:45 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:41:45 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 01/15] dt-bindings: pinctrl: renesas: Document RZ/V2H(P) SoC Date: Thu, 30 May 2024 18:38:43 +0100 Message-Id: <20240530173857.164073-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add documentation for the pin controller found on the Renesas RZ/V2H(P) (R9A09G057) SoC. The RZ/V2H PFC varies slightly compared to the RZ/G2L family: - Additional bits need to be set during pinmuxing. - The GPIO pin count is different. Hence, a SoC-specific compatible string, 'renesas,r9a09g057-pinctrl', is added for the RZ/V2H(P) SoC. Also, add the 'renesas,output-impedance' property. The drive strength setting on RZ/V2H(P) depends on the different power rails coming out from the PMIC (connected via I2C). These power rails (required for drive strength) can be 1.2V, 1.8V, or 3.3V. Pins are grouped into 4 groups: Group 1: Impedance - 150/75/38/25 ohms (at 3.3V) - 130/65/33/22 ohms (at 1.8V) Group 2: Impedance - 50/40/33/25 ohms (at 1.8V) Group 3: Impedance - 150/75/37.5/25 ohms (at 3.3V) - 130/65/33/22 ohms (at 1.8V) Group 4: Impedance - 110/55/30/20 ohms (at 1.8V) - 150/75/38/25 ohms (at 1.2V) The 'renesas,output-impedance' property, as documented, can be [0, 1, 2, 3], these correspond to register bit values that can be set in the PFC_IOLH_mn register, which adjusts the drive strength value and is pin-dependent. As power rail information may not be available very early in the boot process, the 'renesas,output-impedance' property is added instead of reusing the 'output-impedance-ohms' property. Also, allow bias-disable, bias-pull-down and bias-pull-up properties as these can be used to configure the pins. Signed-off-by: Lad Prabhakar --- v2->v3 - Updated description for renesas,output-impedance property - Updated commit description RFC->v2 - Renamed renesas-rzv2h,output-impedance -> renesas,output-impedance - Updated values for renesas,output-impedance - Added bias properties --- .../pinctrl/renesas,rzg2l-pinctrl.yaml | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml index 881e992adca3..957b9f7e7de5 100644 --- a/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml +++ b/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml @@ -26,6 +26,7 @@ properties: - renesas,r9a07g043-pinctrl # RZ/G2UL{Type-1,Type-2} and RZ/Five - renesas,r9a07g044-pinctrl # RZ/G2{L,LC} - renesas,r9a08g045-pinctrl # RZ/G3S + - renesas,r9a09g057-pinctrl # RZ/V2H(P) - items: - enum: @@ -66,10 +67,14 @@ properties: maxItems: 1 resets: - items: - - description: GPIO_RSTN signal - - description: GPIO_PORT_RESETN signal - - description: GPIO_SPARE_RESETN signal + oneOf: + - items: + - description: GPIO_RSTN signal + - description: GPIO_PORT_RESETN signal + - description: GPIO_SPARE_RESETN signal + - items: + - description: PFC main reset + - description: Reset for the control register related to WDTUDFCA and WDTUDFFCM pins additionalProperties: anyOf: @@ -111,6 +116,16 @@ additionalProperties: output-high: true output-low: true line-name: true + bias-disable: true + bias-pull-down: true + bias-pull-up: true + renesas,output-impedance: + description: | + Output impedance for pins on the RZ/V2H(P) SoC. Values 0, 1, 2, and 3 + correspond to register bit values that can be set in the PFC_IOLH_mn + register, which adjusts the drive strength value and is pin-dependent. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] - type: object additionalProperties: From patchwork Thu May 30 17:38:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800323 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8141C4DA0C; Thu, 30 May 2024 17:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090913; cv=none; b=egMDa6U/WinAoSNxIsxMuVjXM7He0+43P2iSY0FKhTry0vJScaiVZGkSLi6WbPb0OL8pB/+xZJcm/RSVTcrg2p8gaEqMXflH3C7J3Gy9OFU0hjbqCuOwA1pnYwe8wX7le+1YRf/tVF7KcIdgjJVeqMw9EhfgyeF3fWkBLJwkkSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090913; c=relaxed/simple; bh=j9tL9gpfy7OkyOe6iOCK7oh07vHPJnmcOh9104/JG0o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NLcdPRgIulwMsd/FLFRVU55CQ1Jyrkx3pKxse6ZFvjwkQ7cR4GqPMYEsJ/rmOeQFZVBJ6ikrp+zQYQi4/9OFNzJbBNcUP1OteXd+kV5NzidRiXNp24LO6GEs+knnfAS4kpkGW89fdzJtzECpJQUQ+kGCmp4oHEczWVBKpU37ndg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fu48Eltv; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fu48Eltv" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1f480624d04so10463825ad.2; Thu, 30 May 2024 10:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090911; x=1717695711; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x0V+JT9uI7tYaLEbdfGiVY2aTzIUtUtzYX+9IgVQ/4A=; b=fu48Eltv3vqO/OrW0fNsK6OWyRSdbkLq6Cou+ddUjKL4tp0aPJcJT6EZyoSvcl/ZjM lsODRxsP7RlN0EDKFujlpIhPN6IxZQ1kE5591ETEv3f+/nZEMir0oYoXNwL3AbDG58y5 CEG4ezkZd3mjEvCgCBV4FqJx8/L4gofSRpwAFBrcjO1dte7vMh5h+Zz0DN2WJ21ZAWbl MWF+ELYfG9l2EWdxK6c9/RmWf5KP0G3n0wa/lRvv7cOD1hEnWlKNYnAgISNz0W1vosfs veW31MqalEQ+yth87qbHo0dwQKMfxgNj5Gb+oU1KMSPELMg8aDsJuFXp+MVsBqL5xepX QAZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090911; x=1717695711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x0V+JT9uI7tYaLEbdfGiVY2aTzIUtUtzYX+9IgVQ/4A=; b=U/XaltW/a57wBXLbshErXeDJY4Lhb+0U1HgMDci543G2ufYO7hhny20vB4s3J/rPCl P+4skPlfKIpFPHwBk4KQwYmZTBk/IubNQh5gRgU621VLXEapNbjjwUMdT0+jvXfzgKLZ HFGb6rJsbRwnKV/43lKNt3fYWpq/HkVAJjik5vibf8of2QWP8uWfpwsWKMbTIZ6QXv7N NIG9AJyAfENCMn1URkNbT8tm69pX4nCIX1mtnrwjI1tkmo547K6YyxlIkmMvAMUqN8Ng 0TJ25neeRO/SaWtL9JIaTdnTIiDfRV/+/0SZ/DuQHMDaKscu0Ah+ZifEoIM0SDxXuj2a Lx6A== X-Forwarded-Encrypted: i=1; AJvYcCUpZtuhJC0KBA7YYqoxr4wrPwifL6xEx0mzNxp2Gm8NIG2+BO7+zGXT8ST953eBiDTuAOqtUf+5RCkrOTKy/JIjrtNsGOXplkJmt4VF0VoxlhmfxmEAlp0OJLWVUd463XVB3T8bZRJ8gAxHfBQIsLz2wZkXte32qDrDfJ4/LlcgKzzQGDk= X-Gm-Message-State: AOJu0Yx50n2jrkBUCvYescaUhQNKZrl677MNnCi3AJ8umwYqKVPZgm9D Ru/KLWTOap64NcLtXamNe+Cqlob0hiFhKPhu5jUtRUd7IFTTOkJ9 X-Google-Smtp-Source: AGHT+IHvsc5SBJFpJUXgUv4v0815qZj0FyTxP6YUrK6X3vXHGF1PDTeQxjh6AfACXTLjlIeBo5yU/g== X-Received: by 2002:a17:903:2352:b0:1f4:be9b:d30d with SMTP id d9443c01a7336-1f61960610bmr29089735ad.25.1717090910691; Thu, 30 May 2024 10:41:50 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:41:50 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 02/15] pinctrl: renesas: pinctrl-rzg2l: Rename B0WI to BOWI Date: Thu, 30 May 2024 18:38:44 +0100 Message-Id: <20240530173857.164073-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Fix the typo B0WI -> BOWI to match with the RZ/G2L HW manual. Reported-by: Geert Uytterhoeven Signed-off-by: Lad Prabhakar --- v2->v3 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index f784169abf11..169986022a73 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -131,7 +131,7 @@ #define PVDD_1800 1 /* I/O domain voltage <= 1.8V */ #define PVDD_3300 0 /* I/O domain voltage >= 3.3V */ -#define PWPR_B0WI BIT(7) /* Bit Write Disable */ +#define PWPR_BOWI BIT(7) /* Bit Write Disable */ #define PWPR_PFCWE BIT(6) /* PFC Register Write Enable */ #define PM_MASK 0x03 @@ -478,8 +478,8 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, writeb(reg & ~BIT(pin), pctrl->base + PMC(off)); /* Set the PWPR register to allow PFC register to write */ - writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=1 */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=1 */ /* Select Pin function mode with PFC register */ reg = readl(pctrl->base + PFC(off)); @@ -487,8 +487,8 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, writel(reg | (func << (pin * 4)), pctrl->base + PFC(off)); /* Set the PWPR register to be write-protected */ - writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ - writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=1, PFCWE=0 */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_BOWI, pctrl->base + regs->pwpr); /* BOWI=1, PFCWE=0 */ /* Switch to Peripheral pin function with PMC register */ reg = readb(pctrl->base + PMC(off)); @@ -2520,8 +2520,8 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) const struct rzg2l_register_offsets *regs = &hwcfg->regs; /* Set the PWPR register to allow PFC register to write. */ - writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=1 */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=1 */ /* Restore port registers. */ for (u32 port = 0; port < nports; port++) { @@ -2565,8 +2565,8 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) } /* Set the PWPR register to be write-protected. */ - writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ - writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=1, PFCWE=0 */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_BOWI, pctrl->base + regs->pwpr); /* BOWI=1, PFCWE=0 */ } static int rzg2l_pinctrl_suspend_noirq(struct device *dev) From patchwork Thu May 30 17:38:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800709 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DFEB4F5FE; Thu, 30 May 2024 17:41:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090917; cv=none; b=K0Xcj6a2NiTo6Y8TkMYi5+uySh8DOpEhDM5y3/12aBLFrLjhc6Y9DNBbXp99dbhtTtZJ6o05N1pfg5KzOz4T00X6LSa63OCR3cVreil1Lt4DsoJRdoT8UU6AHRGJhvfweyeoBn2kuX3vknUfsr9f+lWMKclPMLLQlxjIsP+lJ6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090917; c=relaxed/simple; bh=3+wWWlylxn2raLlyLx8WctR838XlUJwYs3q4PDxMLKw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZegrfOY7ppDSQwMW0Sq90VOcWq3xS82X4QigaX0qc+wx7ad0PnHMxjJTeUSVW/XAaBp8v5JF1A69dshIf0CbxPVEkUG+RaELWB1/KDLYFygRk3CbMUJ9kxgBXmc+8mZtEKB2XlJeSdkO9GEkIAChRPdhBrpzzxfCazmS+hQC3a0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VxWF5Qrc; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VxWF5Qrc" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7022bfbb329so955295b3a.0; Thu, 30 May 2024 10:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090916; x=1717695716; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8dl4efaMd6PG7V2ds0yvRn9ev5wtsAt+KazWwpZSZig=; b=VxWF5QrcWOwCVTDXfkfzHFW5SvH4pWNyWtDKnUiNxQDqMa/A+VfprT5ruLgIuIo6hq LA8LGZjoNT5eFKh3+09k34zRF7Y+6XvB5UMauRfh9IVoFW0pbf5K9l/N3W7C8Rmh3Fsk ShVY2kcvzzV3AMPPcx8fPv+Ds83piMw15Uempjs+IJC5v3zjR4vW1medtjYXT9rYKvFb 2Oh1ykWlaypZGuvQVBGDe4McZ8jIrGqQ9JcYRWrp74d39b1J/oiErUq711V3ocEwri5b AAmUso70AReY72Bjhsz94nz0wNtU7iHNs8LdXQ38IVgYqI62vcq1fLQLHlZnl1kLc5ie 2IZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090916; x=1717695716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8dl4efaMd6PG7V2ds0yvRn9ev5wtsAt+KazWwpZSZig=; b=wsHv8BRpBJmSiU0jyTbElj7zWo0N84YA12wLuzbfztM7cuQgPkxHFSYlfrCCtJDSfl IrwEx0doh57qLep2I3sxbMZe+J510SpnopfhOIjL+tMjgVDwgl/zIxXb6m5O52qRgPCe CUXt+TTq+qR8U456hvwh0favEtMMOgmSUfsr9+mmKZY0tw0Cw7CdYzzEZD85dvPthpQ4 VelqeEm5CH02rvmR1EmPLqt6VfapeYuB4suPwn/Hasd8G2z6X09Cw8XmdeaI/v7jKLDu Nur1jRIVn7093jEzB4LrOtzz4+4Vua8nBhMvCG4wpdnyj2IIKk/OvkVNfaTzYG/Kai49 0Xzg== X-Forwarded-Encrypted: i=1; AJvYcCVvgJd0jHYwIZ+091UjGYQdMdRxLMb02j0BXCn8YefaXHcnRZ0msmZJBNKn9ZhOoeZzwUmZbuqiav8jRljZjF1HictiO6lAGJcmwa9i/RIu7XDGHA0VvXQAu7sbK+f/ecrVd+dURgBWXAh3yZ2GJIsRSExAq6dn8S+mj7GIszMFTsx0+JU= X-Gm-Message-State: AOJu0YzuPQTz2ClNF3I7K9FnZ9FWNv8nq5hId1ubQrHV5KSUenAEJNAa L55ehcXt4fqLP1abNC9FqNJJFh+1mt7BQ66UhiMpXw6WcVXdiuIE X-Google-Smtp-Source: AGHT+IEKZ4ZALznb5HGONKn7x8aCOFbdDf8+QAoeuT36TK5j+2lREX+ESCaT2IWmu9cA0wsELnF1UA== X-Received: by 2002:a17:902:680e:b0:1f4:af80:7a3a with SMTP id d9443c01a7336-1f61bf8fa40mr37336795ad.25.1717090915572; Thu, 30 May 2024 10:41:55 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:41:55 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 03/15] pinctrl: renesas: pinctrl-rzg2l: Allow more bits for pin configuration Date: Thu, 30 May 2024 18:38:45 +0100 Message-Id: <20240530173857.164073-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The pin configuration bits have been growing for every new SoCs being added for the pinctrl-rzg2l driver which would mean updating the macros every time for each new configuration. To avoid this allocate additional bits for pin configuration by relocating the known fixed bits to the very end of the configuration. Also update the size of 'cfg' to 'u64' to allow more configuration bits in the 'struct rzg2l_variable_pin_cfg'. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Claudiu Beznea # on RZ/G3S --- v2->v3 - Updated size for cfg in struct rzg2l_variable_pin_cfg RFC->v2 - Merged the macros and rzg2l_variable_pin_cfg changes into single patch - Updated types for the config changes --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 30 ++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 169986022a73..fe810d8dfa58 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -78,9 +78,9 @@ PIN_CFG_FILNUM | \ PIN_CFG_FILCLKSEL) -#define PIN_CFG_PIN_MAP_MASK GENMASK_ULL(35, 28) -#define PIN_CFG_PIN_REG_MASK GENMASK(27, 20) -#define PIN_CFG_MASK GENMASK(19, 0) +#define PIN_CFG_PIN_MAP_MASK GENMASK_ULL(62, 55) +#define PIN_CFG_PIN_REG_MASK GENMASK_ULL(54, 47) +#define PIN_CFG_MASK GENMASK_ULL(46, 0) /* * m indicates the bitmap of supported pins, a is the register index @@ -102,8 +102,8 @@ * (b * 8) and f is the pin configuration capabilities supported. */ #define RZG2L_SINGLE_PIN BIT_ULL(63) -#define RZG2L_SINGLE_PIN_INDEX_MASK GENMASK(30, 24) -#define RZG2L_SINGLE_PIN_BITS_MASK GENMASK(22, 20) +#define RZG2L_SINGLE_PIN_INDEX_MASK GENMASK_ULL(62, 56) +#define RZG2L_SINGLE_PIN_BITS_MASK GENMASK_ULL(55, 53) #define RZG2L_SINGLE_PIN_PACK(p, b, f) (RZG2L_SINGLE_PIN | \ FIELD_PREP_CONST(RZG2L_SINGLE_PIN_INDEX_MASK, (p)) | \ @@ -241,9 +241,9 @@ struct rzg2l_dedicated_configs { * @pin: port pin */ struct rzg2l_variable_pin_cfg { - u32 cfg:20; - u32 port:5; - u32 pin:3; + u64 cfg:47; + u64 port:5; + u64 pin:3; }; struct rzg2l_pinctrl_data { @@ -1081,7 +1081,8 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, const struct pinctrl_pin_desc *pin = &pctrl->desc.pins[_pin]; u64 *pin_data = pin->drv_data; unsigned int arg = 0; - u32 off, cfg; + u32 off; + u64 cfg; int ret; u8 bit; @@ -1185,7 +1186,8 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, u64 *pin_data = pin->drv_data; enum pin_config_param param; unsigned int i, arg, index; - u32 cfg, off; + u32 off; + u64 cfg; int ret; u8 bit; @@ -2413,9 +2415,9 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen for (u32 port = 0; port < nports; port++) { bool has_iolh, has_ien; - u32 off, caps; + u64 cfg, caps; u8 pincnt; - u64 cfg; + u32 off; cfg = pctrl->data->port_pin_configs[port]; off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg); @@ -2459,12 +2461,14 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, bool suspend) { struct rzg2l_pinctrl_reg_cache *cache = pctrl->dedicated_cache; + u64 caps; + u32 i; /* * Make sure entries in pctrl->data->n_dedicated_pins[] having the same * port offset are close together. */ - for (u32 i = 0, caps = 0; i < pctrl->data->n_dedicated_pins; i++) { + for (i = 0, caps = 0; i < pctrl->data->n_dedicated_pins; i++) { bool has_iolh, has_ien; u32 off, next_off = 0; u64 cfg, next_cfg; From patchwork Thu May 30 17:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800322 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63FA25029E; Thu, 30 May 2024 17:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090922; cv=none; b=qZ25oiKH0+RHB/Mr9VUywQRYWqD9ulW5ZEuoKt+eo1kuZJBFYrwSR+r9TwAPY3MwE2uZOeXXY3VdWEi/0OVQJoBl4rWaZs7XyMAmb4G86A3Pxt0c2p4OiYv+pEcwfj+5vPH8hMBiGVi/IxLEr30hInLr78apQmRabIEcchodb1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090922; c=relaxed/simple; bh=npBIA2AN3P3Z9oBXGKns2tbyk+iq2Mkf1hxJByQehpI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dvaQGg/R01OnPNbAtWVfFWx02LyyEUFK5gWWrqt/Tja4bwcrh30aUhi6KknoaCM7U6iC2y+5BYzzS667PmHOIyvfG+f9RWFNotbkOyOZYWjCQayilDhGC+09kwvxoOIiIFtK5cUKZaOjWdINbe6Jpyc8+9NrDaCdzhYlXe1SBB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Vh/fZGfS; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vh/fZGfS" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1f44b45d6abso7986435ad.0; Thu, 30 May 2024 10:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090921; x=1717695721; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9boa91Tqllq1NXO1CCdarz9fWly9uLdvq3LVU3UoO90=; b=Vh/fZGfSTq3U8ksL1pv3YLKcs592FtePeRxILYFmTuJkM2KMXL0kH6O6/hkPKWBNdj xDa0foGKVajjnhKbsmf1oq0Z1VS40YugwqjulT2PXAPxhN48fvfuRbVLRBFQ2g9UIKSM GuVH9uzfFMkHxhNe7HpSX2dnA5w78fOR4EQj/9ptoL0bUqNWR8Pa5sBKrO/sZzUJ/TAd 2ui7HNq3Mp96xxkTtXQKj1wTK/BbfO0jcT9NZ4Curbnm+2Zn/ITQLxZZNu0OVTZGGAu5 7TkkMN2628QZQKs21MWUeLb+4Qv3yOZ+P3a5P/WClkcSENJqScZRowazOX1qk4z2NmOY DvqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090921; x=1717695721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9boa91Tqllq1NXO1CCdarz9fWly9uLdvq3LVU3UoO90=; b=t1cSR9SH/uNlXjG3Ku2ELQouwmKVN/bo7Ukwz+OoKSNDVk7CSqxLy3UT8CPx6mhTTJ yl0gcFcLOZGhCReJkmcdYueOF68KWRoQeffmdNaCDaI9MZm7K9xUSJuYi4LgB/hzQDs3 HbfQ483rFHWncVCc3r6SC2TxP3efwejRwXh3wYNTTSQwHzi1yLjup36Cirb+kqozLQ09 yQbSu2+pZR++An929LV6/eaoBDpQma19MaSYjb+q6QkF1AAn4iLiKa6GpB9euC8YGk1V rLw0BYgXtzLhLes+jQDljFp4T6lz9cewxpGrPBkRZWCCp9poQfWeYwyrF2uPiuYr4nLu wcdg== X-Forwarded-Encrypted: i=1; AJvYcCVsWNI2GdtBth4N+aNgLXDm4G8LN6YxDzcZESB73Et2h9Q72qRm+/D/mc9jK1wRAnQ9WAcBm4h2ty06gxg/VCk2h54s1R3Ve2hanR55jX3CozjKZU2vyyWgIYZ0LiUaGMPRnBnPukssegpnVyFOaMXwTXnyKdfO88nZaMMkvOm/uIkwAHQ= X-Gm-Message-State: AOJu0YxXtQAyicpITGhyKKTJ088uUkEKvk8ooVDM+/t7EzybVxfttQ3A Qx027D2Cs9c55q1SW+dOksZhK78WagLM5eWNEnOBFENTtT5uefSQ X-Google-Smtp-Source: AGHT+IEGo4IAeu8fYpzlsEySYE/Xwsv0HQtvYpHA9yCK99b+/UMqf/3mEQmHe3jESQ8MppdFEsOumQ== X-Received: by 2002:a17:902:f551:b0:1e4:df0c:a570 with SMTP id d9443c01a7336-1f6192f7debmr30816245ad.8.1717090920451; Thu, 30 May 2024 10:42:00 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:00 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 04/15] pinctrl: renesas: pinctrl-rzg2l: Drop struct rzg2l_variable_pin_cfg Date: Thu, 30 May 2024 18:38:46 +0100 Message-Id: <20240530173857.164073-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Drop the rzg2l_variable_pin_cfg struct and instead use the RZG2L_VARIABLE_PIN_CFG_PACK() macro for the variable pin configuration. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 187 +++++++----------------- 1 file changed, 54 insertions(+), 133 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index fe810d8dfa58..84d5882099a0 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -114,6 +114,13 @@ FIELD_GET(RZG2L_SINGLE_PIN_INDEX_MASK, (cfg)) : \ FIELD_GET(PIN_CFG_PIN_REG_MASK, (cfg))) +#define VARIABLE_PIN_CFG_PIN_MASK GENMASK_ULL(54, 52) +#define VARIABLE_PIN_CFG_PORT_MASK GENMASK_ULL(51, 47) +#define RZG2L_VARIABLE_PIN_CFG_PACK(port, pin, cfg) \ + (FIELD_PREP_CONST(VARIABLE_PIN_CFG_PIN_MASK, (pin)) | \ + FIELD_PREP_CONST(VARIABLE_PIN_CFG_PORT_MASK, (port)) | \ + FIELD_PREP_CONST(PIN_CFG_MASK, (cfg))) + #define P(off) (0x0000 + (off)) #define PM(off) (0x0100 + (off) * 2) #define PMC(off) (0x0200 + (off)) @@ -234,18 +241,6 @@ struct rzg2l_dedicated_configs { u64 config; }; -/** - * struct rzg2l_variable_pin_cfg - pin data cfg - * @cfg: port pin configuration - * @port: port number - * @pin: port pin - */ -struct rzg2l_variable_pin_cfg { - u64 cfg:47; - u64 port:5; - u64 pin:3; -}; - struct rzg2l_pinctrl_data { const char * const *port_pins; const u64 *port_pin_configs; @@ -254,7 +249,7 @@ struct rzg2l_pinctrl_data { unsigned int n_port_pins; unsigned int n_dedicated_pins; const struct rzg2l_hwcfg *hwcfg; - const struct rzg2l_variable_pin_cfg *variable_pin_cfg; + const u64 *variable_pin_cfg; unsigned int n_variable_pin_cfg; }; @@ -331,131 +326,57 @@ static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, unsigned int i; for (i = 0; i < pctrl->data->n_variable_pin_cfg; i++) { - if (pctrl->data->variable_pin_cfg[i].port == port && - pctrl->data->variable_pin_cfg[i].pin == pin) - return (pincfg & ~PIN_CFG_VARIABLE) | pctrl->data->variable_pin_cfg[i].cfg; + u64 cfg = pctrl->data->variable_pin_cfg[i]; + + if (FIELD_GET(VARIABLE_PIN_CFG_PORT_MASK, cfg) == port && + FIELD_GET(VARIABLE_PIN_CFG_PIN_MASK, cfg) == pin) + return (pincfg & ~PIN_CFG_VARIABLE) | FIELD_GET(PIN_CFG_MASK, cfg); } return 0; } -static const struct rzg2l_variable_pin_cfg r9a07g043f_variable_pin_cfg[] = { - { - .port = 20, - .pin = 0, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 1, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 2, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 3, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 4, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 5, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 6, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 20, - .pin = 7, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, - }, - { - .port = 23, - .pin = 1, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT - }, - { - .port = 23, - .pin = 2, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 23, - .pin = 3, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 23, - .pin = 4, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 23, - .pin = 5, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 0, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 1, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 2, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 3, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 4, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_NOGPIO_INT, - }, - { - .port = 24, - .pin = 5, - .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | - PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | - PIN_CFG_NOGPIO_INT, - }, +static const u64 r9a07g043f_variable_pin_cfg[] = { + RZG2L_VARIABLE_PIN_CFG_PACK(20, 0, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 1, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 2, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 3, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 4, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 5, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 6, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(20, 7, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(23, 1, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(23, 2, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(23, 3, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(23, 4, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(23, 5, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 0, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 1, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 2, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 3, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 4, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_NOGPIO_INT), + RZG2L_VARIABLE_PIN_CFG_PACK(24, 5, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | + PIN_CFG_NOGPIO_INT), }; #endif From patchwork Thu May 30 17:38:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800708 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15E7C50A6A; Thu, 30 May 2024 17:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090927; cv=none; b=famWvC/ogSzdCeqlFvaZWiv2im8vWc08dLg8ONL6AHsz5+wj0KOshfMIl57Wshv8A6HQ0l8LZ9qBBNvFIuNAi+1h0ew9PNPl19bfFrDzjbDpXtN7FLKOGZJczNdkfrOFx0LwegAD4BKDe83hQjyDhVirPmIT1zdUkPRlkOXGlUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090927; c=relaxed/simple; bh=Y63eZj5ynJlTxp3nqOXtbXsLRO4yqErLE+JF/wE/wa8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NhwPmTdU2CWM/jnICMXj1NO7VLCAJtOnP+7aW4wFFHypR/+D9t6iU/d+SxZ6QvzMfZV2Tmn01iuWLSonBzgdcLac/aotenuboJYc0q3dLFmGfm0c7rC82brD/kgw3BczNcQq7Qhtp4xrfQBMlPgSGWp2r3szkq1X8DeeUss0Ppo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VGCvgbjU; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VGCvgbjU" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f47f0d8ec9so9966085ad.3; Thu, 30 May 2024 10:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090925; x=1717695725; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AiG47SSKhvKKnIa+4m37tigTBR5LjSSvO/WTRu8YSHo=; b=VGCvgbjUGo+R0Sn0IElNSEgM/y9G76CKpNZ9yyMpYYJobKl7stI9wTZXBOT9SNQsHT V9ysMzp1xR+T9tIwb6KoJq0Rmg9jTz9etBqQdboOgROpoqzjrGLrs8uzAj3PcGzg7eid e6FpL1QVXsK3xQvQo27WyzNmI18UBgK7Q/t8LcB/E95n1QVOV7WuJF2M9V7OMHxyJdyG 2iv+8F/KNfqEmnNfMGNSwfoc72ljwmfkUEpxceDoHgO1NmIhEOVBXlIIsEWtMUImBFUV c97TVmqZOebVElHstgPHh3lcv+lsSeztQw+U3hXxhibgaJMv26K+k2l+jhmnuVGlwlMv ynkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090925; x=1717695725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AiG47SSKhvKKnIa+4m37tigTBR5LjSSvO/WTRu8YSHo=; b=GqrbOirHFGeq3E+ISomDO6BOqzFRPM3IR2Z+VCeFh/utBFYu+ACbK0PJnRuO2WFGmI GjOnpcXk6GxxMkneRz1LxfIUt0EQzGEfd2f1EmSE18uL94GvwT2B8fuf0tXknC+zejVK K/lAD20JuZ9CaMwzxO1uKy/2C4TkId6v7uN3oGUuy6hNpDJIrQnZXZIWCBFzFSSVimPM SdLAijtX6crNAwkISRoM/G7Z1+tZL77Gw73QL21ueKReBLVrS+A6unFEKKqM1HF/cdgT ABXVK5mnpjwTwuzFeXabLi3FN4q96U8jhsiKfQwbQwriUyBXEDFvtfnggbJKgmr5FkLn a4pw== X-Forwarded-Encrypted: i=1; AJvYcCVRg0odvk9XwTJW/4CRBrow4TVBA5Tk/E2oJsIbjIdgeHQNcAyD5ZSWUa1LggSYN7YrBGNgC7qjyr8tpMUpMxS9PZ60g6PcwqW+kSSyp2ZVXx5bituNghKBKoVWFzBx3IQHDHVLtelHToGa4ymttmB4lsuMORPuEiD7X+fjXtMeahLsCTY= X-Gm-Message-State: AOJu0YwfVA/6RrGwJ/Xjy+T+V+W85AJ0BnZiVG1dTGcggYbtvxEj0+zL XCmqvLUM/LaoDnqykBYPfR06xHyUg7DC/lc8/sAvE1JZLkfhgXre X-Google-Smtp-Source: AGHT+IEx735/UTJN5pjZSIrJE7MoozX5l9iuKJoGuRlDf9QySZL70tvBmvuKLU1qgUQoPqfixg/HRA== X-Received: by 2002:a17:902:ce87:b0:1f3:83d:ee82 with SMTP id d9443c01a7336-1f6195fabd6mr29893205ad.25.1717090925313; Thu, 30 May 2024 10:42:05 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:04 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 05/15] pinctrl: renesas: pinctrl-rzg2l: Allow parsing of variable configuration for all architectures Date: Thu, 30 May 2024 18:38:47 +0100 Message-Id: <20240530173857.164073-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Enable parsing of variable configuration for all architectures. This patch is in preparation for adding support for the RZ/V2H SoC, which utilizes the ARM64 architecture and features port pins with variable configuration. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Claudiu Beznea # on RZ/G3S --- v2->v3 - Included RB tag RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 84d5882099a0..89716e842c63 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -317,7 +317,6 @@ struct rzg2l_pinctrl { static const u16 available_ps[] = { 1800, 2500, 3300 }; -#ifdef CONFIG_RISCV static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, u64 pincfg, unsigned int port, @@ -336,6 +335,7 @@ static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, return 0; } +#ifdef CONFIG_RISCV static const u64 r9a07g043f_variable_pin_cfg[] = { RZG2L_VARIABLE_PIN_CFG_PACK(20, 0, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | @@ -2219,13 +2219,11 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl) if (i && !(i % RZG2L_PINS_PER_PORT)) j++; pin_data[i] = pctrl->data->port_pin_configs[j]; -#ifdef CONFIG_RISCV if (pin_data[i] & PIN_CFG_VARIABLE) pin_data[i] = rzg2l_pinctrl_get_variable_pin_cfg(pctrl, pin_data[i], j, i % RZG2L_PINS_PER_PORT); -#endif pins[i].drv_data = &pin_data[i]; } From patchwork Thu May 30 17:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800321 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5ABE50A6A; Thu, 30 May 2024 17:42:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090932; cv=none; b=aDekBS9JuQpLdUy6a92j76Sx2tkM+5pnPfoMZyLCtx7BohIhui9rpBPjGHmR4MbOB/BuZ+A2KEYQHESuQshLOXJ8sSog3kyqt4GiWPjjJpPx6KH2bUYibqCMUHggs23WzfhU6Mi3Aelq7KShRlpNcF4mz2KEw4VCmKyrEyNti/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090932; c=relaxed/simple; bh=QlCZRFkms5XUxZAmvyPgDgpBTH0swfmIc3PeTlj+X94=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DHjXmr+/frJStmx6pYhqjODc3LCy+3C0GoFmNLxAvrP5gF4IckRFsneKfPpDsGHCUwq1MLh23aW6n0lcAyiZmjyU3OeXh8TDqlxWY4zz0+tSblWe39nYSKogh3S9lvOmEz68Snv46+QJm4qF9ZXwkK7mVR5tvBUoP3hMCf+Fue0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F8o+K3Aa; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F8o+K3Aa" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1f6134df05fso11069935ad.1; Thu, 30 May 2024 10:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090930; x=1717695730; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7vvOx144hMmKcZJ7FyOqeEE7A5/8Dx8/aLcbQ4I2N3Q=; b=F8o+K3Aal9vKH7ziTUljBfgy3i/kHlJmCMTkMkqcATGSTtIwZFi2GIM0Mfd918+4Rg 5jkHkAhTfQKV54MP37GkE0jLTaoYJ1sslImGA4B0ZJmnWBJM/ixRn9RobIlz8yln/IOg DBVGO/vch4WlvtRWR8FtBAz5fdl9I4s+rd0PmCzdyR6uhIaK6GvLcOJNK4c0UZIjZkN6 tHDz8HN8Ul0Fy+IH85DJvGIsehT6lr5pgQ52MesgEOrFvLyCO9akjBg99yxIf38hAOfp dTeo6dQO1RXcXumaXBHa90Ru5l5PFCJFkmHrBDjJXYaQy2POrafXfzkmk6H4RF9QQ+Jq aSJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090930; x=1717695730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7vvOx144hMmKcZJ7FyOqeEE7A5/8Dx8/aLcbQ4I2N3Q=; b=I6Li4hRgvXxbx6nhb2g0tKlSQqix+W2oNfSVUVx1EjrMIZNGPnJ9JF7kL3T9XWTvqD Zz1YrpovBCa/Vf1iKhlJbi+FWjk33Nn8hn70cvr5YiBZf4flzEA5cHzk/WIOUo3FsNNx 8e2H8Cox7aTYRWnfsWqiPuY3veqlfZq+2t7vk2OAGpYwzmw6mu4IIpfNNAZ1mmxrsXUB FCRHb/jOf/fXjWETbRdKQcvTLnupsM5+iBJvMz012ynkbvRlGpK/bSBrLoGNSgumCrx8 EZ3yV2O0CZyOX2nukLzCF12vMIgh5ckAQuD7ccVgeMzPhjO+mj8Qc8+DAD6CH1Vp36HB WnCg== X-Forwarded-Encrypted: i=1; AJvYcCV7tu1I/Y+eNXx8SQVRutM7zX507MU07YHUbOg9DoENR5JhU7I0GvwsM6UyfnEGt0OqsEWbYQdcTsx+tJ9xCu6Ir8rIIK423DNN/mwvHupKXtVa5Rq0t7lZkQG0V8vfD6epp8e1H5Kb4v39pUagmUWt4p1LfR4NVDNUgUNmGKf3IALb7Wc= X-Gm-Message-State: AOJu0YweBoLW1Oq7ziWXwi7sOIddMZ1rgse/BiaPd6u2yi9t+PABb3jw JnCFZ2aV2AptpFVyFPB/n+nNB3dQK8uZjHbWCAaA2rXVzMUmGXFR X-Google-Smtp-Source: AGHT+IHB2jCui3VjFPaKI7PloPrMkVVNvTZtPUdvEts5gXqfvb/mn1hYNbkWCZztahbizn29JZX7pA== X-Received: by 2002:a17:902:dac1:b0:1f4:b12d:e282 with SMTP id d9443c01a7336-1f619602478mr33686905ad.35.1717090930199; Thu, 30 May 2024 10:42:10 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:09 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 06/15] pinctrl: renesas: pinctrl-rzg2l: Validate power registers for SD and ETH Date: Thu, 30 May 2024 18:38:48 +0100 Message-Id: <20240530173857.164073-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar On RZ/V2H(P) SoC, the power registers for SD and ETH do not exist, resulting in invalid register offsets. Ensure that the register offsets are valid before any read/write operations are performed. If the power registers are not available, both SD and ETH will be set to '0'. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Included RB tag RFC->v2 - Update check to != 0 instead of -EINVAL --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 89716e842c63..6e3b1adb95f6 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -2503,8 +2503,10 @@ static int rzg2l_pinctrl_suspend_noirq(struct device *dev) rzg2l_pinctrl_pm_setup_dedicated_regs(pctrl, true); for (u8 i = 0; i < 2; i++) { - cache->sd_ch[i] = readb(pctrl->base + SD_CH(regs->sd_ch, i)); - cache->eth_poc[i] = readb(pctrl->base + ETH_POC(regs->eth_poc, i)); + if (regs->sd_ch) + cache->sd_ch[i] = readb(pctrl->base + SD_CH(regs->sd_ch, i)); + if (regs->eth_poc) + cache->eth_poc[i] = readb(pctrl->base + ETH_POC(regs->eth_poc, i)); } cache->qspi = readb(pctrl->base + QSPI); @@ -2535,8 +2537,10 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev) writeb(cache->qspi, pctrl->base + QSPI); writeb(cache->eth_mode, pctrl->base + ETH_MODE); for (u8 i = 0; i < 2; i++) { - writeb(cache->sd_ch[i], pctrl->base + SD_CH(regs->sd_ch, i)); - writeb(cache->eth_poc[i], pctrl->base + ETH_POC(regs->eth_poc, i)); + if (regs->sd_ch) + writeb(cache->sd_ch[i], pctrl->base + SD_CH(regs->sd_ch, i)); + if (regs->eth_poc) + writeb(cache->eth_poc[i], pctrl->base + ETH_POC(regs->eth_poc, i)); } rzg2l_pinctrl_pm_setup_pfc(pctrl); From patchwork Thu May 30 17:38:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800707 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15C7B5337F; Thu, 30 May 2024 17:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090937; cv=none; b=r8IQNdW/axizgedtOHrylKreDNiI6lpHEYvX/hh/Hv9ailFVep2P7NNATj6z0GlH5CLhpD5eO6rcn/++KCGnHKdGPN8pYpzdXLsTfRQPAzB/bzDwz4Xux2aTTa2RcQDdeiqBMesbv8TYsjJKFgbt2w8G1A2+kzV/NCKcm9J2LCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090937; c=relaxed/simple; bh=dmafKK4V9Jo7/DvjYcB10vSmxUrMpkYqS/Py8kzLLik=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rfbL8n/f4huX2Lx9Hvtqm0YhCR/Kfjfxdn8M8l9G24DW346l41iVyzVzxpFk86YpXNJqWX1gszcB3V07HBEiKyM5ZAP96DlXwIR+9Nh4XblK9Z4v6C2iFmE6CxKL7wxKa3D+df8wF+BR+cjo6uIG2SZNXC80u/jw3KJfaP+BUIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O5OqNwbb; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O5OqNwbb" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f62a628b4cso3554525ad.1; Thu, 30 May 2024 10:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090935; x=1717695735; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4tfy++x52mBdsaKltNEVDx4b9YJF7xx5k90A9ioo+R8=; b=O5OqNwbbc2xrtN6EbEwvv6C1mOxw1sznOwbZv2RucDuSVoVJbQDMKQHVOaA7t1oLMd 4iP2axHRdQn2D8SeBLO9HEXpjQFiv3KxxJ0RbcqKLG5mN3srkcRipHhSY8BXsnJ1zhNz v1lkWq6PgvHJmjHTZlKVlgWG7Lq89NWmIibQP87MCq2ir3xofjW5F9SxEAdAEOOUpd0k 3VwIg/RjSPMUVddDwy0reHcXjFZJVwlTaMoze/AuyteW0r9vpUh2U/JwP5lhOcbjFOw/ ajmbyB81nF6Uo8a/DWUPDcgZUAsaPB8a3SrERc3ZXGKMW8Q+hSzxi4p0svLkmZ0Uu1SQ SXQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090935; x=1717695735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4tfy++x52mBdsaKltNEVDx4b9YJF7xx5k90A9ioo+R8=; b=gaGVW+o/jqZ7EL9+UOMn80F5RjN7WdIDsCUuoduu9PKM1dz3l/KU+erqWdbz37pgt7 WdgqHBPQKKGFfsHu2PhVkgydD2gdXfeMARdHjl+ja1zaqaVMQt/Ks9UFP4uHtD59S12A kzJ/3hLfoaW2VEPDBsN+Rp6YcHzoL8jhJs9nGsnvgLHF2aaTp1Rz29elYNIsnuD33Jsr IFPk64mUwSVU+BXoNjRIthKN54FZeiYbSQUGsJcanvHaOcyZyAkIHW+kMKgw8gWYJvb1 kB6GSJPjeKy07MpIAtWETE6ZQqXFO5d7vsyAquhvGpS4Tst9lDY6CspJ7KRVFhfu68QU Jzkw== X-Forwarded-Encrypted: i=1; AJvYcCVobYXWkZuqgmVQj+/wVLrszSlB7V2xenapfNONQi+T1uv+LmihS+oLl4qfdPWI3isvOg781O71lhiF9jloQW94lnIaaCAHztZg6lig8dZxQMALYLMeoA4yKLEUpcDQKhW/F0Gq1Bpi6NUo0zHQDA25fztAMvZBsRdq9FFpoupqcvxIHek= X-Gm-Message-State: AOJu0YweyvS2x6myNI38R1IjxlHumFm0IjkdZ9ylbLAQTV3aWz2Oy4bI ZtXKeGbe6bxJJXMAf4R77WC3sSFMyCvgYKJacN5MMh0vBU0IT78x X-Google-Smtp-Source: AGHT+IHK/wexEcRujfhaR44ZVhFrKgeZTaufhD1XRjLYRPwaPmnURN0Pte//dmx1z+oLgh3wxqQESA== X-Received: by 2002:a17:903:2385:b0:1f6:18f9:b764 with SMTP id d9443c01a7336-1f619624a67mr32422005ad.30.1717090935120; Thu, 30 May 2024 10:42:15 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:14 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 07/15] pinctrl: renesas: pinctrl-rzg2l: Add function pointer for locking/unlocking the PFC register Date: Thu, 30 May 2024 18:38:49 +0100 Message-Id: <20240530173857.164073-8-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar On the RZ/G2L SoC, the PFCWE bit controls writing to PFC registers. However, on the RZ/V2H(P) SoC, the PFCWE (REGWE_A on RZ/V2H) bit controls writing to both PFC and PMC registers. Additionally, BIT(7) B0WI is undocumented for the PWPR register on RZ/V2H(P) SoC. To accommodate these differences across SoC variants, introduce the pwpr_pfc_lock_unlock() function pointer. Note, in rzg2l_pinctrl_set_pfc_mode() the pwpr_pfc_lock_unlock(.., false) is now called before PMC read/write and pwpr_pfc_lock_unlock(.., true) is now called after PMC read/write this is to keep changes minimal for RZ/V2H(P) SoC. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Claudiu Beznea # on RZ/G3S --- v2->v3 - Introduced single function pointer to (un)lock - Updated commit message RFC->v2 - Introduced function pointer for (un)lock --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 44 +++++++++++++++---------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 6e3b1adb95f6..a3fd14b95c5a 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -241,6 +241,8 @@ struct rzg2l_dedicated_configs { u64 config; }; +struct rzg2l_pinctrl; + struct rzg2l_pinctrl_data { const char * const *port_pins; const u64 *port_pin_configs; @@ -251,6 +253,7 @@ struct rzg2l_pinctrl_data { const struct rzg2l_hwcfg *hwcfg; const u64 *variable_pin_cfg; unsigned int n_variable_pin_cfg; + void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock); }; /** @@ -383,7 +386,6 @@ static const u64 r9a07g043f_variable_pin_cfg[] = { static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, u8 pin, u8 off, u8 func) { - const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; unsigned long flags; u32 reg; @@ -394,27 +396,23 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, reg &= ~(PM_MASK << (pin * 2)); writew(reg, pctrl->base + PM(off)); + pctrl->data->pwpr_pfc_lock_unlock(pctrl, false); + /* Temporarily switch to GPIO mode with PMC register */ reg = readb(pctrl->base + PMC(off)); writeb(reg & ~BIT(pin), pctrl->base + PMC(off)); - /* Set the PWPR register to allow PFC register to write */ - writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=1 */ - /* Select Pin function mode with PFC register */ reg = readl(pctrl->base + PFC(off)); reg &= ~(PFC_MASK << (pin * 4)); writel(reg | (func << (pin * 4)), pctrl->base + PFC(off)); - /* Set the PWPR register to be write-protected */ - writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ - writel(PWPR_BOWI, pctrl->base + regs->pwpr); /* BOWI=1, PFCWE=0 */ - /* Switch to Peripheral pin function with PMC register */ reg = readb(pctrl->base + PMC(off)); writeb(reg | BIT(pin), pctrl->base + PMC(off)); + pctrl->data->pwpr_pfc_lock_unlock(pctrl, true); + spin_unlock_irqrestore(&pctrl->lock, flags); }; @@ -2439,12 +2437,8 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) { u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; - const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; - const struct rzg2l_register_offsets *regs = &hwcfg->regs; - /* Set the PWPR register to allow PFC register to write. */ - writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=1 */ + pctrl->data->pwpr_pfc_lock_unlock(pctrl, false); /* Restore port registers. */ for (u32 port = 0; port < nports; port++) { @@ -2487,9 +2481,7 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) } } - /* Set the PWPR register to be write-protected. */ - writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ - writel(PWPR_BOWI, pctrl->base + regs->pwpr); /* BOWI=1, PFCWE=0 */ + pctrl->data->pwpr_pfc_lock_unlock(pctrl, true); } static int rzg2l_pinctrl_suspend_noirq(struct device *dev) @@ -2551,6 +2543,21 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev) return 0; } +static void rzg2l_pwpr_pfc_lock_unlock(struct rzg2l_pinctrl *pctrl, bool lock) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + + if (lock) { + /* Set the PWPR register to be write-protected */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_BOWI, pctrl->base + regs->pwpr); /* BOWI=1, PFCWE=0 */ + } else { + /* Set the PWPR register to allow PFC register to write */ + writel(0x0, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=0 */ + writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* BOWI=0, PFCWE=1 */ + } +} + static const struct rzg2l_hwcfg rzg2l_hwcfg = { .regs = { .pwpr = 0x3014, @@ -2608,6 +2615,7 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { .variable_pin_cfg = r9a07g043f_variable_pin_cfg, .n_variable_pin_cfg = ARRAY_SIZE(r9a07g043f_variable_pin_cfg), #endif + .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2619,6 +2627,7 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .n_dedicated_pins = ARRAY_SIZE(rzg2l_dedicated_pins.common) + ARRAY_SIZE(rzg2l_dedicated_pins.rzg2l_pins), .hwcfg = &rzg2l_hwcfg, + .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2629,6 +2638,7 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .n_port_pins = ARRAY_SIZE(r9a08g045_gpio_configs) * RZG2L_PINS_PER_PORT, .n_dedicated_pins = ARRAY_SIZE(rzg3s_dedicated_pins), .hwcfg = &rzg3s_hwcfg, + .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Thu May 30 17:38:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800320 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE68F535B8; Thu, 30 May 2024 17:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090942; cv=none; b=l/RdCjuHJgXYw+rXkakDbv5iyIBGPPbfbAlNK4ehGHvctu4xu3gH0OpLK0xHDh/OL850KDq6dWyzw06Kwijpl9HBjiCb4DRaj6IIyE/utSvlab2AXHj6aALsQrz4mP3eE9f66wD/ZJljH7oUhqIbLxLgXQgtG3D3PAKvoXWF/Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090942; c=relaxed/simple; bh=Ynwo0kdC+1pKIASysskF4pkBy2e8UpPG54AnZTJK0Fk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QuZKl/hAlH9l7SMb0g2YEcUYvl+PHSZMvjAYbyexdXAaMdfY9XN349iV217cuQsGWsDCrtekOntmOZmGDf5gpIVKkaTKZDfRCqH9K8Dde8qXHAHp8tYsYlam68QoTgMwmuf/tibEJz5nmt6As00ZI/r1C59Ogm/f0eProtJl1c8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P3hl755Y; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P3hl755Y" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f47f07aceaso1494115ad.0; Thu, 30 May 2024 10:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090940; x=1717695740; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=erHQArRzkGOGl9DPtQ1+BIrGdqkIkm0QXe4fD8l1GHs=; b=P3hl755YP/sKsbJ3JNRYDzAFRWo7TyIAA1RnhsYNT8OpSlRkbji6zxm+eAiOFcqbMn FxhewZ2CwNzjqPVLSS7Lolodx/wq6QopIcC7JNC/vQ3EJjSJpnbGVzmnMUZWJ6/QeZQd UbWQ2LgqDYN1Oa0wZWo38qPbbD1LJYhf2TghpN5dFVsDYtOzCgD/v7fsYMkKX2/xMFee wDL/Qng6khJHawH6PP6frw+5Rw/izW2BS3msU3PbWvICvku6pKKtXbnuMSevkF3CoXL3 aolLxBgkNbo0ohkrXLTd6TYsTUE10Un1jmJLhQryEJ1oHNsCtSZ/aBu7jK72+7pDkRg7 wlVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090940; x=1717695740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=erHQArRzkGOGl9DPtQ1+BIrGdqkIkm0QXe4fD8l1GHs=; b=vwtrtofedd0gz7GOLs3AcslsNTQ3qyWWoZwpHUOtOiTfgVaFA5TcL/1ovlTBaErRbr ihTUAuWAmLCoaaVTccealhTmzcS6fXjd7N9m36CIT5H4r3trmeRNKZJeD2CCwySNdZ6k GdD5TGdQkqkv8yGHCnyvETBBedm9tOe5/FKTaA4juEPTeJesF5jD0EFxxKJO0+0oqkQ5 vaF0SOznf6vUgEPfSYUysX3rLlX0xRWNzASggmx/eRJdu5ZjmMjS1pNYJpheoZWbrPyL 6qrZqFepcI6J6u4fQOL8BImcxG3H3zt8p2dA8X+UJXifPPxzgJ7rBSeBYpeCeHq49dUA 7M0A== X-Forwarded-Encrypted: i=1; AJvYcCUpgDKdwtZvlek7bXra++q1+bzM5Tj54wGsiW89GwNpZFciv0/itp5KOjTczAbc4IYpH4+2igtMtj3ObKhiH2ZVLRbMfQohg/LMxo95EmVBH7Z6tqUt9qOpB/FkLzuqr2QwJqW9XAfo/9QE7BumaJt96qaxnZGMtjV5apiP11ZwakIOWnQ= X-Gm-Message-State: AOJu0YzyO/2V4zWkXV+zkdyCz3G8M0VfVf1LYn4KcFeRkiVaVpB/fkHj uVtRKpYllPEB0ZK99Fl1SamrDDCoY/k5cMWmj+tykcrWukbDzvgV X-Google-Smtp-Source: AGHT+IGUATWMdJF+8FSF8bVv7WvaBdfOqMxUEeE+1OAJfmuDE2mTw3Z8XLab7zCmj6SOOTkzikVvGA== X-Received: by 2002:a17:902:ec83:b0:1f4:7bf1:71f8 with SMTP id d9443c01a7336-1f6192ed3e4mr31768385ad.5.1717090940033; Thu, 30 May 2024 10:42:20 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:19 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 08/15] pinctrl: renesas: pinctrl-rzg2l: Add function pointer for writing to PMC register Date: Thu, 30 May 2024 18:38:50 +0100 Message-Id: <20240530173857.164073-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Introduces pmc_writeb() function pointer, in the struct rzg2l_pinctrl_data to facilitate writing to the PMC register. On the RZ/V2H(P) SoC, unlocking the PWPR.REGWE_A bit before writing to PMC registers is required, whereas this is not the case for the existing RZ/G2L family. This addition enables the reuse of existing code for RZ/V2H(P). Additionally, this patch populates this function pointer with appropriate data for existing SoCs. Note that this functionality is only handled in rzg2l_gpio_request(), as PMC unlock/lock during PFC setup will be taken care of in the pwpr_pfc_lock_unlock() function pointer. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Now passing offset to pmc_writeb() instead of virtual address RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index a3fd14b95c5a..f8a1a1f2eebe 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -254,6 +254,7 @@ struct rzg2l_pinctrl_data { const u64 *variable_pin_cfg; unsigned int n_variable_pin_cfg; void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock); + void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset); }; /** @@ -383,6 +384,11 @@ static const u64 r9a07g043f_variable_pin_cfg[] = { }; #endif +static void rzg2l_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset) +{ + writeb(val, pctrl->base + offset); +} + static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, u8 pin, u8 off, u8 func) { @@ -1329,7 +1335,7 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset) /* Select GPIO mode in PMC Register */ reg8 = readb(pctrl->base + PMC(off)); reg8 &= ~BIT(bit); - writeb(reg8, pctrl->base + PMC(off)); + pctrl->data->pmc_writeb(pctrl, reg8, PMC(off)); spin_unlock_irqrestore(&pctrl->lock, flags); @@ -2616,6 +2622,7 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { .n_variable_pin_cfg = ARRAY_SIZE(r9a07g043f_variable_pin_cfg), #endif .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2628,6 +2635,7 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { ARRAY_SIZE(rzg2l_dedicated_pins.rzg2l_pins), .hwcfg = &rzg2l_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2639,6 +2647,7 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .n_dedicated_pins = ARRAY_SIZE(rzg3s_dedicated_pins), .hwcfg = &rzg3s_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Thu May 30 17:38:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800706 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E50553E0A; Thu, 30 May 2024 17:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090947; cv=none; b=K4UmNHmqUWCIgwKDOA7WYXKWJQ/FZpXm/zAKpdmCz9KlV2uSI/Iw4a0Zoc+VXuhWey5UK88hWAKWEbuXl5xMwZe5I/wo+xytSrUDdWZyJGZbuXYe6xsBOIyNR4RJWVOtiq4LWf7Kd+c00P9g0mbd+BwI9sa26BCtnTk5cjI/D1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090947; c=relaxed/simple; bh=enrbLfIqbMgsaGiKXaUzTFdWpObNyqhxtAnxQv+OKu8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Gj7okO7e0kTsFTdYABWNT9rQY69CFKNkq7krOvXh6K4MB7WgSkZJHV3gQUDMsVBoGgGIQJdsR++QT3+uGIYKdATASKyChh5k9U9/ZpAUT7JoOTB3TRY3oUtiq8ItOFdqIBaj7yeg/ojgDiLeOpaASsUhohJcWbQWLt+F7NsV8K0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hjm8j4Rj; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hjm8j4Rj" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f480624d10so10052455ad.1; Thu, 30 May 2024 10:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090945; x=1717695745; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r2tib0SqcDm28UJ2V+pduBqYa7NhxgcQli18CyJVXdQ=; b=hjm8j4Rj5uKSgI1kU7nMQuxVGcr2iUaoH+gxl0+esSpVyzTvXhGA/ucSO4qJ4xVsJi l6g5LRT6Lo+woAHnAjAWw0r3k/ld9YqtkS9md7sB9ldi+bN0cAeQJxFepFDri0itpPpH Yh7h4AAL9q3f6Q6k1QXjlYB7fvjIMLjUdftVNDr9TifstsOp8POXXuJuppuPnz6thGol eveEpTIZ6vwwDJrpbBwQ+BC7epRVkHu8Af3umKeG6f4k+HVgYY4rsiHyi0g06RlEfnDI BBgAFfEXkmItjm/bfLFS3IVJ0rP9/hkEhSk5hilBVrgqB5xmRV7XJQ7FDpG6LV/SVMbu t0Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090945; x=1717695745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r2tib0SqcDm28UJ2V+pduBqYa7NhxgcQli18CyJVXdQ=; b=plcMMJx2C3HAzreYvKKu5vuisYWj2p0q+Ilj0iwBK7maKYK85IWyX71L/T/lfPVGxV V6GXKccB030DbFxuaOMZ0+2UCa41/xdTmjJTVFJSNggaLD0hAd2o1BshWieLXnhJJyzu XTW/5oxLQL2FBu0fmJ81v8vQyiJTrZximdE97ADaR6ULu59yXmQLJ811S6GE5sp7MbnL T2GVrp9qZUtyxuiJkIYdmFk2ADT7nkWT2j6FsUHPzBQ+LfiBYUauIODiyhdrRAIrPLh7 JNUd8AM5NGt/+L5V5SncGl1dghudnP2vEsEPchGsgVrZfPReXxl/ilqRAVOmoCWf11mm oCSw== X-Forwarded-Encrypted: i=1; AJvYcCUzlS/9kuPGGEaz5kAyTaUf+avQWRi52ua2DYmJlXVHE0C39Z1UqUC3/iY8EY9WZjakf9h9ZRcJ9ygXE2TTCKPSzgkDJQisgDXTIOTGPeOcaZncPDoI3/93V/OW8H3d3lqe/jScSWuFu1Ru9kXdYpD5xcrLZxkXZex744b3UwJiad8H47s= X-Gm-Message-State: AOJu0YyUjO9OHbL/KaPeDPbCtGHY7gIIz0F3LOw33qx7oF+lIN8B4D+v sQwegrlOV5fG2xU90YkGE1i0uS49sMvuMBMmjDM7B0sE1qS7bCuQ X-Google-Smtp-Source: AGHT+IF49NPt3yYwEhLZK1bI0CuirM7vxrcUBJu1IoxUjvZ1x/XkLlE07vTLdsiCbkyp9LMZgKJ+jQ== X-Received: by 2002:a17:902:e882:b0:1f3:b9d:87e6 with SMTP id d9443c01a7336-1f6192f06e0mr29661625ad.8.1717090944939; Thu, 30 May 2024 10:42:24 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:24 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 09/15] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for reading/writing OEN register Date: Thu, 30 May 2024 18:38:51 +0100 Message-Id: <20240530173857.164073-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar This patch introduces function pointers, oen_read() and oen_write(), in the struct rzg2l_pinctrl_data to facilitate reading and writing to the PFC_OEN register. On the RZ/V2H(P) SoC, unlocking the PWPR.REGWE_B bit before writing to the PFC_OEN register is necessary, and the PFC_OEN register has more bits compared to the RZ/G2L family. To handle these differences between RZ/G2L and RZ/V2H(P) and to reuse the existing code for RZ/V2H(P), these function pointers are introduced. Additionally, this patch populates these function pointers with appropriate data for existing SoCs. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Claudiu Beznea # on RZ/G3S --- v2->v3 - Renamed read_oen->oen_read - Renamed write_oen->oen_write - Updated commit message RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index f8a1a1f2eebe..807851c33e48 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -255,6 +255,8 @@ struct rzg2l_pinctrl_data { unsigned int n_variable_pin_cfg; void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock); void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset); + u32 (*oen_read)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); + int (*oen_write)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen); }; /** @@ -1035,7 +1037,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, break; case PIN_CONFIG_OUTPUT_ENABLE: - arg = rzg2l_read_oen(pctrl, cfg, _pin, bit); + arg = pctrl->data->oen_read(pctrl, cfg, _pin, bit); if (!arg) return -EINVAL; break; @@ -1144,7 +1146,7 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, case PIN_CONFIG_OUTPUT_ENABLE: arg = pinconf_to_config_argument(_configs[i]); - ret = rzg2l_write_oen(pctrl, cfg, _pin, bit, !!arg); + ret = pctrl->data->oen_write(pctrl, cfg, _pin, bit, !!arg); if (ret) return ret; break; @@ -2623,6 +2625,8 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { #endif .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2636,6 +2640,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .hwcfg = &rzg2l_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2648,6 +2654,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .hwcfg = &rzg3s_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Thu May 30 17:38:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800319 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC60954747; Thu, 30 May 2024 17:42:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090953; cv=none; b=tXCYTQOwor/cSlUXx2bmO3QVTwUy+JBiLygHDhgb3qN0Em4o0fCjstFHZ3X0VQaAiCBt5ikhYBKGG5D2zL9pbNdFX38V9TbJIr9Ot/ehO7i2kWf368LSYyZM+eo7ioJLEiMWzeYmbZSJ9c+Z/8GBSUMghw27D3tUZ7OLp6UD0XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090953; c=relaxed/simple; bh=p7r0INwKdRWb48rWdh8TKxHgYlfbC3bweA28z1yvs8k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KAKFfBxXQ4ze7V/RNoPZLHGxhsD83lrULNlh5Pgdn+lhJDBicD7x91Q1Arjrjazl4GoYWUZ6RgloEjBqMHQy5HiBliw3QrlNLG0Fn1+oI6R0bcwKFQcwfZj65MwP1hDMYxdOJrZ6qSU/kilyzDUUwSZZ1z1eGewazlgOF8eXcC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HDwF9ntH; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HDwF9ntH" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f62fae8c1aso2048195ad.3; Thu, 30 May 2024 10:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090950; x=1717695750; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GuqYrTdiqIXrKd3pr++y5Sw5lUnemumcABKGe+QWJdU=; b=HDwF9ntHykrMhOhs5HkfRE8R6Uwg6TptC8PXFQUr2p8TFpUjPD+FCHxIv5DuuRNgoI 9wgH2sE2N9cErEnETrebFYgx4N8/JzHwOtow3xeKMAqeuo5mfDIIweR7Tc0dpYyJhPtS Qa/K3MclHIv42KMLY8TZnAEfzLUSjDggxEcbOhpon3c7iyh4PBPmnw3sai0/yqYmyQAi 3jcCcnFVGWpyD2a5ykWfdktJKFkyBltbE+ad1g09NRQvtixxtvdr6YJOckfpJL/HG9RU u0yYgvt3hhmyahVJOVE3WeaeQweSa+WbxW6mLEDewfw7pMHmg0vZXKPSmpY2VfWxyLoR z3PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090950; x=1717695750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GuqYrTdiqIXrKd3pr++y5Sw5lUnemumcABKGe+QWJdU=; b=lVX4EMbLY04zww4wbwP+DIviCmhhQfMXvXhHsK+4/PeBSLUuxwmn2sNFw+p4ogFESX HQTqR0WaLdIWV+hYBF1bdiwuJcUntNmmN/I+RsM8w+Z/RBkJwH86REBeJa+TObNGj6HR JxrK9m7ElcPw4zcitFphjvAFdJjd7lLcnlRH0yWH7vCbkUGvM733cs3QTJGnI/cJ+iR4 thMhcQkZsuTgJhauuxPCIHa3oFyUg4NtySeVLjYxuCAtI45FHbEfc9KYJcv0v06YL3Bw z5EX4NECo1UUhgmNf4PqKx/BSFJxr1A2pjcc0EwuZHRuM39jzmuVCZIe2diDd23oDTY6 /USw== X-Forwarded-Encrypted: i=1; AJvYcCWjj7mMNg2NYAw8ZApCqaPGIbwQtA+tVWJSEs2Y3MgaRmgVhgx5vdgMnCq9hUNL1IYvk8klYoenTndzxyiQD5M/XNWx+847x/xuHN9L6fQdjHVifElhIH+jz/xCkTWlUDHDkFB6IOWH1Hj0svPN9+31LTGT844UeDqFutyX/Tu4GU21Zd4= X-Gm-Message-State: AOJu0Yy2aAGR2fvwNg4wkq/y7gCBxykv/0KHtGq59ao2eDPaJaek61QO ki1Lyz2gTHEJlmXLJnBwq50uGZjLX7RjaB1C9Agqp6mmXFzoDZgDWwEodx+sNP4= X-Google-Smtp-Source: AGHT+IG1oulmJfkwr3qxRokPDnuzY03Qxkcp+yp1ih+aCj/GJy+riNXuIwLPJ7bg1aXekrIkh0iWtQ== X-Received: by 2002:a17:903:228a:b0:1f4:5ad1:b65e with SMTP id d9443c01a7336-1f6197271a5mr33858015ad.34.1717090949791; Thu, 30 May 2024 10:42:29 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:29 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 10/15] pinctrl: renesas: pinctrl-rzg2l: Add support to configure the slew-rate Date: Thu, 30 May 2024 18:38:52 +0100 Message-Id: <20240530173857.164073-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add support to configure slew-rate property of the pin. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Included RB tag RFC->v2 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 807851c33e48..6b82e78afa7c 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -127,6 +127,7 @@ #define PFC(off) (0x0400 + (off) * 4) #define PIN(off) (0x0800 + (off)) #define IOLH(off) (0x1000 + (off) * 8) +#define SR(off) (0x1400 + (off) * 8) #define IEN(off) (0x1800 + (off) * 8) #define ISEL(off) (0x2C00 + (off) * 8) #define SD_CH(off, ch) ((off) + (ch) * 4) @@ -145,6 +146,7 @@ #define PFC_MASK 0x07 #define IEN_MASK 0x01 #define IOLH_MASK 0x03 +#define SR_MASK 0x01 #define PM_INPUT 0x1 #define PM_OUTPUT 0x2 @@ -1049,6 +1051,13 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, arg = ret; break; + case PIN_CONFIG_SLEW_RATE: + if (!(cfg & PIN_CFG_SR)) + return -EINVAL; + + arg = rzg2l_read_pin_config(pctrl, SR(off), bit, SR_MASK); + break; + case PIN_CONFIG_DRIVE_STRENGTH: { unsigned int index; @@ -1155,6 +1164,15 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, settings.power_source = pinconf_to_config_argument(_configs[i]); break; + case PIN_CONFIG_SLEW_RATE: + arg = pinconf_to_config_argument(_configs[i]); + + if (!(cfg & PIN_CFG_SR) || arg > 1) + return -EINVAL; + + rzg2l_rmw_pin_config(pctrl, SR(off), bit, SR_MASK, arg); + break; + case PIN_CONFIG_DRIVE_STRENGTH: arg = pinconf_to_config_argument(_configs[i]); From patchwork Thu May 30 17:38:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800705 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66A3A4F5EA; Thu, 30 May 2024 17:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090956; cv=none; b=iNEYZ4IPW6c9F05GXCzRCKs2urd3DMB+9BmnYc9ELTpjaTbl4mQDcKD5mI3A2oiwMnd0FEZE/bwzUCET6UrQe0FRAGrnOIAEtLphlaFGr80ODvRaSESnxIftJGDKJu1giBzZ8r30X7GQhommKQ/2Teul8RQMIbd0sLNct39UoZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090956; c=relaxed/simple; bh=q0csrNRsixEX0TyQyIu5xaVSDKbgOtS1QmtlSnL9s9I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kIQvZkQKZa8H1rZ1AqsVP0q4vr+9WtGoaNQ8onX885peZ4ObmIxqLV5mYeYhizWm+8uA8SryfQVkTneaUUIAJ7mVTFbPHTJjY3DoWX1bbG/IR3+N/9XC2vxfKy7uBw+je5GMui8IMO86UY0vSjsW2VEnfslesR8vZzUrt3mW5+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m2FUvWEe; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m2FUvWEe" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f62fae8c1aso2049095ad.3; Thu, 30 May 2024 10:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090955; x=1717695755; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+NLOuHzEcMgVIytxEmRGRAjntJCNFity9U+tUnuma0Y=; b=m2FUvWEelRqfs8q0b5/tlb/eC0QFwyKq448pROYxgc0kdPpKre8UMYNEjA6NGM7N8X rBDnaSWTAnKGGmTEx0tc0E922+5bvxLe29hC/IaWSn52LGYlLnq9ahViit05i2jbsDRZ EsDJdK0oiYh7lrOxKFnq3i1Ngi1CVHSb1wsAmRr0YcIndcwEXW2SqekM9XRS+aoKfbXN uOjG0kAsNIBVdZTe06sQ38ocm9hMfwNPt4CxlqsaG9tYMFyTNpU0l5fjv8FAcU3cdTwR WllUWycHob3hZSfX/xzKfZz2PCt6sVPStxQRf5fLSK0qel8wxq0gRkUqTI6gNgDq7cMl 94Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090955; x=1717695755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+NLOuHzEcMgVIytxEmRGRAjntJCNFity9U+tUnuma0Y=; b=b7ackqMXQgfHqiwwzPXjB9BTrT4yGpSRoieLY9YDevsVUr2myd2DsZIWD2hNGG801g aynlJfUcH4YdCuLU2lpNVI3nbc8/fmeWcJcKa/DXfzRb1qVPVdm4rBKUw8pqfB3TMxUf AagZGyKE6ejkL6e5f9NotoaODk8f/MetC84pPRbf2gflOcOe2NvekLtV3lwFEO+YU0N7 slZBiOvkCwDT/TkfFftdwO46VH023zrgLSQiuSmwoed+qHatpji+7oZo28CBssJnjs5T knhZyLW/lOVAfatUHLWX0p3+yDJph2hw8G8HEFGC7uZ2qnMh1cRnWMjUhCUJDHQmZCi4 cscw== X-Forwarded-Encrypted: i=1; AJvYcCWadGZRugf1e8SCZecoThJc+/PZIY0TryXKuvs3GUszgQ6eyo1VmZwLhIxPCB2wB9LjigTIHgDYhqEjE79SfTPBd8mHqn6nC+PD3izzt/LtwpE6rKrB9XcA8Ut40qpUUpNwxucGdqJ4ApvxHNzhJoW05bIVeTaJLCjGuXggTOj9vOuLpjA= X-Gm-Message-State: AOJu0YxGpB7B2EsyNMiFBX0i+hY+8ev4I9bnhaHcvgyEvZ+yckxXtLNk k37naexIQIBWuT5dPwQ4Icv18nvF+8MiAESA4DUlzYjwwZoamX+b1a2/INIbQf4= X-Google-Smtp-Source: AGHT+IFGnWu3K8laDIcig7kEnnq0Sz3AfcAYYzhWSFDyDw/nwL/I5DRG2GX1mYAB4rzSLFHA2G6mMg== X-Received: by 2002:a17:902:f548:b0:1f4:a008:29d3 with SMTP id d9443c01a7336-1f6195f9ac8mr32031535ad.15.1717090954665; Thu, 30 May 2024 10:42:34 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:34 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 11/15] pinctrl: renesas: pinctrl-rzg2l: Add support to set pulling up/down the pins Date: Thu, 30 May 2024 18:38:53 +0100 Message-Id: <20240530173857.164073-12-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add support to configure bias-disable, bias-pull-up, and bias-pull-down properties of the pin. Two new function pointers, hw_to_bias_param() and bias_param_to_hw(), are introduced in the struct rzg2l_pinctrl_data to configure bias settings, as the values in the PUPD register differ when compared to the RZ/G2L family and the RZ/V2H(P) SoC. Value | RZ/G2L | RZ/V2H --------------------------------- 00b: | Bias Disabled | Pull up/down disabled 01b: | Pull-up | Pull up/down disabled 10b: | Pull-down | Pull-down 11b: | Prohibited | Pull-up Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Updated commit message - Renamed get_bias_param -> hw_to_bias_param - Renamed get_bias_val -> bias_param_to_hw - Dropped un-necessary block {} - Now reading arg before calling hw_to_bias_param() RFC->v2 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 72 +++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 6b82e78afa7c..e60049b66203 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -129,6 +129,7 @@ #define IOLH(off) (0x1000 + (off) * 8) #define SR(off) (0x1400 + (off) * 8) #define IEN(off) (0x1800 + (off) * 8) +#define PUPD(off) (0x1C00 + (off) * 8) #define ISEL(off) (0x2C00 + (off) * 8) #define SD_CH(off, ch) ((off) + (ch) * 4) #define ETH_POC(off, ch) ((off) + (ch) * 4) @@ -147,6 +148,7 @@ #define IEN_MASK 0x01 #define IOLH_MASK 0x03 #define SR_MASK 0x01 +#define PUPD_MASK 0x03 #define PM_INPUT 0x1 #define PM_OUTPUT 0x2 @@ -259,6 +261,8 @@ struct rzg2l_pinctrl_data { void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset); u32 (*oen_read)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); int (*oen_write)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen); + int (*hw_to_bias_param)(unsigned int val); + int (*bias_param_to_hw)(enum pin_config_param param); }; /** @@ -1000,6 +1004,38 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 return 0; } +static int rzg2l_hw_to_bias_param(unsigned int bias) +{ + switch (bias) { + case 0: + return PIN_CONFIG_BIAS_DISABLE; + case 1: + return PIN_CONFIG_BIAS_PULL_UP; + case 2: + return PIN_CONFIG_BIAS_PULL_DOWN; + default: + break; + } + + return -EINVAL; +} + +static int rzg2l_bias_param_to_hw(enum pin_config_param param) +{ + switch (param) { + case PIN_CONFIG_BIAS_DISABLE: + return 0; + case PIN_CONFIG_BIAS_PULL_UP: + return 1; + case PIN_CONFIG_BIAS_PULL_DOWN: + return 2; + default: + break; + } + + return -EINVAL; +} + static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, unsigned int _pin, unsigned long *config) @@ -1058,6 +1094,23 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, arg = rzg2l_read_pin_config(pctrl, SR(off), bit, SR_MASK); break; + case PIN_CONFIG_BIAS_DISABLE: + case PIN_CONFIG_BIAS_PULL_UP: + case PIN_CONFIG_BIAS_PULL_DOWN: + if (!(cfg & PIN_CFG_PUPD)) + return -EINVAL; + + arg = rzg2l_read_pin_config(pctrl, PUPD(off), bit, PUPD_MASK); + ret = pctrl->data->hw_to_bias_param(arg); + if (ret < 0) + return ret; + + if (ret != param) + return -EINVAL; + /* for PIN_CONFIG_BIAS_PULL_UP/DOWN when enabled we just return 1 */ + arg = 1; + break; + case PIN_CONFIG_DRIVE_STRENGTH: { unsigned int index; @@ -1173,6 +1226,19 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, rzg2l_rmw_pin_config(pctrl, SR(off), bit, SR_MASK, arg); break; + case PIN_CONFIG_BIAS_DISABLE: + case PIN_CONFIG_BIAS_PULL_UP: + case PIN_CONFIG_BIAS_PULL_DOWN: + if (!(cfg & PIN_CFG_PUPD)) + return -EINVAL; + + ret = pctrl->data->bias_param_to_hw(param); + if (ret < 0) + return ret; + + rzg2l_rmw_pin_config(pctrl, PUPD(off), bit, PUPD_MASK, ret); + break; + case PIN_CONFIG_DRIVE_STRENGTH: arg = pinconf_to_config_argument(_configs[i]); @@ -2645,6 +2711,8 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { .pmc_writeb = &rzg2l_pmc_writeb, .oen_read = &rzg2l_read_oen, .oen_write = &rzg2l_write_oen, + .hw_to_bias_param = &rzg2l_hw_to_bias_param, + .bias_param_to_hw = &rzg2l_bias_param_to_hw, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2660,6 +2728,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .pmc_writeb = &rzg2l_pmc_writeb, .oen_read = &rzg2l_read_oen, .oen_write = &rzg2l_write_oen, + .hw_to_bias_param = &rzg2l_hw_to_bias_param, + .bias_param_to_hw = &rzg2l_bias_param_to_hw, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2674,6 +2744,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .pmc_writeb = &rzg2l_pmc_writeb, .oen_read = &rzg2l_read_oen, .oen_write = &rzg2l_write_oen, + .hw_to_bias_param = &rzg2l_hw_to_bias_param, + .bias_param_to_hw = &rzg2l_bias_param_to_hw, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Thu May 30 17:38:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800318 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58267558A4; Thu, 30 May 2024 17:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090961; cv=none; b=aJzc0hkvRRSVAqwpXq2NLnQILgXYY/fMcoa/qaKLMOxUgHD76zSM30zUAL4v33SiYLH24rkOtYNx6CifW697KCcyz0Fk4MMLwhpKD5VxHOcV8qK1cSkHuAlUkLK4refHG3jE1uKZm9Qsvwhv+2pr+aN0pP8MfwuQjcdnPTeTP/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090961; c=relaxed/simple; bh=YnGPCLS+ou+N9rrc2pH7ZjLQeq1ssWPcY0dePVLp8wM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D18tUl7Nc6fOAAt2kTiaYEApw2rAtSBu5cdpx+r04+QLJdy77QOJfRFBf73UC+MiY7KbwfRMCXuyh/B78iBSC9qD4p/VebcJjq8iG0Vy2F2OXu12rk3oinkFsqIsWp85mjE9gfO4rZ2en5HeckLubPTlyu/0Mo9amhBRVTM/v/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jR0fAmUc; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jR0fAmUc" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-70231566377so889427b3a.0; Thu, 30 May 2024 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090959; x=1717695759; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KOPkcCLUqT+qwmWUiEY2AMuOiTv2xstNir1iU4Gtb0c=; b=jR0fAmUciTgUIzIzqsNQixsWpp+eVjsobgCfUhXHyAeKJBhkb09lKIMeiCY8ZUVi9t CiVOQHDj7FaX3dvGJ8yeNFkOeNAy/A6TtmraF1tsYGm73jh3FOnfiidahdNNXJuV+JA0 JiMofjxeaavUMH6DE+SPfEwhhdpkBhF4RZUDcAr9PJ+YM1GrYvdREP/glIqt4ge2osuv MHDgh1rSsw2KIpm9DisZme0y6L4ekdN3lUY9PCNIcCn3PwjlzTjJj60bt3zMPpGO2Rjr 8/YkLocURpBhN4aSNCIMwY8IK+6zTuPaHc43HkewKxnYCvEdMGQRErC/ivYa+hGkVBss 7gEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090959; x=1717695759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KOPkcCLUqT+qwmWUiEY2AMuOiTv2xstNir1iU4Gtb0c=; b=AH7PsRv0VMtAhxImOhdNER8OEsU6vC7Sa61W6wk8U2ZUK6OHkNbcYGuqwQVxSneFWq jpjT5cro29htanVtRRagOs8+NnTjk+jYxkNG4zaQtemxaDSnhk2DpD1/KV51cTTjEfiT E1yU4g0tOpuNZLCi8QcV2540HxOabqRqmnOo3W6riJcpHntw5vAx5VG6VDHIsNOE40GA v/6HtOXgif1WvTpeT6WlkxglXawdNgeF0r/15l4yHDDqwj4lveJxzIaII0POJwyltjJ7 ETap2Yh31SsFGa8AsrWDAjA/l0s41PenWMF5Vaq4UyYjrRliTNfPhXPcILMq63t0PXX5 x2AQ== X-Forwarded-Encrypted: i=1; AJvYcCUofPwziRKyHQcPJgzY2KMU35THpfNksYzpDY4/fCAjKRy2bEZ9atg5K9Yc1IEyL6Pe2Yz0qFGCorwMcDFVsqg1PdMuMePLtYStPHK/x+A4P1uOiNZPyw+jK846/4gPwR7FnI4M04e+nUFscSWMusCa1pzIC2TjoJHyJdd+pHcIi83FYxk= X-Gm-Message-State: AOJu0YwgmAQyLNCGkXXFgXA9Lvf1uI4hsfmGfsp9J0jQBdV2bnFJL4pK Jfs8yJXpcLNd/WrK96lt63mvBu5yHqtWy/yWEhDJw2RsyI890hJc X-Google-Smtp-Source: AGHT+IFx7VInUG2NFOA9YQpsTQeRct+UMrQxhh+ZEAzGqINZCPes7Mr+g9AfRxHBFG1ToL1B74MNMw== X-Received: by 2002:a17:902:da90:b0:1f4:8d80:2352 with SMTP id d9443c01a7336-1f6193f8a95mr30753285ad.16.1717090959566; Thu, 30 May 2024 10:42:39 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:39 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 12/15] pinctrl: renesas: pinctrl-rzg2l: Pass pincontrol device pointer to pinconf_generic_parse_dt_config() Date: Thu, 30 May 2024 18:38:54 +0100 Message-Id: <20240530173857.164073-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Pass pincontrol device pointer to pinconf_generic_parse_dt_config() in preparation for passing custom params. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Claudiu Beznea # on RZ/G3S --- v2->v3 - Included RB tag RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index e60049b66203..ea1a08d272a1 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -532,7 +532,7 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev, return -EINVAL; } - ret = pinconf_generic_parse_dt_config(np, NULL, &configs, &num_configs); + ret = pinconf_generic_parse_dt_config(np, pctldev, &configs, &num_configs); if (ret < 0) return ret; From patchwork Thu May 30 17:38:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800704 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 386B85645E; Thu, 30 May 2024 17:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090966; cv=none; b=qyrP6zNwI2YSxz1b9MIf/S0v4ux5DnXoLfba3UMJaBmWWiLmKAgYdsEtO5PmI6CTPsorzvnRT3AyD7WKRNR5UnuXpMAX6Ctpqq4kTy5U5tUCaVJ0i1RvMTwvYyBPAvWpP8d3QZobDEgf4NHexfrsRy/aD0aZy8e3/jE0z95ppyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090966; c=relaxed/simple; bh=3eAbKEfxVTcMI/6I9pTwIhtxQO8OZJf8Aa03p+FRuOI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PtncJSBs1sHSYz6Qq0A32rwcoKuUdo+B7Zqo3L+eU8BKvn066a2TVN7AlXaoJ/0428IUMiodiaqt8fAj406HvA+JvUxcAOWYUOc7vijXdxznmiX7ol3YwlasMlf/2u+hrWVs9c0QJKIQatxmD3ihmawe3cU8N3KEaZit3kteUoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LhEfdUNm; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LhEfdUNm" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7024063f5b8so258544b3a.1; Thu, 30 May 2024 10:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090964; x=1717695764; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G8ykFvUb+nRh/+RpX+Jt37vnbk6kntRwrp6YI471X20=; b=LhEfdUNmTInWw9qB5maCsw1IFYIFubi966kIzxXnWKIpc8MwPGLYfStwdkeL5a/29k U11aCkvIp3jK4inMyL4At28Vol0PCvzf19lwPHn9qX4ptGYgt3EHRUs4UbbKy4xBMAXg OXDigKFPABjFq6ageNTuz976odxjWetfFs6X5gHmGaY8b1WpDoBLAS4prVZ8mDoDFyVo IBlIX7gmyxes2V9LKA18cb+e1dzx7CPhNDOAdFfEOj8fo2nV1uYT8isxQdArm7gh632a YMMcdjdhpZuBZkuSTJoDRbSjKbJEcansYywcSzhTJC9lNogLwuZuyqOeGiUPfW7TZAdG KPbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090964; x=1717695764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G8ykFvUb+nRh/+RpX+Jt37vnbk6kntRwrp6YI471X20=; b=NoF5dG/a0tcUQmnMCA4EnSHYmtxSy+frfprz85EvJSqkCu2oS/AXtylImK55XVFDvx u5pBbRBeQZ5MeVhCuAsmNdx3qY0KbsOHUxp6VXmu6eb+dLmN2NpqM3hAT3L90tXlkUp3 4g8VrHYRvgxVC2rt+dOS6i3sx8jSO8SmQIm5ABzzOcsHy2SfdKNZznfNX5e+5QtVc1Pb gWzJTIQvM1sDD/s6hFEgdhx6sQQx99/UYWuvjto5GbuZZIG1QaD/nARVFJlLdY8y9KSs W1wRn+y9evYevatP6V5225LJcAoeDz76x8yCadSj16eKH0DNI/kHEZBOltMuEpldW9yk b2oQ== X-Forwarded-Encrypted: i=1; AJvYcCXT0KZndXTuWKXxecHqyvryRSwmUEJ5yIk3n8Ol5rPAlQU60uYH6ODg0vHBWraMQCZADnrW1gBLUJeiVdHkDSyQuYkfZtyMHJ2LmO0AXjYslC7cIrTR2F0hwVLiR7OPjybh4/ko1q08W35lecFoFasqQBdT7tyKGhV9cTl40kgHfg2FgHo= X-Gm-Message-State: AOJu0YzuF6CFBKdmMXAYuRXwEfc6r1k2jjLssn2cw4UMwsKoy1hGWDV9 BxC1DWGvgfsvdFMH1IuVjyYVz1kgzW0bHt9i0lSCrcn9JbL8xRZ4 X-Google-Smtp-Source: AGHT+IGZFcEWMKrHXeRL30DRITF9DE5Ld/uj5Ug1T/N7oLWpDaTINwWS5spN7gFqpDF/Om8izMBAfA== X-Received: by 2002:a17:902:f391:b0:1f6:2a3b:51d with SMTP id d9443c01a7336-1f62a3b0636mr10024925ad.65.1717090964440; Thu, 30 May 2024 10:42:44 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:43 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 13/15] pinctrl: renesas: pinctrl-rzg2l: Add support for custom parameters Date: Thu, 30 May 2024 18:38:55 +0100 Message-Id: <20240530173857.164073-14-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar In preparation for passing custom params for RZ/V2H(P) SoC assign the custom params that is being passed via struct rzg2l_pinctrl_data. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Added gaurd for custom_conf_items in struct rzg2l_pinctrl_data RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index ea1a08d272a1..1cbf97d416bf 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -257,6 +257,11 @@ struct rzg2l_pinctrl_data { const struct rzg2l_hwcfg *hwcfg; const u64 *variable_pin_cfg; unsigned int n_variable_pin_cfg; + unsigned int num_custom_params; + const struct pinconf_generic_params *custom_params; +#ifdef CONFIG_DEBUG_FS + const struct pin_config_item *custom_conf_items; +#endif void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock); void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset); u32 (*oen_read)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); @@ -2290,6 +2295,13 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl) pctrl->desc.pmxops = &rzg2l_pinctrl_pmxops; pctrl->desc.confops = &rzg2l_pinctrl_confops; pctrl->desc.owner = THIS_MODULE; + if (pctrl->data->num_custom_params) { + pctrl->desc.num_custom_params = pctrl->data->num_custom_params; + pctrl->desc.custom_params = pctrl->data->custom_params; +#ifdef CONFIG_DEBUG_FS + pctrl->desc.custom_conf_items = pctrl->data->custom_conf_items; +#endif + } pins = devm_kcalloc(pctrl->dev, pctrl->desc.npins, sizeof(*pins), GFP_KERNEL); if (!pins) From patchwork Thu May 30 17:38:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800317 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05DA550293; Thu, 30 May 2024 17:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090971; cv=none; b=UqsOgIXTZRZGULBUALwwi8N5qIHUqNEjilZfUy3xaiIfk6fGzOuegKhf34Y+UNoxZfPjGVc5Fw/u1hCMf/7W766esj53uzuM/l6YAiDqWSKYVoYxF5G+f7G9lFs99WyAd8sWjZ+MIhrfgTsPa+I0IBLaFkTr4JqmGRPPA5ng110= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090971; c=relaxed/simple; bh=e8LysPKZPuNjB650eDlH9HcUJ51fys2Pk2b5iZXcG+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HYPn9tj86TQARVR3x0WVz1M5lv13zVQTAIfcqpBobIoLS7w+OyrO4g2RyVYSLsMdgN/yQv7PIhGOCG8HE9WBKlFmaX1+Mb18KMmUGCr98qfVRtiYQX/eyVbCbXEQyb15HI4J4yfECVcL/lOV10s1MLEBJsLez0Yl4V4yLSl1F6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aBuxL4QS; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aBuxL4QS" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1f44b51b367so7461395ad.1; Thu, 30 May 2024 10:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090969; x=1717695769; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k2Os1X2jJtLs2nYm4m8LVuoPdT66cqgzspX0Tk5JTyw=; b=aBuxL4QSDDHgd8lKZr0cHbO/U2K3JOBECfFMOIFcRAOd/XinbnOM4s1mNFiFVKn5w0 OebGvjscvOAGWZiHjRf91MjwQ5JKcxKT3pYWspuThugOJRonS5PtyQV7ZUKKid3J6oW2 ha66agOP49Ssb17gjgUaQUSCEv8ux2LDUgtB9g7Mt0P5plmz+VkCQ/yVoDXwPn9qSy9N irnEih2RjPyAHtiA0avKHX2DriTnZMQ5S8qd1G2u7xg2tE30Xx21aWf70J9b/z4DfMQ1 3L5c1mTiu8OS+cTGGDTs0hJIOVrU+FHcRho5wR4dw2mqDip0OjNwRFABM7nUdmaaWngg /uwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090969; x=1717695769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k2Os1X2jJtLs2nYm4m8LVuoPdT66cqgzspX0Tk5JTyw=; b=nP+Nvcc8mnarqZb6h8Os53RGe8h6NGf5pE44zfHYiyRImvMw9EBwGQ1SYeuznhf9jO WMp6yFeLpvMTSC/QP3IeZzOZUGRRsP1xrywh3uQl2yPmCzJMfS4rALbwVfKd7cpowMSm MVTdatA942Y7IKXGyFYUJZhJtiI0buzTSCCC1naEGbVjtsOnOhBZB1XEaX/ONJtUx2ip MCtZnG5IIFe2TJGHlX+/4xBTIdCHU3umTOrfYseXpWBw4LyDQdEPggvbi/rvvsDYyBPS vPuC3qHT+PS6F5YyOfKG7BzFfIpGYKj7Jssc+l+r4KIiz/gi6fOcPB8keYNIQyRy1oSA 2Nfw== X-Forwarded-Encrypted: i=1; AJvYcCUlguJB6jZ0mveM5C1jXWMOQShnYVii7qrMt/QGOpvmeTFVO2fTyEL9/ZU3coWOucpjbuXIyhl/Ta7jy/myihY/5Y72F2hKzZ6yaLYISghN3uhvxdFYGrRhjDH5Rv5uu5TCcoU+5tg0FJy6zdGzjSNAh9U/Jhl6NTTFiYzSOqAvF/VJLWw= X-Gm-Message-State: AOJu0Yy1IClaNVlvT6hEgKixDtdvjEU5BamVr7oOUSMCt679pG+HDQ/K 7HXP6WBNFRJ59QRlqd9TLQVsDcm2nbVLM1epJLh996FNmSEZuZNZ X-Google-Smtp-Source: AGHT+IEYglsUs5rMKC2d4kqgC4rHfl+ZClvS6Ll9PNa/2dKtId3hCMH+0JPmPxKq7eumQ3OMRLVS1Q== X-Received: by 2002:a17:902:da88:b0:1f3:2e31:f83a with SMTP id d9443c01a7336-1f6199328c3mr26622945ad.46.1717090969408; Thu, 30 May 2024 10:42:49 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:48 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 14/15] pinctrl: renesas: pinctrl-rzg2l: Acquire lock in rzg2l_pinctrl_pm_setup_pfc() Date: Thu, 30 May 2024 18:38:56 +0100 Message-Id: <20240530173857.164073-15-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar To keep consistency with rzg2l_pinctrl_set_pfc_mode(), acquire the lock in rzg2l_pinctrl_pm_setup_pfc() during PFC setup. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 1cbf97d416bf..2be088bbbd9f 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -2541,7 +2541,9 @@ static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, b static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) { u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; + unsigned long flags; + spin_lock_irqsave(&pctrl->lock, flags); pctrl->data->pwpr_pfc_lock_unlock(pctrl, false); /* Restore port registers. */ @@ -2586,6 +2588,7 @@ static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) } pctrl->data->pwpr_pfc_lock_unlock(pctrl, true); + spin_unlock_irqrestore(&pctrl->lock, flags); } static int rzg2l_pinctrl_suspend_noirq(struct device *dev) From patchwork Thu May 30 17:38:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 800703 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 498BC57C84; Thu, 30 May 2024 17:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090977; cv=none; b=TNh9Pn8QS2TqFdjabc2DvXosim7kUAXGz6zqcFVaquOQcJFYkxBP0HJixZUnQuGZv6z5ltDN3pove52cDHyexCrdHTnP7OVEjapzgY20HHyjeW12QNSd8rNYJ/dASXNb00MdOxxDoQSqU0bvcKiVKMIY6vnQTDq9aDLawzjf5Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090977; c=relaxed/simple; bh=gVWVZsKpT0nWbLoYbJXJJ/cV2iYVrLC6H8e/HXHIcb0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i0Dih4xRqpqwAA6FpWtf80U0XeQP8TVriFe11ZIBWzzYC9gx9L48kLLDLxswYDC7Dw4E/LgkFYfrykLWiY2OPKGhBN3nPeUoTeFiPwxKYwAnnJgfH+swtawL4qFMOIkVs9bLT5VUUBI0y/PSNbpgIjFVQ4WqnzDrh+3J0ZcSoI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OAXPzksQ; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OAXPzksQ" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1f082d92864so9820895ad.1; Thu, 30 May 2024 10:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090974; x=1717695774; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rwVlV8lvjUVrmgldC6Ra3K9FRt5/wW/Kv6dJKvnIMwU=; b=OAXPzksQwDkDbR2AySp7Rz0vQc+dDR7yJ72Tn5Q1W74XxrzWUw/i7oWnn83ci6AnoQ 8G86/UoZhfieB66xJ6WU0g6+OCKDEnlVb75INGG9JHtlUanTg29wOA2stNdLKjUl/lyi juUZj0FF3AzVi/mV8F3k1F2wpkf41obSoiaPLSxTtVJBxrKDNZjZsSbn1WJBywJyYttB pAYuE7jvbWefdKI6rgHyzCM6vPO/4ipEW2bVcT0os7OHEmZva1DkN8JFWUSyDiQ2b0Kd pj8n2tRwa4gTLIAR4laS994SpDdLBsWak+UNOtQh7uxuwn1aCWfi9jQ+bLs6M0Ta15ub qxRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090974; x=1717695774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rwVlV8lvjUVrmgldC6Ra3K9FRt5/wW/Kv6dJKvnIMwU=; b=SbHc9Ckr33+37VyXGP+8oGHz4RpCciLWeDUNafEtyscYX8EysvjgQp0c2yFRBil8hr 8OsqPKpjIqgjKlRPkdchylSYyJZj+sy4qCFhUrsbjh5CR1NCgsmyDQWeRMGAo6w3O22u Rcp3N+GrRfVxr9Y5FjoR/Nmm9o/Qco35gi2BhRnUX+pzWi6w3SWYjWmZWDulqM43+Pr0 gG2xV6+3Hnbeflz6Gf3Hut8CFf5E4rTpsjXS5hLS1YGbcobc4+J2Wt7uL0gFIe4PUAQw Bh0wum4MfpQCbND/Z1S3XN3ov0RT+bYHCIs7RqYUZRmiWEd6fGBQ4Kybmb6mYqqeBSbh VtAg== X-Forwarded-Encrypted: i=1; AJvYcCVLU/TYjfGp6N4Qdi928pCa+ZbTfilLWtxuKOtns8bcatt716zYf8jc0ZljsBBE05q5KecXfhuQrg/U3zHlf9LNz95NFCwLFdLcgUdmtuyM8u+7UoqH2gmBpMgVwiGY08qm567AD6Ud3/0Rd456+2Ubamk3Uj/MTkaVUmyvl0KCSOBrXrs= X-Gm-Message-State: AOJu0YwikhB5o948QkiH0Rj877sTZvKHbjYY3vQTI4UG+aLKudgeBd5N VfaEAB15nWYkPUoUS0vCmpomKOS9m/OrCGdSX9uolPJWpHnPqPcQ X-Google-Smtp-Source: AGHT+IFf5j5/h7Teu1WqGsalLXHcK2EOUg0QatA7vbeht3sLp5FQYPSGDov5l63F9ygd3cVM5kMmeQ== X-Received: by 2002:a17:902:ec87:b0:1f4:466f:8ca4 with SMTP id d9443c01a7336-1f619209d85mr33001615ad.0.1717090974386; Thu, 30 May 2024 10:42:54 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:53 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 15/15] pinctrl: renesas: pinctrl-rzg2l: Add support for RZ/V2H SoC Date: Thu, 30 May 2024 18:38:57 +0100 Message-Id: <20240530173857.164073-16-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add pinctrl driver support for RZ/V2H(P) SoC. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- v2->v3 - Renamed PIN_CFG_OPEN_DRAIN->PIN_CFG_NOD - Renamed PIN_CFG_SCHMIT_CTRL->PIN_CFG_SMT - Introduced PWPR_REGWE_A instead of using PWPR_PFCWE - Dropped using pwpr_lock - Optimized rzv2h_pin_to_oen_bit() RFC->v2 - Renamed renesas-rzv2h,output-impedance -> renesas,output-impedance - Dropped IOLH groups - Fixed dedicated pin configs - Updated r9a09g057_variable_pin_cfg - Added support OEN - Added support for bias settings - Added function pointers for pwpr (un)lock - Added support for slew-rate --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 374 +++++++++++++++++++++++- 1 file changed, 371 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 2be088bbbd9f..46acdc3ffed9 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -59,6 +59,10 @@ #define PIN_CFG_OEN BIT(15) #define PIN_CFG_VARIABLE BIT(16) #define PIN_CFG_NOGPIO_INT BIT(17) +#define PIN_CFG_NOD BIT(18) /* N-ch Open Drain */ +#define PIN_CFG_SMT BIT(19) /* Schmitt-trigger input control */ +#define PIN_CFG_ELC BIT(20) +#define PIN_CFG_IOLH_RZV2H BIT(21) #define RZG2L_MPXED_COMMON_PIN_FUNCS(group) \ (PIN_CFG_IOLH_##group | \ @@ -73,6 +77,11 @@ #define RZG3S_MPXED_PIN_FUNCS(group) (RZG2L_MPXED_COMMON_PIN_FUNCS(group) | \ PIN_CFG_SOFT_PS) +#define RZV2H_MPXED_PIN_FUNCS (RZG2L_MPXED_COMMON_PIN_FUNCS(RZV2H) | \ + PIN_CFG_NOD | \ + PIN_CFG_SR | \ + PIN_CFG_SMT) + #define RZG2L_MPXED_ETH_PIN_FUNCS(x) ((x) | \ PIN_CFG_FILONOFF | \ PIN_CFG_FILNUM | \ @@ -135,6 +144,7 @@ #define ETH_POC(off, ch) ((off) + (ch) * 4) #define QSPI (0x3008) #define ETH_MODE (0x3018) +#define PFC_OEN (0x3C40) /* known on RZ/V2H(P) only */ #define PVDD_2500 2 /* I/O domain voltage 2.5V */ #define PVDD_1800 1 /* I/O domain voltage <= 1.8V */ @@ -142,6 +152,8 @@ #define PWPR_BOWI BIT(7) /* Bit Write Disable */ #define PWPR_PFCWE BIT(6) /* PFC Register Write Enable */ +#define PWPR_REGWE_A BIT(6) /* PFC and PMC Register Write Enable on RZ/V2H(P) */ +#define PWPR_REGWE_B BIT(5) /* OEN Register Write Enable, known only in RZ/V2H(P) */ #define PM_MASK 0x03 #define PFC_MASK 0x07 @@ -160,6 +172,19 @@ #define RZG2L_TINT_IRQ_START_INDEX 9 #define RZG2L_PACK_HWIRQ(t, i) (((t) << 16) | (i)) +/* Custom pinconf parameters */ +#define RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE (PIN_CONFIG_END + 1) + +static const struct pinconf_generic_params renesas_rzv2h_custom_bindings[] = { + { "renesas,output-impedance", RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE, 1 }, +}; + +#ifdef CONFIG_DEBUG_FS +static const struct pin_config_item renesas_rzv2h_conf_items[] = { + PCONFDUMP(RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE, "output-impedance", "x", true), +}; +#endif + /* Read/write 8 bits register */ #define RZG2L_PCTRL_REG_ACCESS8(_read, _addr, _val) \ do { \ @@ -352,6 +377,15 @@ static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, return 0; } +static const u64 r9a09g057_variable_pin_cfg[] = { + RZG2L_VARIABLE_PIN_CFG_PACK(11, 0, RZV2H_MPXED_PIN_FUNCS), + RZG2L_VARIABLE_PIN_CFG_PACK(11, 1, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_IEN), + RZG2L_VARIABLE_PIN_CFG_PACK(11, 2, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_IEN), + RZG2L_VARIABLE_PIN_CFG_PACK(11, 3, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_IEN), + RZG2L_VARIABLE_PIN_CFG_PACK(11, 4, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_IEN), + RZG2L_VARIABLE_PIN_CFG_PACK(11, 5, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_IEN), +}; + #ifdef CONFIG_RISCV static const u64 r9a07g043f_variable_pin_cfg[] = { RZG2L_VARIABLE_PIN_CFG_PACK(20, 0, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | @@ -402,6 +436,17 @@ static void rzg2l_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset) writeb(val, pctrl->base + offset); } +static void rzv2h_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + u8 pwpr; + + pwpr = readb(pctrl->base + regs->pwpr); + writeb(pwpr | PWPR_REGWE_A, pctrl->base + regs->pwpr); + writeb(val, pctrl->base + offset); + writeb(pwpr & ~PWPR_REGWE_A, pctrl->base + regs->pwpr); +} + static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, u8 pin, u8 off, u8 func) { @@ -1041,14 +1086,104 @@ static int rzg2l_bias_param_to_hw(enum pin_config_param param) return -EINVAL; } +static int rzv2h_hw_to_bias_param(unsigned int bias) +{ + switch (bias) { + case 0: + case 1: + return PIN_CONFIG_BIAS_DISABLE; + case 2: + return PIN_CONFIG_BIAS_PULL_DOWN; + case 3: + return PIN_CONFIG_BIAS_PULL_UP; + default: + break; + } + + return -EINVAL; +} + +static int rzv2h_bias_param_to_hw(enum pin_config_param param) +{ + switch (param) { + case PIN_CONFIG_BIAS_DISABLE: + return 0; + case PIN_CONFIG_BIAS_PULL_DOWN: + return 2; + case PIN_CONFIG_BIAS_PULL_UP: + return 3; + default: + break; + } + + return -EINVAL; +} + +static u8 rzv2h_pin_to_oen_bit(struct rzg2l_pinctrl *pctrl, u32 offset) +{ + static const char * const pin_names[] = { "ET0_TXC_TXCLK", "ET1_TXC_TXCLK", + "XSPI0_RESET0N", "XSPI0_CS0N", + "XSPI0_CKN", "XSPI0_CKP" }; + const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(pin_names); i++) { + if (!strcmp(pin_desc->name, pin_names[i])) + return i; + } + + /* Should not happen. */ + return 0; +} + +static u32 rzv2h_oen_read(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin) +{ + u8 bit; + + if (!(caps & PIN_CFG_OEN)) + return 0; + + bit = rzv2h_pin_to_oen_bit(pctrl, offset); + + return !(readb(pctrl->base + PFC_OEN) & BIT(bit)); +} + +static int rzv2h_oen_write(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen) +{ + const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; + const struct rzg2l_register_offsets *regs = &hwcfg->regs; + unsigned long flags; + u8 val, bit; + u8 pwpr; + + if (!(caps & PIN_CFG_OEN)) + return -EINVAL; + + bit = rzv2h_pin_to_oen_bit(pctrl, offset); + spin_lock_irqsave(&pctrl->lock, flags); + val = readb(pctrl->base + PFC_OEN); + if (oen) + val &= ~BIT(bit); + else + val |= BIT(bit); + + pwpr = readb(pctrl->base + regs->pwpr); + writeb(pwpr | PWPR_REGWE_B, pctrl->base + regs->pwpr); + writeb(val, pctrl->base + PFC_OEN); + writeb(pwpr & ~PWPR_REGWE_B, pctrl->base + regs->pwpr); + spin_unlock_irqrestore(&pctrl->lock, flags); + + return 0; +} + static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, unsigned int _pin, unsigned long *config) { struct rzg2l_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - enum pin_config_param param = pinconf_to_config_param(*config); const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; const struct pinctrl_pin_desc *pin = &pctrl->desc.pins[_pin]; + u32 param = pinconf_to_config_param(*config); u64 *pin_data = pin->drv_data; unsigned int arg = 0; u32 off; @@ -1159,6 +1294,13 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, break; } + case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE: + if (!(cfg & PIN_CFG_IOLH_RZV2H)) + return -EINVAL; + + arg = rzg2l_read_pin_config(pctrl, IOLH(off), bit, IOLH_MASK); + break; + default: return -ENOTSUPP; } @@ -1178,9 +1320,8 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; struct rzg2l_pinctrl_pin_settings settings = pctrl->settings[_pin]; u64 *pin_data = pin->drv_data; - enum pin_config_param param; unsigned int i, arg, index; - u32 off; + u32 off, param; u64 cfg; int ret; u8 bit; @@ -1285,6 +1426,16 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, index); break; + case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE: + if (!(cfg & PIN_CFG_IOLH_RZV2H)) + return -EINVAL; + + arg = pinconf_to_config_argument(_configs[i]); + if (arg > 3) + return -EINVAL; + rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, arg); + break; + default: return -EOPNOTSUPP; } @@ -1732,6 +1883,39 @@ static const u64 r9a08g045_gpio_configs[] = { RZG2L_GPIO_PORT_PACK(6, 0x2a, RZG3S_MPXED_PIN_FUNCS(A)), /* P18 */ }; +static const char * const rzv2h_gpio_names[] = { + "P00", "P01", "P02", "P03", "P04", "P05", "P06", "P07", + "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", + "P20", "P21", "P22", "P23", "P24", "P25", "P26", "P27", + "P30", "P31", "P32", "P33", "P34", "P35", "P36", "P37", + "P40", "P41", "P42", "P43", "P44", "P45", "P46", "P47", + "P50", "P51", "P52", "P53", "P54", "P55", "P56", "P57", + "P60", "P61", "P62", "P63", "P64", "P65", "P66", "P67", + "P70", "P71", "P72", "P73", "P74", "P75", "P76", "P77", + "P80", "P81", "P82", "P83", "P84", "P85", "P86", "P87", + "P90", "P91", "P92", "P93", "P94", "P95", "P96", "P97", + "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", + "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", +}; + +static const u64 r9a09g057_gpio_configs[] = { + RZG2L_GPIO_PORT_PACK(8, 0x20, RZV2H_MPXED_PIN_FUNCS), /* P0 */ + RZG2L_GPIO_PORT_PACK(6, 0x21, RZV2H_MPXED_PIN_FUNCS), /* P1 */ + RZG2L_GPIO_PORT_PACK(2, 0x22, RZG2L_MPXED_COMMON_PIN_FUNCS(RZV2H) | + PIN_CFG_NOD), /* P2 */ + RZG2L_GPIO_PORT_PACK(8, 0x23, RZV2H_MPXED_PIN_FUNCS), /* P3 */ + RZG2L_GPIO_PORT_PACK(8, 0x24, RZV2H_MPXED_PIN_FUNCS), /* P4 */ + RZG2L_GPIO_PORT_PACK(8, 0x25, RZV2H_MPXED_PIN_FUNCS), /* P5 */ + RZG2L_GPIO_PORT_PACK(8, 0x26, RZV2H_MPXED_PIN_FUNCS | + PIN_CFG_ELC), /* P6 */ + RZG2L_GPIO_PORT_PACK(8, 0x27, RZV2H_MPXED_PIN_FUNCS), /* P7 */ + RZG2L_GPIO_PORT_PACK(8, 0x28, RZV2H_MPXED_PIN_FUNCS | + PIN_CFG_ELC), /* P8 */ + RZG2L_GPIO_PORT_PACK(8, 0x29, RZV2H_MPXED_PIN_FUNCS), /* P9 */ + RZG2L_GPIO_PORT_PACK(8, 0x2a, RZV2H_MPXED_PIN_FUNCS), /* PA */ + RZG2L_GPIO_PORT_PACK(6, 0x2b, PIN_CFG_VARIABLE), /* PB */ +}; + static const struct { struct rzg2l_dedicated_configs common[35]; struct rzg2l_dedicated_configs rzg2l_pins[7]; @@ -1858,6 +2042,138 @@ static const struct rzg2l_dedicated_configs rzg3s_dedicated_pins[] = { PIN_CFG_IO_VMC_SD1)) }, }; +static struct rzg2l_dedicated_configs rzv2h_dedicated_pins[] = { + { "NMI", RZG2L_SINGLE_PIN_PACK(0x1, 0, (PIN_CFG_FILONOFF | PIN_CFG_FILNUM | + PIN_CFG_FILCLKSEL)) }, + { "TMS_SWDIO", RZG2L_SINGLE_PIN_PACK(0x3, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN)) }, + { "TDO", RZG2L_SINGLE_PIN_PACK(0x3, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "WDTUDFCA", RZG2L_SINGLE_PIN_PACK(0x5, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_NOD)) }, + { "WDTUDFCM", RZG2L_SINGLE_PIN_PACK(0x5, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_NOD)) }, + { "SCIF_RXD", RZG2L_SINGLE_PIN_PACK(0x6, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "SCIF_TXD", RZG2L_SINGLE_PIN_PACK(0x6, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_CKP", RZG2L_SINGLE_PIN_PACK(0x7, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "XSPI0_CKN", RZG2L_SINGLE_PIN_PACK(0x7, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "XSPI0_CS0N", RZG2L_SINGLE_PIN_PACK(0x7, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "XSPI0_DS", RZG2L_SINGLE_PIN_PACK(0x7, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_RESET0N", RZG2L_SINGLE_PIN_PACK(0x7, 4, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "XSPI0_RSTO0N", RZG2L_SINGLE_PIN_PACK(0x7, 5, (PIN_CFG_PUPD)) }, + { "XSPI0_INT0N", RZG2L_SINGLE_PIN_PACK(0x7, 6, (PIN_CFG_PUPD)) }, + { "XSPI0_ECS0N", RZG2L_SINGLE_PIN_PACK(0x7, 7, (PIN_CFG_PUPD)) }, + { "XSPI0_IO0", RZG2L_SINGLE_PIN_PACK(0x8, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO1", RZG2L_SINGLE_PIN_PACK(0x8, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO2", RZG2L_SINGLE_PIN_PACK(0x8, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO3", RZG2L_SINGLE_PIN_PACK(0x8, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO4", RZG2L_SINGLE_PIN_PACK(0x8, 4, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO5", RZG2L_SINGLE_PIN_PACK(0x8, 5, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO6", RZG2L_SINGLE_PIN_PACK(0x8, 6, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "XSPI0_IO7", RZG2L_SINGLE_PIN_PACK(0x8, 7, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "SD0CLK", RZG2L_SINGLE_PIN_PACK(0x9, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "SD0CMD", RZG2L_SINGLE_PIN_PACK(0x9, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0RSTN", RZG2L_SINGLE_PIN_PACK(0x9, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "SD0DAT0", RZG2L_SINGLE_PIN_PACK(0xa, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT1", RZG2L_SINGLE_PIN_PACK(0xa, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT2", RZG2L_SINGLE_PIN_PACK(0xa, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT3", RZG2L_SINGLE_PIN_PACK(0xa, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT4", RZG2L_SINGLE_PIN_PACK(0xa, 4, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT5", RZG2L_SINGLE_PIN_PACK(0xa, 5, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT6", RZG2L_SINGLE_PIN_PACK(0xa, 6, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD0DAT7", RZG2L_SINGLE_PIN_PACK(0xa, 7, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD1CLK", RZG2L_SINGLE_PIN_PACK(0xb, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "SD1CMD", RZG2L_SINGLE_PIN_PACK(0xb, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD1DAT0", RZG2L_SINGLE_PIN_PACK(0xc, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD1DAT1", RZG2L_SINGLE_PIN_PACK(0xc, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD1DAT2", RZG2L_SINGLE_PIN_PACK(0xc, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "SD1DAT3", RZG2L_SINGLE_PIN_PACK(0xc, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "PCIE0_RSTOUTB", RZG2L_SINGLE_PIN_PACK(0xe, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "PCIE1_RSTOUTB", RZG2L_SINGLE_PIN_PACK(0xe, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR)) }, + { "ET0_MDIO", RZG2L_SINGLE_PIN_PACK(0xf, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "ET0_MDC", RZG2L_SINGLE_PIN_PACK(0xf, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_RXCTL_RXDV", RZG2L_SINGLE_PIN_PACK(0x10, 0, (PIN_CFG_PUPD)) }, + { "ET0_TXCTL_TXEN", RZG2L_SINGLE_PIN_PACK(0x10, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_TXER", RZG2L_SINGLE_PIN_PACK(0x10, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_RXER", RZG2L_SINGLE_PIN_PACK(0x10, 3, (PIN_CFG_PUPD)) }, + { "ET0_RXC_RXCLK", RZG2L_SINGLE_PIN_PACK(0x10, 4, (PIN_CFG_PUPD)) }, + { "ET0_TXC_TXCLK", RZG2L_SINGLE_PIN_PACK(0x10, 5, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "ET0_CRS", RZG2L_SINGLE_PIN_PACK(0x10, 6, (PIN_CFG_PUPD)) }, + { "ET0_COL", RZG2L_SINGLE_PIN_PACK(0x10, 7, (PIN_CFG_PUPD)) }, + { "ET0_TXD0", RZG2L_SINGLE_PIN_PACK(0x11, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_TXD1", RZG2L_SINGLE_PIN_PACK(0x11, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_TXD2", RZG2L_SINGLE_PIN_PACK(0x11, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_TXD3", RZG2L_SINGLE_PIN_PACK(0x11, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET0_RXD0", RZG2L_SINGLE_PIN_PACK(0x11, 4, (PIN_CFG_PUPD)) }, + { "ET0_RXD1", RZG2L_SINGLE_PIN_PACK(0x11, 5, (PIN_CFG_PUPD)) }, + { "ET0_RXD2", RZG2L_SINGLE_PIN_PACK(0x11, 6, (PIN_CFG_PUPD)) }, + { "ET0_RXD3", RZG2L_SINGLE_PIN_PACK(0x11, 7, (PIN_CFG_PUPD)) }, + { "ET1_MDIO", RZG2L_SINGLE_PIN_PACK(0x12, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_IEN | PIN_CFG_PUPD)) }, + { "ET1_MDC", RZG2L_SINGLE_PIN_PACK(0x12, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_RXCTL_RXDV", RZG2L_SINGLE_PIN_PACK(0x13, 0, (PIN_CFG_PUPD)) }, + { "ET1_TXCTL_TXEN", RZG2L_SINGLE_PIN_PACK(0x13, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_TXER", RZG2L_SINGLE_PIN_PACK(0x13, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_RXER", RZG2L_SINGLE_PIN_PACK(0x13, 3, (PIN_CFG_PUPD)) }, + { "ET1_RXC_RXCLK", RZG2L_SINGLE_PIN_PACK(0x13, 4, (PIN_CFG_PUPD)) }, + { "ET1_TXC_TXCLK", RZG2L_SINGLE_PIN_PACK(0x13, 5, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OEN)) }, + { "ET1_CRS", RZG2L_SINGLE_PIN_PACK(0x13, 6, (PIN_CFG_PUPD)) }, + { "ET1_COL", RZG2L_SINGLE_PIN_PACK(0x13, 7, (PIN_CFG_PUPD)) }, + { "ET1_TXD0", RZG2L_SINGLE_PIN_PACK(0x14, 0, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_TXD1", RZG2L_SINGLE_PIN_PACK(0x14, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_TXD2", RZG2L_SINGLE_PIN_PACK(0x14, 2, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_TXD3", RZG2L_SINGLE_PIN_PACK(0x14, 3, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD)) }, + { "ET1_RXD0", RZG2L_SINGLE_PIN_PACK(0x14, 4, (PIN_CFG_PUPD)) }, + { "ET1_RXD1", RZG2L_SINGLE_PIN_PACK(0x14, 5, (PIN_CFG_PUPD)) }, + { "ET1_RXD2", RZG2L_SINGLE_PIN_PACK(0x14, 6, (PIN_CFG_PUPD)) }, + { "ET1_RXD3", RZG2L_SINGLE_PIN_PACK(0x14, 7, (PIN_CFG_PUPD)) }, +}; + static int rzg2l_gpio_get_gpioint(unsigned int virq, struct rzg2l_pinctrl *pctrl) { const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[virq]; @@ -2394,6 +2710,9 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(r9a08g045_gpio_configs) * RZG2L_PINS_PER_PORT > ARRAY_SIZE(rzg2l_gpio_names)); + BUILD_BUG_ON(ARRAY_SIZE(r9a09g057_gpio_configs) * RZG2L_PINS_PER_PORT > + ARRAY_SIZE(rzv2h_gpio_names)); + pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) return -ENOMEM; @@ -2665,6 +2984,22 @@ static void rzg2l_pwpr_pfc_lock_unlock(struct rzg2l_pinctrl *pctrl, bool lock) } } +static void rzv2h_pwpr_pfc_lock_unlock(struct rzg2l_pinctrl *pctrl, bool lock) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + u8 pwpr; + + if (lock) { + /* Set the PWPR register to be write-protected */ + pwpr = readb(pctrl->base + regs->pwpr); + writeb(pwpr & ~PWPR_REGWE_A, pctrl->base + regs->pwpr); + } else { + /* Set the PWPR register to allow PFC and PMC register to write */ + pwpr = readb(pctrl->base + regs->pwpr); + writeb(PWPR_REGWE_A | pwpr, pctrl->base + regs->pwpr); + } +} + static const struct rzg2l_hwcfg rzg2l_hwcfg = { .regs = { .pwpr = 0x3014, @@ -2710,6 +3045,12 @@ static const struct rzg2l_hwcfg rzg3s_hwcfg = { .oen_max_port = 7, /* P7_1 is the maximum OEN port. */ }; +static const struct rzg2l_hwcfg rzv2h_hwcfg = { + .regs = { + .pwpr = 0x3c04, + }, +}; + static struct rzg2l_pinctrl_data r9a07g043_data = { .port_pins = rzg2l_gpio_names, .port_pin_configs = r9a07g043_gpio_configs, @@ -2763,6 +3104,29 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .bias_param_to_hw = &rzg2l_bias_param_to_hw, }; +static struct rzg2l_pinctrl_data r9a09g057_data = { + .port_pins = rzv2h_gpio_names, + .port_pin_configs = r9a09g057_gpio_configs, + .n_ports = ARRAY_SIZE(r9a09g057_gpio_configs), + .dedicated_pins = rzv2h_dedicated_pins, + .n_port_pins = ARRAY_SIZE(r9a09g057_gpio_configs) * RZG2L_PINS_PER_PORT, + .n_dedicated_pins = ARRAY_SIZE(rzv2h_dedicated_pins), + .hwcfg = &rzv2h_hwcfg, + .variable_pin_cfg = r9a09g057_variable_pin_cfg, + .n_variable_pin_cfg = ARRAY_SIZE(r9a09g057_variable_pin_cfg), + .num_custom_params = ARRAY_SIZE(renesas_rzv2h_custom_bindings), + .custom_params = renesas_rzv2h_custom_bindings, +#ifdef CONFIG_DEBUG_FS + .custom_conf_items = renesas_rzv2h_conf_items, +#endif + .pwpr_pfc_lock_unlock = &rzv2h_pwpr_pfc_lock_unlock, + .pmc_writeb = &rzv2h_pmc_writeb, + .oen_read = &rzv2h_oen_read, + .oen_write = &rzv2h_oen_write, + .hw_to_bias_param = &rzv2h_hw_to_bias_param, + .bias_param_to_hw = &rzv2h_bias_param_to_hw, +}; + static const struct of_device_id rzg2l_pinctrl_of_table[] = { { .compatible = "renesas,r9a07g043-pinctrl", @@ -2776,6 +3140,10 @@ static const struct of_device_id rzg2l_pinctrl_of_table[] = { .compatible = "renesas,r9a08g045-pinctrl", .data = &r9a08g045_data, }, + { + .compatible = "renesas,r9a09g057-pinctrl", + .data = &r9a09g057_data, + }, { /* sentinel */ } };