aboutsummaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorCaleb Connolly2024-02-26 17:26:17 +0000
committerCaleb Connolly2024-03-01 14:44:36 +0000
commita245aece2acfbbaf01f41c595f9bfb02a9aedb70 (patch)
treeb85ecd5a7a36f9b851d8c56c8908568dcf6aafc7 /drivers/pinctrl
parentcc18d5486b2cb520d50d2154fc2e9fe2566f480c (diff)
pinctrl: qcom: stub support for special GPIOs
Most platforms have a handful of "special" GPIOs, like the MMC clock/data lanes, UFS reset, etc. These don't follow the usual naming scheme of "gpioX" and also have unique capabilities and registers. We can get away without supporting them all for now, but DT compatibility is still an issue. Add support for allowing these to be specified after the other pins, and make all pinmux/pinconf calls for them nop. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404 Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/qcom/pinctrl-apq8016.c5
-rw-r--r--drivers/pinctrl/qcom/pinctrl-apq8096.c5
-rw-r--r--drivers/pinctrl/qcom/pinctrl-ipq4019.c5
-rw-r--r--drivers/pinctrl/qcom/pinctrl-qcom.c12
-rw-r--r--drivers/pinctrl/qcom/pinctrl-qcs404.c7
-rw-r--r--drivers/pinctrl/qcom/pinctrl-sdm845.c5
6 files changed, 32 insertions, 7 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8016.c b/drivers/pinctrl/qcom/pinctrl-apq8016.c
index 8149ffd83cc..c860b748e99 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8016.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c
@@ -55,7 +55,10 @@ static unsigned int apq8016_get_function_mux(unsigned int selector)
}
static const struct msm_pinctrl_data apq8016_data = {
- .pin_data = { .pin_count = 133, },
+ .pin_data = {
+ .pin_count = 133,
+ .special_pins_start = 122,
+ },
.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
.get_function_name = apq8016_get_function_name,
.get_function_mux = apq8016_get_function_mux,
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8096.c b/drivers/pinctrl/qcom/pinctrl-apq8096.c
index d64ab1ff7be..75d1d0956a3 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8096.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8096.c
@@ -50,7 +50,10 @@ static unsigned int apq8096_get_function_mux(unsigned int selector)
}
static const struct msm_pinctrl_data apq8096_data = {
- .pin_data = { .pin_count = 157, },
+ .pin_data = {
+ .pin_count = 157,
+ .special_pins_start = 150,
+ },
.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
.get_function_name = apq8096_get_function_name,
.get_function_mux = apq8096_get_function_mux,
diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
index 2d99f99e1e4..74c04ab87cd 100644
--- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c
+++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
@@ -46,7 +46,10 @@ static unsigned int ipq4019_get_function_mux(unsigned int selector)
}
static const struct msm_pinctrl_data ipq4019_data = {
- .pin_data = { .pin_count = 100, },
+ .pin_data = {
+ .pin_count = 100,
+ .special_pins_start = 100, /* There are no special pins */
+ },
.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
.get_function_name = ipq4019_get_function_name,
.get_function_mux = ipq4019_get_function_mux,
diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c
index dc3d8c4d903..ee0624df296 100644
--- a/drivers/pinctrl/qcom/pinctrl-qcom.c
+++ b/drivers/pinctrl/qcom/pinctrl-qcom.c
@@ -16,6 +16,7 @@
#include <asm/gpio.h>
#include <dm/pinctrl.h>
#include <linux/bitops.h>
+#include <linux/bug.h>
#include <mach/gpio.h>
#include "pinctrl-qcom.h"
@@ -83,6 +84,10 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector,
{
struct msm_pinctrl_priv *priv = dev_get_priv(dev);
+ /* Always NOP for special pins, assume they're in the correct state */
+ if (qcom_is_special_pin(&priv->data->pin_data, pin_selector))
+ return 0;
+
clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector),
TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE,
priv->data->get_function_mux(func_selector) << 2);
@@ -94,6 +99,10 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector,
{
struct msm_pinctrl_priv *priv = dev_get_priv(dev);
+ /* Always NOP for special pins */
+ if (qcom_is_special_pin(&priv->data->pin_data, pin_selector))
+ return 0;
+
switch (param) {
case PIN_CONFIG_DRIVE_STRENGTH:
argument = (argument / 2) - 1;
@@ -136,6 +145,9 @@ int msm_pinctrl_bind(struct udevice *dev)
const char *name;
int ret;
+ if (!data->pin_data.special_pins_start)
+ dev_warn(dev, "Special pins start index not defined!\n");
+
drv = lists_driver_lookup_name("pinctrl_qcom");
if (!drv)
return -ENOENT;
diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c
index ac00afa2a1f..b54c8d80b8d 100644
--- a/drivers/pinctrl/qcom/pinctrl-qcs404.c
+++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c
@@ -61,8 +61,11 @@ static unsigned int qcs404_get_function_mux(unsigned int selector)
return msm_pinctrl_functions[selector].val;
}
-static struct msm_pinctrl_data qcs404_data = {
- .pin_data = { .pin_count = 126, },
+static const struct msm_pinctrl_data qcs404_data = {
+ .pin_data = {
+ .pin_count = 126,
+ .special_pins_start = 120,
+ },
.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
.get_function_name = qcs404_get_function_name,
.get_function_mux = qcs404_get_function_mux,
diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c
index 9f0f4085ce2..76bd8c4ef41 100644
--- a/drivers/pinctrl/qcom/pinctrl-sdm845.c
+++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c
@@ -75,10 +75,11 @@ static unsigned int sdm845_get_function_mux(unsigned int selector)
return msm_pinctrl_functions[selector].val;
}
-static struct msm_pinctrl_data sdm845_data = {
+static const struct msm_pinctrl_data sdm845_data = {
.pin_data = {
.pin_offsets = sdm845_pin_offsets,
- .pin_count = ARRAY_SIZE(sdm845_pin_offsets),
+ .pin_count = 154,
+ .special_pins_start = 150,
},
.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
.get_function_name = sdm845_get_function_name,