From patchwork Tue Apr 23 17:58: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: 791673 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 3E78213DDDE; Tue, 23 Apr 2024 17:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895159; cv=none; b=nSwaV8pzWY1B9wAFcdEDLI1JsUzxIbXZQRDi+N2jpmA4UEzIZQnyKNWegh1ZlqJPwNCO0XUSLuEhU+EW1F1Ccv6/gNb9AeC216tbnRB+BAhdA3VxEAwgiKEdCCRisQpBcw6uLBNedq2z3KfjdDFbPmpxqNOp5fvtUImxJ+C4/Ps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895159; c=relaxed/simple; bh=UJLGYHQPbzZMT2YvNoHPmmDmdCG43VKrbHKS/AxLT8s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BrstQjWsOFL0Wr2k+6AQZlZjjbnmq1C9oGab2jx9ItuKZUVLWc2mgcAN10EBxyZXOwZluQrWJZ9nyhBMxC1VMzNbHwlWQjoykrS921r2jwyEeEu14Tw/VYE+tMFXZat/Sy7j1MrI1DkkPDY9Ngsq5LXQk36cgLe64L9CCz5LWFw= 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=COkEhOaw; arc=none smtp.client-ip=209.85.128.51 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="COkEhOaw" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-41a7820620dso16867805e9.0; Tue, 23 Apr 2024 10:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895156; x=1714499956; 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=p3y+6qH+3vKHvAcnjlxDf4ow6EVje8GMB46X3eweU1s=; b=COkEhOawaCY7rEBE7PBuOxy2BF1aS67fJAWmE8MsMgcxz7j3L0DiDMppyT1IYYZKgx DJEb3Jijpda6SofSA1V+y4trk+UZ7KVWiajBQoeKwxvzfjPFSBE+LHyAsaBRPskd+Lp1 r9hIwkgwrJiw/I2NaMqApUtY4D686Fs8yDDfntmfkypFVeTdinAFAmQyoJSjAZEAUR/+ zlPsMX70YL9XUUr3Qtbl/0EH5zqC+tRrKCBjK8J4iG8YvftaGmA9WJWoazgCEDxZC9tE DMGcV6hZDG/XwPTNbxW4MpAHP7YaMxtFNLEzWDL3TPxUlt/1uMI2heh3m0dJKXvFQ6jA haXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895156; x=1714499956; 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=p3y+6qH+3vKHvAcnjlxDf4ow6EVje8GMB46X3eweU1s=; b=qYEbwwsTXrwBmKHuhHQhvzaRNUEK16U7DmoZk8p1WYz0S18Y/INP4A7Q0kF/iZ5s+i IZoj0IvkaZZb3LxSl49PdlfwTOMEQ48MgJBvEL3buTqFAyG3bSB2N5Fc9HqSWBnfpFrR R0SD4DTC0eTuPL7nhY135z4mLHRGGRKv5fnzZl7I8E1FuW/y0DTvdbx9Ld0nH3+5HfiX Be1U4u549BTdWEXJtnm2NJ/pgHLAkZTQLkB0eMPtLSIqwTdmZYd6q73+inJ0JDhZQuJD /p6gykulorRyYhCCKDSvw8HTFklOu1KHiySrZR6IP+UtS6yps1Q10puarQAJuEJTeZiz FJLQ== X-Forwarded-Encrypted: i=1; AJvYcCXJUz2DRKHaNAXuVBNoWrFJ0AuYVhSkyo8mNUbFBZwWnHDxOaROq01kBsF8dEvarOFji7dkD08XVsbQcSoVGy8vHJ8hi7IiuCSiYFwBvXMsDqGUYtrxOy83K/LI+NNX8+5hCZQEAB2Bdsap5a3eC3aCSvJnIrdSsnxSEqCkgxGS1O3/jJi+KRZkv9vB X-Gm-Message-State: AOJu0YzKELb6hZZqzRbwaxl543UunJ8ASHA+j4xwLqgpAUNOOHQwvhY4 EDvDbHYkSzyIAM48TKQdlzb17kxiW0QQ5cBxRQeI4vWPEBB4IqLPNWcoimp/ X-Google-Smtp-Source: AGHT+IGEXm1eVY1mbC4/Ky0MszLIPjs6V7S8bUGR3gSWWN2y1N76KS+eFGAM6ll5g9HwakjojtEo8g== X-Received: by 2002:a05:600c:1d01:b0:419:96:965 with SMTP id l1-20020a05600c1d0100b0041900960965mr10653246wms.37.1713895156597; Tue, 23 Apr 2024 10:59:16 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:16 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 01/13] dt-bindings: pinctrl: renesas, rzg2l-pinctrl: Remove the check from the object Date: Tue, 23 Apr 2024 18:58:48 +0100 Message-Id: <20240423175900.702640-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 bogus check from object as this didn't really add restriction check. Signed-off-by: Lad Prabhakar Reviewed-by: Rob Herring Reviewed-by: Geert Uytterhoeven --- RFC->v2 - Updated commit message - Collected RB tag from Rob --- .../bindings/pinctrl/renesas,rzg2l-pinctrl.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml index 4d5a957fa232..881e992adca3 100644 --- a/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml +++ b/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml @@ -79,21 +79,6 @@ additionalProperties: - $ref: pincfg-node.yaml# - $ref: pinmux-node.yaml# - - if: - properties: - compatible: - contains: - enum: - - renesas,r9a08g045-pinctrl - then: - properties: - drive-strength: false - output-impedance-ohms: false - slew-rate: false - else: - properties: - drive-strength-microamp: false - description: Pin controller client devices use pin configuration subnodes (children and grandchildren) for desired pin configuration. From patchwork Tue Apr 23 17:58: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: 791315 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 D939013E884; Tue, 23 Apr 2024 17:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895161; cv=none; b=DlfHqXi6dRvW2ftZh4ZXlzVJENkRVh6eqGOm2RqSDeV1q5V3G9RpptDTho3HzoRw6xuCoGx00T2bmVqIGqmY+W9eM6xVRyUtm5IP5v/japOpalrAhXqL3dLqdvnnMFyy0f7ZhfZAS/BusuEcE3TDyw9OQlDISM7jYoFnBSaVDCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895161; c=relaxed/simple; bh=BpWeENQe/cQhQ7j1K3BiJsL6NqUqR3mxFkNnEjiJqYM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IJvZBzPq8XssMk/J8fkPI/Ol5YoddAZ4FeiG/elCSRkgtDGPs2KFJWQXi+P3A77uvvUuixAPpAufZ38uGCZvEqH0nhEGrNqJjkeOaShen8KDRqOwDGDr4woOBTqMcR3DCgd5xBeJWQAbXosBZdy9t5VoAOM6UJr9pxy/rCMp2cQ= 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=K5P61QpK; arc=none smtp.client-ip=209.85.128.41 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="K5P61QpK" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-41a4f291f80so20911335e9.1; Tue, 23 Apr 2024 10:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895158; x=1714499958; 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=k+oHe0mLkxZA6Ajq9xGHl3pNaIq8n5il5pBKVrZCyg4=; b=K5P61QpKeeVFAa8cLh/mCf3niAcrC5AifMtN/XzZxn7qik1iTVjrRcIJRqFdf3Iskq 4UMYrB9TqfsVRbRESY+tzLybPJks+HsiEMMVueJ1h+HgP1Qx5k0XLuDqGj2MLnKaaOqT aWtWIWLlxIfOpzKdPuXvCmvuul4Cd/0CgeypWu5+V0AyPURy0q7ZtakXl5VtM8GneQsu mw8KOh7kqARMTGmPTqLrL0wycpVl6xGexx5u3wxDizPDQRKdYz9JSBk3Q7pUPgPYxEJK kfVdsdnJVy0TnplERBEADz+Rxe7JkpNydkJmZkVbk1+w02PZXSmTXLnpMZJ3Ogmu/zkY UnpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895158; x=1714499958; 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=k+oHe0mLkxZA6Ajq9xGHl3pNaIq8n5il5pBKVrZCyg4=; b=Yc8aUXfjEzwgiAPR+XlxZ9udq0R/ZE40GtAObqY+jfA0+k5YqBtE1h2ZYeQ38r+92p zQzlYgNfQJ2QBGINVmbkAkfkROOUqlVlgeeR8GR6HDtAOZXgj4WpV0flh9pzVCDk5rQg cRbanjArNEwUxXfIDveGbpA1qIEj0Qe++Dd4KO836dSa2zoeJd1Pp3dRSXhYh8liJErJ pK/oSrjf601AY6uRztMlz2DChyx6weRK9Mp6uR27N7AT4txc6EOfSlJcXDQobLDsf9YK R0QOROr3kKiRlDZ1Q2ejlQDcX3cZFj21ZwR/QBTuyuyyjIC5Gy7hHkHmNSaL/JcNKhGs WU0g== X-Forwarded-Encrypted: i=1; AJvYcCV7EmEvhgnAspTMQUaAhTlqBMp8cX+6ZVTI12QNB1QNz2w6DX6wU5KfrXndTmRWv5ICVhYpzG5mppXrqYV7ZV0S/Wy/+WOnxI43GpWWB/ka2SB0pspTXQyQGo2AkIPjtfOBjHTc8YOE0QVEz1TiBM9JzBVtyyk1Tys7164yNc4j7GpZjc+awKuwDi10 X-Gm-Message-State: AOJu0Yw+uwNfXVMQO7WAwl8dZJYqNx7dun/6YxICjQFvUcTuPBwWxShw QwLOaCFYKjxExvJgHg1XdQtSNUw0gqoTOX3J8fLtIOIbGSjP3exI X-Google-Smtp-Source: AGHT+IFZxo10Epb8HusiJzLSajhXUw4HhN7m+DDZZUaUJxBe8dhJDonTd9tJ/87HblWaDyq2p4YidQ== X-Received: by 2002:a05:600c:5125:b0:41a:7fc8:a650 with SMTP id o37-20020a05600c512500b0041a7fc8a650mr47010wms.0.1713895157861; Tue, 23 Apr 2024 10:59:17 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:17 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 02/13] dt-bindings: pinctrl: renesas: Document RZ/V2H(P) SoC Date: Tue, 23 Apr 2024 18:58:49 +0100 Message-Id: <20240423175900.702640-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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], indicating x1/x2/x3/x4 drive strength. 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 --- RFC->v2 - Renamed renesas-rzv2h,output-impedance -> renesas,output-impedance - Updated values for renesas,output-impedance - Added bias properties --- .../pinctrl/renesas,rzg2l-pinctrl.yaml | 25 ++++++++++++++++--- 1 file changed, 21 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..089b3ce61bac 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,18 @@ 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 RZ/V2H(P) SoC. + 0: Corresponds to x1 + 1: Corresponds to x2 + 2: Corresponds to x3 + 3: Corresponds to x4 + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] - type: object additionalProperties: From patchwork Tue Apr 23 17:58: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: 791672 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 6F8B313E8BC; Tue, 23 Apr 2024 17:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895162; cv=none; b=tPHHwCWWSL+WV6LNXYijh8wKUryUp4l2Lh7fijdzaasuuhK3idAqJqPtbV5XuBcS5EhWDVsHuC7lRZ5eZAIFVKU50b9TGbmXflXqF9RKFgpg7sYgJRj0TgoxgnU/KTu8kU7lW6gn8XFlXBjAnFoJ9t1WIEmnGry8iSGdMkvYotU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895162; c=relaxed/simple; bh=TxT7RBwoDWhi9zCJJZ/QPp3h6RBM/4bgfUUVOU4Dx0A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BzB+aRI5Xgm7psOZkoZPW+H9vQ91Ur8vih/QhgmT7biCM7jc+wsov9xOHQAXowEIbBajF66Rblb/8YD0JGS31XO7vPFmBJc1NDdLT63nUTik+f0fvqZxXDDtwbqZ4YaC3OTLJdV0hFKPkaAfj0qyz+9Nl4PtrTUnysiZ87o2niM= 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=GJ1iC1SK; arc=none smtp.client-ip=209.85.128.47 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="GJ1iC1SK" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-41a77836f16so18040495e9.3; Tue, 23 Apr 2024 10:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895159; x=1714499959; 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=ZcqHIe4hShwv6KW9kzmXn1ZPos31l+yNPmyLSX2yXyo=; b=GJ1iC1SK3oLOV6BGU/FBColivjHGRdZvoa1sglrc2oxJxpLAQ8zRZfkv623rupHhJE G9J9DUX4RdC18Ugpnt9WnO/09rIqJn5RZjvaXqkMEPiuu+Y84Vulew3S/0/SmgNq2SNt nwrfz6vXn44cttAwx3CugUlriwaXgItfMCprVIdGDONDhjl5TX1/q/+KOZemDnBdhZ9X dztrKcJyTTg51LaPZ8ZfVvPMS0gMfgfFz5Bo/PLS8ypx1Wv8ZcesYH9bf0olJDE+20Go h2JP5Z7rT9fl85QaYSDgeM/xjm8WwyKcTIuEtnLiV2yTjHC5jaN5ufXb3fI3cDfBvgjr PCkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895159; x=1714499959; 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=ZcqHIe4hShwv6KW9kzmXn1ZPos31l+yNPmyLSX2yXyo=; b=OJBai6gddC5+gv63hiJ2kJRWASoMXfqJ2C1nyG0hkfBJbgAYK4NzzXn+56cc1BV+sz mRsvkWvdDAC6R83hZEXdQZ1EnPIexxTz+A0d7i5rL0TR6VVzSmSMeUsbTkFR7KEtOULm GwgM2tq1Pf6woateaoqGfL1bEg/JsB/rIKdCKmGVWimi0M8UmagJFP6mtZFejv9S+SZz rpqml2MOXqnhojzIrVEwra7yaB3ULxc8Wy+gBJ0oqqzL5lbCRPm3uN/iHauI6XIhBmXO coBgYus9f1Cc+kBOinCtt0GJuowzyFFaXM2RCy+T0W7XU+yCwEQEjdTo9fsjQAKasoYs zPkQ== X-Forwarded-Encrypted: i=1; AJvYcCVrp7hH8u8BDYwm57QOAorID8swYFsBbs7QF/oE7M9q72etwrd8RUghuHelQVyDNqpUu3VfH/RAm/P9w85Z2Ji2ctCHhWDNhfzXuI9/RwjrfjPqi3wUKp0EZOyoE5J+KTqsexAyd+UPFd/eYtbWl4/mcZxX+aOVNmtIKtkeC8rZxR6mr8tePBhd/16W X-Gm-Message-State: AOJu0YwM8CCRYpBZ8GwKmVCzNpaazhaOCV840bm+9aIkea9vmkQ1Ancu eeRlFQ8YWRlswwgMAUWj9QD2jVqOVyP2ZurfYN9Qx2t5R02Jmqja X-Google-Smtp-Source: AGHT+IGUrBnPwjKbWmXm9BCmzXJGdw3yllNpLRvV2ah+6Ft02VWijO4nHoPeuochHj1xB9kRTQ0U6w== X-Received: by 2002:a05:600c:3106:b0:416:9b7f:7098 with SMTP id g6-20020a05600c310600b004169b7f7098mr10691wmo.24.1713895158773; Tue, 23 Apr 2024 10:59:18 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:18 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 03/13] pinctrl: renesas: pinctrl-rzg2l: Allow more bits for pin configuration Date: Tue, 23 Apr 2024 18:58:50 +0100 Message-Id: <20240423175900.702640-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- 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 dbcf009837ef..9bb9cc63f9df 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:46; + u64 port:5; + u64 pin:3; }; struct rzg2l_pinctrl_data { @@ -1082,7 +1082,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; @@ -1186,7 +1187,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; @@ -2414,9 +2416,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); @@ -2460,12 +2462,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 Tue Apr 23 17:58: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: 791314 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 D71CD13FD7D; Tue, 23 Apr 2024 17:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895163; cv=none; b=DXaWwLid5kR8ulIKflZngXl+qr2XvF/DqRyCMR8nJGQTlZKysUJ6r8OXrljllJhQ4i+n6PtLspCc6WTvEpSHNAaN+ASB51VnMCBm1sSgY22p4HFAAFHHqiIuANttUP+0YVGxwN40W7RYbCqvR8KM5zGSteg3Us1l73IwsETrmpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895163; c=relaxed/simple; bh=kOAveoyeqUZd1efPc/EGSTTdWmb/wq66OfdkFiE4P4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PSbUUscRr4ExzbPt3ZtKcutwxl8J7BcxlX3lQ2ywkHl8Gswn7/b15GA8pikPcftaoAeyXrLQ/SQKoq5//wXBxZ0SNE192fZnBkbifB887fcQ6tg+P40zochd0KATxBibsDW4/9aP4zjyOgez7wmpqJWxrvsqzorL8q2UsTBr450= 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=U/QIrE/D; arc=none smtp.client-ip=209.85.128.43 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="U/QIrE/D" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41ae95468efso1780255e9.2; Tue, 23 Apr 2024 10:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895160; x=1714499960; 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=4smdOkFXv6apnbibsUhiBNRZnnDGWylV+F3FCL/HXXQ=; b=U/QIrE/DCaETfbomlOLV3ms1NPfEl9m/rep+j42TPgyvY5UPMP+sZhyEamvsKNP/og Eo6SBTYq4WuBHw3QlZoNspaGMWeBziWyD4sOELhFqetn+3YsQuoFQrAh5JP0cBPSGR3H ZuLMQtkMzALfO0yQvkqBgVVd02l2KqpgDidEVBLq8cUAadMJ/LAY8h/y+nzCarYuGJOU RLKqwne1SKgabiqt3X++uWtyhy+axKNb26B1quPL+Q077Iv/0X4HTrOcM0U4apErcwb+ CU8yK+0cYzwjDyFIQfh3IvGynasFgJmI8YoRm+ok+3t/y1a3AMxEAl/oCRAF03zFxXbE lM7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895160; x=1714499960; 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=4smdOkFXv6apnbibsUhiBNRZnnDGWylV+F3FCL/HXXQ=; b=cgrsV7yhKoI4KIVwNUClOie36HDDkjgHIsSWVmmTxwLw7JBh27MC4N8yf7onfiekog VCUaRAdenJjIawsVt8KqcOdn6xEXX+R/Pof71Obs7WgfCpZv4yfjesFDVKryhGllzYa0 cS1bNv18ibhMOiXbkoMoJsHIfdHER2oQ+vJyTFYC8UycC6CjHOSHlqMGaqsreWTKRito MTcA57JHYrjHhZEkap+fpWujbACEjuiU23NTRjy1ocItE1z68gSQnYLvKXmKvWwJxoRg xoM+n5WdWYikxqCxTgHgaLYJ0X8IuNUEg1zyqiiXDi53Qngj5p9nd8DzSRoj71keCbfX bulQ== X-Forwarded-Encrypted: i=1; AJvYcCV+9MJeM1c90+m0NJINXONp71Jz1UWZmw2zFfE26cPhek0WQ73EE8KDsxI2lEoUePbFdsq3oo/vZB803IfgtOaHS47Zt07ZGGywg5rvC8n7DjjYNCjz/vFIpPFcI25Oyc3gy/sofJUIF5ydPKWTXotpo3Lc9dADTIIf5vlQXeeVy1xFwIahoNEfP3OO X-Gm-Message-State: AOJu0Yw2eOFKCUKrgMi6GN/4U/EYxv8C0Cs22NFCOXVOo5gnKym6QRyu CYIzPY+5zbSVyhAaXC61oLzlbvnvBCxYP//a9LBQAlZnmRbz+OA+ X-Google-Smtp-Source: AGHT+IHNLUXedQfoGfcBwbl0iKJA+aaqKG0F6TiEyHRmg7KQJrlIPREFvWynPkBiGD2HU6MTj0CTGw== X-Received: by 2002:a05:600c:46c8:b0:414:d95:cc47 with SMTP id q8-20020a05600c46c800b004140d95cc47mr1456wmo.30.1713895160037; Tue, 23 Apr 2024 10:59:20 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:19 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 04/13] pinctrl: renesas: pinctrl-rzg2l: Allow parsing of variable configuration for all architectures Date: Tue, 23 Apr 2024 18:58:51 +0100 Message-Id: <20240423175900.702640-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- 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 9bb9cc63f9df..c944d94b9a36 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -322,7 +322,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, @@ -339,6 +338,7 @@ static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, return 0; } +#ifdef CONFIG_RISCV static const struct rzg2l_variable_pin_cfg r9a07g043f_variable_pin_cfg[] = { { .port = 20, @@ -2299,13 +2299,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 Tue Apr 23 17:58: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: 791671 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 95E491411C7; Tue, 23 Apr 2024 17:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895164; cv=none; b=YAS7RwkpyUEQszUTlORlfMLprvMa/HrvaWAhIKYnwJyAGKkA/KZb4IB4B5zd7ZA2rVyNJZiLe0hCrpORXXoUdaXQY0SGVxnDW6b3eIzzzUxARsp3uloCdkQ7ib4uNHu7QRO4M3eNXzBWkkCr3l4gtNOFnEuTpsHjRlZQJqednhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895164; c=relaxed/simple; bh=q1yXhV+4YHqz1aTwCJ1oxJuZ+Epq/n0SspvRNj8qTbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NJNVg1F4xIyFWghCyUSeXX5qewqRwpMdYKp62AAlVetCsY24H01mnuB1P/F7a9nc8N1T5hENG/dWYTwrhOrMGxohEz4zyrH5XXAfrA6cZcx5z0gkFCgFoVjhKHnU4Vyhl80j94kTT5STQmWFNC+4HZ4AyHkun7mPi+w6jZrlfkg= 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=UznNbhYz; arc=none smtp.client-ip=209.85.128.47 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="UznNbhYz" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-41aa21b06b3so16298675e9.0; Tue, 23 Apr 2024 10:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895161; x=1714499961; 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=Jlu+cze/XH5lMX2g6iIK11eee2996qXsMa53GSJ3Hms=; b=UznNbhYzl6AyTGnEaYqh0O2USXZJBpfe5D3kpRCIGj8/7MuBMF6Y2UU6iYCZwcFLaC gt9Yjq+dECbjkGf5Sph+hPbAb6l0EcSTLx9EyFhLIYBY5fqTLTVsa6/iB++RHZcm/fgn A2m7716M/WG9SGrDTBSGc/WtUHPacsfkLudv8jMa1A9VoomrtzTuekqOoU+6WLdjuNPo 5K1eHVZW2dLroago2FD6efRZdK+S2vdqQs1gpWSxixzbiH0UQowu/jb4G2TI5rrp1qUb VrbfeLmazJPNE1DzR4m1sFe/PNxzOphh4f3/OtG0twwMcAOv1I8VMpL4RlYfBhGCzghU UZew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895161; x=1714499961; 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=Jlu+cze/XH5lMX2g6iIK11eee2996qXsMa53GSJ3Hms=; b=UUH2wMFxRpWtLOjLzGoGjsCveLKuoMr2m7X/cz7rvL0CAaPlnCbDSh32uIFJ0Xcvrr UIKSrDzgTbB//r4txNgOx3XnZ+Uu36GTOJB8f2ZVVWOBEKEqi8xgLV9VTjbpkiAc1vqi R47DiK4xkH//a95UNnanCs4xJRqoYGt27EUcxrRI58RJ9Du0jwRymiZTuHPj8qna52BU mwr7hP5JmG5W2+ykCzN2o2VmLxRidAkU5JKY1xcsYqpeCcSEvoU9VBBbTjCf12QPhLPc mwNYtvrW28slV/QBioAtuEsaO/AhtgcITPIEu+xc5P5HJHbXSC8bgP5g90oSCrf4R7KQ IDpw== X-Forwarded-Encrypted: i=1; AJvYcCVk30N1krhWCXfZRAlRgsJ1A4XGlscIh+L8tuK2bxrpEIQE66lUFp7tY0M7a3Swgzy/C/Ytv8J1xbAd1LDLGb0C4y9x0HwwrL7S96yWVwM5IZ2JahpyYYjib3vOP94gtzispiqjdxnI8ZBs+dZ2DYNNhJZqV4yegn/fcG4RnrxP2wk3gJOAVIb3Ueqf X-Gm-Message-State: AOJu0YwuxpnYxAt7jr8SXyuD+5d8EheJJuS0c3ndQGm/6s5WO090tm90 JWlcYes/cCwkAnVcFfBuPTSJCnwQxZuWUef2reprhCCibNBcWPpX X-Google-Smtp-Source: AGHT+IH5buIEi/VPw6QAuTpTWyRW4A+k0YzEFzIQb6LtOXv4k1FqZjEkPD71f3r/9FJjqYZEXaGtjg== X-Received: by 2002:a05:600c:3590:b0:41a:93f3:5c6b with SMTP id p16-20020a05600c359000b0041a93f35c6bmr29752wmq.11.1713895160952; Tue, 23 Apr 2024 10:59:20 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:20 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 05/13] pinctrl: renesas: pinctrl-rzg2l: Validate power registers for SD and ETH Date: Tue, 23 Apr 2024 18:58:52 +0100 Message-Id: <20240423175900.702640-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- 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 c944d94b9a36..bec4685b4681 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -2583,8 +2583,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); @@ -2615,8 +2617,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 Tue Apr 23 17:58: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: 791313 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 D2C1213E3EF; Tue, 23 Apr 2024 17:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895165; cv=none; b=Pqhb39qyzAfrvsRxcqkSu3LujHFfUEbinLgWEv0/wZ4wl5cJBX4wudwKgeBpGGbxPh+x0f0WHDumngFiovjDG+Bmc5HZ0Hzqg/CnKB3iJY/9u5KzA4CtbHJFRB5fQmFWLNKmQHqSY7C7w7mJrj7IJvmLbVJh7+sfmSE+S6jbsGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895165; c=relaxed/simple; bh=gdVRy4l+0rPCzzeaDtUAxHoTiZ9wS43BkviQ1INDWkk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NDjKGDQE2ortOshGWvjh1G9+KNY8ganvigMWFP+YjOK3bEi2sHKGW4o2bGNzMeRUz52HTZ7vz0+RkCrgI4oYhQ25O+ljuVliasMDZsqOiT5hTkOV/UIr1sqR8WFESLdhRYyO4oMdZko3nKn8sjWSdfuA/nynsBza3nafWWHLmpw= 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=FkB2Yai4; arc=none smtp.client-ip=209.85.128.54 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="FkB2Yai4" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-41a77836f16so18041075e9.3; Tue, 23 Apr 2024 10:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895162; x=1714499962; 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=CEG9OgVQaChXDQKIKqAoHsUK5uRo77wy78qh/m7RZcI=; b=FkB2Yai43whREWJOWVv6N7vpr92YUx91xiS5QmR/dn8lZ/Dx6451xfrxzWIYvtU82V mpZRBUgpI0d9EIjgZ20T61+/W6o9wfPpaq5sgqIkn1B5gzX1uHcK5e747zmOo41q+4BW fZSChzANEl2ZMsYxIRx9pOilT7wuut911Uz0YYhy8tSqh79E4buoNFnzH00qY5orlduY 7izpZdDmZcCQnDg1ntEau1eM7fpoJTFe1N0Hmp3sTU6AQzmYh8UHTCSFg5431Bgvy+lh mgsQogbUS7jFhjaY88LG4N0cHoQqotlljdLN8FNSdWzvxnON5WFnh/zNsEH0sG4pXcWo lSYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895162; x=1714499962; 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=CEG9OgVQaChXDQKIKqAoHsUK5uRo77wy78qh/m7RZcI=; b=aNZRT8FFUxv4LXEL7L9mJ1N1C29JuQVvrEQYxLkXuXZh6pzdjeL7ToNeZOGt2iVHJA v9HoLhH866Duz7b+2DRtenCdY3q/SSyM9/YSffBf3s6BJMN9kE7JlIOCxelgkt2/Tuuc OfUIShGPC2nrzW2BiCeU5dFCYIUSRUgCeZDEF1LjAL7CDfBqpye9HR7U7Vj2cepLoLtn nmC7dRCl4DgdTaKBDXXTRVsnwvdMfWbwDvc1qAPZkDATKdI/HRogHq/SUqmwKfG6Jna0 uv2R7z9hPO5zcQaAy0IP0WAW+Mde4N5waM/4BJ/xy/g4oKQEkMubJnouIJXDQT0LUeae DnVQ== X-Forwarded-Encrypted: i=1; AJvYcCXvkeRIEdfmIqXGgbU+pIroGCew7+nLwziHma0pRhGpDQL27GhGFPnLofS9fiH9hAphhG1LOYmP4/yzQCV2vY8+H/7M2DEtROgKf9d0M+K8jBfvJD17eY03fB4Raw30vYy5f9TVNkAAiYG0bzQgTfe3aVHXo7Ng+ooVx32df7TyKwozoYLWnzujKxz3 X-Gm-Message-State: AOJu0YxqV9eXnjJfo2b7GI+ntZkUkYW5kb8rdr+FDdpdb97wkluce3fJ jKyZYugtsA88VT3haui77uBBhKVVgtMo0k18djtAit9vLq0awbHh X-Google-Smtp-Source: AGHT+IHWr2BeP4XN9iE6LQhCrMLzqJBljW2jJRq6LLReqsyv2Rh9c0wyoN6zxyG/fvvQyFzu1oEn5g== X-Received: by 2002:a05:600c:1d93:b0:41a:bfc4:e9a9 with SMTP id p19-20020a05600c1d9300b0041abfc4e9a9mr32748wms.4.1713895162205; Tue, 23 Apr 2024 10:59:22 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:21 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 06/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for locking/unlocking the PFC register Date: Tue, 23 Apr 2024 18:58:53 +0100 Message-Id: <20240423175900.702640-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 set_pfc_mode() and pm_set_pfc() function pointers. Note, in rzg2l_pinctrl_set_pfc_mode() the pwpr_pfc_unlock() call is now called before PMC read/write and pwpr_pfc_lock() call is now called after PMC read/write this is to keep changes minimal for RZ/V2H(P). Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- RFC->v2 - Introduced function pointer for (un)lock --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 51 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index bec4685b4681..0840fda7ca69 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -246,6 +246,8 @@ struct rzg2l_variable_pin_cfg { u64 pin:3; }; +struct rzg2l_pinctrl; + struct rzg2l_pinctrl_data { const char * const *port_pins; const u64 *port_pin_configs; @@ -256,6 +258,8 @@ struct rzg2l_pinctrl_data { const struct rzg2l_hwcfg *hwcfg; const struct rzg2l_variable_pin_cfg *variable_pin_cfg; unsigned int n_variable_pin_cfg; + void (*pwpr_pfc_unlock)(struct rzg2l_pinctrl *pctrl); + void (*pwpr_pfc_lock)(struct rzg2l_pinctrl *pctrl); }; /** @@ -462,7 +466,6 @@ static const struct rzg2l_variable_pin_cfg 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; @@ -473,27 +476,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_unlock(pctrl); + /* 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); /* B0WI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* B0WI=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); /* B0WI=0, PFCWE=0 */ - writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=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(pctrl); + spin_unlock_irqrestore(&pctrl->lock, flags); }; @@ -2519,12 +2518,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); /* B0WI=0, PFCWE=0 */ - writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=1 */ + pctrl->data->pwpr_pfc_unlock(pctrl); /* Restore port registers. */ for (u32 port = 0; port < nports; port++) { @@ -2567,9 +2562,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); /* B0WI=0, PFCWE=0 */ - writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=1, PFCWE=0 */ + pctrl->data->pwpr_pfc_lock(pctrl); } static int rzg2l_pinctrl_suspend_noirq(struct device *dev) @@ -2631,6 +2624,24 @@ static int rzg2l_pinctrl_resume_noirq(struct device *dev) return 0; } +static void rzg2l_pwpr_pfc_unlock(struct rzg2l_pinctrl *pctrl) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->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 */ +} + +static void rzg2l_pwpr_pfc_lock(struct rzg2l_pinctrl *pctrl) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + + /* 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 */ +} + static const struct rzg2l_hwcfg rzg2l_hwcfg = { .regs = { .pwpr = 0x3014, @@ -2688,6 +2699,8 @@ 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_unlock = &rzg2l_pwpr_pfc_unlock, + .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2699,6 +2712,8 @@ 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_unlock = &rzg2l_pwpr_pfc_unlock, + .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2709,6 +2724,8 @@ 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_unlock = &rzg2l_pwpr_pfc_unlock, + .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Tue Apr 23 17:58: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: 791670 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 1E9EA1422DD; Tue, 23 Apr 2024 17:59:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895166; cv=none; b=SX63KzJDvLcm7h4QIMUidPOKsB1ly6YMO8mXmqsDW49g3cJyfasY5Ai917tA/LPH3mG1lbo/TPVmM36wm2EJyfhOyb5bVbwlqoN3V0IYD5N7ANXk5JZFow5Q2H2lRhodJOunLkboB7NfDwYYkk+Qzjudod4nndufJOH8qFwK/hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895166; c=relaxed/simple; bh=+5ygHTr71DNitGm7m0sAPaYUX1UL+ExqAUD+nwhbYlg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WtU8n5l5qG+1xF4dJ0BMXK0OGXAUnYZo5+0YUIvHBSe8JghqmzmPYyWXWfAWRd4kPUtLPgrjF3JpFysAkIeRdh6c/pqTP4TIFqthrI6s1iCfW4drDnwBiw1UkzOPy4luOqxZaNqjsRj87nZdhbsdXglIhHmJVDo1m5uwDozz160= 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=Po6waH0L; arc=none smtp.client-ip=209.85.128.41 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="Po6waH0L" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-41aa45251eeso12277015e9.3; Tue, 23 Apr 2024 10:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895163; x=1714499963; 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=bbQ26bp2LTo8Azc9QCf3B+NBWpup/zm6dtXf/3UzkoQ=; b=Po6waH0LVKLufTQuccPytuuLYuMg6VluBoIm1wiZY2fdxmcZglJhxOkTvcgjPAR5Py +BxUAjoyes08+OZtW9d+EBzYjQww0CUEz1WlPdp1aIJxow1GSYt5Df8Q6NSLqZ2AhDTZ MRtk7nOiQJDNcu1CXyoJOwZd62JRM5RsHsOPLlHrzZrMkm3QT8ZBsOGn/P7GOham6mpJ huvHQJ+0JINg+6tFj6T/aTaNEwNSFL8huPAjAig4VZDd8SZ3FHcO4G+xwTrP32AcrxXf qI2NAYHBYH24tumN+JFVcHstqe8AKUccxT3tqqv677E3CFfT7EAEV+nHQvyKn9v/magb vnCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895163; x=1714499963; 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=bbQ26bp2LTo8Azc9QCf3B+NBWpup/zm6dtXf/3UzkoQ=; b=i9zQOfqpRyccq6wk/XNM0006t/biy15oqTrJGFLoz2h5q2NtwX+L1VdoFxxkC2PGqm Ydrig8Ra64cL2x61lpaGHjhqjLgEDgrwLRJSscuDfCw0gFtVqJth0dD1rsyS+Cz61Edq j7TlsHWIA6n4hv+rGYbukfEHdt0NzGzYtHsEAR+GHeWMaM1jRruHnqMUNnjuCDjf/INt t3tx2vVX3Q6k9nPe+2XsjKucLT3hvopYxqxRFzg0Zt+f/JZPlQWbWtz2/RIIXbujJv16 KJxYAw7t1m0ZGwEFn2R5HRrT0EIVUCxlkWh48Vbr93iSJ/Xgspjb/VhGFn0gyGpYWYQK l42Q== X-Forwarded-Encrypted: i=1; AJvYcCXmS51N0PZJENYWq3osmhfp2YjOj0HkkzIq3gFoSUxnkHDbSCBnfHiLLQW3gwDvc2NE3IDK1wZxDxx7/HTz3TlGsbAyRzcLzUMLCNcDOk2J6vPJOqi9OEIgKJROqcUafxjNbuhj0P2C2NuX+rQFHSDoeCrEfz2ych0UuTIQyW5iRt3NFGWFwv0BxJwG X-Gm-Message-State: AOJu0YyWVCyL2YbLSi0BJHFOoge/kvgzs0fteRwDJ7pjvD5aHxc5QXGw FLfPfiZ7K/tDD1O3ijc6Weh8PwmKn8yBFK4GCPnYBjfvPiSz7OXb X-Google-Smtp-Source: AGHT+IGyDXzlS+AEqNZexqNenfnSsvSIRWtF8AqjWIF3/9Q01UBvulHrbsLXfzC5g0zt/HFDv3pNeQ== X-Received: by 2002:a05:600c:4590:b0:418:f991:713f with SMTP id r16-20020a05600c459000b00418f991713fmr3751wmo.23.1713895163472; Tue, 23 Apr 2024 10:59:23 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:22 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 07/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointer for writing to PMC register Date: Tue, 23 Apr 2024 18:58:54 +0100 Message-Id: <20240423175900.702640-8-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 a function pointer, pmc_writeb(), 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_unlock/pwpr_pfc_lock. Signed-off-by: Lad Prabhakar --- 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 0840fda7ca69..e6d986b84be6 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -260,6 +260,7 @@ struct rzg2l_pinctrl_data { unsigned int n_variable_pin_cfg; void (*pwpr_pfc_unlock)(struct rzg2l_pinctrl *pctrl); void (*pwpr_pfc_lock)(struct rzg2l_pinctrl *pctrl); + void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr); }; /** @@ -463,6 +464,11 @@ static const struct rzg2l_variable_pin_cfg r9a07g043f_variable_pin_cfg[] = { }; #endif +static void rzg2l_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr) +{ + writeb(val, addr); +} + static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, u8 pin, u8 off, u8 func) { @@ -1410,7 +1416,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, pctrl->base + PMC(off)); spin_unlock_irqrestore(&pctrl->lock, flags); @@ -2701,6 +2707,7 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { #endif .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2714,6 +2721,7 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .hwcfg = &rzg2l_hwcfg, .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2726,6 +2734,7 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .hwcfg = &rzg3s_hwcfg, .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, + .pmc_writeb = &rzg2l_pmc_writeb, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Tue Apr 23 17:58: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: 791669 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 00C78142E60; Tue, 23 Apr 2024 17:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895168; cv=none; b=DbeeG/DBrldGlLu4DFP7iE6qs/VwHRoRY4Dlpg+xuWw6X5gbtzOBVUpiOKYE3rAQG9q6J5uGXxbCnOoEN495lvl9x6h11Vv4t18yIvU6VHNtu8Ux6y0z3PCUp1VYNaLNbOGCGt8nCriRl2zyNPONa/IwDdSCJUFNJolZmu0J6wE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895168; c=relaxed/simple; bh=f24p978oNHO9WNN1fLZRjrPDQ/Q+S2HAOUSw7IOAnqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N9kTz0MYMfZly1u7DhIfssi28qm4itInEalYZQDPnNbXy3Ed2GuALbLiMA5vEf6RC00bdB51zxwR3s+o4gGEqppTk7QYFnbZm9EIWD8BqoEHywoltrE84D0YotwGn5fm+5q/kxsl9MqYm8ip2a70uZyPOtMuUos8WjkvMeLNZec= 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=FyBn5+Gw; arc=none smtp.client-ip=209.85.128.44 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="FyBn5+Gw" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-41adf3580dbso710025e9.0; Tue, 23 Apr 2024 10:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895164; x=1714499964; 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=I+3snCKEJ2UBE0awN9fjDpUa5Hdg4iDF9w8kRU1NdWE=; b=FyBn5+Gw8LjK84/SoYiflPQ6sD4CBUiBlhgkkchkqv2XUtH8TSXbvWcHFAoq9odWCL Q7kpNYNx5GMUpRN4cdVSdrrEQ+aOj3MH/1vfZo4v/GKiOHhkSyQIBVIb8kPZbDUxIrca vbdVb4aZ4Hw1k1X1bVTYdu420jEIPzRXRr1G8xlU88ULRP9iniEyccGTyd3BawtjY+7X /+g8W+0H9rZdTW4/dhTQUlplmD6ErSCpqJwhS/GkhDbjZEAUJvYPST8fDmPmzxIYhMtP EtK8E/oIGWGAfUiWbhUzkQ5ES5UEHblGZxR5LuyeYmrj7DhUiirYitW1RwG+hCDyEcSS e3DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895164; x=1714499964; 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=I+3snCKEJ2UBE0awN9fjDpUa5Hdg4iDF9w8kRU1NdWE=; b=LXNz01xe+GxQstw+0P3PWTTscq4RLkPQo1LMjs+yv16a091mfIGEMiO7WsWXjpGhIf uQsKWyK38qTlUOrNd0DZB8C3wR0qx3PZtxW0Aa0s1u8OICucVfUmZ+95jWWoXPlMcOLc mwh5LM2cWusjFItUpjSoQMf0XLZyr6eBOFsSWpK+8irT5RsZHGs/mf8sIBVh3J7VBt9J O+H/3d3cIdPholdW6H7j7EhWLTFayPLmGP1K2mGgJOOstmQaupjRszKyYOt90m0IXY/j 9NjuSFE6XVApggJC/irvfZgjjIEt9teUJAgq3wOExl8MDy/4l1BzKerTKcJ5P5Ufvpwf oYSA== X-Forwarded-Encrypted: i=1; AJvYcCWlbxKGngr3yj6eU3M9AJFvjTpziwLkoHKRR7YRHIbiWcJQ9o9fuC+ikFsc9zhggCealQmWj93GJZOdq0kwe5HFCs9+0K9XxUL2vm1+MZFjP9FYjY5z93jQrMwG3OxstzybSBKGSeKmEDoGyVDBq1Oj3ovezqW5H/Hj1P40gBrKDJmdezbeNYEsAGF8 X-Gm-Message-State: AOJu0YwnJEU1zIKWzagkejwqvofg/bB+apeAptO5FysxruMeofqVdEYv NfuqQXeCQiKAJrKwVW2qKDBBg/CWgeq/v5lFrU30WaIN+xPwQTz8yHDF/m6m X-Google-Smtp-Source: AGHT+IETX+4LqtaiWCVcDsJ2omJUnSkV1Gc7bvlSYodEKPuAWO5pk5+/bXscFzNSKU1DkzYahLhn3w== X-Received: by 2002:a05:600c:1c18:b0:418:f770:30e2 with SMTP id j24-20020a05600c1c1800b00418f77030e2mr2549939wms.1.1713895164433; Tue, 23 Apr 2024 10:59:24 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:23 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 08/13] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for reading/writing OEN register Date: Tue, 23 Apr 2024 18:58:55 +0100 Message-Id: <20240423175900.702640-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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, read_oen() and write_oen(), 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 --- 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 e6d986b84be6..64648a951323 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -261,6 +261,8 @@ struct rzg2l_pinctrl_data { void (*pwpr_pfc_unlock)(struct rzg2l_pinctrl *pctrl); void (*pwpr_pfc_lock)(struct rzg2l_pinctrl *pctrl); void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr); + u32 (*read_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); + int (*write_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen); }; /** @@ -1116,7 +1118,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->read_oen(pctrl, cfg, _pin, bit); if (!arg) return -EINVAL; break; @@ -1225,7 +1227,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->write_oen(pctrl, cfg, _pin, bit, !!arg); if (ret) return ret; break; @@ -2708,6 +2710,8 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, .pmc_writeb = &rzg2l_pmc_writeb, + .read_oen = &rzg2l_read_oen, + .write_oen = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2722,6 +2726,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, .pmc_writeb = &rzg2l_pmc_writeb, + .read_oen = &rzg2l_read_oen, + .write_oen = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2735,6 +2741,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .pwpr_pfc_unlock = &rzg2l_pwpr_pfc_unlock, .pwpr_pfc_lock = &rzg2l_pwpr_pfc_lock, .pmc_writeb = &rzg2l_pmc_writeb, + .read_oen = &rzg2l_read_oen, + .write_oen = &rzg2l_write_oen, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Tue Apr 23 17:58: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: 791312 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 0D99E13E404; Tue, 23 Apr 2024 17:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895168; cv=none; b=Ujo+YG9GIwV+FjxE1f14zMdJtXDNOIifqN+JhFb+Cr2QDUUYXa5zEEIxszBcs8kXoIPsNfmM2CwUWQ2T+FhwG/BWFPzXIyP2gVrugCS7K3ool1sb+1z4MnUoKG9+wfNwlX4L45ACUPfXJp8Zfk3lDK7aXGzU2RplapJp9AFSSqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895168; c=relaxed/simple; bh=z3asK9ZnNJBdzXEtrEeLUepWgKog2SPt5U7wD8lPZV8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WHIZ1aeV9fF40i0iGVv2iT3WhGGbD5FpIlt0Q3KetV2ZeNOr0FyAVzVnyuuIOrjTbMahavIhC6b25zq+QnDLAOHSsEplh8xU4Zd73nWInnLanBZ91l4JDRuj/VlYU7DkatKftHcKVywXSCQ8C/DqJzFE44Z2IHBZuJvq5XNZyHY= 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=bpD3jBuG; arc=none smtp.client-ip=209.85.128.43 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="bpD3jBuG" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41a5b68ed85so622555e9.1; Tue, 23 Apr 2024 10:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895165; x=1714499965; 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=QrHDO3czwVKAabC8YW+PusgYxVVJ2LCvn2W+dun83jA=; b=bpD3jBuGyXVnNBF5oKQyUYBj2saMArJ6zWLfdWDuYqrl1VO6IpjAQdGQRYAlHNIzkw GaRa9w2Uqrgt8KiwRuw4q7VKHg07pJr2OMblgj1QsoqsDU88DrL/9b2ZuQ+IKsQzrUUy CdW/S/zoWY+FUMxQPhihzVlUG5owsDQmIuX/py2gzMJZ44abkWzsbAPe8ZhfmCyd1gdM PMcoS5Cl9Jbagoy9xdlxcYWzaSoi94r7MadRf4NJwKSCZ/Wopy7+lq18YzU6K8Vydlq+ ykkhYkiTcKZoJmBdKqu5mPTm3k//lngx8u4J1TMH1p3GfxDu7hjCJ6M6gwY1GrpdlEhn jr0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895165; x=1714499965; 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=QrHDO3czwVKAabC8YW+PusgYxVVJ2LCvn2W+dun83jA=; b=Mp5eH6dUuaBLsrDN2TrmH3Tnfis7/e5XG0q7T11G0S6/xRaWO8OMCevd7+Wv7HLpaf IpsVGk//6kbBQIc+4aKbQN6FoN93hX/H2OgL5qb1400+BkbN3fx8uqBvQO8bg5URZZpW S62kEm2avHTNN/nALi36w1PxQMrXUBEr0wOv+6Pm2RFNf5DZSBJ736J0W4yPHf+ELdpJ F0EtxozKhcPlsFNmwq7uKty+cIlFYlab9FVfusWLnShkKu9gi6jFPM/YC2dXTS98Rn8D QPm7fS9uUetGBJk4/2ACzTmq+7lrE6CS8/pkYiZfowPXLcChzETc1eGb0R82HF7zs3pc sWNA== X-Forwarded-Encrypted: i=1; AJvYcCWJHz7B8cMdM4lpEmfL6//UbeTPJV5Xy/BZQ/woD/gePXdR55tk6eR5VUIW1KkGtxFYmOnpidpemZtYaK8DuEMdrsXMG35HtFZpVybyVK8jR2jxUycCwdwqlJ76dXOz04xdCyi/QA/qP5pK/3woTQl8eohXIkOHvl8PdmKX9k1ppwiyhrsiTz1i1Smp X-Gm-Message-State: AOJu0YyQZyrvxN0UveEq4VbrbC/O+/4RgovxC9K+EmYLjtKRV70tAS0S zNfvUMJXwg/idDp7kd1ADyxa7GtFbiIut/UehcejVc5DTmcFO23Y X-Google-Smtp-Source: AGHT+IGHykaCU420pnUiRngXe0DX+kV29P+oyaCbX7O8GEiCXyDu5ruf6hLKNfih+uNQlQQJvajEWQ== X-Received: by 2002:a05:600c:1e2a:b0:41a:b42d:e6cd with SMTP id ay42-20020a05600c1e2a00b0041ab42de6cdmr139906wmb.4.1713895165419; Tue, 23 Apr 2024 10:59:25 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:24 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 09/13] pinctrl: renesas: pinctrl-rzg2l: Add support to configure the slew-rate Date: Tue, 23 Apr 2024 18:58:56 +0100 Message-Id: <20240423175900.702640-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- 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 64648a951323..102fa75c71d3 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -120,6 +120,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) @@ -138,6 +139,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 @@ -1130,6 +1132,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; @@ -1236,6 +1245,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 Tue Apr 23 17:58: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: 791311 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 0422B142E77; Tue, 23 Apr 2024 17:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895169; cv=none; b=OMb9WZpKp/1wXkCNrdHy5kIW746OhU9/qGw8P970hAJPOvsfGmYp3jYa+twPaAHXXTSsrt4FmzNMg2uuAUWN2paQl963ST35sLRiwQp9/hdgnenAHFsjBpp2kkiajLc05WofHy1lCNeJBUP2X8Em5PNj+WYeeMHvliOWahCoXB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895169; c=relaxed/simple; bh=HcbsyG+Tvga8urvYrCDOXy5hy5ESWVMOxCwdjcLP2bo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cbJep38NoiOur1TltQYWdBnSJla4YZeqsqQx8vg+jr0C9L2ftlb5odlFLRnmo2NHbKRDh8Y6NGfO0UhzQtQMnMIEBRGHXonrHnrYn9dVkTC9qtrJRo1Rk4jxz7t/WgPXoZIVp+jk/5w8/v4HdQCH3PeXnLE10c9uUREaX6gqnOE= 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=lsODWg13; arc=none smtp.client-ip=209.85.128.43 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="lsODWg13" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41a1d88723bso20336915e9.0; Tue, 23 Apr 2024 10:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895166; x=1714499966; 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=fjO/zSIrfOCV8FlsmQ6h2ESV4mTTgyPIjLpSsgo714E=; b=lsODWg13N+pP3Tm8y17rPS4ig6EpH33cN+Vf1fWkSn/9qC0TIOlkKT3VTpBKAFYHqY uuYMZ35jymWbUvg2L0EwhDV2U0x1dajfY26pwEQcZ9fHclaMVpSVnoHexIfJrpFXubWs jQjtthF3vkTgjAKwP2Ixl5A5UJgH65xH917T29BfGrWayJH0LeyRuqqcdwNaN1CZbh+W YZNOUlnDCCm2zP8jPhXmVnOpL5QlsPAjxlSUxtgVncsuUD404d3Fbk2b0Fi3g0pwjWH7 GS+GKPc/qL6qoMuINpOS5Lgoev+G9+4g77tQwaVbViJs+P5jCk+b4B2eYtdQrpm59p21 uaQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895166; x=1714499966; 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=fjO/zSIrfOCV8FlsmQ6h2ESV4mTTgyPIjLpSsgo714E=; b=HiHtByHy3YhrA7CRbuj9obvyrBSI3WJxZiKrqoCDZZuukzjLnTeRFOZBS2bfFpDT0T uTw9bx5aibHFC9B1G+hNNiy5EhBgi3m+P3ImCxIyCVQy6rDu0QTL21d5Q3HB9sPhDFQV HtqAFSXwMUCQ8Icf6wIyyVxzH4m78NtaavgEZV0uacNwV7MoauWGujnpki9h4t/w8vqo pTLfLNRasVorgrmhhRQBeZf5FmKeZs+qB3FKiMHjCi0IOGIRlPXqNrvGQ59g6Rm7DwRW qqBAbxdIXfJB696yLo24RFxDWa1Xe6I0LJ0q3cZFncd6vJNxm1qXMO+KXgvE6nNniVkR iLpw== X-Forwarded-Encrypted: i=1; AJvYcCVAG7+hsq3JzDGqupoYxZcAbaMPs3QMad9HqPkn4XCvKBhXYrQUeRtCKRO2gJvc7tEk2TFrRao5QQTgOW3tfb+AyWw4B7Y6R1mGO5qHmL8pesHl1mnwJDdX8lu+128sK3xmrye7xCXRexXniqQLsHZJN6kYGjGPbYJcAhWocs/RQoNAkrv3g42OyTvC X-Gm-Message-State: AOJu0YxULLpVM6cwauYGvOQSv9/RbanM5/tpQvtZpIl3DjJNQBl3QVXN Jq0YJ7x5LojrSRj8MaRl3JXRP2ntbASWLI1GTQdKiMlmoUlWMeYd X-Google-Smtp-Source: AGHT+IGQMns8H4G/rcVSdlfEuvP8vWD5ItDQGUbTdN9MT5cc1VBP0gNAhrZQzcNVz5mXTseeoutPLg== X-Received: by 2002:a05:600c:3108:b0:41a:ac28:1fc8 with SMTP id g8-20020a05600c310800b0041aac281fc8mr6347wmo.33.1713895166435; Tue, 23 Apr 2024 10:59:26 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:25 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 10/13] pinctrl: renesas: pinctrl-rzg2l: Add support to set pulling up/down the pins Date: Tue, 23 Apr 2024 18:58:57 +0100 Message-Id: <20240423175900.702640-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 get_bias_param() and get_bias_val() are introduced as the values in PUPD register differ when compared to RZ/G2L family and 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 --- RFC->v2 - New patch --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 102fa75c71d3..c144bf43522b 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -122,6 +122,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) @@ -140,6 +141,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 @@ -265,6 +267,8 @@ struct rzg2l_pinctrl_data { void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr); u32 (*read_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); int (*write_oen)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen); + int (*get_bias_param)(u8 val); + int (*get_bias_val)(enum pin_config_param param); }; /** @@ -1081,6 +1085,38 @@ static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 return 0; } +static int rzg2l_get_bias_param(u8 val) +{ + switch (val) { + 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_get_bias_val(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) @@ -1139,6 +1175,25 @@ 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; + + ret = pctrl->data->get_bias_param(rzg2l_read_pin_config(pctrl, + PUPD(off), + bit, PUPD_MASK)); + 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; @@ -1254,6 +1309,20 @@ 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->get_bias_val(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]); @@ -2746,6 +2815,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .pmc_writeb = &rzg2l_pmc_writeb, .read_oen = &rzg2l_read_oen, .write_oen = &rzg2l_write_oen, + .get_bias_param = &rzg2l_get_bias_param, + .get_bias_val = &rzg2l_get_bias_val, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2761,6 +2832,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .pmc_writeb = &rzg2l_pmc_writeb, .read_oen = &rzg2l_read_oen, .write_oen = &rzg2l_write_oen, + .get_bias_param = &rzg2l_get_bias_param, + .get_bias_val = &rzg2l_get_bias_val, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { From patchwork Tue Apr 23 17:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 791668 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 55C10143863; Tue, 23 Apr 2024 17:59:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895170; cv=none; b=ADdopi7VONSQLSvEufkv7EP5QCSSwokBN6FhTRB5WxhPo2O2xGhlYeZ9dWyn5rMbdp6dd7CjhuNDmQwd1NsKmXGXGVQotfR6VhirGcCJn+h06sELb2jt8/nYuUcPnlODcJdv7398A2HSisjUfbZM5SbqsPwMf1FDzc5bpaZnr38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895170; c=relaxed/simple; bh=STU5CQpoNfY02usuPMTXrlizywFUdoAEy4M2VaJzvd4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AFNy9MmEmpHG6yMWU8Wgji3TAzqXRepv2h2eqZLIZz8J9xUIQwNUV3xuanjbkNskiFZrP0jnMLBQNLIF6mSBi2l7y/0gnL2yozjm1MyGkpo7RKx9h3bg08oG3yDvOqGwxyqLhMX7l9bCHaqpJbs0woX6G/LfOBn+r8CzfCFY0zA= 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=DmEfkHaj; arc=none smtp.client-ip=209.85.128.52 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="DmEfkHaj" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-41a72f3a1edso18625905e9.2; Tue, 23 Apr 2024 10:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895168; x=1714499968; 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=YP2hHXwuCZ6+4FXdVWlwcP9W+FvxPjHrC0SRjRAJvHg=; b=DmEfkHaj3aD4LEPoyGmhTk3DnrRvVhhI8jPOek72K0q//Y1Z52eGTuP62x78wiAw/H TUCwhdD7nRabv81DPOLvLbWK2NvCbdLzF4w3q4zYizzFBQ+zUiu4dChalUlTF8VZxQDn tWDp39EV90zujKnr5kO7/eyi5pC4F76r3AVu3FoM+Ywu78Qls7z6P2lI1b8tdbqcqgAu AsAyWfuh4v5AlBXVLhoHH9I2D6Y+JPfdTiW9dbIwi3Z/r49gbEA5fnfPz++g8w7qhJHb v/LMnMhQWQ/5/UeCtwgD/axuSu12Zvj10UfjXpgdDIBAomw7kwNTzq8u1ZN9ZySX/S3q 2zVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895168; x=1714499968; 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=YP2hHXwuCZ6+4FXdVWlwcP9W+FvxPjHrC0SRjRAJvHg=; b=FScs5PSBg+T6ovVNsNulSpXiqHwNWrAdgUzhSBfgGS/Owbq3bpVmCghBmnXkOFwE6I h/qDtwP25rs/SW/QOeOmSNjSmvxLW10d1jEFJewJb+MFFw9WDL/5yatOkf9lwg5NExyW geYxiPUyBus2CL1pLsaQtCbgdwUqbYLMPqc28GyLFRbtidzTrRq+sszhpHlJ0YAU697p H63+pe7q1mkkH9uZbN34YUkwGiKEjMs6rO6ZklqEoLmDtIDaVCRY6jtYaJUIB/solUQz lJj6RiQR0TacF6ZWxENu2EnYsE8qIgTj7IpXRRoAniWefD/wSnEOr0ZSCD7rNdMdegpM Mk3A== X-Forwarded-Encrypted: i=1; AJvYcCX8MJuK2Eh2dHRsc3GieP3JhkR4u9Cx9WJcwmrLBSp6cDyswBraAyJYrm4Tn2p7G7pNIc2UNmxBl27KrK+sq8//r3iV7Ok98nDn0vhIJTQSKsYhbLt18p7Jyg/k7LkuG5J9gQ3wxFQXI6cd1vSgzL92DQPpdD/RjhvKXopY00tiH7f+Dp3t+I3YgiZ3 X-Gm-Message-State: AOJu0YzG2Ib3IvSnG8/ktBhfUqAIxzC53YAU9cbAjZNU7E8ey4iXmi5p ModQXGTBr58k5MCe6DbV8UnNJBTgAwRlpDYwzO9T6Djnfy6EL5P2 X-Google-Smtp-Source: AGHT+IGs32Ia9+aBEgbpCcygR11byEhaWYgNe4QNUH2rpEhu6tcbCXCbTdC8jGZ2vRLRQIY4kK41/Q== X-Received: by 2002:a5d:540f:0:b0:343:efb7:8748 with SMTP id g15-20020a5d540f000000b00343efb78748mr8915699wrv.66.1713895167723; Tue, 23 Apr 2024 10:59:27 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:26 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 11/13] pinctrl: renesas: pinctrl-rzg2l: Pass pincontrol device pointer to pinconf_generic_parse_dt_config() Date: Tue, 23 Apr 2024 18:58:58 +0100 Message-Id: <20240423175900.702640-12-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 prepration for passing custom params. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- 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 c144bf43522b..f3c5e8982623 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -612,7 +612,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 Tue Apr 23 17:58:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 791310 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 7EBB6143896; Tue, 23 Apr 2024 17:59:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895172; cv=none; b=I6ylAz92rc3pEIRx7zspGhwUPuAeC0Shk0jLrW5Bors76Fo43PBGm58yXA39baNXemhp5SdJ5PsDYVtBSnplNha8TM/6h5YO81pqITVWsTIr75vDqj8sTMAB4x1q34ddt0GC2P0Y/XfQECz95tdZdFkK6BdmDSGlKR3btzC5lOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895172; c=relaxed/simple; bh=nVmJXiH4yHIp2+Ic2OWQVS6oMl9V+PTyUf/HbTVGFkQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OdiL9q0MN5GpFNk9X64Nl0ZiiRHH8CHgIzSTWnIECevlngr+Sms618Td664UzIT8jhqdU5hstwG25iFOUyRWbLfO/T1VPMLksfwOGLE+uda3GT2/WfGCvFu36v3kYGlN70MiVTaY7sZyeeVimW3aFGe64/v9ItqU4iUv5zrE6RM= 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=Yevd2CPI; arc=none smtp.client-ip=209.85.128.54 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="Yevd2CPI" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-417e327773cso562565e9.1; Tue, 23 Apr 2024 10:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895169; x=1714499969; 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=7C4Ech5rHYG7C4jDh6HOejAsVKSBZX+m5gTsiDcVD3Y=; b=Yevd2CPItOPY5+nTJBvC4sxWssrf2LjSxu6pM6EaxQkf6HeknUogwxP8JuFv0Pctq/ ulfaEJOf2viVE0DXtxscKC4w+M+MBOtpt+/i80f5gQHpBysQR9K9un2bBBP2IQJEK1zM s5WgxPM1ah+ob9wY68rOA/cNpGJmbA2PhzypQGaEuULFpPBgg5vjLX4AXDfFsxUT/cp0 FGnuk6qZIdZpPdzr6W3tN8WU+EQMTCR3eyG43XaIMUcVGzNFvxeMaRWUuVAtsTFuXppg MIuS8VXr4uU8WrDiZ9FFNEGZJ95MupmLvo08hULQyVHZAF2GFtYBD8TWbvd1L/RTtP9Q QK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895169; x=1714499969; 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=7C4Ech5rHYG7C4jDh6HOejAsVKSBZX+m5gTsiDcVD3Y=; b=nobnmWG+FJALsohXfvOPVEP27CEUe0aKRieZyPsjnXnboEVKJh+YwG2SNINdtUPbJ/ r0fhaosNUMdpqKBAyuoslUjQ41Y1qoe4lLLVJ2NlnpcFY9g69wfEEhTobDqwjzOP0/8Y Em4UqFpaVUuoKSqtNpuvUSHWJh3C7XxuMenAjPXQONMa2dKGlFtszrqwaLl/AnZ2tQFR Njz16J5LZ3icM6PNQ0dQ4poyqwqE2G9aiBA3F7yUP00jUy3c2fWnFXmwob1ru3XlGDgt FwGQRJnRgTdp5de0FMHEsMg++3xJvqo7nciF5gAx2e760Zuj7jzJm488OasdogzdZYU1 XvNw== X-Forwarded-Encrypted: i=1; AJvYcCWrm5BYvEM/PipTrsq1rQE/3Jgj/XZE2tct4mx+J7Ah4IpRMDtdKBk0nMkHPhNcrlNjwq/7dDvMFDgp9aBhfwYqNUV0GaIqmWVGNfVJEsCIKVqoPp0TNFgoahMSMLehZSBWqbyQFD6GepAKUJiTpKU3pg0Kv3OY4NdPbu1Ar+tCu0kRHKVmTWiV7GYB X-Gm-Message-State: AOJu0YzshoVxDaiP2SUIqXqh22xfzp830beX0uTMlYJd88sM9ji/e2/l e6FfI3HJM2m+Md4tGpoH9HYlaav3/JMB+USl1UfC8Qp5aqVsL6uz X-Google-Smtp-Source: AGHT+IEGFdfJlVa7IglglfByhIZh80xohHWIw8NfwmUi/AJxPTZaMQZmN5w5KSLIzcahuZ+J1Q4EIw== X-Received: by 2002:a05:600c:35d3:b0:418:3ea8:46c0 with SMTP id r19-20020a05600c35d300b004183ea846c0mr2310079wmq.13.1713895169011; Tue, 23 Apr 2024 10:59:29 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:28 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 12/13] pinctrl: renesas: pinctrl-rzg2l: Add support for custom parameters Date: Tue, 23 Apr 2024 18:58:59 +0100 Message-Id: <20240423175900.702640-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index f3c5e8982623..7e3ed18e0745 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -262,6 +262,9 @@ struct rzg2l_pinctrl_data { const struct rzg2l_hwcfg *hwcfg; const struct rzg2l_variable_pin_cfg *variable_pin_cfg; unsigned int n_variable_pin_cfg; + unsigned int num_custom_params; + const struct pinconf_generic_params *custom_params; + const struct pin_config_item *custom_conf_items; void (*pwpr_pfc_unlock)(struct rzg2l_pinctrl *pctrl); void (*pwpr_pfc_lock)(struct rzg2l_pinctrl *pctrl); void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr); @@ -2374,6 +2377,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 Tue Apr 23 17:59:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 791667 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 D8035143C6F; Tue, 23 Apr 2024 17:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895174; cv=none; b=ByMMk24WWYYEwKNmung7bcK7xDvN8wLpSz7Yyn7grAJTLp26efFSCT7tJYmsqMTfNk5PHYHpk3rmzeZ1gXd+hRJClzOtLtAj+e4XRFV5I/NL0VQqK4xRIiz+Rg0aQx07UpwvT2m/ucq8pXylE/fr+XsXV+lWbQdiD2KsifkexJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713895174; c=relaxed/simple; bh=JM2mRqpDBRblBzr7A+RrHdUgIcSBQBDa9NjVpzLYq64=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p7AJJwJkdB3bbJmU2aTthkju84nbNHEnL1A7cfx8WTn6qa/MW+IEU7PaDx+r8rH6JSLMR9/ER8mSslaBXIy6Gr7UIF/mOxRNhVvmPqDZTqmjteXv21QSCbjyAlIksW5MGg40dR+daPneEh9XDHyRUQiHle+jQUT1ysv+U4vOtyM= 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=DgZ9lMjf; arc=none smtp.client-ip=209.85.128.42 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="DgZ9lMjf" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4196c62bb4eso32645025e9.2; Tue, 23 Apr 2024 10:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713895170; x=1714499970; 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=5UlZJOdbrr4w7IN8RhsDHqQQd56vqfihEwOWI2Dp2Zg=; b=DgZ9lMjfSgMq08CqbK6z4N+eRAT7Cdss1UzhPQ+SXYD4y3A9etlXyMmwFC3DJJGMZn qbidI2CTAbEfS1pxifvCB+EQZ04ol//qfQxPEqjgU80hHlMOvpvGoKsGscg7uF+u7jTJ dxP2Uf/AKOaXAs99gEYUZlgxCESe0+Xgoie7PYxu3ssUPeEsdcSkoJ9oewWMsL3rK67Q I6mJ9eiKq9sOPjb3ExtCn/HketEtxfGIvB0n2mYTGDtMfU8+q+5rWAcba/EYPL6fpFeP lW7GabyYLgXssKrKF0rpN/IsVzDOeUdxB6+lg+yXeBBe2HSyfZKCUbdfx0/hDuoU7jLo yNrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895170; x=1714499970; 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=5UlZJOdbrr4w7IN8RhsDHqQQd56vqfihEwOWI2Dp2Zg=; b=qjCJZ9KMJwYj3Xrn9NN0D3WkGD5y13qQk23D/bZL5fN90I5NDBCvaLFEpHhBAxMqxh Y+sKy1RuF9tRboN0rt/4DOO0+ZE5lOhjz5Ku5hp9xEX0vg+BVoWQm5s3baatTH9hdDW1 biB29fUvBWW4UsVQyBIV17WCUzu/cPnMadpauQ8IuB2VYC+NXI1m9mkbIRlZ8fj63i06 hnmjkc9OIhuZgtIE5HVodJK+NuPOXDGGsh31PbvUxWWbFH2AAmequXr8ZilDL+3Z7mkE TBoR3PGu8lrA+R8aQtO1eRzbHVAft81RZNgP0g8FvL0xgzUWAF6X5vIZTzbczBvEcLA8 ARfg== X-Forwarded-Encrypted: i=1; AJvYcCVkCoKVJ3B3Ty3/LoUwmEr45Hnd6ZeKYHdMzoBgaPcJhbtx6jKut9H4aFiM67HXIgwTkMRd4jAc0LBwsGtj3pC28CP+ToPAT1th2ikgi+OcGFD77D1jafeFoY7G18e/0J+HaGXAlE1sU8hYnqfoTcC0Jmq63IKgJDkfvYdEYNM/Snl/14CUth6WoJ67 X-Gm-Message-State: AOJu0YyXV2sjlAGCVB5CA5KznELbUs3HesqTjeeW74na/JbBUVZEutcD x53ieW6JhrysXMUWRO6Gv/m8PcI0YMCLz9H2r0jsdSc78vRYH2Mk X-Google-Smtp-Source: AGHT+IHgont4897T904JKXHafu3TUc10hFLHse2iO2Aq9GMGS+gTZEt1PTJxMKsD51hgvdGxQ2UGXg== X-Received: by 2002:a05:600c:1f0b:b0:41a:c33d:772f with SMTP id bd11-20020a05600c1f0b00b0041ac33d772fmr16040wmb.8.1713895170217; Tue, 23 Apr 2024 10:59:30 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:cef0:9ed3:1428:f85f]) by smtp.gmail.com with ESMTPSA id fl5-20020a05600c0b8500b0041abeaaf7f0sm2808145wmb.28.2024.04.23.10.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:59:29 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , linux-renesas-soc@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 13/13] pinctrl: renesas: pinctrl-rzg2l: Add support for RZ/V2H SoC Date: Tue, 23 Apr 2024 18:59:00 +0100 Message-Id: <20240423175900.702640-14-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423175900.702640-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240423175900.702640-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 --- 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 | 419 +++++++++++++++++++++++- 1 file changed, 415 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 7e3ed18e0745..ee0dcdd7921a 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_OPEN_DRAIN BIT(18) +#define PIN_CFG_SCHMIT_CTRL BIT(19) +#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,10 @@ #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_OPEN_DRAIN | \ + PIN_CFG_SR) + #define RZG2L_MPXED_ETH_PIN_FUNCS(x) ((x) | \ PIN_CFG_FILONOFF | \ PIN_CFG_FILNUM | \ @@ -128,13 +136,15 @@ #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 */ #define PVDD_3300 0 /* I/O domain voltage >= 3.3V */ #define PWPR_B0WI BIT(7) /* Bit Write Disable */ -#define PWPR_PFCWE BIT(6) /* PFC Register Write Enable */ +#define PWPR_PFCWE BIT(6) /* PFC (and PMC on RZ/V2H) Register Write Enable */ +#define PWPR_REGWE_B BIT(5) /* OEN Register Write Enable, known only in RZ/V2H(P) */ #define PM_MASK 0x03 #define PFC_MASK 0x07 @@ -153,6 +163,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 { \ @@ -330,6 +353,8 @@ struct rzg2l_pinctrl { spinlock_t lock; /* lock read/write registers */ struct mutex mutex; /* serialize adding groups and functions */ + raw_spinlock_t pwpr_lock; /* serialize PWPR register access */ + struct rzg2l_pinctrl_pin_settings *settings; struct rzg2l_pinctrl_reg_cache *cache; struct rzg2l_pinctrl_reg_cache *dedicated_cache; @@ -354,6 +379,39 @@ static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, return 0; } +static const struct rzg2l_variable_pin_cfg r9a09g057_variable_pin_cfg[] = { + { + .port = 11, + .pin = 0, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL, + }, + { + .port = 11, + .pin = 1, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | PIN_CFG_IEN, + }, + { + .port = 11, + .pin = 2, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | PIN_CFG_IEN, + }, + { + .port = 11, + .pin = 3, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | PIN_CFG_IEN, + }, + { + .port = 11, + .pin = 4, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | PIN_CFG_IEN, + }, + { + .port = 11, + .pin = 5, + .cfg = RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | PIN_CFG_IEN, + }, +}; + #ifdef CONFIG_RISCV static const struct rzg2l_variable_pin_cfg r9a07g043f_variable_pin_cfg[] = { { @@ -480,6 +538,19 @@ static void rzg2l_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem * writeb(val, addr); } +static void rzv2h_pmc_writeb(struct rzg2l_pinctrl *pctrl, u8 val, void __iomem *addr) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + u8 pwpr; + + raw_spin_lock(&pctrl->pwpr_lock); + pwpr = readb(pctrl->base + regs->pwpr); + writeb(pwpr | PWPR_PFCWE, pctrl->base + regs->pwpr); + writeb(val, addr); + writeb(pwpr & ~PWPR_PFCWE, pctrl->base + regs->pwpr); + raw_spin_unlock(&pctrl->pwpr_lock); +} + static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, u8 pin, u8 off, u8 func) { @@ -1120,14 +1191,107 @@ static int rzg2l_get_bias_val(enum pin_config_param param) return -EINVAL; } +static int rzv2h_get_bias_param(u8 val) +{ + switch (val) { + 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_get_bias_val(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]; + u8 bit_array[] = { 0, 1, 2, 3, 4, 5 }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(bit_array); i++) { + if (!strcmp(pin_desc->name, pin_names[i])) + return bit_array[i]; + } + + /* Should not happen. */ + return 0; +} + +static u32 rzv2h_read_oen(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_write_oen(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); + + raw_spin_lock(&pctrl->pwpr_lock); + 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); + raw_spin_unlock(&pctrl->pwpr_lock); + 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; @@ -1240,6 +1404,14 @@ 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; } @@ -1259,9 +1431,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; @@ -1367,6 +1538,17 @@ 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: + arg = pinconf_to_config_argument(_configs[i]); + + if (!(cfg & PIN_CFG_IOLH_RZV2H)) + return -EINVAL; + + if (arg > 3) + return -EINVAL; + rzg2l_rmw_pin_config(pctrl, IOLH(off), bit, IOLH_MASK, arg); + break; + default: return -EOPNOTSUPP; } @@ -1814,6 +1996,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 | PIN_CFG_SCHMIT_CTRL), /* P0 */ + RZG2L_GPIO_PORT_PACK(6, 0x21, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P1 */ + RZG2L_GPIO_PORT_PACK(2, 0x22, RZG2L_MPXED_COMMON_PIN_FUNCS(RZV2H) | + PIN_CFG_OPEN_DRAIN), /* P2 */ + RZG2L_GPIO_PORT_PACK(8, 0x23, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P3 */ + RZG2L_GPIO_PORT_PACK(8, 0x24, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P4 */ + RZG2L_GPIO_PORT_PACK(8, 0x25, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P5 */ + RZG2L_GPIO_PORT_PACK(8, 0x26, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | + PIN_CFG_ELC), /* P6 */ + RZG2L_GPIO_PORT_PACK(8, 0x27, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P7 */ + RZG2L_GPIO_PORT_PACK(8, 0x28, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL | + PIN_CFG_ELC), /* P8 */ + RZG2L_GPIO_PORT_PACK(8, 0x29, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* P9 */ + RZG2L_GPIO_PORT_PACK(8, 0x2a, RZV2H_MPXED_PIN_FUNCS | PIN_CFG_SCHMIT_CTRL), /* 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]; @@ -1940,6 +2155,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_OPEN_DRAIN)) }, + { "WDTUDFCM", RZG2L_SINGLE_PIN_PACK(0x5, 1, (PIN_CFG_IOLH_RZV2H | PIN_CFG_SR | + PIN_CFG_PUPD | PIN_CFG_OPEN_DRAIN)) }, + { "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]; @@ -2476,6 +2823,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; @@ -2498,6 +2848,7 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev) spin_lock_init(&pctrl->lock); spin_lock_init(&pctrl->bitmap_lock); + raw_spin_lock_init(&pctrl->pwpr_lock); mutex_init(&pctrl->mutex); atomic_set(&pctrl->wakeup_path, 0); @@ -2747,6 +3098,32 @@ static void rzg2l_pwpr_pfc_lock(struct rzg2l_pinctrl *pctrl) writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=1, PFCWE=0 */ } +static void rzv2h_pwpr_pfc_unlock(struct rzg2l_pinctrl *pctrl) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + u8 pwpr; + + /* + * lock is acquired in pfc unlock call back and then released in + * pfc lock callback + */ + raw_spin_lock(&pctrl->pwpr_lock); + /* Set the PWPR register to allow PFC and PMC register to write */ + pwpr = readb(pctrl->base + regs->pwpr); + writeb(PWPR_PFCWE | pwpr, pctrl->base + regs->pwpr); +} + +static void rzv2h_pwpr_pfc_lock(struct rzg2l_pinctrl *pctrl) +{ + const struct rzg2l_register_offsets *regs = &pctrl->data->hwcfg->regs; + u8 pwpr; + + /* Set the PWPR register to be write-protected */ + pwpr = readb(pctrl->base + regs->pwpr); + writeb(pwpr & ~PWPR_PFCWE, pctrl->base + regs->pwpr); + raw_spin_unlock(&pctrl->pwpr_lock); +} + static const struct rzg2l_hwcfg rzg2l_hwcfg = { .regs = { .pwpr = 0x3014, @@ -2792,6 +3169,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, @@ -2846,6 +3229,30 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .get_bias_val = &rzg2l_get_bias_val, }; +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_unlock = &rzv2h_pwpr_pfc_unlock, + .pwpr_pfc_lock = &rzv2h_pwpr_pfc_lock, + .pmc_writeb = &rzv2h_pmc_writeb, + .read_oen = &rzv2h_read_oen, + .write_oen = &rzv2h_write_oen, + .get_bias_param = &rzv2h_get_bias_param, + .get_bias_val = &rzv2h_get_bias_val, +}; + static const struct of_device_id rzg2l_pinctrl_of_table[] = { { .compatible = "renesas,r9a07g043-pinctrl", @@ -2859,6 +3266,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 */ } };