summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/pinconf-generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/pinconf-generic.c')
-rw-r--r--drivers/pinctrl/pinconf-generic.c65
1 files changed, 47 insertions, 18 deletions
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 5de6ff62c69b..366775841c63 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -54,6 +54,8 @@ static const struct pin_config_item conf_items[] = {
PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false),
PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
PCONFDUMP(PIN_CONFIG_SKEW_DELAY, "skew delay", NULL, true),
+ PCONFDUMP(PIN_CONFIG_SKEW_DELAY_INPUT_PS, "input skew delay", "ps", true),
+ PCONFDUMP(PIN_CONFIG_SKEW_DELAY_OUTPUT_PS, "output skew delay", "ps", true),
};
static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
@@ -65,11 +67,12 @@ static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
int i;
for (i = 0; i < nitems; i++) {
+ const struct pin_config_item *item = &items[i];
unsigned long config;
int ret;
/* We want to check out this parameter */
- config = pinconf_to_config_packed(items[i].param, 0);
+ config = pinconf_to_config_packed(item->param, 0);
if (gname)
ret = pin_config_group_get(dev_name(pctldev->dev),
gname, &config);
@@ -86,15 +89,22 @@ static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
if (*print_sep)
seq_puts(s, ", ");
*print_sep = 1;
- seq_puts(s, items[i].display);
+ seq_puts(s, item->display);
/* Print unit if available */
- if (items[i].has_arg) {
+ if (item->has_arg) {
u32 val = pinconf_to_config_argument(config);
- if (items[i].format)
- seq_printf(s, " (%u %s)", val, items[i].format);
+ if (item->format)
+ seq_printf(s, " (%u %s)", val, item->format);
else
seq_printf(s, " (0x%x)", val);
+
+ if (item->values && item->num_values) {
+ if (val < item->num_values)
+ seq_printf(s, " \"%s\"", item->values[val]);
+ else
+ seq_puts(s, " \"(unknown)\"");
+ }
}
}
}
@@ -104,7 +114,7 @@ static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev,
* @pctldev: Pincontrol device
* @s: File to print to
* @gname: Group name specifying pins
- * @pin: Pin number specyfying pin
+ * @pin: Pin number specifying pin
*
* Print the pinconf configuration for the requested pin(s) to @s. Pins can be
* specified either by pin using @pin or by group using @gname. Only one needs
@@ -190,6 +200,8 @@ static const struct pinconf_generic_params dt_params[] = {
{ "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },
{ "slew-rate", PIN_CONFIG_SLEW_RATE, 0 },
{ "skew-delay", PIN_CONFIG_SKEW_DELAY, 0 },
+ { "skew-delay-input-ps", PIN_CONFIG_SKEW_DELAY_INPUT_PS, 0 },
+ { "skew-delay-output-ps", PIN_CONFIG_SKEW_DELAY_OUTPUT_PS, 0 },
};
/**
@@ -205,10 +217,10 @@ static const struct pinconf_generic_params dt_params[] = {
* @ncfg. @ncfg is updated to reflect the number of entries after parsing. @cfg
* needs to have enough memory allocated to hold all possible entries.
*/
-static void parse_dt_cfg(struct device_node *np,
- const struct pinconf_generic_params *params,
- unsigned int count, unsigned long *cfg,
- unsigned int *ncfg)
+static int parse_dt_cfg(struct device_node *np,
+ const struct pinconf_generic_params *params,
+ unsigned int count, unsigned long *cfg,
+ unsigned int *ncfg)
{
int i;
@@ -217,7 +229,19 @@ static void parse_dt_cfg(struct device_node *np,
int ret;
const struct pinconf_generic_params *par = &params[i];
- ret = of_property_read_u32(np, par->property, &val);
+ if (par->values && par->num_values) {
+ ret = fwnode_property_match_property_string(of_fwnode_handle(np),
+ par->property,
+ par->values, par->num_values);
+ if (ret == -ENOENT)
+ return ret;
+ if (ret >= 0) {
+ val = ret;
+ ret = 0;
+ }
+ } else {
+ ret = of_property_read_u32(np, par->property, &val);
+ }
/* property not found */
if (ret == -EINVAL)
@@ -231,6 +255,8 @@ static void parse_dt_cfg(struct device_node *np,
cfg[*ncfg] = pinconf_to_config_packed(par->param, val);
(*ncfg)++;
}
+
+ return 0;
}
/**
@@ -242,7 +268,7 @@ static void parse_dt_cfg(struct device_node *np,
* @pmux: array with pin mux value entries
* @npins: number of pins
*
- * pinmux propertity: mux value [0,7]bits and pin identity [8,31]bits.
+ * pinmux property: mux value [0,7]bits and pin identity [8,31]bits.
*/
int pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev,
unsigned int **pid, unsigned int **pmux,
@@ -323,13 +349,16 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
if (!cfg)
return -ENOMEM;
- parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg);
+ ret = parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg);
+ if (ret)
+ return ret;
if (pctldev && pctldev->desc->num_custom_params &&
- pctldev->desc->custom_params)
- parse_dt_cfg(np, pctldev->desc->custom_params,
- pctldev->desc->num_custom_params, cfg, &ncfg);
-
- ret = 0;
+ pctldev->desc->custom_params) {
+ ret = parse_dt_cfg(np, pctldev->desc->custom_params,
+ pctldev->desc->num_custom_params, cfg, &ncfg);
+ if (ret)
+ return ret;
+ }
/* no configs found at all */
if (ncfg == 0) {