add support for cherryview gpio controller driver
Subsystems (5)
v2 cover add support for cherryview gpio controller driver
1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device and remove _of for api name.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.
I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.
index f83d7689f..50afbd418 100644
testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv) goto out; } - ret =ioctl (ti.fd_dev_intr,GPIO_RTIOC_TS , &value); + ret =ioctl (ti.fd_dev_intr,GPIO_RTIOC_TS_MONO , &value);if (ret) {printf ("ioctl gpio port ts, failed\n" ); goto out;
3. test result for inner related output:
REALTIME clock:
# Total: 000999999 # Min Latencies: 00013 # Avg Latencies: 16.879997 # Max Latencies: 00043
MONO clock:
# Total: 000083988 # Min Latencies: 00012 # Avg Latencies: 2814377.000000 # Max Latencies: 00041
Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.
Hongzhan Chen (3):
drivers/gpio: core: Move out of OF config conditional compilation drivers/gpio: core: Introduce helper to find gpiochip driver/gpio: Add Intel Cherryview pinctrl driver
include/cobalt/kernel/rtdm/gpio.h | 12 +++++-- kernel/drivers/gpio/Kconfig | 7 ++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-bcm2835.c | 2 +- kernel/drivers/gpio/gpio-cherryview.c | 42 ++++++++++++++++++++++ kernel/drivers/gpio/gpio-core.c | 50 ++++++++++++++++++++++++--- kernel/drivers/gpio/gpio-mxc.c | 2 +- kernel/drivers/gpio/gpio-omap.c | 2 +- kernel/drivers/gpio/gpio-sun8i-h3.c | 2 +- kernel/drivers/gpio/gpio-xilinx.c | 2 +- kernel/drivers/gpio/gpio-zynq7000.c | 2 +- 11 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
Signature · 1 line
2.17.1
PATCH v2 1/3 drivers/gpio: core: Move out of OF config conditional compilation
Rename interface name because it is undependent of OF platform and non-OF platform would also call it to remove rtdm gpio chip device.
--- include/cobalt/kernel/rtdm/gpio.h | 5 ++--- kernel/drivers/gpio/gpio-bcm2835.c | 2 +- kernel/drivers/gpio/gpio-core.c | 8 ++++---- kernel/drivers/gpio/gpio-mxc.c | 2 +- kernel/drivers/gpio/gpio-omap.c | 2 +- kernel/drivers/gpio/gpio-sun8i-h3.c | 2 +- kernel/drivers/gpio/gpio-xilinx.c | 2 +- kernel/drivers/gpio/gpio-zynq7000.c | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-)
include/cobalt/kernel/rtdm/gpio.h +2 -3
@@ -70,9 +70,8 @@ int rtdm_gpiochip_scan_of(struct device_node *from,int rtdm_gpiochip_scan_array_of (struct device_node *from,const char *compat[],int nentries,int type); - -void rtdm_gpiochip_remove_of (int type); -#endif +void rtdm_gpiochip_remove (int type); +#endif /* !_COBALT_RTDM_GPIO_H */
kernel/drivers/gpio/gpio-bcm2835.c +1 -1
@@ -29,7 +29,7 @@ module_init(bcm2835_gpio_init); static void __exit bcm2835_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_BCM2835 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_BCM2835 ); }module_exit (bcm2835_gpio_exit);
kernel/drivers/gpio/gpio-core.c +4 -4
@@ -626,7 +626,9 @@ int rtdm_gpiochip_scan_array_of(struct device_node *from, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_scan_array_of); -void rtdm_gpiochip_remove_of (int type) +#endif /* CONFIG_OF */ + +void rtdm_gpiochip_remove (int type) {struct rtdm_gpio_chip *rgc, *n;
@@ -643,6 +645,4 @@ void rtdm_gpiochip_remove_of(int type)mutex_unlock (&chip_lock); } -EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove_of); - -#endif /* CONFIG_OF */ +EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove);
kernel/drivers/gpio/gpio-mxc.c +1 -1
@@ -35,7 +35,7 @@ module_init(mxc_gpio_init); static void __exit mxc_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_MXC ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_MXC ); }module_exit (mxc_gpio_exit);
kernel/drivers/gpio/gpio-omap.c +1 -1
@@ -36,7 +36,7 @@ module_init(omap_gpio_init); static void __exit omap_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_OMAP ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_OMAP ); }module_exit (omap_gpio_exit);
kernel/drivers/gpio/gpio-sun8i-h3.c +1 -1
@@ -36,7 +36,7 @@ module_init(h3_gpio_init); static void __exit h3_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_H3 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_H3 ); }module_exit (h3_gpio_exit);
kernel/drivers/gpio/gpio-xilinx.c +1 -1
@@ -32,7 +32,7 @@ module_init(xilinx_gpio_init); static void __exit xilinx_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_XILINX ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_XILINX ); }module_exit (xilinx_gpio_exit);
kernel/drivers/gpio/gpio-zynq7000.c +1 -1
@@ -32,7 +32,7 @@ module_init(zynq7000_gpio_init); static void __exit zynq7000_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_ZYNQ7000 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_ZYNQ7000 ); }module_exit (zynq7000_gpio_exit);
Signature · 1 line
2.17.1
Re: [PATCH 1/3] drivers/gpio: core: Move out of OF config conditional compilation
Quoted 125 lines · Hongzhan Chen via Xenomai
Rename interface name because it is undependent of OF platform and non-OF platform would also call it to remove rtdm gpio chip device.
Signed-off-by Hongzhan Chen <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 5 ++--- kernel/drivers/gpio/gpio-bcm2835.c | 2 +- kernel/drivers/gpio/gpio-core.c | 8 ++++---- kernel/drivers/gpio/gpio-mxc.c | 2 +- kernel/drivers/gpio/gpio-omap.c | 2 +- kernel/drivers/gpio/gpio-sun8i-h3.c | 2 +- kernel/drivers/gpio/gpio-xilinx.c | 2 +- kernel/drivers/gpio/gpio-zynq7000.c | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-)include/cobalt/kernel/rtdm/gpio.h +2
-3@@ -70,9 +70,8 @@ int rtdm_gpiochip_scan_of(struct device_node *from,int rtdm_gpiochip_scan_array_of (struct device_node *from,const char *compat[],int nentries,int type); - -void rtdm_gpiochip_remove_of (int type); -#endif +void rtdm_gpiochip_remove (int type); +#endif /* !_COBALT_RTDM_GPIO_H */ kernel/drivers/gpio/gpio-bcm2835.c +1
-1@@ -29,7 +29,7 @@ module_init(bcm2835_gpio_init); static void __exit bcm2835_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_BCM2835 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_BCM2835 ); }module_exit (bcm2835_gpio_exit);kernel/drivers/gpio/gpio-core.c +4
-4@@ -626,7 +626,9 @@ int rtdm_gpiochip_scan_array_of(struct device_node *from, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_scan_array_of); -void rtdm_gpiochip_remove_of (int type) +#endif /* CONFIG_OF */ + +void rtdm_gpiochip_remove (int type) {struct rtdm_gpio_chip *rgc, *n;@@ -643,6 +645,4 @@ void rtdm_gpiochip_remove_of(int type)mutex_unlock (&chip_lock); } -EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove_of); - -#endif /* CONFIG_OF */ +EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove);kernel/drivers/gpio/gpio-mxc.c +1
-1@@ -35,7 +35,7 @@ module_init(mxc_gpio_init); static void __exit mxc_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_MXC ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_MXC ); }module_exit (mxc_gpio_exit);kernel/drivers/gpio/gpio-omap.c +1
-1@@ -36,7 +36,7 @@ module_init(omap_gpio_init); static void __exit omap_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_OMAP ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_OMAP ); }module_exit (omap_gpio_exit);kernel/drivers/gpio/gpio-sun8i-h3.c +1
-1@@ -36,7 +36,7 @@ module_init(h3_gpio_init); static void __exit h3_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_H3 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_H3 ); }module_exit (h3_gpio_exit);kernel/drivers/gpio/gpio-xilinx.c +1
-1@@ -32,7 +32,7 @@ module_init(xilinx_gpio_init); static void __exit xilinx_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_XILINX ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_XILINX ); }module_exit (xilinx_gpio_exit);kernel/drivers/gpio/gpio-zynq7000.c +0
-0
kernel/drivers/gpio/gpio-zynq7000.c module_init(zynq7000_gpio_init); · line 38
Quoted 8 lines
kernel/drivers/gpio/gpio-zynq7000.c +1
-1@@ -32,7 +32,7 @@ module_init(zynq7000_gpio_init); static void __exit zynq7000_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_ZYNQ7000 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_ZYNQ7000 ); }module_exit (zynq7000_gpio_exit);
Oops, we already had a rtdm_gpiochip_remove. Renaming this one to rtdm_gpiochip_remove_by_type".
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
RE: [PATCH 1/3] drivers/gpio: core: Move out of OF config conditional compilation
Quoted 134 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 9:06 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 1/3]drivers/gpio: core: Move out of OF config conditional compilationQuoted 125 lines · Hongzhan Chen via Xenomai
Rename interface name because it is undependent of OF platform and non-OF platform would also call it to remove rtdm gpio chip device.
Signed-off-by Hongzhan Chen <[email protected]>---
include/cobalt/kernel/rtdm/gpio.h | 5 ++--- kernel/drivers/gpio/gpio-bcm2835.c | 2 +- kernel/drivers/gpio/gpio-core.c | 8 ++++---- kernel/drivers/gpio/gpio-mxc.c | 2 +- kernel/drivers/gpio/gpio-omap.c | 2 +- kernel/drivers/gpio/gpio-sun8i-h3.c | 2 +- kernel/drivers/gpio/gpio-xilinx.c | 2 +- kernel/drivers/gpio/gpio-zynq7000.c | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-)include/cobalt/kernel/rtdm/gpio.h +2
-3@@ -70,9 +70,8 @@ int rtdm_gpiochip_scan_of(struct device_node *from,int rtdm_gpiochip_scan_array_of (struct device_node *from,const char *compat[],int nentries,int type); - -void rtdm_gpiochip_remove_of (int type); -#endif +void rtdm_gpiochip_remove (int type); +#endif /* !_COBALT_RTDM_GPIO_H */ kernel/drivers/gpio/gpio-bcm2835.c +1
-1@@ -29,7 +29,7 @@ module_init(bcm2835_gpio_init); static void __exit bcm2835_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_BCM2835 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_BCM2835 ); }module_exit (bcm2835_gpio_exit);kernel/drivers/gpio/gpio-core.c +4
-4@@ -626,7 +626,9 @@ int rtdm_gpiochip_scan_array_of(struct device_node *from, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_scan_array_of); -void rtdm_gpiochip_remove_of (int type) +#endif /* CONFIG_OF */ + +void rtdm_gpiochip_remove(int type) {struct rtdm_gpio_chip *rgc, *n;@@ -643,6 +645,4 @@ void rtdm_gpiochip_remove_of(int type)mutex_unlock (&chip_lock); } -EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove_of); - -#endif /* CONFIG_OF */ +EXPORT_SYMBOL_GPL (rtdm_gpiochip_remove);kernel/drivers/gpio/gpio-mxc.c +1
-1@@ -35,7 +35,7 @@ module_init(mxc_gpio_init); static void __exit mxc_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_MXC ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_MXC ); }module_exit (mxc_gpio_exit);kernel/drivers/gpio/gpio-omap.c +1
-1@@ -36,7 +36,7 @@ module_init(omap_gpio_init); static void __exit omap_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_OMAP ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_OMAP ); }module_exit (omap_gpio_exit);kernel/drivers/gpio/gpio-sun8i-h3.c +1
-1@@ -36,7 +36,7 @@ module_init(h3_gpio_init); static void __exit h3_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_H3 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_H3 ); }module_exit (h3_gpio_exit);kernel/drivers/gpio/gpio-xilinx.c +1
-1@@ -32,7 +32,7 @@ module_init(xilinx_gpio_init); static void __exit xilinx_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_XILINX ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_XILINX ); }module_exit (xilinx_gpio_exit);kernel/drivers/gpio/gpio-zynq7000.c +0
-0@@ -32,7 +32,7 @@ module_init(zynq7000_gpio_init);
Quoted 11 lines
kernel/drivers/gpio/gpio-zynq7000.c module_init(zynq7000_gpio_init); · line 38
Quoted 8 lines
kernel/drivers/gpio/gpio-zynq7000.c +1
-1static void __exit zynq7000_gpio_exit(void) { -rtdm_gpiochip_remove_of (RTDM_SUBCLASS_ZYNQ7000 ); +rtdm_gpiochip_remove (RTDM_SUBCLASS_ZYNQ7000 ); }module_exit (zynq7000_gpio_exit);Oops, we already had a
rtdm_gpiochip_remove. Renaming this one tortdm_gpiochip_remove_by_type".
Thanks for your finding it out and correcting it. I just noticed it.
Quoted 6 lines
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
PATCH v2 2/3 drivers/gpio: core: Introduce helper to find gpiochip
In reply to Hongzhan ChenTo find gpiochip for non-OF platforms like x86
--- include/cobalt/kernel/rtdm/gpio.h | 7 ++++++ kernel/drivers/gpio/gpio-core.c | 42 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
include/cobalt/kernel/rtdm/gpio.h +7 -0
@@ -62,6 +62,13 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,int rtdm_gpiochip_post_event (struct rtdm_gpio_chip *rgc,unsigned int offset); +int rtdm_gpiochip_find (struct device_node *from, +const char *label,int type); + +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type); +#ifdef CONFIG_OF int rtdm_gpiochip_scan_of(struct device_node *from,
kernel/drivers/gpio/gpio-core.c +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH 2/3] drivers/gpio: core: Introduce helper to find gpiochip
Quoted 49 lines · Hongzhan Chen via Xenomai
To find gpiochip for non-OF platforms like x86
Signed-off-by Hongzhan Chen <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 7 ++++++ kernel/drivers/gpio/gpio-core.c | 42 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)include/cobalt/kernel/rtdm/gpio.h +7
-0@@ -62,6 +62,13 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,int rtdm_gpiochip_post_event (struct rtdm_gpio_chip *rgc,unsigned int offset); +int rtdm_gpiochip_find (struct device_node *from, +const char *label,int type); + +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type); +#ifdef CONFIG_OF int rtdm_gpiochip_scan_of(struct device_node *from,kernel/drivers/gpio/gpio-core.c +15
-0@@ -528,6 +528,48 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_add_by_name); +int rtdm_gpiochip_find (struct device_node *from,const char *label, +int type) +{ +struct rtdm_gpio_chip *rgc; +struct gpio_chip *chip; +int ret = -ENODEV ; + +if (!rtdm_available ()) +return -ENOSYS ; + + chip =find_chip_by_name (label); +if (chip ==NULL ) +return ret; + + ret =0 ;
kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, · line 555
Quoted 10 lines
kernel/drivers/gpio/gpio-core.c +10
-0+ rgc =rtdm_gpiochip_alloc (chip, type); +if (IS_ERR (rgc)) + ret =PTR_ERR (rgc); + +return ret; +} +EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); + +int rtdm_gpiochip_array_find(struct device_node *from, + const char *compat[],
Is "compat" the right argument name here? We are searching by name (label), no?
Jan
Quoted 21 lines
kernel/drivers/gpio/gpio-core.c +17
-0+ int nentries, int type) +{ + int ret = -ENODEV, _ret, n; + +for (n =0 ; n < nentries; n++) { + _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +} +EXPORT_SYMBOL_GPL (rtdm_gpiochip_array_find); +#ifdef CONFIG_OF #include <linux/of_platform.h>
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
RE: [PATCH 2/3] drivers/gpio: core: Introduce helper to find gpiochip
-----Original Message-----
Quoted 60 lines
From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 2:48 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3]drivers/gpio: core: Introduce helper to find gpiochipQuoted 54 lines · Hongzhan Chen via Xenomai
To find gpiochip for non-OF platforms like x86
Signed-off-by Hongzhan Chen <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 7 ++++++ kernel/drivers/gpio/gpio-core.c | 42 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)include/cobalt/kernel/rtdm/gpio.h +7
-0@@ -62,6 +62,13 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,int rtdm_gpiochip_post_event (struct rtdm_gpio_chip *rgc,unsigned int offset); +int rtdm_gpiochip_find (struct device_node *from, +const char *label,int type); + +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type); +#ifdef CONFIG_OF int rtdm_gpiochip_scan_of(struct device_node *from,kernel/drivers/gpio/gpio-core.c +20
-0@@ -528,6 +528,48 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_add_by_name); +int rtdm_gpiochip_find (struct device_node *from,const char *label, +int type) +{ +struct rtdm_gpio_chip *rgc; +struct gpio_chip *chip; +int ret = -ENODEV ; + +if (!rtdm_available ()) +return -ENOSYS ; + + chip =find_chip_by_name (label); +if (chip ==NULL ) +return ret; + + ret =0 ; + rgc =rtdm_gpiochip_alloc (chip, type); +if (IS_ERR (rgc)) + ret =PTR_ERR (rgc); + +return ret;
Quoted 8 lines
kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, · line 555
Quoted 5 lines
kernel/drivers/gpio/gpio-core.c +5
-0+} +EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); + +int rtdm_gpiochip_array_find(struct device_node *from, + const char *compat[],Is "compat" the right argument name here? We are searching by name (label), no?
Yes , it is label. Let me modify it. So patch 1/3 is accepted ?
Regards
Hongzhan chen
Quoted 30 lines
Jan
Quoted 21 lines
kernel/drivers/gpio/gpio-core.c +17
-0+ int nentries, int type) +{ + int ret = -ENODEV, _ret, n; + +for (n =0 ; n < nentries; n++) { + _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +} +EXPORT_SYMBOL_GPL (rtdm_gpiochip_array_find); +#ifdef CONFIG_OF #include <linux/of_platform.h> Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH 2/3] drivers/gpio: core: Introduce helper to find gpiochip
Quoted 72 lines · Hongzhan
-----Original Message-----
Quoted 60 lines
From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 2:48 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3]drivers/gpio: core: Introduce helper to find gpiochipQuoted 54 lines · Hongzhan Chen via Xenomai
To find gpiochip for non-OF platforms like x86
Signed-off-by Hongzhan Chen <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 7 ++++++ kernel/drivers/gpio/gpio-core.c | 42 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)include/cobalt/kernel/rtdm/gpio.h +7
-0@@ -62,6 +62,13 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,int rtdm_gpiochip_post_event (struct rtdm_gpio_chip *rgc,unsigned int offset); +int rtdm_gpiochip_find (struct device_node *from, +const char *label,int type); + +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type); +#ifdef CONFIG_OF int rtdm_gpiochip_scan_of(struct device_node *from,kernel/drivers/gpio/gpio-core.c +20
-0@@ -528,6 +528,48 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_add_by_name); +int rtdm_gpiochip_find (struct device_node *from,const char *label, +int type) +{ +struct rtdm_gpio_chip *rgc; +struct gpio_chip *chip; +int ret = -ENODEV ; + +if (!rtdm_available ()) +return -ENOSYS ; + + chip =find_chip_by_name (label); +if (chip ==NULL ) +return ret; + + ret =0 ; + rgc =rtdm_gpiochip_alloc (chip, type); +if (IS_ERR (rgc)) + ret =PTR_ERR (rgc); + +return ret;Quoted 8 lines
kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc, · line 555
Quoted 5 lines
kernel/drivers/gpio/gpio-core.c +5
-0+} +EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); + +int rtdm_gpiochip_array_find(struct device_node *from, + const char *compat[],Is "compat" the right argument name here? We are searching by name (label), no?
Quoted 2 lines
Yes , it is label. Let me modify it. So patch 1/3 is accepted ?
Already done that locally while merging. Also just renamed compat_array to label_array in patch 3. Let me push this then.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
PATCH v2 3/3 driver/gpio: Add Intel Cherryview pinctrl driver
In reply to Hongzhan ChenAdd support for Intel Cherryview pin controller driver
--- kernel/drivers/gpio/Kconfig | 7 +++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-cherryview.c | 42 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
kernel/drivers/gpio/Kconfig +7 -0
@@ -57,6 +57,13 @@ config XENO_DRIVERS_GPIO_OMAP Enables support for the GPIO controller available from OMAP family SOC. +config XENO_DRIVERS_GPIO_CHERRYVIEW + depends on PINCTRL_CHERRYVIEW + tristate "Support for Cherryview GPIOs" + help + + Enables support for the Intel Cherryview GPIO controller + config XENO_DRIVERS_GPIO_DEBUG bool "Enable GPIO core debugging features"
kernel/drivers/gpio/Makefile +2 -0
@@ -6,6 +6,7 @@ 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_OMAP) += xeno-gpio-omap.o +obj-$(CONFIG_XENO_DRIVERS_GPIO_CHERRYVIEW) += xeno-gpio-cherryview.o obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o xeno-gpio-bcm2835-y := gpio-bcm2835.o
@@ -14,3 +15,4 @@ xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o xeno-gpio-zynq7000-y := gpio-zynq7000.o xeno-gpio-xilinx-y := gpio-xilinx.o xeno-gpio-omap-y := gpio-omap.o +xeno-gpio-cherryview-y := gpio-cherryview.o
kernel/drivers/gpio/gpio-cherryview.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH 3/3] driver/gpio: Add Intel Cherryview pinctrl driver
Quoted 62 lines · Hongzhan Chen via Xenomai
Add support for Intel Cherryview pin controller driver
Signed-off-by Hongzhan Chen <[email protected]>--- kernel/drivers/gpio/Kconfig | 7 +++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-cherryview.c | 42 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 kernel/drivers/gpio/gpio-cherryview.ckernel/drivers/gpio/Kconfig +7
-0@@ -57,6 +57,13 @@ config XENO_DRIVERS_GPIO_OMAP Enables support for the GPIO controller available from OMAP family SOC. +config XENO_DRIVERS_GPIO_CHERRYVIEW + depends on PINCTRL_CHERRYVIEW + tristate "Support for Cherryview GPIOs" + help + + Enables support for the Intel Cherryview GPIO controller + config XENO_DRIVERS_GPIO_DEBUG bool "Enable GPIO core debugging features"kernel/drivers/gpio/Makefile +2
-0@@ -6,6 +6,7 @@ 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_OMAP) += xeno-gpio-omap.o +obj-$(CONFIG_XENO_DRIVERS_GPIO_CHERRYVIEW) += xeno-gpio-cherryview.o obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o xeno-gpio-bcm2835-y := gpio-bcm2835.o@@ -14,3 +15,4 @@ xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o xeno-gpio-zynq7000-y := gpio-zynq7000.o xeno-gpio-xilinx-y := gpio-xilinx.o xeno-gpio-omap-y := gpio-omap.o +xeno-gpio-cherryview-y := gpio-cherryview.okernel/drivers/gpio/gpio-cherryview.c new file +11
-0@@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* @note Copyright (C) 2021 Hongzhan Chen <[email protected]> +* +* 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-cherryview.c line 21
Quoted 10 lines
kernel/drivers/gpio/gpio-cherryview.c new file +10
-0+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ +#include <linux/module.h> +#include <rtdm/gpio.h> + +#define RTDM_SUBCLASS_CHERRYVIEW 7 + +static const char *compat_array[] = {
Again naming: 'compat'? Or rather 'label'?
Quoted 12 lines
kernel/drivers/gpio/gpio-cherryview.c new file +11
-0+"INT33FF:00" , +"INT33FF:01" , +"INT33FF:02" , + "INT33FF:03", +}; + +static int __init cherryview_gpio_init (void ) +{ +return rtdm_gpiochip_array_find (NULL , compat_array, +ARRAY_SIZE (compat_array), +RTDM_SUBCLASS_CHERRYVIEW );
kernel/drivers/gpio/gpio-cherryview.c line 42
Quoted 10 lines
kernel/drivers/gpio/gpio-cherryview.c new file +10
-0+} +module_init (cherryview_gpio_init); + +static void __exit cherryview_gpio_exit(void) +{ +rtdm_gpiochip_remove (RTDM_SUBCLASS_CHERRYVIEW ); +} +module_exit (cherryview_gpio_exit); + +MODULE_LICENSE ("GPL" );
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 48 lines · Hongzhan Chen via Xenomai
1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device and remove
_offor api name.
2. Introduce helper to find gpiochip as referring to pair ofrtdm_gpiochip_scan_ofandrtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.I also did following tests with this patchset:
1. run/usr/lib/xenomai/testsuite/gpiobench-i 334 -i 335 -c INT33FF:02 to validate patch9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892when settingGPIO_RTIOC_TS
2. apply following patch, and rerun 1.index
f83d7689f..50afbd418100644testsuite/gpiobench/gpiobench.c +1
-1@@ -619,7 +619,7 @@ int main(int argc, char **argv) goto out; } - ret =ioctl (ti.fd_dev_intr,GPIO_RTIOC_TS , &value); + ret =ioctl (ti.fd_dev_intr,GPIO_RTIOC_TS_MONO , &value);if (ret) {printf ("ioctl gpio port ts, failed\n" ); goto out;3. test result for inner related output:
REALTIME clock: # Total: 000999999 # Min Latencies: 00013 # Avg Latencies: 16.879997 # Max Latencies: 00043 MONO clock: # Total: 000083988 # Min Latencies: 00012 # Avg Latencies: 2814377.000000 # Max Latencies: 00041Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.Hongzhan Chen (3):
drivers/gpio: core: Move out of OF config conditional compilationdrivers/gpio: core: Introduce helper to find gpiochip driver/gpio: Add Intel Cherryview pinctrl driver
Quoted 14 lines
include/cobalt/kernel/rtdm/gpio.h | 12 +++++-- kernel/drivers/gpio/Kconfig | 7 ++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-bcm2835.c | 2 +- kernel/drivers/gpio/gpio-cherryview.c | 42 ++++++++++++++++++++++ kernel/drivers/gpio/gpio-core.c | 50 ++++++++++++++++++++++++--- kernel/drivers/gpio/gpio-mxc.c | 2 +- kernel/drivers/gpio/gpio-omap.c | 2 +- kernel/drivers/gpio/gpio-sun8i-h3.c | 2 +- kernel/drivers/gpio/gpio-xilinx.c | 2 +- kernel/drivers/gpio/gpio-zynq7000.c | 2 +- 11 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
All three merged, with slight modifications as discussed.
Thanks,
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux