Skip to contentSkip to conversation

pinctrl: at91: Add pinctrl driver

PATCH Superseded Wenyou Yang 2 participants 4 messages Jan 24, 2017 – Feb 6, 2017

Subsystems (7)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover pinctrl: at91: Add pinctrl driver

The purpose of this patch set is to add the pinctrl driver for AT91 PIO controller.

Changes in v4:
- Fix the incomplete conversion of the peripheral configurations on the sama5d3, sam9x5, and sam9n12.

Changes in v3:
- Add support for OUTPUT config

Changes in v2:
- Add more information for the PINCTRL_AT91 option's help.
- Add more comments for the callback of struct at91_pinctrl_mux_ops.
- Use clrsetbits_le32() in set_drive_strength().
- Add the brackets for readability.
- Use debug() to print the message to debug, instead of printf().
- Remove not veryuseful at91_bank_base().
- Add Reviewed-by tag.

Wenyou Yang (2):
gpio: at91_gpio: Remove CPU_HAS_PIO3 macro
pinctrl: at91: Add pinctrl driver

 arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c | 106 ++---
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c  | 112 ++---
 arch/arm/mach-at91/armv7/sama5d3_devices.c         | 140 +++----
 arch/arm/mach-at91/include/mach/at91_pio.h         |  67 +--
 arch/arm/mach-at91/include/mach/at91sam9x5.h       |   1 -
 arch/arm/mach-at91/include/mach/sama5d3.h          |   1 -
 arch/arm/mach-at91/include/mach/sama5d4.h          |   1 -
 board/atmel/at91sam9n12ek/at91sam9n12ek.c          |  10 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c            |  90 ++--
 board/atmel/sama5d3xek/sama5d3xek.c                |  64 +--
 board/atmel/sama5d4_xplained/sama5d4_xplained.c    | 148 +++----
 board/atmel/sama5d4ek/sama5d4ek.c                  | 136 +++----
 board/denx/ma5d4evk/ma5d4evk.c                     | 178 ++++----
 board/l+g/vinco/vinco.c                            |  70 ++--
 drivers/gpio/at91_gpio.c                           | 142 +++++--
 drivers/pinctrl/Kconfig                            |  14 +
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl-at91.c                     | 453 +++++++++++++++++++++
 include/dt-bindings/pinctrl/at91.h                 |   2 +
 19 files changed, 1131 insertions(+), 605 deletions(-)
 create mode 100644 drivers/pinctrl/pinctrl-at91.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v4 1/2 gpio: at91_gpio: Remove CPU_HAS_PIO3 macro

The intention of this patch is the preparation to introduce the pinctrl driver for AT91 PIO.

Use "union" to make the PIO3 and PIO2's registers be together and make their offset aligned.

---

Changes in v4:
- Fix the incomplete conversion of the peripheral configurations on the sama5d3, sam9x5, and sam9n12.

Changes in v3: None
Changes in v2: None

 arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c | 106 ++++++------
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c  | 112 ++++++-------
 arch/arm/mach-at91/armv7/sama5d3_devices.c         | 140 ++++++++--------
 arch/arm/mach-at91/include/mach/at91_pio.h         |  61 +++----
 arch/arm/mach-at91/include/mach/at91sam9x5.h       |   1 -
 arch/arm/mach-at91/include/mach/sama5d3.h          |   1 -
 arch/arm/mach-at91/include/mach/sama5d4.h          |   1 -
 board/atmel/at91sam9n12ek/at91sam9n12ek.c          |  10 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c            |  90 +++++------
 board/atmel/sama5d3xek/sama5d3xek.c                |  64 ++++----
 board/atmel/sama5d4_xplained/sama5d4_xplained.c    | 148 ++++++++---------
 board/atmel/sama5d4ek/sama5d4ek.c                  | 136 ++++++++--------
 board/denx/ma5d4evk/ma5d4evk.c                     | 178 ++++++++++-----------
 board/l+g/vinco/vinco.c                            |  70 ++++----
 drivers/gpio/at91_gpio.c                           | 142 ++++++++++------
 15 files changed, 656 insertions(+), 604 deletions(-)
arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c +53 -53
index a03abfc310..28c8cf260a 100644
@@ -18,45 +18,45 @@ unsigned int has_lcdc()
 
 void at91_serial0_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 0, 1);		/* TXD0 */
-	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);		/* RXD0 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 0, 1);		/* TXD0 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 1, 0);		/* RXD0 */
 	at91_periph_clk_enable(ATMEL_ID_USART0);
 }
 
 void at91_serial1_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 5, 1);		/* TXD1 */
-	at91_set_a_periph(AT91_PIO_PORTA, 6, 0);		/* RXD1 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 5, 1);		/* TXD1 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 6, 0);		/* RXD1 */
 	at91_periph_clk_enable(ATMEL_ID_USART1);
 }
 
 void at91_serial2_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 7, 1);		/* TXD2 */
-	at91_set_a_periph(AT91_PIO_PORTA, 8, 0);		/* RXD2 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 7, 1);		/* TXD2 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 8, 0);		/* RXD2 */
 	at91_periph_clk_enable(ATMEL_ID_USART2);
 }
 
 void at91_serial3_hw_init(void)
 {
-	at91_set_b_periph(AT91_PIO_PORTC, 22, 1);		/* TXD3 */
-	at91_set_b_periph(AT91_PIO_PORTC, 23, 0);		/* RXD3 */
+	at91_pio3_set_b_periph(AT91_PIO_PORTC, 22, 1);		/* TXD3 */
+	at91_pio3_set_b_periph(AT91_PIO_PORTC, 23, 0);		/* RXD3 */
 	at91_periph_clk_enable(ATMEL_ID_USART3);
 }
 
 void at91_seriald_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 10, 1);		/* DTXD */
-	at91_set_a_periph(AT91_PIO_PORTA, 9, 0);		/* DRXD */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 1);		/* DTXD */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 9, 0);		/* DRXD */
 	at91_periph_clk_enable(ATMEL_ID_SYS);
 }
 
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */
-	at91_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */
-	at91_set_a_periph(AT91_PIO_PORTA, 13, 0);	/* SPI0_SPCK */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 13, 0);	/* SPI0_SPCK */
 
 	at91_periph_clk_enable(ATMEL_ID_SPI0);
 
@@ -72,9 +72,9 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */
-	at91_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */
-	at91_set_b_periph(AT91_PIO_PORTA, 23, 0);	/* SPI1_SPCK */
+	at91_pio3_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */
+	at91_pio3_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */
+	at91_pio3_set_b_periph(AT91_PIO_PORTA, 23, 0);	/* SPI1_SPCK */
 
 	at91_periph_clk_enable(ATMEL_ID_SPI1);
 
@@ -91,12 +91,12 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 
 void at91_mci_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTA, 17, 0);	/* MCCK */
-	at91_set_a_periph(AT91_PIO_PORTA, 16, 0);	/* MCCDA */
-	at91_set_a_periph(AT91_PIO_PORTA, 15, 0);	/* MCDA0 */
-	at91_set_a_periph(AT91_PIO_PORTA, 18, 0);	/* MCDA1 */
-	at91_set_a_periph(AT91_PIO_PORTA, 19, 0);	/* MCDA2 */
-	at91_set_a_periph(AT91_PIO_PORTA, 20, 0);	/* MCDA3 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 17, 0);	/* MCCK */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 16, 0);	/* MCCDA */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 15, 0);	/* MCDA0 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 18, 0);	/* MCDA1 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 19, 0);	/* MCDA2 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTA, 20, 0);	/* MCDA3 */
 
 	at91_periph_clk_enable(ATMEL_ID_HSMCI0);
 }
