* [PATCH v2 0/2] few small change for gpio-vf610
@ 2024-08-01 9:30 haibo.chen
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: haibo.chen @ 2024-08-01 9:30 UTC (permalink / raw)
To: linus.walleij, brgl; +Cc: wahrenst, linux-gpio, linux-kernel, imx, haibo.chen
From: Haibo Chen <haibo.chen@nxp.com>
V2:
-add PATCH 1 to use u32 instead of unsigned long, to handle 32 pins
-only one difference from V1, use u32 mask instead unsigned long.
Haibo Chen (2):
gpio: gpio-vf610: use u32 mask to handle 32 number gpios
gpio: vf610: add get_direction() support
drivers/gpio/gpio-vf610.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios
2024-08-01 9:30 [PATCH v2 0/2] few small change for gpio-vf610 haibo.chen
@ 2024-08-01 9:30 ` haibo.chen
2024-08-02 13:22 ` Stefan Wahren
2024-08-05 4:38 ` Stefan Wahren
2024-08-01 9:30 ` [PATCH v2 2/2] gpio: vf610: add get_direction() support haibo.chen
2024-08-05 9:51 ` [PATCH v2 0/2] few small change for gpio-vf610 Bartosz Golaszewski
2 siblings, 2 replies; 8+ messages in thread
From: haibo.chen @ 2024-08-01 9:30 UTC (permalink / raw)
To: linus.walleij, brgl; +Cc: wahrenst, linux-gpio, linux-kernel, imx, haibo.chen
From: Haibo Chen <haibo.chen@nxp.com>
This gpio controller support up to 32 pins per port. And all the
register width is 32 bit. So here use u32 to replace the original
unsigned long.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/gpio/gpio-vf610.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 07e5e6323e86..db68d8541597 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -97,7 +97,7 @@ static inline u32 vf610_gpio_readl(void __iomem *reg)
static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio)
{
struct vf610_gpio_port *port = gpiochip_get_data(gc);
- unsigned long mask = BIT(gpio);
+ u32 mask = BIT(gpio);
unsigned long offset = GPIO_PDIR;
if (port->sdata->have_paddr) {
@@ -112,16 +112,16 @@ static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio)
static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
{
struct vf610_gpio_port *port = gpiochip_get_data(gc);
- unsigned long mask = BIT(gpio);
+ u32 mask = BIT(gpio);
unsigned long offset = val ? GPIO_PSOR : GPIO_PCOR;
vf610_gpio_writel(mask, port->gpio_base + offset);
}
-static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
+static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
{
struct vf610_gpio_port *port = gpiochip_get_data(chip);
- unsigned long mask = BIT(gpio);
+ u32 mask = BIT(gpio);
u32 val;
if (port->sdata->have_paddr) {
@@ -133,11 +133,11 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
return pinctrl_gpio_direction_input(chip, gpio);
}
-static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
+static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
int value)
{
struct vf610_gpio_port *port = gpiochip_get_data(chip);
- unsigned long mask = BIT(gpio);
+ u32 mask = BIT(gpio);
u32 val;
vf610_gpio_set(chip, gpio, value);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] gpio: vf610: add get_direction() support
2024-08-01 9:30 [PATCH v2 0/2] few small change for gpio-vf610 haibo.chen
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
@ 2024-08-01 9:30 ` haibo.chen
2024-08-02 13:22 ` Stefan Wahren
2024-08-05 9:51 ` [PATCH v2 0/2] few small change for gpio-vf610 Bartosz Golaszewski
2 siblings, 1 reply; 8+ messages in thread
From: haibo.chen @ 2024-08-01 9:30 UTC (permalink / raw)
To: linus.walleij, brgl; +Cc: wahrenst, linux-gpio, linux-kernel, imx, haibo.chen
From: Haibo Chen <haibo.chen@nxp.com>
For IP which do not contain PDDR, currently use the pinmux API
pinctrl_gpio_direction_input() to config the output/input, pinmux
currently do not support get_direction(). So here add the GPIO
get_direction() support only for the IP which has Port Data
Direction Register (PDDR).
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/gpio/gpio-vf610.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index db68d8541597..27eff741fe9a 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -151,6 +151,19 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio
return pinctrl_gpio_direction_output(chip, gpio);
}
+static int vf610_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
+{
+ struct vf610_gpio_port *port = gpiochip_get_data(gc);
+ u32 mask = BIT(gpio);
+
+ mask &= vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
+
+ if (mask)
+ return GPIO_LINE_DIRECTION_OUT;
+
+ return GPIO_LINE_DIRECTION_IN;
+}
+
static void vf610_gpio_irq_handler(struct irq_desc *desc)
{
struct vf610_gpio_port *port =
@@ -362,6 +375,12 @@ static int vf610_gpio_probe(struct platform_device *pdev)
gc->get = vf610_gpio_get;
gc->direction_output = vf610_gpio_direction_output;
gc->set = vf610_gpio_set;
+ /*
+ * only IP has Port Data Direction Register(PDDR) can
+ * support get direction
+ */
+ if (port->sdata->have_paddr)
+ gc->get_direction = vf610_gpio_get_direction;
/* Mask all GPIO interrupts */
for (i = 0; i < gc->ngpio; i++)
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] gpio: vf610: add get_direction() support
2024-08-01 9:30 ` [PATCH v2 2/2] gpio: vf610: add get_direction() support haibo.chen
@ 2024-08-02 13:22 ` Stefan Wahren
2024-08-05 2:08 ` Bough Chen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Wahren @ 2024-08-02 13:22 UTC (permalink / raw)
To: haibo.chen, linus.walleij, brgl; +Cc: linux-gpio, linux-kernel, imx
Hi Haibo,
Am 01.08.24 um 11:30 schrieb haibo.chen@nxp.com:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> For IP which do not contain PDDR, currently use the pinmux API
> pinctrl_gpio_direction_input() to config the output/input, pinmux
> currently do not support get_direction(). So here add the GPIO
> get_direction() support only for the IP which has Port Data
> Direction Register (PDDR).
just a question about how things work:
fsl,imx7ulp-gpio and i.MX93 have PDDR, so GPIO get_direction is handled
in gpio-vf610 driver
fsl,vf610-gpio doesn't have PDDR, so all GPIO direction stuff is handled
in pinctrl-vf610 driver
Is this correct?
Best regards
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
@ 2024-08-02 13:22 ` Stefan Wahren
2024-08-05 4:38 ` Stefan Wahren
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Wahren @ 2024-08-02 13:22 UTC (permalink / raw)
To: haibo.chen, linus.walleij, brgl; +Cc: linux-gpio, linux-kernel, imx
Am 01.08.24 um 11:30 schrieb haibo.chen@nxp.com:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> This gpio controller support up to 32 pins per port. And all the
> register width is 32 bit. So here use u32 to replace the original
> unsigned long.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2 2/2] gpio: vf610: add get_direction() support
2024-08-02 13:22 ` Stefan Wahren
@ 2024-08-05 2:08 ` Bough Chen
0 siblings, 0 replies; 8+ messages in thread
From: Bough Chen @ 2024-08-05 2:08 UTC (permalink / raw)
To: Stefan Wahren, linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Stefan Wahren <wahrenst@gmx.net>
> Sent: 2024年8月2日 21:22
> To: Bough Chen <haibo.chen@nxp.com>; linus.walleij@linaro.org;
> brgl@bgdev.pl
> Cc: linux-gpio@vger.kernel.org; linux-kernel@vger.kernel.org;
> imx@lists.linux.dev
> Subject: Re: [PATCH v2 2/2] gpio: vf610: add get_direction() support
>
> Hi Haibo,
>
> Am 01.08.24 um 11:30 schrieb haibo.chen@nxp.com:
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > For IP which do not contain PDDR, currently use the pinmux API
> > pinctrl_gpio_direction_input() to config the output/input, pinmux
> > currently do not support get_direction(). So here add the GPIO
> > get_direction() support only for the IP which has Port Data Direction
> > Register (PDDR).
> just a question about how things work:
>
> fsl,imx7ulp-gpio and i.MX93 have PDDR, so GPIO get_direction is handled in
> gpio-vf610 driver fsl,vf610-gpio doesn't have PDDR, so all GPIO direction stuff is
> handled in pinctrl-vf610 driver
>
> Is this correct?
Yes, correct. vf610_pmx_gpio_set_direction() did that.
Best Regards
Haibo Chen
>
> Best regards
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
2024-08-02 13:22 ` Stefan Wahren
@ 2024-08-05 4:38 ` Stefan Wahren
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Wahren @ 2024-08-05 4:38 UTC (permalink / raw)
To: haibo.chen, linus.walleij, brgl; +Cc: linux-gpio, linux-kernel, imx
Am 01.08.24 um 11:30 schrieb haibo.chen@nxp.com:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> This gpio controller support up to 32 pins per port. And all the
> register width is 32 bit. So here use u32 to replace the original
> unsigned long.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] few small change for gpio-vf610
2024-08-01 9:30 [PATCH v2 0/2] few small change for gpio-vf610 haibo.chen
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
2024-08-01 9:30 ` [PATCH v2 2/2] gpio: vf610: add get_direction() support haibo.chen
@ 2024-08-05 9:51 ` Bartosz Golaszewski
2 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2024-08-05 9:51 UTC (permalink / raw)
To: linus.walleij, brgl, haibo.chen
Cc: Bartosz Golaszewski, wahrenst, linux-gpio, linux-kernel, imx
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Thu, 01 Aug 2024 17:30:26 +0800, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> V2:
> -add PATCH 1 to use u32 instead of unsigned long, to handle 32 pins
> -only one difference from V1, use u32 mask instead unsigned long.
>
> Haibo Chen (2):
> gpio: gpio-vf610: use u32 mask to handle 32 number gpios
> gpio: vf610: add get_direction() support
>
> [...]
Applied, thanks!
[1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios
commit: 3e7ebf271f935a316e9593d63f495498cde22f80
[2/2] gpio: vf610: add get_direction() support
commit: 26b95b7b588d70b5075b597ff808543503d36ac6
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-08-05 9:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-01 9:30 [PATCH v2 0/2] few small change for gpio-vf610 haibo.chen
2024-08-01 9:30 ` [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios haibo.chen
2024-08-02 13:22 ` Stefan Wahren
2024-08-05 4:38 ` Stefan Wahren
2024-08-01 9:30 ` [PATCH v2 2/2] gpio: vf610: add get_direction() support haibo.chen
2024-08-02 13:22 ` Stefan Wahren
2024-08-05 2:08 ` Bough Chen
2024-08-05 9:51 ` [PATCH v2 0/2] few small change for gpio-vf610 Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox