All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Minor fixes for MediaTek pinctrl driver
@ 2021-03-05  2:21 Weijie Gao
  2021-03-05  2:22 ` [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name Weijie Gao
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Weijie Gao @ 2021-03-05  2:21 UTC (permalink / raw)
  To: u-boot

This patch series provides fixes for MediaTek pinctrl driver common parts
and mt7629.

Sam Shih (2):
  pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name
  pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl

Weijie Gao (2):
  pinctrl: mediatek: do not probe gpio driver if not enabled
  pinctrl: mt7629: add jtag function and pin group

 drivers/pinctrl/mediatek/pinctrl-mt7629.c     |  7 +++++
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 28 +++++++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name
  2021-03-05  2:21 [PATCH 0/4] Minor fixes for MediaTek pinctrl driver Weijie Gao
@ 2021-03-05  2:22 ` Weijie Gao
  2021-03-20 23:36   ` Tom Rini
  2021-03-05  2:22 ` [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl Weijie Gao
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Weijie Gao @ 2021-03-05  2:22 UTC (permalink / raw)
  To: u-boot

From: Sam Shih <sam.shih@mediatek.com>

This is a bug fix for mtk pinctrl common part. Appearently pins should be
used instead of grps in mtk_get_pin_name().

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 4dd3f73ead..b700dd98bf 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -219,7 +219,7 @@ static const char *mtk_get_pin_name(struct udevice *dev,
 {
 	struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
 
-	if (!priv->soc->grps[selector].name)
+	if (!priv->soc->pins[selector].name)
 		return mtk_pinctrl_dummy_name;
 
 	return priv->soc->pins[selector].name;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl
  2021-03-05  2:21 [PATCH 0/4] Minor fixes for MediaTek pinctrl driver Weijie Gao
  2021-03-05  2:22 ` [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name Weijie Gao
@ 2021-03-05  2:22 ` Weijie Gao
  2021-03-20 23:36   ` Tom Rini
  2021-03-05  2:22 ` [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled Weijie Gao
  2021-03-05  2:22 ` [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group Weijie Gao
  3 siblings, 1 reply; 9+ messages in thread
From: Weijie Gao @ 2021-03-05  2:22 UTC (permalink / raw)
  To: u-boot

From: Sam Shih <sam.shih@mediatek.com>

This patch add get_pin_muxing support for mediatek pinctrl drivers

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index b700dd98bf..b2212c2559 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -232,6 +232,19 @@ static int mtk_get_pins_count(struct udevice *dev)
 	return priv->soc->npins;
 }
 
+static int mtk_get_pin_muxing(struct udevice *dev, unsigned int selector,
+			      char *buf, int size)
+{
+	int val, err;
+
+	err = mtk_hw_get_value(dev, selector, PINCTRL_PIN_REG_MODE, &val);
+	if (err)
+		return err;
+
+	snprintf(buf, size, "Aux Func.%d", val);
+	return 0;
+}
+
 static const char *mtk_get_group_name(struct udevice *dev,
 				      unsigned int selector)
 {
@@ -512,6 +525,7 @@ static int mtk_pinconf_group_set(struct udevice *dev,
 const struct pinctrl_ops mtk_pinctrl_ops = {
 	.get_pins_count = mtk_get_pins_count,
 	.get_pin_name = mtk_get_pin_name,
+	.get_pin_muxing = mtk_get_pin_muxing,
 	.get_groups_count = mtk_get_groups_count,
 	.get_group_name = mtk_get_group_name,
 	.get_functions_count = mtk_get_functions_count,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled
  2021-03-05  2:21 [PATCH 0/4] Minor fixes for MediaTek pinctrl driver Weijie Gao
  2021-03-05  2:22 ` [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name Weijie Gao
  2021-03-05  2:22 ` [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl Weijie Gao
@ 2021-03-05  2:22 ` Weijie Gao
  2021-03-20 23:36   ` Tom Rini
  2021-03-05  2:22 ` [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group Weijie Gao
  3 siblings, 1 reply; 9+ messages in thread
From: Weijie Gao @ 2021-03-05  2:22 UTC (permalink / raw)
  To: u-boot

The mtk pinctrl driver is a combination driver with support for both
pinctrl and gpio. When this driver is used in SPL, gpio support may not be
enabled, and this will result in a compilation error.

To fix this, macros are added to make sure gpio related code will only be
compiled when gpio support is enabled.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index b2212c2559..264c6458c9 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -540,6 +540,8 @@ const struct pinctrl_ops mtk_pinctrl_ops = {
 	.set_state = pinctrl_generic_set_state,
 };
 
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
+    (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
 static int mtk_gpio_get(struct udevice *dev, unsigned int off)
 {
 	int val, err;
@@ -647,12 +649,13 @@ static int mtk_gpiochip_register(struct udevice *parent)
 
 	return 0;
 }
+#endif
 
 int mtk_pinctrl_common_probe(struct udevice *dev,
 			     struct mtk_pinctrl_soc *soc)
 {
 	struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
-	int ret;
+	int ret = 0;
 
 	priv->base = dev_read_addr_ptr(dev);
 	if (!priv->base)
@@ -660,9 +663,10 @@ int mtk_pinctrl_common_probe(struct udevice *dev,
 
 	priv->soc = soc;
 
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
+    (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
 	ret = mtk_gpiochip_register(dev);
-	if (ret)
-		return ret;
+#endif
 
-	return 0;
+	return ret;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group
  2021-03-05  2:21 [PATCH 0/4] Minor fixes for MediaTek pinctrl driver Weijie Gao
                   ` (2 preceding siblings ...)
  2021-03-05  2:22 ` [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled Weijie Gao
@ 2021-03-05  2:22 ` Weijie Gao
  2021-03-20 23:37   ` Tom Rini
  3 siblings, 1 reply; 9+ messages in thread
From: Weijie Gao @ 2021-03-05  2:22 UTC (permalink / raw)
  To: u-boot

The EPHY LEDs of mt7629 can be used as JTAG. This patch adds the jtag pin
group to the pinctrl driver.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7629.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7629.c b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
index 7ce64fde25..5d4bec2234 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7629.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
@@ -201,6 +201,10 @@ static int mt7629_wf2g_led_funcs[] = { 1, };
 static int mt7629_wf5g_led_pins[] = { 18, };
 static int mt7629_wf5g_led_funcs[] = { 1, };
 
+/* LED for EPHY used as JTAG */
+static int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, };
+static int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, };
+
 /* Watchdog */
 static int mt7629_watchdog_pins[] = { 11, };
 static int mt7629_watchdog_funcs[] = { 1, };
@@ -297,6 +301,7 @@ static const struct mtk_group_desc mt7629_groups[] = {
 	PINCTRL_PIN_GROUP("ephy_led2", mt7629_ephy_led2),
 	PINCTRL_PIN_GROUP("ephy_led3", mt7629_ephy_led3),
 	PINCTRL_PIN_GROUP("ephy_led4", mt7629_ephy_led4),
+	PINCTRL_PIN_GROUP("ephy_leds_jtag", mt7629_ephy_leds_jtag),
 	PINCTRL_PIN_GROUP("wf2g_led", mt7629_wf2g_led),
 	PINCTRL_PIN_GROUP("wf5g_led", mt7629_wf5g_led),
 	PINCTRL_PIN_GROUP("watchdog", mt7629_watchdog),
@@ -364,6 +369,7 @@ static const char *const mt7629_uart_groups[] = { "uart1_0_txd_rxd",
 static const char *const mt7629_wdt_groups[] = { "watchdog", };
 static const char *const mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", };
 static const char *const mt7629_flash_groups[] = { "snfi", "spi_nor" };
+static const char *const mt7629_jtag_groups[] = { "ephy_leds_jtag" };
 
 static const struct mtk_function_desc mt7629_functions[] = {
 	{"eth",	mt7629_ethernet_groups, ARRAY_SIZE(mt7629_ethernet_groups)},
@@ -376,6 +382,7 @@ static const struct mtk_function_desc mt7629_functions[] = {
 	{"watchdog", mt7629_wdt_groups, ARRAY_SIZE(mt7629_wdt_groups)},
 	{"wifi", mt7629_wifi_groups, ARRAY_SIZE(mt7629_wifi_groups)},
 	{"flash", mt7629_flash_groups, ARRAY_SIZE(mt7629_flash_groups)},
+	{"jtag", mt7629_jtag_groups, ARRAY_SIZE(mt7629_jtag_groups)},
 };
 
 static struct mtk_pinctrl_soc mt7629_data = {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name
  2021-03-05  2:22 ` [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name Weijie Gao
@ 2021-03-20 23:36   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-03-20 23:36 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 05, 2021 at 10:22:11AM +0800, Weijie Gao wrote:

> From: Sam Shih <sam.shih@mediatek.com>
> 
> This is a bug fix for mtk pinctrl common part. Appearently pins should be
> used instead of grps in mtk_get_pin_name().
> 
> Signed-off-by: Sam Shih <sam.shih@mediatek.com>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210320/53870e9a/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl
  2021-03-05  2:22 ` [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl Weijie Gao
@ 2021-03-20 23:36   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-03-20 23:36 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 05, 2021 at 10:22:19AM +0800, Weijie Gao wrote:

> From: Sam Shih <sam.shih@mediatek.com>
> 
> This patch add get_pin_muxing support for mediatek pinctrl drivers
> 
> Signed-off-by: Sam Shih <sam.shih@mediatek.com>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210320/a9c103ce/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled
  2021-03-05  2:22 ` [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled Weijie Gao
@ 2021-03-20 23:36   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-03-20 23:36 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 05, 2021 at 10:22:26AM +0800, Weijie Gao wrote:

> The mtk pinctrl driver is a combination driver with support for both
> pinctrl and gpio. When this driver is used in SPL, gpio support may not be
> enabled, and this will result in a compilation error.
> 
> To fix this, macros are added to make sure gpio related code will only be
> compiled when gpio support is enabled.
> 
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210320/7060dfbf/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group
  2021-03-05  2:22 ` [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group Weijie Gao
@ 2021-03-20 23:37   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-03-20 23:37 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 05, 2021 at 10:22:31AM +0800, Weijie Gao wrote:

> The EPHY LEDs of mt7629 can be used as JTAG. This patch adds the jtag pin
> group to the pinctrl driver.
> 
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210320/51f2f5a6/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-20 23:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  2:21 [PATCH 0/4] Minor fixes for MediaTek pinctrl driver Weijie Gao
2021-03-05  2:22 ` [PATCH 1/4] pinctrl: mediatek: fix wrong assignment in mtk_get_pin_name Weijie Gao
2021-03-20 23:36   ` Tom Rini
2021-03-05  2:22 ` [PATCH 2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl Weijie Gao
2021-03-20 23:36   ` Tom Rini
2021-03-05  2:22 ` [PATCH 3/4] pinctrl: mediatek: do not probe gpio driver if not enabled Weijie Gao
2021-03-20 23:36   ` Tom Rini
2021-03-05  2:22 ` [PATCH 4/4] pinctrl: mt7629: add jtag function and pin group Weijie Gao
2021-03-20 23:37   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.