From: Eugen Hristev <eugen.hristev@microchip.com>
To: u-boot@lists.denx.de
Subject: [PATCH 4/4] pinctrl: at91-pio4: implement drive strength support
Date: Thu, 7 Jan 2021 09:20:47 +0200 [thread overview]
Message-ID: <20210107072047.150507-4-eugen.hristev@microchip.com> (raw)
In-Reply-To: <20210107072047.150507-1-eugen.hristev@microchip.com>
Implement drive strength support, by preserving the same bindings
as in Linux.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
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(+)
diff --git a/arch/arm/mach-at91/include/mach/atmel_pio4.h b/arch/arm/mach-at91/include/mach/atmel_pio4.h
index f348b05bc8..35ac7b2d40 100644
--- a/arch/arm/mach-at91/include/mach/atmel_pio4.h
+++ b/arch/arm/mach-at91/include/mach/atmel_pio4.h
@@ -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)
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 58f4d8cb39..350ea0a1f3 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -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);
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
index 5afb1863c3..3831f91fb3 100644
--- a/include/dt-bindings/pinctrl/at91.h
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -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__ */
--
2.25.1
prev parent reply other threads:[~2021-01-07 7:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 7:20 [PATCH 1/4] dt-bindings: pinctrl: at91-pio4: update license to SPDX style Eugen Hristev
2021-01-07 7:20 ` [PATCH 2/4] dt-bindings: pinctrl: at91-pio4: add property for drive strength Eugen Hristev
2021-01-07 7:20 ` [PATCH 3/4] pinctrl: at91-pio4: convert to dev_read_prop Eugen Hristev
2021-01-07 7:20 ` Eugen Hristev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210107072047.150507-4-eugen.hristev@microchip.com \
--to=eugen.hristev@microchip.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox