netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mvpp2: initialize port of_node pointer
@ 2018-08-27 12:12 Baruch Siach
  2018-08-27 13:47 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2018-08-27 12:12 UTC (permalink / raw)
  To: Maxime Chevallier, Antoine Tenart
  Cc: netdev, Russell King, Ori Shem-Tov, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth, Baruch Siach

Without a valid of_node in struct device we can't find the mvpp2 port
device by its DT node. Specifically, this breaks
of_find_net_device_by_node().

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 32d785b616e1..28500417843e 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4803,6 +4803,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 	dev->min_mtu = ETH_MIN_MTU;
 	/* 9704 == 9728 - 20 and rounding to 8 */
 	dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
+	dev->dev.of_node = port_node;
 
 	/* Phylink isn't used w/ ACPI as of now */
 	if (port_node) {
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mvpp2: initialize port of_node pointer
  2018-08-27 12:12 [PATCH] net: mvpp2: initialize port of_node pointer Baruch Siach
@ 2018-08-27 13:47 ` Andrew Lunn
  2018-08-27 18:17   ` Baruch Siach
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2018-08-27 13:47 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Maxime Chevallier, Antoine Tenart, netdev, Russell King,
	Ori Shem-Tov, Jason Cooper, Gregory Clement,
	Sebastian Hesselbarth

On Mon, Aug 27, 2018 at 03:12:53PM +0300, Baruch Siach wrote:
> Without a valid of_node in struct device we can't find the mvpp2 port
> device by its DT node. Specifically, this breaks
> of_find_net_device_by_node().

Hi Baruch

We need to be a little bit careful here. I've seen this done wrongly
before, breaking DSA support. Is you intention to use DSA? Can you
quote a section of DT, and indicate which node is port_node.

Thanks
	Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mvpp2: initialize port of_node pointer
  2018-08-27 13:47 ` Andrew Lunn
@ 2018-08-27 18:17   ` Baruch Siach
  2018-08-27 18:44     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2018-08-27 18:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Maxime Chevallier, Antoine Tenart, netdev, Russell King,
	Ori Shem-Tov, Jason Cooper, Gregory Clement,
	Sebastian Hesselbarth

Hi Andrew,

Thanks for reviewing.

On Mon, Aug 27, 2018 at 03:47:23PM +0200, Andrew Lunn wrote:
> On Mon, Aug 27, 2018 at 03:12:53PM +0300, Baruch Siach wrote:
> > Without a valid of_node in struct device we can't find the mvpp2 port
> > device by its DT node. Specifically, this breaks
> > of_find_net_device_by_node().
> 
> We need to be a little bit careful here. I've seen this done wrongly
> before, breaking DSA support. Is you intention to use DSA? Can you
> quote a section of DT, and indicate which node is port_node.

Yes. This is for the Armada 8K based Clearfog GT-8K. The board has a Marvell 
88E6141 switch connected to the &cp1_eth2 port.

Here are the relevant DT nodes:

&cp1_mdio {
	...

	switch0: switch0@4 {
		compatible = "marvell,mv88e6085";
		...

		ports {
			...

			port@5 {
				reg = <5>;
				label = "cpu";
				ethernet = <&cp1_eth2>;
			};
		};

Without this patch, dsa_register_switch() returns -EPROBE_DEFER because 
of_find_net_device_by_node() can't find the device_node of the &cp1_eth2 
device.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mvpp2: initialize port of_node pointer
  2018-08-27 18:17   ` Baruch Siach
@ 2018-08-27 18:44     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2018-08-27 18:44 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Maxime Chevallier, Antoine Tenart, netdev, Russell King,
	Ori Shem-Tov, Jason Cooper, Gregory Clement,
	Sebastian Hesselbarth

On Mon, Aug 27, 2018 at 09:17:21PM +0300, Baruch Siach wrote:
> Hi Andrew,
> 
> Thanks for reviewing.
> 
> On Mon, Aug 27, 2018 at 03:47:23PM +0200, Andrew Lunn wrote:
> > On Mon, Aug 27, 2018 at 03:12:53PM +0300, Baruch Siach wrote:
> > > Without a valid of_node in struct device we can't find the mvpp2 port
> > > device by its DT node. Specifically, this breaks
> > > of_find_net_device_by_node().
> > 
> > We need to be a little bit careful here. I've seen this done wrongly
> > before, breaking DSA support. Is you intention to use DSA? Can you
> > quote a section of DT, and indicate which node is port_node.
> 
> Yes. This is for the Armada 8K based Clearfog GT-8K. The board has a Marvell 
> 88E6141 switch connected to the &cp1_eth2 port.
> 
> Here are the relevant DT nodes:
> 
> &cp1_mdio {
> 	...
> 
> 	switch0: switch0@4 {
> 		compatible = "marvell,mv88e6085";
> 		...
> 
> 		ports {
> 			...
> 
> 			port@5 {
> 				reg = <5>;
> 				label = "cpu";
> 				ethernet = <&cp1_eth2>;
> 			};
> 		};
> 
> Without this patch, dsa_register_switch() returns -EPROBE_DEFER because 
> of_find_net_device_by_node() can't find the device_node of the &cp1_eth2 
> device.

O.K. This all looks correct.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-27 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-27 12:12 [PATCH] net: mvpp2: initialize port of_node pointer Baruch Siach
2018-08-27 13:47 ` Andrew Lunn
2018-08-27 18:17   ` Baruch Siach
2018-08-27 18:44     ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).