Skip to contentSkip to conversation

Add Xilinx AXI gpio driver

PATCH In review Greg Gallagher 2 participants 8 messages Jan 31, 2018 – Feb 1, 2018 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Add Xilinx AXI gpio driver

---
 kernel/drivers/gpio/Kconfig       | 10 +++++++++-
 kernel/drivers/gpio/Makefile      |  3 ++-
 kernel/drivers/gpio/gpio-xilinx.c | 40 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 kernel/drivers/gpio/gpio-xilinx.c
kernel/drivers/gpio/Kconfig +9 -1
index 81fc442..b7efa54 100644
@@ -6,7 +6,7 @@ config XENO_DRIVERS_GPIO
        help
 
        Real-time capable GPIO module.
-      
+
 if XENO_DRIVERS_GPIO
 
 config XENO_DRIVERS_GPIO_BCM2835
@@ -41,6 +41,14 @@ config XENO_DRIVERS_GPIO_ZYNQ7000
 	Enables support for the GPIO controller available from
 	Xilinx's Zynq7000 SoC.
 
+config XENO_DRIVERS_GPIO_XILINX
+	depends on ARCH_ZYNQ
+	bool "Support for Xilinx GPIOs"
+	help
+
+	Enables support for the GPIO controller available from
+	Xilinx's softcore IP.
+
 config XENO_DRIVERS_GPIO_DEBUG
        bool "Enable GPIO core debugging features"
 
kernel/drivers/gpio/Makefile +2 -1
index 7f28403..3737330 100644
@@ -1,4 +1,3 @@
-
 ccflags-$(CONFIG_XENO_DRIVERS_GPIO_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_XENO_DRIVERS_GPIO) += xeno_gpio.o
@@ -9,3 +8,5 @@ xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += gpio-bcm2835.o
 xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += gpio-mxc.o
 xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += gpio-sun8i-h3.o
 xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += gpio-zynq7000.o
+xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += gpio-xilinx.o
+
kernel/drivers/gpio/gpio-xilinx.c new file +40 -0
new file mode 100644
index 0000000..72d4364
@@ -0,0 +1,40 @@
+/**
+ * @note Copyright (C) 2017 Greg Gallagher <[email protected]>
+ *
+ * This driver controls the gpio that can be located on the PL
+ * of the Zynq SOC
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include <linux/module.h>
+#include "gpio-core.h"
+
+#define RTDM_SUBCLASS_XILINX  5
+
+static int __init xilinx_gpio_init(void)
+{
+ 	return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
+                     RTDM_SUBCLASS_XILINX);
+}
+module_init(xilinx_gpio_init);
+
+static void __exit xilinx_gpio_exit(void)
+{
+	rtdm_gpiochip_remove_of(RTDM_SUBCLASS_XILINX);
+}
+module_exit(xilinx_gpio_exit);
+
+MODULE_LICENSE("GPL");
+
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 Handle device paths from the device tree that start with a forward slash

If the device name from the device tree starts with a forward slash (/) the rtdm device stores it in the registry including the forward slash. When we go to use that device and do the registry lookup we use a relative path from /dev/rtdm which doesn't contain the forward slash and fails to find a match. Open won't return an error but IO calls will fail. To fix this when we register an RTDM device skip the first character if it's a forward slash.

In my case the path from the device tree is

        /amba_pl/gpio@41200000/gpio905
which gets stored in the registry. When we want to use the device and look up
the device path in the registry we use
        amba_pl/gpio@41200000/gpio905

which won't find a match in the registry.

Tested on Zynq7000 gpio drivers

---
 kernel/cobalt/rtdm/device.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
kernel/cobalt/rtdm/device.c +11 -3
index 4533dfb..89e0815 100644
@@ -91,9 +91,12 @@ struct rtdm_device *__rtdm_get_namedev(const char *path)
 	if (strncmp(path, "rtdm/", 5) == 0)
 		path += 5;
 
+	printk(KERN_ERR "path to bind %s\n", path);
 	ret = xnregistry_bind(path, XN_NONBLOCK, XN_RELATIVE, &handle);
-	if (ret)
+	if (ret) {
+		printk(KERN_ERR "xnreg bind fail %d\n", ret);
 		return NULL;
+	}
 
 	mutex_lock(&register_lock);
 
@@ -394,6 +397,7 @@ int rtdm_dev_register(struct rtdm_device *dev)
 	int ret, major, minor;
 	xnkey_t id;
 	dev_t rdev;
+	const char *dev_name;
 
 	secondary_mode_only();
 
@@ -446,8 +450,12 @@ int rtdm_dev_register(struct rtdm_device *dev)
 			ret = -ENOMEM;
 			goto fail;
 		}
-
-		ret = xnregistry_enter(dev->name, dev,
+		if (dev->name[0] == '/') {
+			dev_name = dev->name+1;
+		} else {
+			dev_name = dev->name;
+		}
+		ret = xnregistry_enter(dev_name, dev,
 				       &dev->named.handle, NULL);
 		if (ret)
 			goto fail;
Signature · 1 line
2.7.4
#2 lore raw

Re: [Xenomai] [PATCH 2/3] Handle device paths from the device tree that start with a forward slash

Quoted 7 lines · Greg Gallagher

If the device name from the device tree starts with a forward slash (/) the rtdm device stores it in the registry including the forward slash. When we go to use that device and do the registry lookup we use a relative path from /dev/rtdm which doesn't contain the forward slash and fails to find a match. Open won't return an error but IO calls will fail. To fix this when we register an RTDM device skip the first character if it's a forward slash.

Quoted 7 lines

In my case the path from the device tree is

        /amba_pl/gpio@41200000/gpio905
which gets stored in the registry. When we want to use the device and look up
the device path in the registry we use
        amba_pl/gpio@41200000/gpio905

which won't find a match in the registry.

Good catch, thanks.

Quoted 10 lines

Tested on Zynq7000 gpio drivers

---
 kernel/cobalt/rtdm/device.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
kernel/cobalt/rtdm/device.c +0 -0
index 4533dfb..89e0815 100644

kernel/cobalt/rtdm/device.c struct rtdm_device *__rtdm_get_namedev(const char *path) · line 94

Quoted 4 lines
kernel/cobalt/rtdm/device.c +1 -0
@@ -91,9 +91,12 @@ struct rtdm_device *__rtdm_get_namedev(const char *path)
 	if (strncmp(path, "rtdm/", 5) == 0)
 		path += 5;
 
+	printk(KERN_ERR "path to bind %s\n", path);

Debug stuff to remove before merging.

Signature · 1 line
Philippe.
#3 lore raw

Re: [Xenomai] [PATCH 2/3] Handle device paths from the device tree that start with a forward slash

Yep, sorry I thought I removed that. Will update

Quoted 37 lines · Philippe Gerum
Quoted 7 lines · Greg Gallagher

If the device name from the device tree starts with a forward slash (/) the rtdm device stores it in the registry including the forward slash. When we go to use that device and do the registry lookup we use a relative path from /dev/rtdm which doesn't contain the forward slash and fails to find a match. Open won't return an error but IO calls will fail. To fix this when we register an RTDM device skip the first character if it's a forward slash.

Quoted 7 lines

In my case the path from the device tree is

        /amba_pl/gpio@41200000/gpio905
which gets stored in the registry. When we want to use the device and look up
the device path in the registry we use
        amba_pl/gpio@41200000/gpio905

which won't find a match in the registry.

Good catch, thanks.

Quoted 10 lines

Tested on Zynq7000 gpio drivers

---
 kernel/cobalt/rtdm/device.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
kernel/cobalt/rtdm/device.c +0 -0
index 4533dfb..89e0815 100644

kernel/cobalt/rtdm/device.c struct rtdm_device *__rtdm_get_namedev(const char *path) · line 94

Quoted 4 lines
kernel/cobalt/rtdm/device.c +1 -0
@@ -91,9 +91,12 @@ struct rtdm_device *__rtdm_get_namedev(const char *path)
      if (strncmp(path, "rtdm/", 5) == 0)
              path += 5;
 
+     printk(KERN_ERR "path to bind %s\n", path);

Debug stuff to remove before merging.

--
Philippe.

#4 lore raw

PATCH 3/3 Allow for more then one rt gpio driver to be built and loaded at the same build

In reply to Greg Gallagher

Some SOCs will have two GPIO chips that require two independent drivers. In my case I was working with the Zynq SOC and needed a driver for the gpios on the FPGA and a driver for the gpios available on the ARM core. This change allows for two rt gpio drivers to be built and loaded at the same time. The rt gpio driver will be renamed from xeno-gpio to the following:

xeno-gpio-bcm2835.ko
xeno-gpio-mxc.ko
xeno-gpio-sun8i-h3.ko
xeno-gpio-zynq7000.ko

This also moves the gpio-core logic into the kernel image.

---
 kernel/drivers/gpio/Kconfig       | 12 ++++++------
 kernel/drivers/gpio/Makefile      | 22 ++++++++++++----------
 kernel/drivers/gpio/gpio-xilinx.c |  4 ++--
 3 files changed, 20 insertions(+), 18 deletions(-)
kernel/drivers/gpio/Kconfig +6 -6
index b7efa54..48475f2 100644
@@ -1,7 +1,7 @@
 menu "Real-time GPIO drivers"
 
 config XENO_DRIVERS_GPIO
-       tristate "GPIO controller"
+       bool "GPIO controller"
        depends on GPIOLIB
        help
 
@@ -11,7 +11,7 @@ if XENO_DRIVERS_GPIO
 
 config XENO_DRIVERS_GPIO_BCM2835
 	depends on MACH_BCM2708 || ARCH_BCM2835
-	bool "Support for BCM2835 GPIOs"
+	tristate "Support for BCM2835 GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
@@ -19,7 +19,7 @@ config XENO_DRIVERS_GPIO_BCM2835
 
 config XENO_DRIVERS_GPIO_MXC
 	depends on GPIO_MXC
-	bool "Support for MXC GPIOs"
+	tristate "Support for MXC GPIOs"
 	help
 
 	Suitable for the GPIO controller available from
@@ -27,7 +27,7 @@ config XENO_DRIVERS_GPIO_MXC
 
 config XENO_DRIVERS_GPIO_SUN8I_H3
 	depends on MACH_SUN8I && PINCTRL_SUN8I_H3
-	bool "Support for SUN8I H3 GPIOs"
+	tristate "Support for SUN8I H3 GPIOs"
 	help
 
 	Suitable for the GPIO controller available from Allwinner's H3
@@ -35,7 +35,7 @@ config XENO_DRIVERS_GPIO_SUN8I_H3
 
 config XENO_DRIVERS_GPIO_ZYNQ7000
 	depends on ARCH_ZYNQ
-	bool "Support for Zynq7000 GPIOs"
+	tristate "Support for Zynq7000 GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
@@ -43,7 +43,7 @@ config XENO_DRIVERS_GPIO_ZYNQ7000
 
 config XENO_DRIVERS_GPIO_XILINX
 	depends on ARCH_ZYNQ
-	bool "Support for Xilinx GPIOs"
+	tristate "Support for Xilinx GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
kernel/drivers/gpio/Makefile +12 -10
index 3737330..8648fcc 100644
@@ -1,12 +1,14 @@
 ccflags-$(CONFIG_XENO_DRIVERS_GPIO_DEBUG) := -DDEBUG
 
-obj-$(CONFIG_XENO_DRIVERS_GPIO) += xeno_gpio.o
-
-xeno_gpio-y := gpio-core.o
-
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += gpio-bcm2835.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += gpio-mxc.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += gpio-sun8i-h3.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += gpio-zynq7000.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += gpio-xilinx.o
-
+obj-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += xeno-gpio-bcm2835.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += xeno-gpio-mxc.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += xeno-gpio-sun8i-h3.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += xeno-gpio-zynq7000.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += xeno-gpio-xilinx.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o
+
+xeno-gpio-bcm2835-y := gpio-bcm2835.o
+xeno-gpio-mxc-y := gpio-mxc.o
+xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o
+xeno-gpio-zynq7000-y := gpio-zynq7000.o
+xeno-gpio-xilinx-y := gpio-xilinx.o
kernel/drivers/gpio/gpio-xilinx.c +2 -2
index 72d4364..e982f5f 100644
@@ -19,13 +19,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include <linux/module.h>
-#include "gpio-core.h"
+#include <rtdm/gpio.h>
 
 #define RTDM_SUBCLASS_XILINX  5
 
 static int __init xilinx_gpio_init(void)
 {
- 	return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
+	return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
                      RTDM_SUBCLASS_XILINX);
 }
 module_init(xilinx_gpio_init);
Signature · 1 line
2.7.4
#5 lore raw

Re: [Xenomai] [PATCH 3/3] Allow for more then one rt gpio driver to be built and loaded at the same build

Quoted 95 lines · Greg Gallagher

Some SOCs will have two GPIO chips that require two independent drivers. In my case I was working with the Zynq SOC and needed a driver for the gpios on the FPGA and a driver for the gpios available on the ARM core. This change allows for two rt gpio drivers to be built and loaded at the same time. The rt gpio driver will be renamed from xeno-gpio to the following:

xeno-gpio-bcm2835.ko
xeno-gpio-mxc.ko
xeno-gpio-sun8i-h3.ko
xeno-gpio-zynq7000.ko

This also moves the gpio-core logic into the kernel image.

---
 kernel/drivers/gpio/Kconfig       | 12 ++++++------
 kernel/drivers/gpio/Makefile      | 22 ++++++++++++----------
 kernel/drivers/gpio/gpio-xilinx.c |  4 ++--
 3 files changed, 20 insertions(+), 18 deletions(-)
kernel/drivers/gpio/Kconfig +6 -6
index b7efa54..48475f2 100644
@@ -1,7 +1,7 @@
 menu "Real-time GPIO drivers"
 
 config XENO_DRIVERS_GPIO
-       tristate "GPIO controller"
+       bool "GPIO controller"
        depends on GPIOLIB
        help
 
@@ -11,7 +11,7 @@ if XENO_DRIVERS_GPIO
 
 config XENO_DRIVERS_GPIO_BCM2835
 	depends on MACH_BCM2708 || ARCH_BCM2835
-	bool "Support for BCM2835 GPIOs"
+	tristate "Support for BCM2835 GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
@@ -19,7 +19,7 @@ config XENO_DRIVERS_GPIO_BCM2835
 
 config XENO_DRIVERS_GPIO_MXC
 	depends on GPIO_MXC
-	bool "Support for MXC GPIOs"
+	tristate "Support for MXC GPIOs"
 	help
 
 	Suitable for the GPIO controller available from
@@ -27,7 +27,7 @@ config XENO_DRIVERS_GPIO_MXC
 
 config XENO_DRIVERS_GPIO_SUN8I_H3
 	depends on MACH_SUN8I && PINCTRL_SUN8I_H3
-	bool "Support for SUN8I H3 GPIOs"
+	tristate "Support for SUN8I H3 GPIOs"
 	help
 
 	Suitable for the GPIO controller available from Allwinner's H3
@@ -35,7 +35,7 @@ config XENO_DRIVERS_GPIO_SUN8I_H3
 
 config XENO_DRIVERS_GPIO_ZYNQ7000
 	depends on ARCH_ZYNQ
-	bool "Support for Zynq7000 GPIOs"
+	tristate "Support for Zynq7000 GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
@@ -43,7 +43,7 @@ config XENO_DRIVERS_GPIO_ZYNQ7000
 
 config XENO_DRIVERS_GPIO_XILINX
 	depends on ARCH_ZYNQ
-	bool "Support for Xilinx GPIOs"
+	tristate "Support for Xilinx GPIOs"
 	help
 
 	Enables support for the GPIO controller available from
kernel/drivers/gpio/Makefile +2 -10
index 3737330..8648fcc 100644
@@ -1,12 +1,14 @@
 ccflags-$(CONFIG_XENO_DRIVERS_GPIO_DEBUG) := -DDEBUG
 
-obj-$(CONFIG_XENO_DRIVERS_GPIO) += xeno_gpio.o
-
-xeno_gpio-y := gpio-core.o
-
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += gpio-bcm2835.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += gpio-mxc.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += gpio-sun8i-h3.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += gpio-zynq7000.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += gpio-xilinx.o
-
+obj-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += xeno-gpio-bcm2835.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += xeno-gpio-mxc.o

kernel/drivers/gpio/Makefile line 14

Quoted 10 lines
kernel/drivers/gpio/Makefile +10 -0
+obj-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += xeno-gpio-sun8i-h3.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += xeno-gpio-zynq7000.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += xeno-gpio-xilinx.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o
+
+xeno-gpio-bcm2835-y := gpio-bcm2835.o
+xeno-gpio-mxc-y := gpio-mxc.o
+xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o
+xeno-gpio-zynq7000-y := gpio-zynq7000.o
+xeno-gpio-xilinx-y := gpio-xilinx.o

Ok.

Quoted 11 lines
kernel/drivers/gpio/gpio-xilinx.c +1 -1
index 72d4364..e982f5f 100644
@@ -19,13 +19,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include <linux/module.h>
-#include "gpio-core.h"
+#include <rtdm/gpio.h>

kernel/drivers/gpio/gpio-xilinx.c line 31

Quoted 10 lines
kernel/drivers/gpio/gpio-xilinx.c +1 -1
 
 #define RTDM_SUBCLASS_XILINX  5
 
 static int __init xilinx_gpio_init(void)
 {
- 	return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
+	return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
                      RTDM_SUBCLASS_XILINX);
 }
 module_init(xilinx_gpio_init);

Left over from patch #1?

Signature · 1 line
Philippe.
#6 lore raw

Re: [Xenomai] [PATCH 3/3] Allow for more then one rt gpio driver to be built and loaded at the same build

Yes, will fix that

Quoted 135 lines · Philippe Gerum
Quoted 95 lines · Greg Gallagher

Some SOCs will have two GPIO chips that require two independent drivers. In my case I was working with the Zynq SOC and needed a driver for the gpios on the FPGA and a driver for the gpios available on the ARM core. This change allows for two rt gpio drivers to be built and loaded at the same time. The rt gpio driver will be renamed from xeno-gpio to the following:

xeno-gpio-bcm2835.ko
xeno-gpio-mxc.ko
xeno-gpio-sun8i-h3.ko
xeno-gpio-zynq7000.ko

This also moves the gpio-core logic into the kernel image.

---
 kernel/drivers/gpio/Kconfig       | 12 ++++++------
 kernel/drivers/gpio/Makefile      | 22 ++++++++++++----------
 kernel/drivers/gpio/gpio-xilinx.c |  4 ++--
 3 files changed, 20 insertions(+), 18 deletions(-)
kernel/drivers/gpio/Kconfig +6 -6
index b7efa54..48475f2 100644
@@ -1,7 +1,7 @@
 menu "Real-time GPIO drivers"
 
 config XENO_DRIVERS_GPIO
-       tristate "GPIO controller"
+       bool "GPIO controller"
        depends on GPIOLIB
        help
 
@@ -11,7 +11,7 @@ if XENO_DRIVERS_GPIO
 
 config XENO_DRIVERS_GPIO_BCM2835
      depends on MACH_BCM2708 || ARCH_BCM2835
-     bool "Support for BCM2835 GPIOs"
+     tristate "Support for BCM2835 GPIOs"
      help
 
      Enables support for the GPIO controller available from
@@ -19,7 +19,7 @@ config XENO_DRIVERS_GPIO_BCM2835
 
 config XENO_DRIVERS_GPIO_MXC
      depends on GPIO_MXC
-     bool "Support for MXC GPIOs"
+     tristate "Support for MXC GPIOs"
      help
 
      Suitable for the GPIO controller available from
@@ -27,7 +27,7 @@ config XENO_DRIVERS_GPIO_MXC
 
 config XENO_DRIVERS_GPIO_SUN8I_H3
      depends on MACH_SUN8I && PINCTRL_SUN8I_H3
-     bool "Support for SUN8I H3 GPIOs"
+     tristate "Support for SUN8I H3 GPIOs"
      help
 
      Suitable for the GPIO controller available from Allwinner's H3
@@ -35,7 +35,7 @@ config XENO_DRIVERS_GPIO_SUN8I_H3
 
 config XENO_DRIVERS_GPIO_ZYNQ7000
      depends on ARCH_ZYNQ
-     bool "Support for Zynq7000 GPIOs"
+     tristate "Support for Zynq7000 GPIOs"
      help
 
      Enables support for the GPIO controller available from
@@ -43,7 +43,7 @@ config XENO_DRIVERS_GPIO_ZYNQ7000
 
 config XENO_DRIVERS_GPIO_XILINX
      depends on ARCH_ZYNQ
-     bool "Support for Xilinx GPIOs"
+     tristate "Support for Xilinx GPIOs"
      help
 
      Enables support for the GPIO controller available from
kernel/drivers/gpio/Makefile +2 -10
index 3737330..8648fcc 100644
@@ -1,12 +1,14 @@
 ccflags-$(CONFIG_XENO_DRIVERS_GPIO_DEBUG) := -DDEBUG
 
-obj-$(CONFIG_XENO_DRIVERS_GPIO) += xeno_gpio.o
-
-xeno_gpio-y := gpio-core.o
-
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += gpio-bcm2835.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += gpio-mxc.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += gpio-sun8i-h3.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += gpio-zynq7000.o
-xeno_gpio-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += gpio-xilinx.o
-
+obj-$(CONFIG_XENO_DRIVERS_GPIO_BCM2835) += xeno-gpio-bcm2835.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_MXC) += xeno-gpio-mxc.o

kernel/drivers/gpio/Makefile line 14

Quoted 10 lines
kernel/drivers/gpio/Makefile +10 -0
+obj-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += xeno-gpio-sun8i-h3.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += xeno-gpio-zynq7000.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += xeno-gpio-xilinx.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o
+
+xeno-gpio-bcm2835-y := gpio-bcm2835.o
+xeno-gpio-mxc-y := gpio-mxc.o
+xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o
+xeno-gpio-zynq7000-y := gpio-zynq7000.o
+xeno-gpio-xilinx-y := gpio-xilinx.o

Ok.

Quoted 11 lines
kernel/drivers/gpio/gpio-xilinx.c +1 -1
index 72d4364..e982f5f 100644
@@ -19,13 +19,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include <linux/module.h>
-#include "gpio-core.h"
+#include <rtdm/gpio.h>

kernel/drivers/gpio/gpio-xilinx.c line 31

Quoted 10 lines
kernel/drivers/gpio/gpio-xilinx.c +1 -1
 
 #define RTDM_SUBCLASS_XILINX  5
 
 static int __init xilinx_gpio_init(void)
 {
-     return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
+     return rtdm_gpiochip_scan_of(NULL, "xlnx,xps-gpio-1.00.a",
                      RTDM_SUBCLASS_XILINX);
 }
 module_init(xilinx_gpio_init);

Left over from patch #1?

--
Philippe.

#7 lore raw
In reply to Greg Gallagher
Quoted 5 lines · Greg Gallagher
---
 kernel/drivers/gpio/Kconfig       | 10 +++++++++-
 kernel/drivers/gpio/Makefile      |  3 ++-
 kernel/drivers/gpio/gpio-xilinx.c | 40 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)

[snip]

Quoted 19 lines
kernel/drivers/gpio/gpio-xilinx.c new file +13 -0
new file mode 100644
index 0000000..72d4364
@@ -0,0 +1,40 @@
+/**
+ * @note Copyright (C) 2017 Greg Gallagher <[email protected]>
+ *
+ * This driver controls the gpio that can be located on the PL
+ * of the Zynq SOC
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

kernel/drivers/gpio/gpio-xilinx.c line 23

Quoted 10 lines
kernel/drivers/gpio/gpio-xilinx.c new file +10 -0
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include <linux/module.h>
+#include "gpio-core.h"
+

The change below is required for this driver to build since recently, due to moving gpio-core.h to a public header containing the generic GPIO bits some client drivers may need. Other than that, this looks ok.

(quoted diff) +0 -0

b/kernel/drivers/gpio/gpio-xilinx.c
index 72d436435..cae88b62f 100644

kernel/drivers/gpio/gpio-xilinx.c +0 -0
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

02111-1307, USA.
*/
#include <linux/module.h>
-#include "gpio-core.h"
+#include <rtdm/gpio.h>

#define RTDM_SUBCLASS_XILINX 5

Signature · 1 line
Philippe.