diff mbox series

[v3,2/4] mmc: pic32: Refresh PIC32 MMC driver

Message ID VI1P190MB0141AC6615FB7FE07647AFB9FB2E0@VI1P190MB0141.EURP190.PROD.OUTLOOK.COM
State Accepted
Commit 10d65bf00beb8609c8d6639c3e60a89b148899e6
Delegated to: Daniel Schwierzeck
Headers show
Series [v3,1/4] mmc: pic32: Refresh PIC32 MMC driver | expand

Commit Message

John Robertson Sept. 1, 2020, 2:55 a.m. UTC
The GPIO pins used by the SDHCI controller need to be configured to
allow the interface to work.

Signed-off-by: John Robertson <john.robertson@simiatec.com>
---

 drivers/pinctrl/pinctrl_pic32.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Daniel Schwierzeck Sept. 19, 2020, 7:28 p.m. UTC | #1
Am Dienstag, den 01.09.2020, 02:55 +0000 schrieb John Robertson:
> The GPIO pins used by the SDHCI controller need to be configured to
> allow the interface to work.
> 
> Signed-off-by: John Robertson <john.robertson@simiatec.com>
> ---
> 
>  drivers/pinctrl/pinctrl_pic32.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 

applied to u-boot-mips/fixes, thanks.

Note: I've updated the commit subject to "pinmux: pic32: add SDHCI pin
config"
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl_pic32.c b/drivers/pinctrl/pinctrl_pic32.c
index 911af1297b..899c279975 100644
--- a/drivers/pinctrl/pinctrl_pic32.c
+++ b/drivers/pinctrl/pinctrl_pic32.c
@@ -222,6 +222,31 @@  static void pic32_eth_pin_config(struct udevice *dev)
 	pic32_pinconfig_set(priv, configs, ARRAY_SIZE(configs));
 }
 
+static void pic32_sdhci_pin_config(struct udevice *dev)
+{
+	struct pic32_pinctrl_priv *priv = dev_get_priv(dev);
+	const struct pic32_pin_config configs[] = {
+		/* SDWP - H2 */
+		PIN_CONFIG(PIC32_PORT_H, 2, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDCD - A0 */
+		PIN_CONFIG(PIC32_PORT_A, 0, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDCMD - D4 */
+		PIN_CONFIG(PIC32_PORT_D, 4, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDCK - A6 */
+		PIN_CONFIG(PIC32_PORT_A, 6, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDDATA0 - G13 */
+		PIN_CONFIG(PIC32_PORT_G, 13, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDDATA1 - G12 */
+		PIN_CONFIG(PIC32_PORT_G, 12, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDDATA2 - G14 */
+		PIN_CONFIG(PIC32_PORT_G, 14, PIN_CONFIG_PIC32_DIGITAL),
+		/* SDDATA3 - A7 */
+		PIN_CONFIG(PIC32_PORT_A, 7, PIN_CONFIG_PIC32_DIGITAL),
+	};
+
+	pic32_pinconfig_set(priv, configs, ARRAY_SIZE(configs));
+}
+
 static int pic32_pinctrl_request(struct udevice *dev, int func, int flags)
 {
 	struct pic32_pinctrl_priv *priv = dev_get_priv(dev);
@@ -240,6 +265,9 @@  static int pic32_pinctrl_request(struct udevice *dev, int func, int flags)
 	case PERIPH_ID_ETH:
 		pic32_eth_pin_config(dev);
 		break;
+	case PERIPH_ID_SDHCI:
+		pic32_sdhci_pin_config(dev);
+		break;
 	default:
 		debug("%s: unknown-unhandled case\n", __func__);
 		break;