Received: by 2002:ab2:7853:0:b0:1fa:5c73:8e2d with SMTP id m19csp22262lqp; Thu, 30 May 2024 10:44:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHUacFTbzydT6QjfeW/y6S0mZwwJm8izVYS3+LEXuVUklRe5Vp2yy8L1ya3Xo+M0XCbRtuTZwOh2ucO9+LAmHA8csukyasYkMFInXl8Q== X-Google-Smtp-Source: AGHT+IHrKtG3e/qCHXyjOOF1vJg58mrfvrT8SteCunfVRGOmCB7ieUSFh3stv7kj/lX59Yo7cqsG X-Received: by 2002:a05:620a:5852:b0:792:f45c:9055 with SMTP id af79cd13be357-794e9db4180mr283453985a.21.1717091040493; Thu, 30 May 2024 10:44:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717091040; cv=pass; d=google.com; s=arc-20160816; b=wMEuZRgLqkoO/GVx22enJC7ZOyEUwpJgKonUJVtISjNOWMOQSsnpu4iMcsqUwu5Oss 2iw7ikyCZPxadNrEy2lE8Vn20WYO70+3j6TTVC/awXLCyl6pxIGsmO0xTenWkh12DF14 GuKso5NeJMsZpsH9bMw+WjUiT3pPnGRon/x2nDxeaE+pYNVpb5UQpOetpof9ufnoS9hs lf/Rm9AX+s9VxJ/u7roOclY6QyYv3a0XhwEEB0O1YWPpkfa2oqfWnzu/j8OO2mrA/Qaq ZORU5KAYRzOyAYnqy7oWhg0gmzetW+/9h9TyhaewWJloPPi0wSR5R/BnbFkIiWzSn/2n cnUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=r2tib0SqcDm28UJ2V+pduBqYa7NhxgcQli18CyJVXdQ=; fh=sRxjF1qrSgzQBdgX6yzRYNBOED0GbdPTxxG4Zcstu7M=; b=0bwzGyBXC9QRhpq07WHtSuKNMGFxf733lYuV9jJgEt4ILpvP8nv7dtbDhYGfF4u463 NDLk1rYpUymXBvAnkfnagUyBM6uJvzBhdJbloGJJ+7pnTtN3BvCuNF1nZfF8xxcLquSd /UrccK2+/tuztLron2OXwZbEFQklap1dhH3XcPkW5DdAMAxLAQNxVigwM2Tj6cquvTp8 4V4K5vOowkqvm5m5FqDHYgpBfHOCwG2TS+KZGjvh40HZBMtyueEa+eGnc2WA9j7nEwtg 40HheAkFN3gO0Lq5hSGRws5CEXL83MYtyeUcwXA9iB8H99Jp20XXdqXIQKnA2tONNFw0 xJGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjm8j4Rj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794f32a55cbsi3571785a.612.2024.05.30.10.44.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjm8j4Rj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2CDEE1C22D69 for ; Thu, 30 May 2024 17:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E02624EB2E; Thu, 30 May 2024 17:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hjm8j4Rj" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E50553E0A; Thu, 30 May 2024 17:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090947; cv=none; b=K4UmNHmqUWCIgwKDOA7WYXKWJQ/FZpXm/zAKpdmCz9KlV2uSI/Iw4a0Zoc+VXuhWey5UK88hWAKWEbuXl5xMwZe5I/wo+xytSrUDdWZyJGZbuXYe6xsBOIyNR4RJWVOtiq4LWf7Kd+c00P9g0mbd+BwI9sa26BCtnTk5cjI/D1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717090947; c=relaxed/simple; bh=enrbLfIqbMgsaGiKXaUzTFdWpObNyqhxtAnxQv+OKu8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Gj7okO7e0kTsFTdYABWNT9rQY69CFKNkq7krOvXh6K4MB7WgSkZJHV3gQUDMsVBoGgGIQJdsR++QT3+uGIYKdATASKyChh5k9U9/ZpAUT7JoOTB3TRY3oUtiq8ItOFdqIBaj7yeg/ojgDiLeOpaASsUhohJcWbQWLt+F7NsV8K0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hjm8j4Rj; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f480624d10so10052455ad.1; Thu, 30 May 2024 10:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717090945; x=1717695745; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r2tib0SqcDm28UJ2V+pduBqYa7NhxgcQli18CyJVXdQ=; b=hjm8j4Rj5uKSgI1kU7nMQuxVGcr2iUaoH+gxl0+esSpVyzTvXhGA/ucSO4qJ4xVsJi l6g5LRT6Lo+woAHnAjAWw0r3k/ld9YqtkS9md7sB9ldi+bN0cAeQJxFepFDri0itpPpH Yh7h4AAL9q3f6Q6k1QXjlYB7fvjIMLjUdftVNDr9TifstsOp8POXXuJuppuPnz6thGol eveEpTIZ6vwwDJrpbBwQ+BC7epRVkHu8Af3umKeG6f4k+HVgYY4rsiHyi0g06RlEfnDI BBgAFfEXkmItjm/bfLFS3IVJ0rP9/hkEhSk5hilBVrgqB5xmRV7XJQ7FDpG6LV/SVMbu t0Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717090945; x=1717695745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r2tib0SqcDm28UJ2V+pduBqYa7NhxgcQli18CyJVXdQ=; b=plcMMJx2C3HAzreYvKKu5vuisYWj2p0q+Ilj0iwBK7maKYK85IWyX71L/T/lfPVGxV V6GXKccB030DbFxuaOMZ0+2UCa41/xdTmjJTVFJSNggaLD0hAd2o1BshWieLXnhJJyzu XTW/5oxLQL2FBu0fmJ81v8vQyiJTrZximdE97ADaR6ULu59yXmQLJ811S6GE5sp7MbnL T2GVrp9qZUtyxuiJkIYdmFk2ADT7nkWT2j6FsUHPzBQ+LfiBYUauIODiyhdrRAIrPLh7 JNUd8AM5NGt/+L5V5SncGl1dghudnP2vEsEPchGsgVrZfPReXxl/ilqRAVOmoCWf11mm oCSw== X-Forwarded-Encrypted: i=1; AJvYcCUzlS/9kuPGGEaz5kAyTaUf+avQWRi52ua2DYmJlXVHE0C39Z1UqUC3/iY8EY9WZjakf9h9ZRcJ9ygXE2TTCKPSzgkDJQisgDXTIOTGPeOcaZncPDoI3/93V/OW8H3d3lqe/jScSWuFu1Ru9kXdYpD5xcrLZxkXZex744b3UwJiad8H47s= X-Gm-Message-State: AOJu0YyUjO9OHbL/KaPeDPbCtGHY7gIIz0F3LOw33qx7oF+lIN8B4D+v sQwegrlOV5fG2xU90YkGE1i0uS49sMvuMBMmjDM7B0sE1qS7bCuQ X-Received: by 2002:a17:902:e882:b0:1f3:b9d:87e6 with SMTP id d9443c01a7336-1f6192f06e0mr29661625ad.8.1717090944939; Thu, 30 May 2024 10:42:24 -0700 (PDT) Received: from prasmi.. ([2401:4900:1c07:3bcb:e05d:a577:9add:a9ce]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f63240c947sm450105ad.269.2024.05.30.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:42:24 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Claudiu Beznea , Fabrizio Castro , Paul Barker , Lad Prabhakar Subject: [PATCH v3 09/15] pinctrl: renesas: pinctrl-rzg2l: Add function pointers for reading/writing OEN register Date: Thu, 30 May 2024 18:38:51 +0100 Message-Id: <20240530173857.164073-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20240530173857.164073-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Lad Prabhakar This patch introduces function pointers, oen_read() and oen_write(), in the struct rzg2l_pinctrl_data to facilitate reading and writing to the PFC_OEN register. On the RZ/V2H(P) SoC, unlocking the PWPR.REGWE_B bit before writing to the PFC_OEN register is necessary, and the PFC_OEN register has more bits compared to the RZ/G2L family. To handle these differences between RZ/G2L and RZ/V2H(P) and to reuse the existing code for RZ/V2H(P), these function pointers are introduced. Additionally, this patch populates these function pointers with appropriate data for existing SoCs. Signed-off-by: Lad Prabhakar --- v2->v3 - Renamed read_oen->oen_read - Renamed write_oen->oen_write - Updated commit message RFC->v2 - No change --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index f8a1a1f2eebe..807851c33e48 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -255,6 +255,8 @@ struct rzg2l_pinctrl_data { unsigned int n_variable_pin_cfg; void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock); void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset); + u32 (*oen_read)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin); + int (*oen_write)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen); }; /** @@ -1035,7 +1037,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev, break; case PIN_CONFIG_OUTPUT_ENABLE: - arg = rzg2l_read_oen(pctrl, cfg, _pin, bit); + arg = pctrl->data->oen_read(pctrl, cfg, _pin, bit); if (!arg) return -EINVAL; break; @@ -1144,7 +1146,7 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, case PIN_CONFIG_OUTPUT_ENABLE: arg = pinconf_to_config_argument(_configs[i]); - ret = rzg2l_write_oen(pctrl, cfg, _pin, bit, !!arg); + ret = pctrl->data->oen_write(pctrl, cfg, _pin, bit, !!arg); if (ret) return ret; break; @@ -2623,6 +2625,8 @@ static struct rzg2l_pinctrl_data r9a07g043_data = { #endif .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a07g044_data = { @@ -2636,6 +2640,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = { .hwcfg = &rzg2l_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static struct rzg2l_pinctrl_data r9a08g045_data = { @@ -2648,6 +2654,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = { .hwcfg = &rzg3s_hwcfg, .pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock, .pmc_writeb = &rzg2l_pmc_writeb, + .oen_read = &rzg2l_read_oen, + .oen_write = &rzg2l_write_oen, }; static const struct of_device_id rzg2l_pinctrl_of_table[] = { -- 2.34.1