Skip to contentSkip to conversation

dt-bindings: pinctrl: at91-pio4: update license to SPDX style

PATCH New Eugen Hristev 1 participant 4 messages Jan 7, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 dt-bindings: pinctrl: at91-pio4: update license to SPDX style

Update license header to SPDX style

---
 include/dt-bindings/pinctrl/at91.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/dt-bindings/pinctrl/at91.h +1 -2
index 616f5ce400..5afb1863c3 100644
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * This header provides constants for most at91 pinctrl bindings.
  *
  * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
- *
- * GPLv2 only
  */
 
 #ifndef __DT_BINDINGS_AT91_PINCTRL_H__
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/4 dt-bindings: pinctrl: at91-pio4: add property for drive strength

Add drive strength property which is equivalent with the one in Linux

---
 doc/device-tree-bindings/pinctrl/atmel,at91-pio4-pinctrl.txt | 2 ++
 1 file changed, 2 insertions(+)
doc/device-tree-bindings/pinctrl/atmel,at91-pio4-pinctrl.txt +2 -0
index a376c6fba5..9252dc154e 100644
@@ -28,6 +28,8 @@ Optional properties:
 - GENERIC_PINCONFIG: generic pinconfig options to use, bias-disable,
 bias-pull-down, bias-pull-up, drive-open-drain, input-schmitt-enable,
 input-debounce.
+- atmel,drive-strength: 0 or 1 for low drive, 2 for medium drive and 3 for
+high drive. The default value is low drive.
 
 Example:
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 pinctrl: at91-pio4: convert to dev_read_prop

In reply to Eugen Hristev

Use dev_read_prop instead of using the fdt_read_property which reads from the GD struct's fdt.
This way the node is accessed via the device config instead of the global struct, which makes code more portable and GD independent.

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +3 -3
index bf85cc916a..58f4d8cb39 100644
@@ -36,7 +36,7 @@ static const struct pinconf_param conf_params[] = {
 	{ "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
 };
 
-static u32 atmel_pinctrl_get_pinconf(const void *blob, int node)
+static u32 atmel_pinctrl_get_pinconf(struct udevice *config)
 {
 	const struct pinconf_param *params;
 	u32 param, arg, conf = 0;
@@ -44,7 +44,7 @@ static u32 atmel_pinctrl_get_pinconf(const void *blob, int node)
 
 	for (i = 0; i < ARRAY_SIZE(conf_params); i++) {
 		params = &conf_params[i];
-		if (!fdt_get_property(blob, node, params->property, NULL))
+		if (!dev_read_prop(config, params->property, NULL))
 			continue;
 
 		param = params->param;
@@ -115,7 +115,7 @@ static int atmel_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 	u32 i, conf;
 	int count;
 
-	conf = atmel_pinctrl_get_pinconf(blob, node);
+	conf = atmel_pinctrl_get_pinconf(config);
 
 	count = fdtdec_get_int_array_count(blob, node, "pinmux",
 					   cells, ARRAY_SIZE(cells));
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 pinctrl: at91-pio4: implement drive strength support

In reply to Eugen Hristev

Implement drive strength support, by preserving the same bindings as in Linux.

---
 arch/arm/mach-at91/include/mach/atmel_pio4.h | 1 +
 drivers/pinctrl/pinctrl-at91-pio4.c          | 8 ++++++++
 include/dt-bindings/pinctrl/at91.h           | 4 ++++
 3 files changed, 13 insertions(+)
arch/arm/mach-at91/include/mach/atmel_pio4.h +1 -0
index f348b05bc8..35ac7b2d40 100644
@@ -52,6 +52,7 @@ struct atmel_pio4_port {
 #define ATMEL_PIO_DRVSTR_LO		(1 << 16)
 #define ATMEL_PIO_DRVSTR_ME		(2 << 16)
 #define ATMEL_PIO_DRVSTR_HI		(3 << 16)
+#define ATMEL_PIO_DRVSTR_OFFSET		16
 #define ATMEL_PIO_CFGR_EVTSEL_MASK	GENMASK(26, 24)
 #define ATMEL_PIO_CFGR_EVTSEL_FALLING	(0 << 24)
 #define ATMEL_PIO_CFGR_EVTSEL_RISING	(1 << 24)
drivers/pinctrl/pinctrl-at91-pio4.c +8 -0
index 58f4d8cb39..350ea0a1f3 100644
@@ -34,6 +34,7 @@ static const struct pinconf_param conf_params[] = {
 	{ "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
 	{ "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
 	{ "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
+	{ "atmel,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
 };
 
 static u32 atmel_pinctrl_get_pinconf(struct udevice *config)
@@ -41,6 +42,7 @@ static u32 atmel_pinctrl_get_pinconf(struct udevice *config)
 	const struct pinconf_param *params;
 	u32 param, arg, conf = 0;
 	u32 i;
+	u32 val;
 
 	for (i = 0; i < ARRAY_SIZE(conf_params); i++) {
 		params = &conf_params[i];
@@ -82,6 +84,12 @@ static u32 atmel_pinctrl_get_pinconf(struct udevice *config)
 				conf |= ATMEL_PIO_IFSCEN_MASK;
 			}
 			break;
+		case PIN_CONFIG_DRIVE_STRENGTH:
+			dev_read_u32(config, params->property, &val);
+			conf &= (~ATMEL_PIO_DRVSTR_MASK);
+			conf |= (val << ATMEL_PIO_DRVSTR_OFFSET)
+				& ATMEL_PIO_DRVSTR_MASK;
+			break;
 		default:
 			printf("%s: Unsupported configuration parameter: %u\n",
 			       __func__, param);
include/dt-bindings/pinctrl/at91.h +4 -0
index 5afb1863c3..3831f91fb3 100644
@@ -42,4 +42,8 @@
 #define AT91_PERIPH_C		3
 #define AT91_PERIPH_D		4
 
+#define ATMEL_PIO_DRVSTR_LO	1
+#define ATMEL_PIO_DRVSTR_ME	2
+#define ATMEL_PIO_DRVSTR_HI	3
+
 #endif /* __DT_BINDINGS_AT91_PINCTRL_H__ */
Signature · 1 line
2.25.1