Add support for Cherryview GPIO
cover Add support for Cherryview GPIO
1. introduce helper to find array of gpiochips
2. Add support for Cherryview GPIO controller based on helper 1.
I already validated them on Rock PI X board.
hongzha1 (2):
drivers/gpio: core: introduce helper to find array of gpiochips driver/gpio: cherryview: introduce gpio driver for pinctl Cherryview
include/cobalt/kernel/rtdm/gpio.h | 4 +++ kernel/drivers/gpio/Kconfig | 7 +++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-cherryview.c | 43 +++++++++++++++++++++++++++ kernel/drivers/gpio/gpio-core.c | 19 ++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
Signature · 1 line
2.17.1
PATCH 1/2 drivers/gpio: core: introduce helper to find array of gpiochips
To find array of gpiochips for non-OF platform
--- include/cobalt/kernel/rtdm/gpio.h | 4 ++++ kernel/drivers/gpio/gpio-core.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)
include/cobalt/kernel/rtdm/gpio.h +4 -0
@@ -64,6 +64,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,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 +19 -0
@@ -543,6 +543,25 @@ int rtdm_gpiochip_find(struct device_node *from, const char *label, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +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 · 1 line
2.17.1
Re: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 38 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 4 ++++ kernel/drivers/gpio/gpio-core.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)include/cobalt/kernel/rtdm/gpio.h +4
-0@@ -64,6 +64,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,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 +7
-0@@ -543,6 +543,25 @@ int rtdm_gpiochip_find(struct device_node *from, const char *label, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type) +{ +int ret = -ENODEV , _ret, n; + +for (n =0 ; n < nentries; n++) {
kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_find(struct device_node *from, const char *label, · line 562
Quoted 10 lines
kernel/drivers/gpio/gpio-core.c +10
-0+ _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +}
I'm not sure if I completely understand the code, but maybe it could be simplified to:
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
}
return ret;
}Quoted 6 lines
kernel/drivers/gpio/gpio-core.c +2
-0+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: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 53 lines · Florian Bezdeka via Xenomai
Quoted 38 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 4 ++++ kernel/drivers/gpio/gpio-core.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)include/cobalt/kernel/rtdm/gpio.h +4
-0@@ -64,6 +64,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,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 +7
-0@@ -543,6 +543,25 @@ int rtdm_gpiochip_find(struct device_node *from, const char *label, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type) +{ +int ret = -ENODEV , _ret, n; + +for (n =0 ; n < nentries; n++) {kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_find(struct device_node *from, const char *label, · line 562
Quoted 10 lines
kernel/drivers/gpio/gpio-core.c +10
-0+ _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +}I'm not sure if I completely understand the code, but maybe it could be simplified to:
Quoted 12 lines
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
}
return ret;
}v2:
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
// Should we stop on first -ENODEV?
if (ret && ret == -ENODEV)
ret = 0;
}
return ret;
}Quoted 9 lines
Quoted 7 lines
kernel/drivers/gpio/gpio-core.c +2
-0+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: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 76 lines
-----Original Message-----
From: Florian Bezdeka <[email protected]>
Sent: Friday, May 14, 2021 5:11 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [for-upstream/dovetail 1/2]drivers/gpio: core: introduce helper to find array of gpiochipsQuoted 53 lines · Florian Bezdeka via Xenomai
Quoted 38 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 4 ++++ kernel/drivers/gpio/gpio-core.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)include/cobalt/kernel/rtdm/gpio.h +4
-0@@ -64,6 +64,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,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 +7
-0@@ -543,6 +543,25 @@ int rtdm_gpiochip_find(struct device_node *from, const char *label, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type) +{ +int ret = -ENODEV , _ret, n; + +for (n =0 ; n < nentries; n++) {kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_find(struct device_node *from, const char *label, · line 562
Quoted 10 lines
kernel/drivers/gpio/gpio-core.c +10
-0+ _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +}I'm not sure if I completely understand the code, but maybe it could be simplified to:
Quoted 4 lines
{ int ret, n; for (n = 0; n < nentries; n++) {ret = rtdm_gpiochip_find(from, compat[n], type); if (ret && ret != -ENODEV) break; } return ret; }v2:
Quoted 12 lines
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
// Should we stop on first -ENODEV?
if (ret && ret == -ENODEV)
ret = 0;Thanks for your advices.
The code actually is referring to rtdm_gpiochip_scan_array_of function totally but we have to implement helper for Non-of platform to find gpiochip with scanning whole array.
Regards
Hongzhan Chen
Quoted 5 lines
} return ret; }Quoted 1 line
Quoted 13 lines
Quoted 8 lines
Quoted 6 lines
kernel/drivers/gpio/gpio-core.c +2
-0+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
-----Original Message-----
From: Florian Bezdeka <[email protected]>
Sent: Friday, May 14, 2021 5:11 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 53 lines · Florian Bezdeka via Xenomai
Quoted 38 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>--- include/cobalt/kernel/rtdm/gpio.h | 4 ++++ kernel/drivers/gpio/gpio-core.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)include/cobalt/kernel/rtdm/gpio.h +4
-0@@ -64,6 +64,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,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 +7
-0@@ -543,6 +543,25 @@ int rtdm_gpiochip_find(struct device_node *from, const char *label, }EXPORT_SYMBOL_GPL (rtdm_gpiochip_find); +int rtdm_gpiochip_array_find (struct device_node *from, +const char *compat[], +int nentries,int type) +{ +int ret = -ENODEV , _ret, n; + +for (n =0 ; n < nentries; n++) {kernel/drivers/gpio/gpio-core.c int rtdm_gpiochip_find(struct device_node *from, const char *label, · line 562
Quoted 10 lines
kernel/drivers/gpio/gpio-core.c +10
-0+ _ret =rtdm_gpiochip_find (from, compat[n], type); +if (_ret) { +if (_ret != -ENODEV ) +return _ret; + }else + ret =0 ; + } + +return ret; +}I'm not sure if I completely understand the code, but maybe it could be simplified to:
Quoted 12 lines
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
}
return ret;
}v2:
{
int ret, n;
for (n = 0; n < nentries; n++) {
ret = rtdm_gpiochip_find(from, compat[n], type);
if (ret && ret != -ENODEV)
break;
// Should we stop on first -ENODEV?
if (ret && ret == -ENODEV)
ret = 0;
}
return ret;
}Quoted 9 lines
Quoted 7 lines
kernel/drivers/gpio/gpio-core.c +2
-0+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: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
In reply to hongzha1Quoted 3 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>
Just noticed that all your patches carry your user name in the signed-off. You should fix that. Is this correct?
Also, please make sure that patches carry the extra "From: your name <your@email>" at the top of the commit message. This list server has to mangle the sender, and that means the author on git can become something like "hongzha1 via Xenomai <[email protected]>". You can trigger this injection by providing a dummy address via --from when calling git format-patch.
Thanks,
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 17 lines · Jan Kiszka
Quoted 3 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>Just noticed that all your patches carry your user name in the signed-off. You should fix that. Is this correct?
Signed-off-by Hongzhan Chen <[email protected]>Also, please make sure that patches carry the extra "From: your name <your@email>" at the top of the commit message. This list server has to mangle the sender, and that means the author on git can become something like "hongzha1 via Xenomai <[email protected]>". You can trigger this injection by providing a dummy address via --from when calling git format-patch.
Quoted 3 lines
Thanks,
Jan
Just to clarify: No action need for anything in wip/dovetail if my spelling above is correct - just adjusted all your patches there accordingly.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
RE: [for-upstream/dovetail 1/2] drivers/gpio: core: introduce helper to find array of gpiochips
Quoted 26 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, May 19, 2021 5:44 AM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [for-upstream/dovetail 1/2]drivers/gpio: core: introduce helper to find array of gpiochipsQuoted 17 lines · Jan Kiszka
Quoted 3 lines · On 13.05.21 03:02, hongzha1 via Xenomai wrote:
To find array of gpiochips for non-OF platform
Signed-off-by hongzha1 <[email protected]>Just noticed that all your patches carry your user name in the signed-off. You should fix that. Is this correct?
Signed-off-by Hongzhan Chen <[email protected]>Also, please make sure that patches carry the extra "From: your name <your@email>" at the top of the commit message. This list server has to mangle the sender, and that means the author on git can become something like "hongzha1 via Xenomai <[email protected]>". You can trigger this injection by providing a dummy address via --from when calling git format-patch.
Quoted 7 lines
Quoted 3 lines
Thanks,
JanJust to clarify: No action need for anything in wip/dovetail if my spelling above is correct - just adjusted all your patches there accordingly.
Thanks for your kind of reminding and adjustment. Spelling is correct.
Regards
Hongzhan Chen
Quoted 8 lines
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
PATCH 2/2 driver/gpio: cherryview: introduce gpio driver for pinctl Cherryview
In reply to hongzha1Add support for Intel Cherryview pin controller driver
--- kernel/drivers/gpio/Kconfig | 7 +++++ kernel/drivers/gpio/Makefile | 2 ++ kernel/drivers/gpio/gpio-cherryview.c | 43 +++++++++++++++++++++++++++ 3 files changed, 52 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 +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.17.1