@@ -104,37 +104,37 @@ void at91_mci_hw_init(void)
 #ifdef CONFIG_LCD
 void at91_lcd_hw_init(void)
 {
-	at91_set_a_periph(AT91_PIO_PORTC, 24, 0);	/* LCDDPWR */
-	at91_set_a_periph(AT91_PIO_PORTC, 26, 0);	/* LCDVSYNC */
-	at91_set_a_periph(AT91_PIO_PORTC, 27, 0);	/* LCDHSYNC */
-	at91_set_a_periph(AT91_PIO_PORTC, 28, 0);	/* LCDDOTCK */
-	at91_set_a_periph(AT91_PIO_PORTC, 29, 0);	/* LCDDEN */
-	at91_set_a_periph(AT91_PIO_PORTC, 30, 0);	/* LCDDOTCK */
-
-	at91_set_a_periph(AT91_PIO_PORTC, 0, 0);	/* LCDD0 */
-	at91_set_a_periph(AT91_PIO_PORTC, 1, 0);	/* LCDD1 */
-	at91_set_a_periph(AT91_PIO_PORTC, 2, 0);	/* LCDD2 */
-	at91_set_a_periph(AT91_PIO_PORTC, 3, 0);	/* LCDD3 */
-	at91_set_a_periph(AT91_PIO_PORTC, 4, 0);	/* LCDD4 */
-	at91_set_a_periph(AT91_PIO_PORTC, 5, 0);	/* LCDD5 */
-	at91_set_a_periph(AT91_PIO_PORTC, 6, 0);	/* LCDD6 */
-	at91_set_a_periph(AT91_PIO_PORTC, 7, 0);	/* LCDD7 */
-	at91_set_a_periph(AT91_PIO_PORTC, 8, 0);	/* LCDD8 */
-	at91_set_a_periph(AT91_PIO_PORTC, 9, 0);	/* LCDD9 */
-	at91_set_a_periph(AT91_PIO_PORTC, 10, 0);	/* LCDD10 */
-	at91_set_a_periph(AT91_PIO_PORTC, 11, 0);	/* LCDD11 */
-	at91_set_a_periph(AT91_PIO_PORTC, 12, 0);	/* LCDD12 */
-	at91_set_a_periph(AT91_PIO_PORTC, 13, 0);	/* LCDD13 */
-	at91_set_a_periph(AT91_PIO_PORTC, 14, 0);	/* LCDD14 */
-	at91_set_a_periph(AT91_PIO_PORTC, 15, 0);	/* LCDD15 */
-	at91_set_a_periph(AT91_PIO_PORTC, 16, 0);	/* LCDD16 */
-	at91_set_a_periph(AT91_PIO_PORTC, 17, 0);	/* LCDD17 */
-	at91_set_a_periph(AT91_PIO_PORTC, 18, 0);	/* LCDD18 */
-	at91_set_a_periph(AT91_PIO_PORTC, 19, 0);	/* LCDD19 */
-	at91_set_a_periph(AT91_PIO_PORTC, 20, 0);	/* LCDD20 */
-	at91_set_a_periph(AT91_PIO_PORTC, 21, 0);	/* LCDD21 */
-	at91_set_a_periph(AT91_PIO_PORTC, 22, 0);	/* LCDD22 */
-	at91_set_a_periph(AT91_PIO_PORTC, 23, 0);	/* LCDD23 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 24, 0);	/* LCDDPWR */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 26, 0);	/* LCDVSYNC */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 27, 0);	/* LCDHSYNC */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 28, 0);	/* LCDDOTCK */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 29, 0);	/* LCDDEN */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 30, 0);	/* LCDDOTCK */
+
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 0, 0);	/* LCDD0 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 1, 0);	/* LCDD1 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 2, 0);	/* LCDD2 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 3, 0);	/* LCDD3 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 4, 0);	/* LCDD4 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 5, 0);	/* LCDD5 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 6, 0);	/* LCDD6 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 7, 0);	/* LCDD7 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 8, 0);	/* LCDD8 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 9, 0);	/* LCDD9 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 10, 0);	/* LCDD10 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 11, 0);	/* LCDD11 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 12, 0);	/* LCDD12 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 13, 0);	/* LCDD13 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 14, 0);	/* LCDD14 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 15, 0);	/* LCDD15 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 16, 0);	/* LCDD16 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 17, 0);	/* LCDD17 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 18, 0);	/* LCDD18 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 19, 0);	/* LCDD19 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 20, 0);	/* LCDD20 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 21, 0);	/* LCDD21 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 22, 0);	/* LCDD22 */
+	at91_pio3_set_a_periph(AT91_PIO_PORTC, 23, 0);	/* LCDD23 */
 
 	at91_periph_clk_enable(ATMEL_ID_LCDC);
 }
arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c +56 -56

185 lines not on this page · raw message

arch/arm/mach-at91/armv7/sama5d3_devices.c +70 -70

198 lines not on this page · raw message

arch/arm/mach-at91/include/mach/at91_pio.h +32 -29

88 lines not on this page · raw message

arch/arm/mach-at91/include/mach/at91sam9x5.h +0 -1
index 8100ebed4b..eaec727253 100644
@@ -171,7 +171,6 @@
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS         4
-#define CPU_HAS_PIO3
 #define PIO_SCDR_DIV            (0x3fff <<  0)  /* Slow Clock Divider Mask */
 #define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
 #define ATMEL_ID_UHP		ATMEL_ID_UHPHS
arch/arm/mach-at91/include/mach/sama5d3.h +0 -1
index 33f6c97c11..e4e97dc989 100644
@@ -188,7 +188,6 @@
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS		5
-#define CPU_HAS_PIO3
 #define PIO_SCDR_DIV		0x3fff
 #define CPU_HAS_PCR
 
