gpio: Add DW APB GPIO driver
Subsystems (2)
PATCH v2 1/3 gpio: Add DW APB GPIO driver
Add driver for the DesignWare APB GPIO IP block.
This driver is DM capable and probes from DT.
--- drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 1 + drivers/gpio/dwapb_gpio.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 drivers/gpio/dwapb_gpio.c
V2: Obtain the bank name from the "bank-name" property instead.
drivers/gpio/Kconfig +7 -0
@@ -8,6 +8,13 @@ config DM_GPIO particular GPIOs that they provide. The uclass interface is defined in include/asm-generic/gpio.h. +config DWAPB_GPIO + bool "DWAPB GPIO driver" + depends on DM && DM_GPIO + default n + help + Support for the Designware APB GPIO driver. + config LPC32XX_GPIO bool "LPC32XX GPIO driver" depends on DM
drivers/gpio/Makefile +1 -0
@@ -6,6 +6,7 @@ # ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif obj-$(CONFIG_DM_GPIO) += gpio-uclass.o
drivers/gpio/dwapb_gpio.c new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 2/3 arm: socfpga: dts: Add bank-name property to each GPIO bank
Add "bank-name" property to each GPIO bank to give it unique name. The approach here is exactly the same as with the "regulator-name" property for regulators.
--- arch/arm/dts/socfpga.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/dts/socfpga.dtsi +3 -0
@@ -550,6 +550,7 @@ porta: gpio-controller at 0 { compatible = "snps,dw-apb-gpio-port"; + bank-name = "porta"; gpio-controller; #gpio-cells = <2>; snps,nr-gpios = <29>;
@@ -570,6 +571,7 @@ portb: gpio-controller at 0 { compatible = "snps,dw-apb-gpio-port"; + bank-name = "portb"; gpio-controller; #gpio-cells = <2>; snps,nr-gpios = <29>;
@@ -590,6 +592,7 @@ portc: gpio-controller at 0 { compatible = "snps,dw-apb-gpio-port"; + bank-name = "portc"; gpio-controller; #gpio-cells = <2>; snps,nr-gpios = <27>;
Signature · 1 line
2.1.4
PATCH 3/3 arm: socfpga: Enable DWAPB GPIO driver
In reply to Marek VasutEnable the DWAPB GPIO driver for SoCFPGA Cyclone V and Arria V.
--- configs/socfpga_arria5_defconfig | 2 ++ configs/socfpga_cyclone5_defconfig | 2 ++ configs/socfpga_socrates_defconfig | 2 ++ include/configs/socfpga_arria5.h | 2 +- include/configs/socfpga_cyclone5.h | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-)
configs/socfpga_arria5_defconfig +2 -0
@@ -7,6 +7,8 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set CONFIG_OF_CONTROL=y CONFIG_SPI_FLASH=y +CONFIG_DM_GPIO=y +CONFIG_DWAPB_GPIO=y CONFIG_SPL_DM=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_DM_SEQ_ALIAS=y
configs/socfpga_cyclone5_defconfig +2 -0
@@ -10,6 +10,8 @@ CONFIG_SPI_FLASH=y CONFIG_DM_ETH=y CONFIG_NETDEVICES=y CONFIG_ETH_DESIGNWARE=y +CONFIG_DM_GPIO=y +CONFIG_DWAPB_GPIO=y CONFIG_SPL_DM=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_DM_SEQ_ALIAS=y
configs/socfpga_socrates_defconfig +2 -0
@@ -10,6 +10,8 @@ CONFIG_SPI_FLASH=y CONFIG_DM_ETH=y CONFIG_NETDEVICES=y CONFIG_ETH_DESIGNWARE=y +CONFIG_DM_GPIO=y +CONFIG_DWAPB_GPIO=y CONFIG_SPL_DM=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_DM_SEQ_ALIAS=y
include/configs/socfpga_arria5.h +1 -1
@@ -23,6 +23,7 @@#define CONFIG_CMD_EXT4_WRITE #define CONFIG_CMD_FAT #define CONFIG_CMD_FS_GENERIC +#define CONFIG_CMD_GPIO #define CONFIG_CMD_GREPENV #define CONFIG_CMD_MII #define CONFIG_CMD_MMC
@@ -30,7 +31,6 @@#define CONFIG_CMD_USB #define CONFIG_CMD_USB_MASS_STORAGE -/* Memory configurations */ #define PHYS_SDRAM_1_SIZE 0x40000000/* 1GiB on SoCDK */
include/configs/socfpga_cyclone5.h +1 -1
@@ -23,6 +23,7 @@#define CONFIG_CMD_EXT4_WRITE #define CONFIG_CMD_FAT #define CONFIG_CMD_FS_GENERIC +#define CONFIG_CMD_GPIO #define CONFIG_CMD_GREPENV #define CONFIG_CMD_MII #define CONFIG_CMD_MMC
@@ -30,7 +31,6 @@#define CONFIG_CMD_USB #define CONFIG_CMD_USB_MASS_STORAGE -/* Memory configurations */ #define PHYS_SDRAM_1_SIZE 0x40000000/* 1GiB on SoCDK */
Signature · 1 line
2.1.4
PATCH v2 1/3 gpio: Add DW APB GPIO driver
In reply to Marek VasutHi Marek,
Quoted 11 lines · Marek Vasut
Add driver for the DesignWare APB GPIO IP block.
This driver is DM capable and probes from DT.Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>--- drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 1 + drivers/gpio/dwapb_gpio.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 drivers/gpio/dwapb_gpio.c
Please see nits/suggestions below.
Are you going to submit a GPIO binding change for this?
Quoted 8 lines
V2: Obtain the bank name from the "bank-name" property instead.
drivers/gpio/Kconfig +0
-0
drivers/gpio/Kconfig config DM_GPIO · line 16
Quoted 9 lines
drivers/gpio/Kconfig +6
-0@@ -8,6 +8,13 @@ config DM_GPIO particular GPIOs that they provide. The uclass interface is defined in include/asm-generic/gpio.h. +config DWAPB_GPIO + bool "DWAPB GPIO driver" + depends on DM && DM_GPIO + default n + help + Support for the Designware APB GPIO driver.
You could expand this to talk about bank naming, features supported, chips which use it.
Quoted 30 lines
drivers/gpio/Kconfig +1
-0+ config LPC32XX_GPIO bool "LPC32XX GPIO driver" depends on DMdrivers/gpio/Makefile +1
-0@@ -6,6 +6,7 @@ # ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif obj-$(CONFIG_DM_GPIO) += gpio-uclass.odrivers/gpio/dwapb_gpio.c new file +8
-0@@ -0,0 +1,167 @@ +/* +* (C) Copyright 2015 Marek Vasut <[email protected]> +* +* DesignWare APB GPIO driver +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
drivers/gpio/dwapb_gpio.c line 18
Quoted 10 lines
drivers/gpio/dwapb_gpio.c new file +10
-0+#include <common.h> +#include <malloc.h> +#include <asm/arch/gpio.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <dm.h> +#include <dm/device-internal.h> +#include <dm/lists.h> +#include <dm/root.h> +#include <errno.h>
should go just below common.h
drivers/gpio/dwapb_gpio.c line 31
Quoted 13 lines
drivers/gpio/dwapb_gpio.c new file +13
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define GPIO_SWPORTA_DR 0x00 +#define GPIO_SWPORTA_DDR 0x04 +#define GPIO_INTEN 0x30 +#define GPIO_INTMASK 0x34 +#define GPIO_INTTYPE_LEVEL 0x38 +#define GPIO_INT_POLARITY 0x3c +#define GPIO_INTSTATUS 0x40 +#define GPIO_PORTA_DEBOUNCE 0x48 +#define GPIO_PORTA_EOI 0x4c +#define GPIO_EXT_PORTA 0x50
What's the deal with C structures? Has the policy on this changed? I can't help thinking that your GPIO_ prefix is unnecessary.
Quoted 77 lines
drivers/gpio/dwapb_gpio.c new file +77
-0+ +struct gpio_dwapb_platdata { +const char *name; +int bank; +int pins; +fdt_addr_t base; +}; + +static int dwapb_gpio_direction_input (struct udevice *dev,unsigned pin) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +clrbits_le32 (plat->base +GPIO_SWPORTA_DDR ,1 << pin); +return 0 ; +} + +static int dwapb_gpio_direction_output (struct udevice *dev,unsigned pin, +int val) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +setbits_le32 (plat->base +GPIO_SWPORTA_DDR ,1 << pin); + +if (val) +setbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); +else +clrbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); + +return 0 ; +} + +static int dwapb_gpio_get_value (struct udevice *dev,unsigned pin) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); +return !!(readl (plat->base +GPIO_EXT_PORTA ) & (1 << pin)); +} + + +static int dwapb_gpio_set_value (struct udevice *dev,unsigned pin,int val) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +if (val) +setbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); +else +clrbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); + +return 0 ; +} + +static const struct dm_gpio_ops gpio_dwapb_ops = { + .direction_input = dwapb_gpio_direction_input, + .direction_output = dwapb_gpio_direction_output, + .get_value = dwapb_gpio_get_value, + .set_value = dwapb_gpio_set_value, +}; + +static int gpio_dwapb_probe (struct udevice *dev) +{ +struct gpio_dev_priv *priv =dev_get_uclass_priv (dev); +struct gpio_dwapb_platdata *plat = dev->platdata; + +if (!plat) +return 0 ; + + priv->gpio_count = plat->pins; + priv->bank_name = plat->name; + +return 0 ; +} + +static int gpio_dwapb_bind (struct udevice *dev) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); +const void *blob = gd->fdt_blob; +struct udevice *subdev; +fdt_addr_t base;
drivers/gpio/dwapb_gpio.c line 118
Quoted 10 lines
drivers/gpio/dwapb_gpio.c new file +10
-0+int ret, node, bank =0 ; + +/* If this is a child device, there is nothing to do here */ +if (plat) +return 0 ; + + base =fdtdec_get_addr (blob, dev->of_offset,"reg" ); +if (base ==FDT_ADDR_T_NONE ) { +debug ("Can't get the GPIO register base address\n" ); +return -ENXIO ;
-EINVAL I think, since this is an invalid parameter
Quoted 50 lines
drivers/gpio/dwapb_gpio.c new file +49
-1+ } + +for (node =fdt_first_subnode (blob, dev->of_offset); + node >0 ; + node =fdt_next_subnode (blob, node)) { +if (!fdtdec_get_bool (blob, node,"gpio-controller" )) +continue ; + + plat =NULL ; + plat =calloc (1 ,sizeof (*plat)); +if (!plat) +return -ENOMEM ; + + plat->base = base; + plat->bank = bank; + plat->pins =fdtdec_get_int (blob, node,"snps,nr-gpios" ,0 ); + ret =fdt_get_string (blob, node,"bank-name" , &plat->name); +if (ret) + goto err; + + ret =device_bind (dev, dev->driver, plat->name, + plat,-1 , &subdev); +if (ret) + goto err; + + subdev->of_offset = node; + bank++; + } + +return 0 ; + +err: +free (plat); +return ret; +} + +static const struct udevice_id gpio_dwapb_ids[] = { + { .compatible ="snps,dw-apb-gpio" }, + { } +}; + +U_BOOT_DRIVER (gpio_dwapb) = { + .name ="gpio-dwapb" , + .id =UCLASS_GPIO , + .of_match = gpio_dwapb_ids, + .ops = &gpio_dwapb_ops, + .bind = gpio_dwapb_bind, + .probe = gpio_dwapb_probe, +}; --
Quoted 2 lines
2.1.4
Regards,
Simon
PATCH 2/3 arm: socfpga: dts: Add bank-name property to each GPIO bank
In reply to Marek VasutQuoted 9 lines · Marek Vasut
Add "bank-name" property to each GPIO bank to give it unique name. The approach here is exactly the same as with the "regulator-name" property for regulators.
Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>--- arch/arm/dts/socfpga.dtsi | 3 +++ 1 file changed, 3 insertions(+)
PATCH 3/3 arm: socfpga: Enable DWAPB GPIO driver
In reply to Marek VasutQuoted 5 lines · Marek Vasut
Enable the DWAPB GPIO driver for SoCFPGA Cyclone V and Arria V.
Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>Cc Dinh Nguyen <[email protected]>
Quoted 7 lines
--- configs/socfpga_arria5_defconfig | 2 ++ configs/socfpga_cyclone5_defconfig | 2 ++ configs/socfpga_socrates_defconfig | 2 ++ include/configs/socfpga_arria5.h | 2 +- include/configs/socfpga_cyclone5.h | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-)
PATCH v2 1/3 gpio: Add DW APB GPIO driver
In reply to Simon GlassQuoted 4 lines · Simon Glass
Quoted 4 lines
drivers/gpio/dwapb_gpio.c new file +4
-0+#define GPIO_SWPORTA_DR 0x00 +#define GPIO_SWPORTA_DDR 0x04 +#define GPIO_INTEN 0x30 +#define GPIO_INTMASK 0x34
Quoted 8 lines
drivers/gpio/dwapb_gpio.c line 31
Quoted 6 lines
drivers/gpio/dwapb_gpio.c new file +6
-0+#define GPIO_INTTYPE_LEVEL 0x38 +#define GPIO_INT_POLARITY 0x3c +#define GPIO_INTSTATUS 0x40 +#define GPIO_PORTA_DEBOUNCE 0x48 +#define GPIO_PORTA_EOI 0x4c +#define GPIO_EXT_PORTA 0x50What's the deal with C structures? Has the policy on this changed? I
I thought we no longer need to access registers via structs, and accessing them via base + offset, like the kernel does is OK in U-boot:
https://www.marc.info/?l=u-boot&m=142609602127309&w=2
Regards,
Fabio Estevam
PATCH v2 1/3 gpio: Add DW APB GPIO driver
+Tom
Hi Fabio,
Quoted 16 lines · Fabio Estevam
Quoted 4 lines · Simon Glass
Quoted 4 lines
drivers/gpio/dwapb_gpio.c new file +4
-0+#define GPIO_SWPORTA_DR 0x00 +#define GPIO_SWPORTA_DDR 0x04 +#define GPIO_INTEN 0x30 +#define GPIO_INTMASK 0x34Quoted 8 lines
drivers/gpio/dwapb_gpio.c line 31
Quoted 6 lines
drivers/gpio/dwapb_gpio.c new file +6
-0+#define GPIO_INTTYPE_LEVEL 0x38 +#define GPIO_INT_POLARITY 0x3c +#define GPIO_INTSTATUS 0x40 +#define GPIO_PORTA_DEBOUNCE 0x48 +#define GPIO_PORTA_EOI 0x4c +#define GPIO_EXT_PORTA 0x50What's the deal with C structures? Has the policy on this changed? I
Quoted 4 lines
I thought we no longer need to access registers via structs, and accessing them via base + offset, like the kernel does is OK in U-boot:
https://www.marc.info/?l=u-boot&m=142609602127309&w=2
Thanks for the link. No I did not know that.
Perhaps we should add the type-checking referred to in that thread? What is it and who is doing it?
Regards,
Simon
PATCH v2 1/3 gpio: Add DW APB GPIO driver
In reply to Simon GlassQuoted 17 lines · Simon Glass
Hi Marek,
Quoted 5 lines · Marek Vasut
Add driver for the DesignWare APB GPIO IP block.
This driver is DM capable and probes from DT.Signed-off-by Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>Quoted 8 lines
---
drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 1 + drivers/gpio/dwapb_gpio.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 drivers/gpio/dwapb_gpio.c
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>Please see nits/suggestions below.
Are you going to submit a GPIO binding change for this?
You mean for the bank-name ? Yes, I think it only makes sense to do it.
Quoted 11 lines
Quoted 11 lines
V2: Obtain the bank name from the "bank-name" property instead.
drivers/gpio/Kconfig +0
-0@@ -8,6 +8,13 @@ config DM_GPIO particular GPIOs that they provide. The uclass interface is defined in include/asm-generic/gpio.h.
Quoted 9 lines
drivers/gpio/Kconfig config DM_GPIO · line 16
Quoted 6 lines
drivers/gpio/Kconfig +6
-0+config DWAPB_GPIO + bool "DWAPB GPIO driver" + depends on DM && DM_GPIO + default n + help + Support for the Designware APB GPIO driver.You could expand this to talk about bank naming, features supported, chips which use it.
Done
Quoted 41 lines
Quoted 41 lines
drivers/gpio/Kconfig +1
-0+ config LPC32XX_GPIObool "LPC32XX GPIO driver"
depends on DMdrivers/gpio/Makefile +1
-0@@ -6,6 +6,7 @@ # ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.oobj-$(CONFIG_AXP_GPIO) += axp_gpio.o
endif
obj-$(CONFIG_DM_GPIO) += gpio-uclass.odrivers/gpio/dwapb_gpio.c new file +12
-0@@ -0,0 +1,167 @@ +/* +* (C) Copyright 2015 Marek Vasut <[email protected]> +* +* DesignWare APB GPIO driver +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <malloc.h> +#include <asm/arch/gpio.h> +#include <asm/gpio.h>
Quoted 8 lines
drivers/gpio/dwapb_gpio.c line 18
Quoted 6 lines
drivers/gpio/dwapb_gpio.c new file +6
-0+#include <asm/io.h> +#include <dm.h> +#include <dm/device-internal.h> +#include <dm/lists.h> +#include <dm/root.h> +#include <errno.h> should go just below
common.h
Yup
Quoted 8 lines
Quoted 8 lines
drivers/gpio/dwapb_gpio.c new file +8
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#define GPIO_SWPORTA_DR 0x00 +#define GPIO_SWPORTA_DDR 0x04 +#define GPIO_INTEN 0x30 +#define GPIO_INTMASK 0x34 +#define GPIO_INTTYPE_LEVEL 0x38
Quoted 8 lines
drivers/gpio/dwapb_gpio.c line 31
Quoted 5 lines
drivers/gpio/dwapb_gpio.c new file +5
-0+#define GPIO_INT_POLARITY 0x3c +#define GPIO_INTSTATUS 0x40 +#define GPIO_PORTA_DEBOUNCE 0x48 +#define GPIO_PORTA_EOI 0x4c +#define GPIO_EXT_PORTA 0x50What's the deal with C structures? Has the policy on this changed? I can't help thinking that your
GPIO_prefix is unnecessary.
I think we don't do that anymore. The GPIO_ stuff is copied from Linux.
Quoted 81 lines
Quoted 81 lines
drivers/gpio/dwapb_gpio.c new file +17
-0+ +struct gpio_dwapb_platdata { +const char *name; +int bank; +int pins; +fdt_addr_t base; +}; + +static int dwapb_gpio_direction_input (struct udevice *dev,unsigned pin) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +clrbits_le32 (plat->base +GPIO_SWPORTA_DDR ,1 << pin); +return 0 ; +} + +static int dwapb_gpio_direction_output(struct udevice *dev, unsignedpin, + int val)
drivers/gpio/dwapb_gpio.c new file +21
-0+{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +setbits_le32 (plat->base +GPIO_SWPORTA_DDR ,1 << pin); + +if (val) +setbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); +else +clrbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); + +return 0 ; +} + +static int dwapb_gpio_get_value (struct udevice *dev,unsigned pin) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); +return !!(readl (plat->base +GPIO_EXT_PORTA ) & (1 << pin)); +} + + +static int dwapb_gpio_set_value(struct udevice *dev, unsigned pin, intval) +{
drivers/gpio/dwapb_gpio.c new file +41
-0+struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); + +if (val) +setbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); +else +clrbits_le32 (plat->base +GPIO_SWPORTA_DR ,1 << pin); + +return 0 ; +} + +static const struct dm_gpio_ops gpio_dwapb_ops = { + .direction_input = dwapb_gpio_direction_input, + .direction_output = dwapb_gpio_direction_output, + .get_value = dwapb_gpio_get_value, + .set_value = dwapb_gpio_set_value, +}; + +static int gpio_dwapb_probe (struct udevice *dev) +{ +struct gpio_dev_priv *priv =dev_get_uclass_priv (dev); +struct gpio_dwapb_platdata *plat = dev->platdata; + +if (!plat) +return 0 ; + + priv->gpio_count = plat->pins; + priv->bank_name = plat->name; + +return 0 ; +} + +static int gpio_dwapb_bind (struct udevice *dev) +{ +struct gpio_dwapb_platdata *plat =dev_get_platdata (dev); +const void *blob = gd->fdt_blob; +struct udevice *subdev; +fdt_addr_t base; +int ret, node, bank =0 ; + +/* If this is a child device, there is nothing to do here */ +if (plat)
Quoted 8 lines
drivers/gpio/dwapb_gpio.c line 118
Quoted 6 lines
drivers/gpio/dwapb_gpio.c new file +6
-0+return 0 ; + + base =fdtdec_get_addr (blob, dev->of_offset,"reg" ); +if (base ==FDT_ADDR_T_NONE ) { +debug ("Can't get the GPIO register base address\n" ); +return -ENXIO ;
-EINVALI think, since this is an invalid parameter
OK
[...]
PATCH v3 1/3 gpio: Add DW APB GPIO driver
In reply to Simon GlassAdd driver for the DesignWare APB GPIO IP block.
This driver is DM capable and probes from DT.
--- drivers/gpio/Kconfig | 10 +++ drivers/gpio/Makefile | 1 + drivers/gpio/dwapb_gpio.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 drivers/gpio/dwapb_gpio.c
V2: Obtain the bank name from the "bank-name" property instead.
V3: Tweak the description, replace ENXIO with EINVAL, fix Simon's comments.
drivers/gpio/Kconfig +10 -0
@@ -14,6 +14,16 @@ config DM_GPIO particular GPIOs that they provide. The uclass interface is defined in include/asm-generic/gpio.h. +config DWAPB_GPIO + bool "DWAPB GPIO driver" + depends on DM && DM_GPIO + default n + help + Support for the Designware APB GPIO driver. This driver can + be probed only from device tree. Each DW APB GPIO controller + can contain multiple GPIO banks, use the "bank-name" property + in the OF to select reasonable name for each bank. + config LPC32XX_GPIO bool "LPC32XX GPIO driver" depends on DM
drivers/gpio/Makefile +1 -0
@@ -6,6 +6,7 @@ # ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif obj-$(CONFIG_DM_GPIO) += gpio-uclass.o
drivers/gpio/dwapb_gpio.c new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
2.1.4