gpio: rgpio2p: Enhance reading of GPIO pin value
Subsystems (2)
PATCH RESEND 1/1 gpio: rgpio2p: Enhance reading of GPIO pin value
Add support for reading GPIO pin value when function is output. With this patch applied, gpio toggle command is working.
--- drivers/gpio/imx_rgpio2p.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpio/imx_rgpio2p.c +13 -1
@@ -39,6 +39,14 @@ static int imx_rgpio2p_is_output(struct gpio_regs *regs, int offset)return val & (1 << offset) ?1 :0 ; } +static int imx_rgpio2p_bank_get_direction (struct gpio_regs *regs,int offset) +{ +if ((readl (®s->gpio_pddr) >> offset) &0x01 ) +return IMX_RGPIO2P_DIRECTION_OUT ; + +return IMX_RGPIO2P_DIRECTION_IN ; +} +static void imx_rgpio2p_bank_direction (struct gpio_regs *regs,int offset,enum imx_rgpio2p_direction direction) {
@@ -67,7 +75,11 @@ static void imx_rgpio2p_bank_set_value(struct gpio_regs *regs, int offset,static int imx_rgpio2p_bank_get_value (struct gpio_regs *regs,int offset) { -return (readl (®s->gpio_pdir) >> offset) &0x01 ; +if (imx_rgpio2p_bank_get_direction (regs, offset) == +IMX_RGPIO2P_DIRECTION_IN ) +return (readl (®s->gpio_pdir) >> offset) &0x01 ; + +return (readl (®s->gpio_pdor) >> offset) &0x01 ; }static int imx_rgpio2p_direction_input (struct udevice *dev,unsigned offset)
Signature · 1 line
2.30.2
Hello Stefano,
could you please pick up this patch?
bye
-- Christoph
Quoted 49 lines · Christoph Fritz
Add support for reading GPIO pin value when function is output. With this patch applied, gpio toggle command is working.
Signed-off-by Christoph Fritz <[email protected]>Reviewed-by Peng Fan <[email protected]>Reviewed-by Fabio Estevam <[email protected]>---
drivers/gpio/imx_rgpio2p.c | 14 +++++++++++++-1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpio/imx_rgpio2p.c +0
-0@@ -39,6 +39,14 @@ static int imx_rgpio2p_is_output(struct gpio_regs *regs, int offset) return val & (1 << offset) ? 1 : 0; }
+static intimx_rgpio2p_bank_get_direction(struct gpio_regs *regs, int offset)drivers/gpio/imx_rgpio2p.c +7
-0+{ + if ((readl(®s->gpio_pddr) >> offset) & 0x01) + return IMX_RGPIO2P_DIRECTION_OUT; + + return IMX_RGPIO2P_DIRECTION_IN; +} +static void imx_rgpio2p_bank_direction(struct
gpio_regs*regs, int offset,
enumimx_rgpio2p_directiondirection)
{drivers/gpio/imx_rgpio2p.c +0
-0@@ -67,7 +75,11 @@ static void imx_rgpio2p_bank_set_value(struct gpio_regs *regs, int offset,
static intimx_rgpio2p_bank_get_value(struct gpio_regs *regs, int offset)
{
- return (readl(®s->gpio_pdir)>> offset) &0x01; + if (imx_rgpio2p_bank_get_direction(regs, offset)== +IMX_RGPIO2P_DIRECTION_IN)
+ return (readl(®s->gpio_pdir)>> offset) &0x01; +
+ return (readl(®s->gpio_pdor)>> offset) &0x01; }
static intimx_rgpio2p_direction_input(struct udevice *dev, unsigned offset)
*ping*
Quoted 58 lines · Christoph Fritz
Hello Stefano,
could you please pick up this patch?
bye
-- ChristophQuoted 49 lines · Christoph Fritz
Add support for reading GPIO pin value when function is output. With this patch applied, gpio toggle command is working.
Signed-off-by Christoph Fritz <[email protected]>Reviewed-by Peng Fan <[email protected]>Reviewed-by Fabio Estevam <[email protected]>---
drivers/gpio/imx_rgpio2p.c | 14 +++++++++++++-1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpio/imx_rgpio2p.c +0
-0@@ -39,6 +39,14 @@ static int imx_rgpio2p_is_output(struct gpio_regs *regs, int offset) return val & (1 << offset) ? 1 : 0; }
+static intimx_rgpio2p_bank_get_direction(struct gpio_regs *regs, int offset)drivers/gpio/imx_rgpio2p.c +7
-0+{ + if ((readl(®s->gpio_pddr) >> offset) & 0x01) + return IMX_RGPIO2P_DIRECTION_OUT; + + return IMX_RGPIO2P_DIRECTION_IN; +} +static void imx_rgpio2p_bank_direction(struct
gpio_regs*regs, int offset,
enumimx_rgpio2p_directiondirection)
{drivers/gpio/imx_rgpio2p.c +0
-0@@ -67,7 +75,11 @@ static void imx_rgpio2p_bank_set_value(struct gpio_regs *regs, int offset,
static intimx_rgpio2p_bank_get_value(struct gpio_regs *regs, int offset)
{
- return (readl(®s->gpio_pdir)>> offset) &0x01; + if (imx_rgpio2p_bank_get_direction(regs, offset)== +IMX_RGPIO2P_DIRECTION_IN)
+ return (readl(®s->gpio_pdir)>> offset) &0x01; +
+ return (readl(®s->gpio_pdor)>> offset) &0x01; }
static intimx_rgpio2p_direction_input(struct udevice *dev, unsigned offset)
Quoted 62 lines · Christoph Fritz
*ping*
Quoted 58 lines · Christoph Fritz
Hello Stefano,
could you please pick up this patch?
bye
-- ChristophQuoted 49 lines · Christoph Fritz
Add support for reading GPIO pin value when function is output. With this patch applied, gpio toggle command is working.
Signed-off-by Christoph Fritz <[email protected]>Reviewed-by Peng Fan <[email protected]>Reviewed-by Fabio Estevam <[email protected]>--- drivers/gpio/imx_rgpio2p.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpio/imx_rgpio2p.c +8
-0@@ -39,6 +39,14 @@ static int imx_rgpio2p_is_output(struct gpio_regs *regs, int offset) return val & (1 << offset) ? 1 : 0; } +static int imx_rgpio2p_bank_get_direction (struct gpio_regs *regs,int offset) +{ + if ((readl(®s->gpio_pddr) >> offset) & 0x01) + return IMX_RGPIO2P_DIRECTION_OUT; + + return IMX_RGPIO2P_DIRECTION_IN; +} + static void imx_rgpio2p_bank_direction(struct gpio_regs *regs, intoffset,
enumimx_rgpio2p_direction
direction)
{drivers/gpio/imx_rgpio2p.c +5
-1@@ -67,7 +75,11 @@ static void imx_rgpio2p_bank_set_value(struct gpio_regs *regs, int offset, static int imx_rgpio2p_bank_get_value(struct gpio_regs *regs, int offset) { - return (readl(®s->gpio_pdir) >> offset) & 0x01; + if (imx_rgpio2p_bank_get_direction(regs, offset) == + IMX_RGPIO2P_DIRECTION_IN) + return (readl(®s->gpio_pdir) >> offset) & 0x01; + + return (readl(®s->gpio_pdor) >> offset) & 0x01; }static int imx_rgpio2p_direction_input(struct udevice *dev,
unsigned offset)
Picked up, it will go in next MR
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================