arch/arm/mach-at91/include/mach/sama5d4.h +0 -1
index 90085da1c6..9a6c974bf7 100644
@@ -174,7 +174,6 @@
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS		5
-#define CPU_HAS_PIO3
 #define PIO_SCDR_DIV		0x3fff
 #define CPU_HAS_PCR
 #define CPU_HAS_H32MXDIV
board/atmel/at91sam9n12ek/at91sam9n12ek.c +5 -5
index fc4f50d219..58da2d27f8 100644
@@ -71,10 +71,10 @@ static void at91sam9n12ek_nand_hw_init(void)
 	/* Configure ENABLE pin for NandFlash */
 	at91_set_pio_output(AT91_PIO_PORTD, 4, 1);
 
-	at91_set_a_periph(AT91_PIO_PORTD, 0, 1);    /* NAND OE */
-	at91_set_a_periph(AT91_PIO_PORTD, 1, 1);    /* NAND WE */
-	at91_set_a_periph(AT91_PIO_PORTD, 2, 1);    /* ALE */
-	at91_set_a_periph(AT91_PIO_PORTD, 3, 1);    /* CLE */
+	at91_pio3_set_a_periph(AT91_PIO_PORTD, 0, 1);    /* NAND OE */
+	at91_pio3_set_a_periph(AT91_PIO_PORTD, 1, 1);    /* NAND WE */
+	at91_pio3_set_a_periph(AT91_PIO_PORTD, 2, 1);    /* ALE */
+	at91_pio3_set_a_periph(AT91_PIO_PORTD, 3, 1);    /* CLE */
 }
 #endif
 
@@ -194,7 +194,7 @@ void at91sam9n12ek_ks8851_hw_init(void)
 	       &smc->cs[2].mode);
 
 	/* Configure NCS2 PIN */
-	at91_set_b_periph(AT91_PIO_PORTD, 19, 0);
+	at91_pio3_set_b_periph(AT91_PIO_PORTD, 19, 0);
 }
 #endif
 
board/atmel/at91sam9x5ek/at91sam9x5ek.c +45 -45

112 lines not on this page · raw message

board/atmel/sama5d3xek/sama5d3xek.c +32 -32

77 lines not on this page · raw message

board/atmel/sama5d4_xplained/sama5d4_xplained.c +74 -74

190 lines not on this page · raw message

board/atmel/sama5d4ek/sama5d4ek.c +68 -68

178 lines not on this page · raw message

board/denx/ma5d4evk/ma5d4evk.c +89 -89

244 lines not on this page · raw message

board/l+g/vinco/vinco.c +35 -35

100 lines not on this page · raw message

drivers/gpio/at91_gpio.c +97 -45

241 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v4 1/2 gpio: at91_gpio: Remove CPU_HAS_PIO3 macro

Quoted 16 lines · Wenyou Yang

The intention of this patch is the preparation to introduce the pinctrl driver for AT91 PIO.

Use "union" to make the PIO3 and PIO2's registers be together and make their offset aligned.

---

Changes in v4:
- Fix the incomplete conversion of the peripheral configurations on the sama5d3, sam9x5, and sam9n12.

Changes in v3: None
Changes in v2: None

Quoted 16 lines
 arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c | 106 ++++++------
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c  | 112 ++++++-------
 arch/arm/mach-at91/armv7/sama5d3_devices.c         | 140 ++++++++--------
 arch/arm/mach-at91/include/mach/at91_pio.h         |  61 +++----
 arch/arm/mach-at91/include/mach/at91sam9x5.h       |   1 -
 arch/arm/mach-at91/include/mach/sama5d3.h          |   1 -
 arch/arm/mach-at91/include/mach/sama5d4.h          |   1 -
 board/atmel/at91sam9n12ek/at91sam9n12ek.c          |  10 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c            |  90 +++++------
 board/atmel/sama5d3xek/sama5d3xek.c                |  64 ++++----
 board/atmel/sama5d4_xplained/sama5d4_xplained.c    | 148 ++++++++---------
 board/atmel/sama5d4ek/sama5d4ek.c                  | 136 ++++++++--------
 board/denx/ma5d4evk/ma5d4evk.c                     | 178 ++++++++++-----------
 board/l+g/vinco/vinco.c                            |  70 ++++----
 drivers/gpio/at91_gpio.c                           | 142 ++++++++++------
 15 files changed, 656 insertions(+), 604 deletions(-)
#3 lore raw

PATCH v4 2/2 pinctrl: at91: Add pinctrl driver

In reply to Wenyou Yang

AT91 PIO controller is a combined gpio-controller, pin-mux and pin-config module. The peripheral's pins are assigned through per-pin based muxing logic.

Each soc will have to describe the SoC limitation and pin configuration via DT. This will allow to do not need to touch the C code when adding new SoC if the IP version is supported.

---

Changes in v4: None
Changes in v3:
- Add support for OUTPUT config

Changes in v2:
- Add more information for the PINCTRL_AT91 option's help.
- Add more comments for the callback of struct at91_pinctrl_mux_ops.
- Use clrsetbits_le32() in set_drive_strength().
- Add the brackets for readability.
- Use debug() to print the message to debug, instead of printf().
- Remove not veryuseful at91_bank_base().
- Add Reviewed-by tag.

 arch/arm/mach-at91/include/mach/at91_pio.h |   6 +-
 drivers/pinctrl/Kconfig                    |  14 +
 drivers/pinctrl/Makefile                   |   1 +
 drivers/pinctrl/pinctrl-at91.c             | 453 +++++++++++++++++++++++++++++
 include/dt-bindings/pinctrl/at91.h         |   2 +
 5 files changed, 475 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/pinctrl-at91.c
arch/arm/mach-at91/include/mach/at91_pio.h +5 -1
index 393a163ce4..f195a7d38e 100644
@@ -107,7 +107,11 @@ typedef struct at91_port {
 	u32	wpsr;		/* 0xE8 Write Protect Status Register */
 	u32	reserved11[5];	/* */
 	u32	schmitt;	/* 0x100 Schmitt Trigger Register */
-	u32	reserved12[63];
+	u32	reserved12[4];	/* 0x104 ~ 0x110 */
+	u32	driver1;	/* 0x114 I/O Driver Register1(AT91SAM9x5's driver1) */
+	u32	driver12;	/* 0x118 I/O Driver Register12(AT91SAM9x5's driver2 or SAMA5D3x's driver1 ) */
+	u32	driver2;	/* 0x11C I/O Driver Register2(SAMA5D3x's driver2) */
+	u32	reserved13[12];	/* 0x120 ~ 0x14C */
 } at91_port_t;
 
 typedef union at91_pio {
drivers/pinctrl/Kconfig +14 -0
index efcb4c0003..106510c8f7 100644
@@ -141,6 +141,20 @@ config ROCKCHIP_RK3288_PINCTRL
 	  definitions and pin control functions for each available multiplex
 	  function.
 
+config PINCTRL_AT91
+	bool "AT91 pinctrl driver"
+	depends on DM
+	help
+	  This option is to enable the AT91 pinctrl driver for AT91 PIO
+	  controller. AT91 PIO controller is a combined gpio-controller,
+	  pin-mux and pin-config module. Each I/O pin may be dedicated as
+	  a general-purpose I/O or be assigned to a function of an embedded
+	  peripheral. Each I/O pin has a glitch filter providing rejection of
+	  glitches lower than one-half of peripheral clock cycle and
+	  a debouncing filter providing rejection of unwanted pulses from key
+	  or push button operations. You can also control the multi-driver
+	  capability, pull-up and pull-down feature on each I/O pin.
+
 config PINCTRL_AT91PIO4
 	bool "AT91 PIO4 pinctrl driver"
 	depends on DM
drivers/pinctrl/Makefile +1 -0
index 512112af64..c461605cd8 100644
@@ -5,6 +5,7 @@
 obj-y					+= pinctrl-uclass.o
 obj-$(CONFIG_$(SPL_)PINCTRL_GENERIC)	+= pinctrl-generic.o
 
+obj-$(CONFIG_PINCTRL_AT91)		+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_AT91PIO4)		+= pinctrl-at91-pio4.o
 obj-y					+= nxp/
 obj-$(CONFIG_ARCH_ATH79) += ath79/
drivers/pinctrl/pinctrl-at91.c new file +453 -0

453 lines not on this page · raw message

include/dt-bindings/pinctrl/at91.h +2 -0
index bbca3d0389..2732d6c0fb 100644
@@ -15,6 +15,8 @@
 #define AT91_PINCTRL_DEGLITCH		(1 << 2)
 #define AT91_PINCTRL_PULL_DOWN		(1 << 3)
 #define AT91_PINCTRL_DIS_SCHMIT		(1 << 4)
+#define AT91_PINCTRL_OUTPUT		(1 << 7)
+#define AT91_PINCTRL_OUTPUT_VAL(x)	((x & 0x1) << 8)
 #define AT91_PINCTRL_DEBOUNCE		(1 << 16)
 #define AT91_PINCTRL_DEBOUNCE_VAL(x)	(x << 17)
 
Signature · 1 line
2.11.0