mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ye Zhang <ye.zhang@rock-chips.com>
To: linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	tao.huang@rock-chips.com, finley.xiao@rock-chips.com,
	tim.chen@rock-chips.com, elaine.zhang@rock-chips.com,
	Ye Zhang <ye.zhang@rock-chips.com>
Subject: [PATCH v1 2/5] gpio: rockchip: support GPIO_TYPE_V2_2
Date: Thu, 15 Aug 2024 15:16:48 +0800	[thread overview]
Message-ID: <20240815071651.3645949-3-ye.zhang@rock-chips.com> (raw)
In-Reply-To: <20240815071651.3645949-1-ye.zhang@rock-chips.com>

Support GPIO_TYPE_V2_2

Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
---
 drivers/gpio/gpio-rockchip.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 251961a876a9..b2f26a16b1f6 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -32,6 +32,7 @@
 #define GPIO_TYPE_V1		(0)           /* GPIO Version ID reserved */
 #define GPIO_TYPE_V2		(0x01000C2B)  /* GPIO Version ID 0x01000C2B */
 #define GPIO_TYPE_V2_1		(0x0101157C)  /* GPIO Version ID 0x0101157C */
+#define GPIO_TYPE_V2_2		(0x010219C8)  /* GPIO Version ID 0x010219C8 */
 
 #define GPIO_MAX_PINS	(32)
 
@@ -624,13 +625,17 @@ static void rockchip_gpio_get_ver(struct rockchip_pin_bank *bank)
 {
 	int id = readl(bank->reg_base + gpio_regs_v2.version_id);
 
-	/* If not gpio v2, that is default to v1. */
-	if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) {
+	switch (id) {
+	case GPIO_TYPE_V2:
+	case GPIO_TYPE_V2_1:
+	case GPIO_TYPE_V2_2:
 		bank->gpio_regs = &gpio_regs_v2;
 		bank->gpio_type = GPIO_TYPE_V2;
-	} else {
+		break;
+	default:
 		bank->gpio_regs = &gpio_regs_v1;
 		bank->gpio_type = GPIO_TYPE_V1;
+		pr_info("Note: Use default GPIO_TYPE_V1!\n");
 	}
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-08-15  7:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15  7:16 [PATCH v1 0/5] gpio: rockchip: Update the GPIO driver Ye Zhang
2024-08-15  7:16 ` [PATCH v1 1/5] gpio: rockchip: support acpi Ye Zhang
2024-08-16  9:48   ` Bartosz Golaszewski
2024-08-26  6:21   ` Dan Carpenter
2024-08-15  7:16 ` Ye Zhang [this message]
2024-08-16  9:49   ` [PATCH v1 2/5] gpio: rockchip: support GPIO_TYPE_V2_2 Bartosz Golaszewski
2024-08-15  7:16 ` [PATCH v1 3/5] gpio: rockchip: Set input direction in irq_request_resources Ye Zhang
2024-08-16  9:49   ` Bartosz Golaszewski
2024-08-15  7:16 ` [PATCH v1 4/5] gpio: rockchip: avoid division by zero Ye Zhang
2024-08-16  9:51   ` Bartosz Golaszewski
2024-08-15  7:16 ` [PATCH v1 5/5] rockchip: gpio: fix debounce config error Ye Zhang
2024-08-16 10:11   ` Bartosz Golaszewski
2024-08-16  9:46 ` [PATCH v1 0/5] gpio: rockchip: Update the GPIO driver Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240815071651.3645949-3-ye.zhang@rock-chips.com \
    --to=ye.zhang@rock-chips.com \
    --cc=brgl@bgdev.pl \
    --cc=elaine.zhang@rock-chips.com \
    --cc=finley.xiao@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=tao.huang@rock-chips.com \
    --cc=tim.chen@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®