diff mbox series

[6/7] pinctrl: qcom: sdm845: add special pin names

Message ID 20240409-b4-qcom-mmc-fixes-v1-6-5039164ecbf7@linaro.org
State New
Headers show
Series qcom: mmc fixes and sdm845 support | expand

Commit Message

Caleb Connolly April 9, 2024, 6:03 p.m. UTC
Adjust sdm845_get_pin_name() to return the correct names for the special
pins. This fixes a non-fatal -ENOSYS error when probing MMC.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-sdm845.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Neil Armstrong April 10, 2024, 8:42 a.m. UTC | #1
On 09/04/2024 20:03, Caleb Connolly wrote:
> Adjust sdm845_get_pin_name() to return the correct names for the special
> pins. This fixes a non-fatal -ENOSYS error when probing MMC.
> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   drivers/pinctrl/qcom/pinctrl-sdm845.c | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c
> index 459a4329ec80..c1e5cc01fded 100644
> --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
> +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
> @@ -65,9 +65,20 @@ static const char *sdm845_get_function_name(struct udevice *dev,
>   
>   static const char *sdm845_get_pin_name(struct udevice *dev,
>   					unsigned int selector)
>   {
> -	snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector);
> +	static const char *special_pins_names[] = {
> +		"ufs_reset",
> +		"sdc2_clk",
> +		"sdc2_cmd",
> +		"sdc2_data",
> +	};
> +
> +	if (selector >= 150 && selector <= 154)
> +		snprintf(pin_name, MAX_PIN_NAME_LEN, special_pins_names[selector - 150]);
> +	else
> +		snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector);
> +
>   	return pin_name;
>   }
>   
>   static unsigned int sdm845_get_function_mux(__maybe_unused unsigned int pin,
> 

At some point we should add the pinconf settings for SDC and UFS, but for now it's ok!

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
diff mbox series

Patch

diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c
index 459a4329ec80..c1e5cc01fded 100644
--- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
+++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
@@ -65,9 +65,20 @@  static const char *sdm845_get_function_name(struct udevice *dev,
 
 static const char *sdm845_get_pin_name(struct udevice *dev,
 					unsigned int selector)
 {
-	snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector);
+	static const char *special_pins_names[] = {
+		"ufs_reset",
+		"sdc2_clk",
+		"sdc2_cmd",
+		"sdc2_data",
+	};
+
+	if (selector >= 150 && selector <= 154)
+		snprintf(pin_name, MAX_PIN_NAME_LEN, special_pins_names[selector - 150]);
+	else
+		snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector);
+
 	return pin_name;
 }
 
 static unsigned int sdm845_get_function_mux(__maybe_unused unsigned int pin,