gpio: atmel: Add the PIO4 driver support
PATCH v3 1/1 gpio: atmel: Add the PIO4 driver support
The PIO4 is introduced from SAMA5D2, as a new version for Atmel PIO controller.
---
Changes in v3:
1./ add return to atmel_pio4_set_pio_output() to avoid compilation
warning.
Changes in v2:
1./ update the macro definitions according to the latest datasheet. 2./ change the return value to -ENODEV.
3./ add check to port_base, pin and return -ENODEV.
4./ change the return value for set/get_pio_output/input function.
arch/arm/mach-at91/include/mach/atmel_pio4.h | 48 +++++ drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/atmel_pio4.c | 296 ++++++++++++++++++++++++++ 4 files changed, 356 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/atmel_pio4.h create mode 100644 drivers/gpio/atmel_pio4.c
arch/arm/mach-at91/include/mach/atmel_pio4.h new file +48 -0
@@ -0,0 +1,48 @@ +/* +* Copyright (C) 2015 Atmel Corporation. +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ATMEL_PIO4_H +#define __ATMEL_PIO4_H + +#ifndef __ASSEMBLY__ + +struct atmel_pio4_port { +u32 mskr;/* 0x00 PIO Mask Register */ +u32 cfgr;/* 0x04 PIO Configuration Register */ +u32 pdsr;/* 0x08 PIO Pin Data Status Register */ +u32 locksr;/* 0x0C PIO Lock Status Register */ +u32 sodr;/* 0x10 PIO Set Output Data Register */ +u32 codr;/* 0x14 PIO Clear Output Data Register */ +u32 odsr;/* 0x18 PIO Output Data Status Register */ +u32 reserved0; +u32 ier;/* 0x20 PIO Interrupt Enable Register */ +u32 idr;/* 0x24 PIO Interrupt Disable Register */ +u32 imr;/* 0x28 PIO Interrupt Mask Register */ +u32 isr;/* 0x2C PIO Interrupt Status Register */ +u32 reserved1[3 ]; +u32 iofr;/* 0x3C PIO I/O Freeze Register */ +}; + +#endif + +#define AT91_PIO_PORTA 0x0 +#define AT91_PIO_PORTB 0x1 +#define AT91_PIO_PORTC 0x2 +#define AT91_PIO_PORTD 0x3 + +int atmel_pio4_set_gpio (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_a_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_b_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_c_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_d_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_e_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_f_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_g_periph (u32 port,u32 pin,u32 use_pullup); +int atmel_pio4_set_pio_output (u32 port,u32 pin,u32 value); +int atmel_pio4_get_pio_input (u32 port,u32 pin); + +#endif
drivers/gpio/Kconfig +11 -0
@@ -28,6 +28,17 @@ config DWAPB_GPIO help Support for the Designware APB GPIO driver. +config ATMEL_PIO4 + bool "ATMEL PIO4 driver" + depends on DM + default n + help + Say yes here to support the Atmel PIO4 driver. + The PIO4 is new version of Atmel PIO controller, which manages + up to 128 fully programmable input/output lines. Each I/O line + may be dedicated as a general purpose I/O or be assigned to + a function of an embedded peripheral. + config LPC32XX_GPIO bool "LPC32XX GPIO driver" depends on DM
drivers/gpio/Makefile +1 -0
@@ -12,6 +12,7 @@ endif obj-$(CONFIG_DM_GPIO) += gpio-uclass.o obj-$(CONFIG_AT91_GPIO) += at91_gpio.o +obj-$(CONFIG_ATMEL_PIO4) += atmel_pio4.o obj-$(CONFIG_INTEL_ICH6_GPIO) += intel_ich6_gpio.o obj-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o obj-$(CONFIG_KONA_GPIO) += kona_gpio.o
drivers/gpio/atmel_pio4.c new file +296 -0
296 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 1/1 gpio: atmel: Add the PIO4 driver support
Quoted 4 lines · Wenyou Yang
The PIO4 is introduced from SAMA5D2, as a new version for Atmel PIO controller.
Signed-off-by Wenyou Yang <[email protected]>
Quoted 19 lines
---
Changes in v3:
1./ add return toatmel_pio4_set_pio_output()to avoid compilation
warning.Changes in v2:
1./ update the macro definitions according to the latest datasheet. 2./ change the return value to-ENODEV.
3./ add check toport_base, pin and return-ENODEV.
4./ change the return value for set/get_pio_output/input function.arch/arm/mach-at91/include/mach/atmel_pio4.h | 48 +++++ drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/atmel_pio4.c | 296 ++++++++++++++++++++++++++ 4 files changed, 356 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/atmel_pio4.h create mode 100644 drivers/gpio/atmel_pio4.c
PATCH v3 1/1 gpio: atmel: Add the PIO4 driver support
In reply to Wenyou YangDear Wenyou Yang,
Quoted 16 lines · Wenyou Yang
The PIO4 is introduced from SAMA5D2, as a new version for Atmel PIO controller.
Signed-off-by Wenyou Yang <[email protected]>---
Changes in v3:
1./ add return toatmel_pio4_set_pio_output()to avoid compilation
warning.Changes in v2:
1./ update the macro definitions according to the latest datasheet. 2./ change the return value to-ENODEV.
3./ add check toport_base, pin and return-ENODEV.
4./ change the return value for set/get_pio_output/input function.
Quoted 7 lines
arch/arm/mach-at91/include/mach/atmel_pio4.h | 48 +++++ drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/atmel_pio4.c | 296 ++++++++++++++++++++++++++ 4 files changed, 356 insertions(+)create mode 100644
arch/arm/mach-at91/include/mach/atmel_pio4.hcreate mode 100644drivers/gpio/atmel_pio4.c
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann