Skip to contentSkip to conversation

net: gmac_rockchip: Add support for pinctrl

PATCH New Romain Perier 3 participants 6 messages Jul 3, 2017 – Jul 11, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

This commits toggles the pinctrl on the right node from the probe function of the driver.

---
 drivers/net/gmac_rockchip.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/gmac_rockchip.c +4 -0
index 5e2ca76302..8581026b4a 100644
@@ -160,6 +160,10 @@ static int gmac_rockchip_probe(struct udevice *dev)
 	struct clk clk;
 	int ret;
 
+	ret = pinctrl_select_state(dev, "simple");
+	if (ret)
+		return ret;
+
 	ret = clk_get_by_index(dev, 0, &clk);
 	if (ret)
 		return ret;
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

+Philipp

Hi Romain,

Quoted 8 lines · Romain Perier

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

This commits toggles the pinctrl on the right node from the probe function of the driver.

Is it possible to fix this while still using driver-model automatic pinctrl?

Quoted 22 lines
---
 drivers/net/gmac_rockchip.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/gmac_rockchip.c +4 -1
index 5e2ca76302..8581026b4a 100644
@@ -160,6 +160,10 @@ static int gmac_rockchip_probe(struct udevice *dev)
        struct clk clk;
        int ret;
 
+       ret = pinctrl_select_state(dev, "simple");
+       if (ret)
+               return ret;
+
        ret = clk_get_by_index(dev, 0, &clk);
        if (ret)
                return ret;
--
Quoted 2 lines

2.11.0

Regards,
Simon

#2 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

Quoted 11 lines · Simon Glass

+Philipp

Hi Romain,

Quoted 6 lines · Romain Perier

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

Quoted 3 lines
Quoted 2 lines

This commits toggles the pinctrl on the right node from the probe function of the driver.

Is it possible to fix this while still using driver-model automatic pinctrl?

This is what I have tried to do, without success. The purpose of this patch is also to discuss about the possible solutions we have.

Regards,
Romain

Quoted 26 lines
Quoted 22 lines
---
 drivers/net/gmac_rockchip.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/gmac_rockchip.c +4 -1
index 5e2ca76302..8581026b4a 100644
@@ -160,6 +160,10 @@ static int gmac_rockchip_probe(struct udevice *dev)
        struct clk clk;
        int ret;
 
+       ret = pinctrl_select_state(dev, "simple");
+       if (ret)
+               return ret;
+
        ret = clk_get_by_index(dev, 0, &clk);
        if (ret)
                return ret;
--
Quoted 2 lines

2.11.0

Regards,
Simon

#3 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

Quoted 21 lines · Romain Perier
Quoted 11 lines · Simon Glass

+Philipp

Hi Romain,

Quoted 6 lines · Romain Perier

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

Quoted 3 lines
Quoted 2 lines

This commits toggles the pinctrl on the right node from the probe function of the driver.

Is it possible to fix this while still using driver-model automatic pinctrl?

This is what I have tried to do, without success. The purpose of this patch is also to discuss about the possible solutions we have.

#5 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

In reply to Simon Glass
Quoted 14 lines · Simon Glass

+Philipp

Hi Romain,

Quoted 6 lines · Romain Perier

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

Quoted 4 lines
Quoted 2 lines

This commits toggles the pinctrl on the right node from the probe function of the driver.

Is it possible to fix this while still using driver-model automatic pinctrl?

I agree that we need to get a handle on the underlying issue and solve that instead of putting a band-aid on.

Quoted 26 lines
Quoted 21 lines

---
drivers/net/gmac_rockchip.c | 4 ++++

1 file changed, 4 insertions(+)
drivers/net/gmac_rockchip.c +4 -1
index 5e2ca76302..8581026b4a 100644
@@ -160,6 +160,10 @@ static int gmac_rockchip_probe(struct udevice *dev)
       struct clk clk;
       int ret;
 
+       ret = pinctrl_select_state(dev, "simple");
+       if (ret)
+               return ret;
+
       ret = clk_get_by_index(dev, 0, &clk);
       if (ret)
               return ret;
--
Quoted 2 lines

2.11.0

Regards,
Simon

#4 lore raw

PATCH 1/1 net: gmac_rockchip: Add support for pinctrl

In reply to Dr. Philipp Tomsich

Hello,

Quoted 19 lines · Dr. Philipp Tomsich
Quoted 14 lines · Romain Perier
Quoted 11 lines · Simon Glass

+Philipp

Hi Romain,

Quoted 6 lines · Romain Perier

Currently, selecting state simple is done by the device driver model, prior probing the driver. The problem is that it's done and called on the pinctrl node with "gmac" as the "periph" struct udevice *. So pinctrl-rk3288 is looking for an interrupt property that is not found, and then gmac_config is never called.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

This commits toggles the pinctrl on the right node from the probe function of the driver.

Is it possible to fix this while still using driver-model automatic pinctrl?

This is what I have tried to do, without success. The purpose of this patch is also to discuss about the possible solutions we have.

Quoted 8 lines

From looking at pinctrl_rk3288.c, I wonder if there’s a problem with pinctrl on the RK3288 outside of SPL: I see that the (full) set_state is also implemented outside of SPL (#ifndef CONFIG_SPL_BUILD) and not guarded by a CONFIG_IS_ENABLED(PINCTRL_FULL). So something might go down the wrong path.

Could start narrowing this down by enabling DEBUG in pinctrl_rk3288 to see whether this is even the simple pinctrl that gets called?

Yeah, the simple pinctrl is called at least for "hdmi" and the function for configuring hdmi is called internally.

Romain