Skip to contentSkip to conversation

pinctrl: at91: add drive strength configuration

PATCH New Marek Roszko 4 participants 11 messages Aug 24, 2014 – Sep 18, 2014

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

PATCH v2 1/3 pinctrl: at91: add drive strength configuration

The SAMA5 and SAM9x5 series both have drive strength options for the PIOs. This patch adds the ability to set one of three hardware options for drive strengths of low, medium or high for the each pin. The actual current output of the chip based on the setting is defined in the datasheets and varies per pins separate from banks and with supply voltage.

This patch adds three new dt-bindings that allow setting the strength when configuring pins. By default, no change will be made to the drive strength of a pin from its reset value. Due to the difference between the register addresses of the SAMA5 and SAM9x5 series, a new sama5d3-pinctrl id was added.

---
changes from v1:
rebased to latest pinctrl
added requested comments
fix oversight in shift logic(off by 1)

---
 arch/arm/mach-at91/include/mach/at91_pio.h |   6 ++
 drivers/pinctrl/pinctrl-at91.c             | 162 ++++++++++++++++++++++++++++-
 include/dt-bindings/pinctrl/at91.h         |   5 +
 3 files changed, 172 insertions(+), 1 deletion(-)
arch/arm/mach-at91/include/mach/at91_pio.h +6 -0
index 732b11c..7b73662 100644
@@ -71,4 +71,10 @@
 #define ABCDSR_PERIPH_C	0x2
 #define ABCDSR_PERIPH_D	0x3
 
+#define SAMA5D3_PIO_DRIVER1		0x118  /*PIO Driver 1 register offset*/
+#define SAMA5D3_PIO_DRIVER2		0x11C  /*PIO Driver 2 register offset*/
+
+#define AT91SAM9X5_PIO_DRIVER1	0x114  /*PIO Driver 1 register offset*/
+#define AT91SAM9X5_PIO_DRIVER2	0x118  /*PIO Driver 2 register offset*/
+
 #endif
drivers/pinctrl/pinctrl-at91.c +161 -1

239 lines not on this page · raw message

include/dt-bindings/pinctrl/at91.h +5 -0
index 0fee6ff..bbca3d0 100644
@@ -20,6 +20,11 @@
 
 #define AT91_PINCTRL_PULL_UP_DEGLITCH	(AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
 
+#define AT91_PINCTRL_DRIVE_STRENGTH_DEFAULT		(0x0 << 5)
+#define AT91_PINCTRL_DRIVE_STRENGTH_LOW			(0x1 << 5)
+#define AT91_PINCTRL_DRIVE_STRENGTH_MED			(0x2 << 5)
+#define AT91_PINCTRL_DRIVE_STRENGTH_HI			(0x3 << 5)
+
 #define AT91_PIOA	0
 #define AT91_PIOB	1
 #define AT91_PIOC	2
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/3 ARM: at91/dt: at91: use new pinctrl id for sama5

This switches the SAMA5D3 to use the new atmel,sama5d3-pinctrl id that was added with the drive strength options patch.

---
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d3.dtsi +1 -1
index 45013b8..7db0e85 100644
@@ -428,7 +428,7 @@
 			pinctrl at fffff200 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-				compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
+				compatible = "atmel,sama5d3-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
 				ranges = <0xfffff200 0xfffff200 0xa00>;
 				atmel,mux-mask = <
 					/*   A          B          C  */
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 2/3 ARM: at91/dt: at91: use new pinctrl id for sama5

In reply to Marek Roszko

On 24/08/2014 05:12, Marek Roszko :

Quoted 13 lines

This switches the SAMA5D3 to use the new atmel,sama5d3-pinctrl id that was added with the drive strength options patch.

---
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d3.dtsi +0 -0
index 45013b8..7db0e85 100644

arch/arm/boot/dts/sama5d3.dtsi line 431

Quoted 5 lines
arch/arm/boot/dts/sama5d3.dtsi +1 -1
@@ -428,7 +428,7 @@
 			pinctrl at fffff200 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-				compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
+				compatible = "atmel,sama5d3-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";

I'd better keep the compatibility with at91sam9x5, like it was before your patch: that will remove the dependency on the pinctrl series: what about:

+ compatible = "atmel,sama5d3-pinctrl", "atmel,at91sam9x5-pinctrl", "simple-bus";

