double requested gpio problem
Subsystems (2)
PATCH 1/1 double requested gpio problem
Hi,
I have seen that our phy_reset pin is not correctly configured because the gpiopin information is requested more than one time. I get this as error message. (My board is the eDM-QMX6 from Data-Modul)
gpiolib: _gpio_request: gpio-25 (phy-reset) status -16
Because gpiolib is used so many times, I don't know if this is a correct solution for my problem.
Can someone check this patch and give me some comments?
Thx,
Silvio
Silvio Fricke (1):
gpiolib: gpio_request: correct return code of a already requested gpio
drivers/gpio/gpiolib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/1 gpiolib: gpio_request: correct return code of a already requested gpio
--- drivers/gpio/gpiolib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpiolib.c +2 -4
@@ -55,10 +55,8 @@ int gpio_request(unsigned gpio, const char *label) goto done; } -if (gi->requested) { - ret = -EBUSY ; - goto done; - } +if (gi->requested) +return 0 ; ret =0 ;
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/1 gpio phy-reset problem
Hi,
okay - I have found the problem: Silvio - know YOUR BOARDS code! :-)
Sasha: Please ignore the first patch, and add this to your repo.
Thx,
Silvio
Silvio Fricke (1):
ARM: i.MX: edmqmx6: free phy-reset gpio pin
arch/arm/boards/datamodul-edm-qmx6/board.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/1 ARM: i.MX: edmqmx6: free phy-reset gpio pin
Since 93a6c6a808("dts: update to v3.17-rc2") we have a correct gpio configuration. This results in a double gpio request what receipted in a error message like this one:
gpiolib: _gpio_request: gpio-25 (phy-reset) status -16
Now with this patch the problem is gone.
--- arch/arm/boards/datamodul-edm-qmx6/board.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/boards/datamodul-edm-qmx6/board.c +6 -2
@@ -49,6 +49,7 @@#define RQ7_GPIO_ENET_MODE2 IMX_GPIO_NR(6, 28)#define RQ7_GPIO_ENET_MODE3 IMX_GPIO_NR(6, 29)#define RQ7_GPIO_ENET_EN_CLK125 IMX_GPIO_NR(6, 24) +#define RQ7_GPIO_ENET_RESET IMX_GPIO_NR(1, 25)static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RXC__GPIO_6_30 ,
@@ -57,6 +58,7 @@ static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RD2__GPIO_6_28 ,MX6Q_PAD_RGMII_RD3__GPIO_6_29 ,MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24 , + MX6Q_PAD_ENET_CRS_DV__GPIO_1_25, };static int ksz9031rn_phy_fixup (struct phy_device *dev)
@@ -85,12 +87,14 @@ static int realq7_enet_init(void)gpio_direction_output (RQ7_GPIO_ENET_MODE3 ,1 );gpio_direction_output (RQ7_GPIO_ENET_EN_CLK125 ,1 ); -gpio_direction_output (25 ,0 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,0 );mdelay (50 ); -gpio_direction_output (25 ,1 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,1 );mdelay (50 ); +gpio_free (RQ7_GPIO_ENET_RESET ); +phy_register_fixup_for_uid (PHY_ID_KSZ9031 ,MICREL_PHY_ID_MASK , ksz9031rn_phy_fixup);
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] ARM: i.MX: edmqmx6: free phy-reset gpio pin
Hi Silvio,
Quoted 39 lines · Silvio Fricke
Since 93a6c6a808("dts: update to v3.17-rc2") we have a correct gpio configuration. This results in a double gpio request what receipted in a error message like this one:
gpiolib:
_gpio_request: gpio-25 (phy-reset) status -16Now with this patch the problem is gone.
Signed-off-by Silvio Fricke <[email protected]>--- arch/arm/boards/datamodul-edm-qmx6/board.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/boards/datamodul-edm-qmx6/board.c +3
-1@@ -49,6 +49,7 @@#define RQ7_GPIO_ENET_MODE2 IMX_GPIO_NR(6, 28)#define RQ7_GPIO_ENET_MODE3 IMX_GPIO_NR(6, 29)#define RQ7_GPIO_ENET_EN_CLK125 IMX_GPIO_NR(6, 24) +#define RQ7_GPIO_ENET_RESET IMX_GPIO_NR(1, 25)static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RXC__GPIO_6_30 ,@@ -57,6 +58,7 @@ static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RD2__GPIO_6_28 ,MX6Q_PAD_RGMII_RD3__GPIO_6_29 ,MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24 , + MX6Q_PAD_ENET_CRS_DV__GPIO_1_25, };static int ksz9031rn_phy_fixup (struct phy_device *dev)@@ -85,12 +87,14 @@ static int realq7_enet_init(void)gpio_direction_output (RQ7_GPIO_ENET_MODE3 ,1 );gpio_direction_output (RQ7_GPIO_ENET_EN_CLK125 ,1 ); -gpio_direction_output (25 ,0 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,0 );
arch/arm/boards/datamodul-edm-qmx6/board.c static int realq7_enet_init(void) · line 99
Quoted 10 lines
arch/arm/boards/datamodul-edm-qmx6/board.c +3
-1mdelay (50 ); -gpio_direction_output (25 ,1 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,1 );mdelay (50 ); +gpio_free (RQ7_GPIO_ENET_RESET ); +phy_register_fixup_for_uid (PHY_ID_KSZ9031 ,MICREL_PHY_ID_MASK , ksz9031rn_phy_fixup);
I'm not sure this fully works as expected. Here the code configures the ethernet pins as gpios with defined output states and resets the phy afterwards. This makes sure the phy bootstrap pins are configured correctly during phy reset.
Now the driver core sets up the ethernet pins to their functional mode and the fec driver resets the phy again with some undefined states. IMO this phy-reset-gpio property really stinks. Not that it's in the wrong place (should be in a phy node, not the ethernet node), it also destroys all careful phy setup done earlier.
I don't know a good way out of this situation, but it seems we should create a way to reset the phy either properly or not at all.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] ARM: i.MX: edmqmx6: free phy-reset gpio pin
Wed, 17 Sep 2014 09:11:37 +0200 от Sascha Hauer <[email protected]>:
Quoted 10 lines
Hi Silvio,
Quoted 7 lines · Silvio Fricke
Since 93a6c6a808("dts: update to v3.17-rc2") we have a correct gpio configuration. This results in a double gpio request what receipted in a error message like this one:
gpiolib:
_gpio_request: gpio-25 (phy-reset) status -16Now with this patch the problem is gone.
Funny, at this time I trying to resolve a similar problem with the BUSY state for GPIO, but in 3.16 kernel...
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedRe: [PATCH] ARM: i.MX: edmqmx6: free phy-reset gpio pin
In reply to Silvio FrickeQuoted 9 lines · Silvio Fricke
Since 93a6c6a808("dts: update to v3.17-rc2") we have a correct gpio configuration. This results in a double gpio request what receipted in a error message like this one:
gpiolib:
_gpio_request: gpio-25 (phy-reset) status -16Now with this patch the problem is gone.
Signed-off-by Silvio Fricke <[email protected]>
Applied, thanks
Sascha
Quoted 45 lines
--- arch/arm/boards/datamodul-edm-qmx6/board.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/boards/datamodul-edm-qmx6/board.c +6
-2@@ -49,6 +49,7 @@#define RQ7_GPIO_ENET_MODE2 IMX_GPIO_NR(6, 28)#define RQ7_GPIO_ENET_MODE3 IMX_GPIO_NR(6, 29)#define RQ7_GPIO_ENET_EN_CLK125 IMX_GPIO_NR(6, 24) +#define RQ7_GPIO_ENET_RESET IMX_GPIO_NR(1, 25)static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RXC__GPIO_6_30 ,@@ -57,6 +58,7 @@ static iomux_v3_cfg_t realq7_pads_gpio[] = {MX6Q_PAD_RGMII_RD2__GPIO_6_28 ,MX6Q_PAD_RGMII_RD3__GPIO_6_29 ,MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24 , + MX6Q_PAD_ENET_CRS_DV__GPIO_1_25, };static int ksz9031rn_phy_fixup (struct phy_device *dev)@@ -85,12 +87,14 @@ static int realq7_enet_init(void)gpio_direction_output (RQ7_GPIO_ENET_MODE3 ,1 );gpio_direction_output (RQ7_GPIO_ENET_EN_CLK125 ,1 ); -gpio_direction_output (25 ,0 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,0 );mdelay (50 ); -gpio_direction_output (25 ,1 ); +gpio_direction_output (RQ7_GPIO_ENET_RESET ,1 );mdelay (50 ); +gpio_free (RQ7_GPIO_ENET_RESET ); +phy_register_fixup_for_uid (PHY_ID_KSZ9031 ,MICREL_PHY_ID_MASK , ksz9031rn_phy_fixup);Signature · 1 line
2.1.0
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox