add SAMA5D2 PIOBU GPIO driver
Subsystems (4)
v4 cover add SAMA5D2 PIOBU GPIO driver
On SAMA5D2 SoC the PIOBU pins do not lose their voltage during Backup/Self-refresh mode. This can be useful, for example, when the voltage must remain positive for a peripheral during Backup/Self-refresh mode (suspend-to ram is the Linux equivalent state).
v4:
- readd Makefile and Kconfig changes which are missing in v3
v3:
- change driver's compatible to atmel,sama5d2-secumod
- get syscon using syscon_node_to_regmap(pdev->dev.of_node)
- document how to use SECUMOD as a gpio-controller
v2:
- make driver be a subnode of the syscon node
- change Kconfig to depend on MFD_SYSCON and select GPIO_SYSCON
- change include header from linux/gpio.h to linux/gpio/driver.h
- include linux/bits.h header
- change intrusion in comment to tamper
- fix kerneldoc of functions
- replace GPIOF_DIR_* flags with 0/1
- replace ?: statement with if-else
- remove the use of sama5d2_piobu_template_chip
- retrieve syscon via syscon_node_to_regmap(pdev->dev.parent->of_node);
Note that PIOBU_REG_SIZE is used to determine the register to write to with regmap:
reg = PIOBU_BASE + pin * PIOBU_REG_SIZE;
Also, no irq capability implemented.
Andrei Stefanescu (2):
dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
gpio: add driver for SAMA5D2 PIOBU pins
.../devicetree/bindings/arm/atmel-sysregs.txt | 12 +- MAINTAINERS | 6 + drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sama5d2-piobu.c | 253 +++++++++++++++++++++ 5 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 drivers/gpio/gpio-sama5d2-piobu.c
Signature · 1 line
2.7.4
PATCH v4 1/2 dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
This patch describes the Security Module's usage as a GPIO controller for its PIOBU pins. These pins have the special property of maintaining their voltage during suspend-to-mem.
--- Documentation/devicetree/bindings/arm/atmel-sysregs.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/atmel-sysregs.txt +11 -1
@@ -158,14 +158,24 @@ Security Module (SECUMOD) The Security Module macrocell provides all necessary secure functions to avoid voltage, temperature, frequency and mechanical attacks on the chip. It also -embeds secure memories that can be scrambled +embeds secure memories that can be scrambled. + +The Security Module also offers the PIOBU pins which can be used as GPIO pins. +Note that they maintain their voltage during Backup/Self-refresh. required properties: - compatible: Should be "atmel,<chip>-secumod", "syscon". <chip> can be "sama5d2". - reg: Should contain registers location and length +- gpio-controller: Marks the port as GPIO controller. +- #gpio-cells: There are 2. The pin number is the + first, the second represents additional + parameters such as GPIO_ACTIVE_HIGH/LOW. + secumod@fc040000 { compatible = "atmel,sama5d2-secumod", "syscon"; reg = <0xfc040000 0x100>; + gpio-controller; + #gpio-cells = <2>; };
Signature · 1 line
2.7.4
Re: [PATCH v4 1/2] dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
Quoted 9 lines · On Wed, 12 Dec 2018 11:57:11 +0000, <[email protected]> wrote:
This patch describes the Security Module's usage as a GPIO controller for its PIOBU pins. These pins have the special property of maintaining their voltage during suspend-to-mem.
Signed-off-by Andrei Stefanescu <[email protected]>--- Documentation/devicetree/bindings/arm/atmel-sysregs.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
Re: [PATCH v4 1/2] dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
In reply to [email protected]Quoted 5 lines · On Wed, Dec 12, 2018 at 12:57 PM <[email protected]> wrote:
This patch describes the Security Module's usage as a GPIO controller for its PIOBU pins. These pins have the special property of maintaining their voltage during suspend-to-mem.
Signed-off-by Andrei Stefanescu <[email protected]>
Patch applied with Rob's ACK.
Yours,
Linus Walleij
PATCH v4 2/2 gpio: add driver for SAMA5D2 PIOBU pins
In reply to [email protected]PIOBU pins do not lose their voltage during Backup/Self-refresh. This patch adds a simple GPIO controller for them and a maintainer for the driver.
This driver adds support for using the pins as GPIO offering the possibility to read/set the voltage.
--- MAINTAINERS | 6 + drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sama5d2-piobu.c | 253 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 271 insertions(+) create mode 100644 drivers/gpio/gpio-sama5d2-piobu.c
MAINTAINERS +6 -0
@@ -9760,6 +9760,12 @@ M: Nicolas Ferre <[email protected]> S: Supported F: drivers/power/reset/at91-sama5d2_shdwc.c +MICROCHIP SAMA5D2-COMPATIBLE PIOBU GPIO +M: Andrei Stefanescu <[email protected]> +L: [email protected] (moderated for non-subscribers) +L: [email protected] +F: drivers/gpio/gpio-sama5d2-piobu.c + MICROCHIP SPI DRIVER M: Nicolas Ferre <[email protected]> S: Supported
drivers/gpio/Kconfig +11 -0
@@ -429,6 +429,17 @@ config GPIO_REG A 32-bit single register GPIO fixed in/out implementation. This can be used to represent any register as a set of GPIO signals. +config GPIO_SAMA5D2_PIOBU + tristate "SAMA5D2 PIOBU GPIO support" + depends on MFD_SYSCON + select GPIO_SYSCON + help + Say yes here to use the PIOBU pins as GPIOs. + + PIOBU pins on the SAMA5D2 can be used as GPIOs. + The difference from regular GPIOs is that they + maintain their value during backup/self-refresh. + config GPIO_SIOX tristate "SIOX GPIO support" depends on SIOX
drivers/gpio/Makefile +1 -0
@@ -108,6 +108,7 @@ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o obj-$(CONFIG_GPIO_REG) += gpio-reg.o obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o +obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o obj-$(CONFIG_GPIO_SCH) += gpio-sch.o obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o obj-$(CONFIG_GPIO_SNPS_CREG) += gpio-creg-snps.o
drivers/gpio/gpio-sama5d2-piobu.c new file +253 -0
253 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v4 2/2] gpio: add driver for SAMA5D2 PIOBU pins
Quoted 8 lines · On Wed, Dec 12, 2018 at 12:57 PM <[email protected]> wrote:
PIOBU pins do not lose their voltage during Backup/Self-refresh. This patch adds a simple GPIO controller for them and a maintainer for the driver.
This driver adds support for using the pins as GPIO offering the possibility to read/set the voltage.
Signed-off-by Andrei Stefanescu <[email protected]>
Patch applied for v4.21, sorry for taking so long to reply!
Good work on this driver Andrei, it looks really nice now.
Yours,
Linus Walleij