Quoted 4 lines
arch/arm/boot/dts/sama5d3.dtsi +0 -0
 				ranges = <0xfffff200 0xfffff200 0xa00>;
 				atmel,mux-mask = <
 					/*   A          B          C  */
Signature · 1 line
Nicolas Ferre
#4 lore raw

PATCH v2 2/3 ARM: at91/dt: at91: use new pinctrl id for sama5

On 08/09/2014 10:07, Nicolas Ferre :

Quoted 24 lines

On 24/08/2014 05:12, Marek Roszko :

Quoted 13 lines

This switches the SAMA5D3 to use the new atmel,sama5d3-pinctrl id that was added with the drive strength options patch.

---
 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d3.dtsi +0 -0
index 45013b8..7db0e85 100644

arch/arm/boot/dts/sama5d3.dtsi line 431

Quoted 5 lines
arch/arm/boot/dts/sama5d3.dtsi +1 -1
@@ -428,7 +428,7 @@
 			pinctrl at fffff200 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-				compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
+				compatible = "atmel,sama5d3-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";

I'd better keep the compatibility with at91sam9x5, like it was before your patch: that will remove the dependency on the pinctrl series: what about:

Review

Quoted 1 line
(quoted diff) +1 -0
+				compatible = "atmel,sama5d3-pinctrl", "atmel,at91sam9x5-pinctrl", "simple-bus";

So, with the modification that I did above:

I also stack it to my at91-3.18-dt3 that will soon reach arm-soc (there is no dependency with the other patches of the series anymore).

Linus, are the other two of the series ready to land in Mainline for next kernel release (3.18)? (I'm just asking because you said you would do a "tentative").

Thanks, bye,

Quoted 7 lines
Quoted 5 lines
arch/arm/boot/dts/sama5d3.dtsi +0 -0
 				ranges = <0xfffff200 0xfffff200 0xa00>;
 				atmel,mux-mask = <
 					/*   A          B          C  */
Signature · 1 line
Nicolas Ferre
#5 lore raw

PATCH v2 3/3 pinctrl: at91: update documentation for drive strength options and tweaks

In reply to Marek Roszko

The drive strength patched introduced the atmel,sama5d-pinctrl compatible string. Drive strength is now an option for the CONFIG bits per pin. Also added note about MULTIDRIVE being equivalent to open-drain output and added missing "s" at the end of need everywhere in the bits descriptions.

---
 .../bindings/pinctrl/atmel,at91-pinctrl.txt        | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt +15 -7
index 02ab5ab..b7a93e8 100644
@@ -19,6 +19,7 @@ such as pull-up, multi drive, etc.
 
 Required properties for iomux controller:
 - compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl"
+		or "atmel,sama5d3-pinctrl"
 - atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be
   configured in this periph mode. All the periph and bank need to be describe.
 
@@ -85,13 +86,20 @@ Required properties for pin configuration node:
   PIN_BANK 0 is pioA, PIN_BANK 1 is pioB...
 
 Bits used for CONFIG:
-PULL_UP		(1 << 0): indicate this pin need a pull up.
-MULTIDRIVE	(1 << 1): indicate this pin need to be configured as multidrive.
-DEGLITCH	(1 << 2): indicate this pin need deglitch.
-PULL_DOWN	(1 << 3): indicate this pin need a pull down.
-DIS_SCHMIT	(1 << 4): indicate this pin need to disable schmit trigger.
-DEBOUNCE	(1 << 16): indicate this pin need debounce.
-DEBOUNCE_VAL	(0x3fff << 17): debounce val.
+PULL_UP		(1 << 0): indicate this pin needs a pull up.
+MULTIDRIVE	(1 << 1): indicate this pin needs to be configured as multi-drive.
+			Multi-drive is equivalent to open-drain type output.
+DEGLITCH	(1 << 2): indicate this pin needs deglitch.
+PULL_DOWN	(1 << 3): indicate this pin needs a pull down.
+DIS_SCHMIT	(1 << 4): indicate this pin needs to the disable schmitt trigger.
+DRIVE_STRENGTH (3 << 5): indicate the drive strength of the pin using the
+			following values:
+				00 - No change (reset state value kept)
+				01 - Low
+				10 - Medium
+				11 - High
+DEBOUNCE	(1 << 16): indicate this pin needs debounce.
+DEBOUNCE_VAL	(0x3fff << 17): debounce value.
 
 NOTE:
 Some requirements for using atmel,at91rm9200-pinctrl binding:
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 3/3 pinctrl: at91: update documentation for drive strength options and tweaks

Quoted 6 lines · Marek Roszko

The drive strength patched introduced the atmel,sama5d-pinctrl compatible string. Drive strength is now an option for the CONFIG bits per pin. Also added note about MULTIDRIVE being equivalent to open-drain output and added missing "s" at the end of need everywhere in the bits descriptions.

Also tentatively applied.

Yours,
Linus Walleij

#7 lore raw

PATCH v2 1/3 pinctrl: at91: add drive strength configuration

In reply to Marek Roszko
Quoted 11 lines · Marek Roszko

The SAMA5 and SAM9x5 series both have drive strength options for the PIOs. This patch adds the ability to set one of three hardware options for drive strengths of low, medium or high for the each pin. The actual current output of the chip based on the setting is defined in the datasheets and varies per pins separate from banks and with supply voltage.

This patch adds three new dt-bindings that allow setting the strength when configuring pins. By default, no change will be made to the drive strength of a pin from its reset value. Due to the difference between the register addresses of the SAMA5 and SAM9x5 series, a new sama5d3-pinctrl id was added.

Waiting for feedback from AT91 maintainers...

Yours,
Linus Walleij

#8 lore raw

PATCH v2 1/3 pinctrl: at91: add drive strength configuration

Quoted 8 lines · Linus Walleij
Quoted 5 lines · Marek Roszko

The SAMA5 and SAM9x5 series both have drive strength options for the PIOs. This patch adds the ability to set one of three hardware options for drive strengths of low, medium or high for the each pin. The actual current output of the chip based on the setting is defined in the datasheets and varies per pins separate from banks and with supply voltage.

Quoted 8 lines
Quoted 6 lines

This patch adds three new dt-bindings that allow setting the strength when configuring pins. By default, no change will be made to the drive strength of a pin from its reset value. Due to the difference between the register addresses of the SAMA5 and SAM9x5 series, a new sama5d3-pinctrl id was added.

Waiting for feedback from AT91 maintainers?

I?ll check tomorrow

Quoted 3 lines

Yours,
Linus Walleij

#9 lore raw

PATCH v2 1/3 pinctrl: at91: add drive strength configuration

In reply to Marek Roszko
Quoted 10 lines · Marek Roszko

The SAMA5 and SAM9x5 series both have drive strength options for the PIOs. This patch adds the ability to set one of three hardware options for drive strengths of low, medium or high for the each pin. The actual current output of the chip based on the setting is defined in the datasheets and varies per pins separate from banks and with supply voltage.

This patch adds three new dt-bindings that allow setting the strength when configuring pins. By default, no change will be made to the drive strength of a pin from its reset value. Due to the difference between the register addresses of the SAMA5 and SAM9x5 series, a new sama5d3-pinctrl id was added.

Quoted 7 lines

---
changes from v1:
rebased to latest pinctrl
added requested comments
fix oversight in shift logic(off by 1)

Tentatively applied this patch so we get some rotation in linux-next.

Yours,
Linus Walleij

#10 lore raw

PATCH v2 1/3 pinctrl: at91: add drive strength configuration

On 05/09/2014 09:33, Linus Walleij :

Quoted 14 lines · Marek Roszko
Quoted 13 lines

The SAMA5 and SAM9x5 series both have drive strength options for the PIOs. This patch adds the ability to set one of three hardware options for drive strengths of low, medium or high for the each pin. The actual current output of the chip based on the setting is defined in the datasheets and varies per pins separate from banks and with supply voltage.

This patch adds three new dt-bindings that allow setting the strength when configuring pins. By default, no change will be made to the drive strength of a pin from its reset value. Due to the difference between the register addresses of the SAMA5 and SAM9x5 series, a new sama5d3-pinctrl id was added.

Quoted 7 lines
Quoted 5 lines

---
changes from v1:
rebased to latest pinctrl
added requested comments
fix oversight in shift logic(off by 1)

Tentatively applied this patch so we get some rotation in linux-next.

After reading the comments made back in January during first submission of this feature, it seems that there was a consensus on this patch series. After a quick look at the new version, the comments and needed documentation has been added: Thanks Marek!

So, if it can help, you have my:

On the whole series. I will certainly take the AT91 compatible string addition with my tree as well (patch 2/3).

Thanks to both of you, bye,

Signature · 1 line
Nicolas Ferre