linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyle Hendry <kylehendrydev@gmail.com>
To: linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kyle Hendry <kylehendrydev@gmail.com>
Subject: [PATCH] pinctrl: bcm63268: Add gpio function
Date: Sat,  7 Dec 2024 14:33:35 -0800	[thread overview]
Message-ID: <20241207223335.17535-1-kylehendrydev@gmail.com> (raw)

There is no guarantee that the bootloader will leave the pin configuration
in a known default state, so pinctrl needs to be explicitly set in some
cases. This patch adds a gpio function for drivers that need it, i.e.
gpio-leds.

Signed-off-by: Kyle Hendry <kylehendrydev@gmail.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm63268.c | 68 ++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm63268.c b/drivers/pinctrl/bcm/pinctrl-bcm63268.c
index 80c2fc55ffa2..5ad86b40f0b3 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm63268.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c
@@ -38,6 +38,7 @@ enum bcm63268_pinctrl_reg {
 	BCM63268_MODE,
 	BCM63268_CTRL,
 	BCM63268_BASEMODE,
+	BCM63268_NOREG,
 };
 
 struct bcm63268_function {
@@ -242,6 +243,61 @@ static struct pingroup bcm63268_groups[] = {
 	BCM_PIN_GROUP(vdsl_phy3_grp),
 };
 
+static const char * const gpio_groups[] = {
+	"gpio0",
+	"gpio1",
+	"gpio2",
+	"gpio3",
+	"gpio4",
+	"gpio5",
+	"gpio6",
+	"gpio7",
+	"gpio8",
+	"gpio9",
+	"gpio10",
+	"gpio11",
+	"gpio12",
+	"gpio13",
+	"gpio14",
+	"gpio15",
+	"gpio16",
+	"gpio17",
+	"gpio18",
+	"gpio19",
+	"gpio20",
+	"gpio21",
+	"gpio22",
+	"gpio23",
+	"gpio24",
+	"gpio25",
+	"gpio26",
+	"gpio27",
+	"gpio28",
+	"gpio29",
+	"gpio30",
+	"gpio31",
+	"gpio32",
+	"gpio33",
+	"gpio34",
+	"gpio35",
+	"gpio36",
+	"gpio37",
+	"gpio38",
+	"gpio39",
+	"gpio40",
+	"gpio41",
+	"gpio42",
+	"gpio43",
+	"gpio44",
+	"gpio45",
+	"gpio46",
+	"gpio47",
+	"gpio48",
+	"gpio49",
+	"gpio50",
+	"gpio51",
+};
+
 static const char * const led_groups[] = {
 	"gpio0",
 	"gpio1",
@@ -427,7 +483,16 @@ static const char * const vdsl_phy_override_3_groups[] = {
 		.mask = val,				\
 	}
 
+#define BCM63268_NOMODE_FUN(n)			\
+	{						\
+		.name = #n,				\
+		.groups = n##_groups,			\
+		.num_groups = ARRAY_SIZE(n##_groups),	\
+		.reg = BCM63268_NOREG,			\
+	}
+
 static const struct bcm63268_function bcm63268_funcs[] = {
+	BCM63268_NOMODE_FUN(gpio),
 	BCM63268_LED_FUN(led),
 	BCM63268_MODE_FUN(serial_led_clk),
 	BCM63268_MODE_FUN(serial_led_data),
@@ -562,6 +627,9 @@ static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev,
 		mask = f->mask;
 		val = f->mask;
 		break;
+	case BCM63268_NOREG:
+		/*Do nothing, leave registers as default*/
+		break;
 	default:
 		WARN_ON(1);
 		return -EINVAL;
-- 
2.43.0


             reply	other threads:[~2024-12-07 22:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-07 22:33 Kyle Hendry [this message]
2024-12-09  4:44 ` [PATCH] pinctrl: bcm63268: Add gpio function kernel test robot
2024-12-24 10:36 ` [PATCH v2] pinctrl: bcm63268: add " Álvaro Fernández Rojas
2024-12-27 16:17   ` Linus Walleij
2024-12-28  9:47     ` Álvaro Fernández Rojas
2024-12-30 16:42   ` Jonas Gorski
2025-01-03  3:04     ` Kyle Hendry
2025-01-04 15:44       ` Álvaro Fernández Rojas
2025-01-04 17:02         ` Álvaro Fernández Rojas
2025-01-04 19:32           ` Jonas Gorski
2025-01-05  9:31             ` Álvaro Fernández Rojas

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=20241207223335.17535-1-kylehendrydev@gmail.com \
    --to=kylehendrydev@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).