public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Bryan.Whitehead@microchip•com
Cc: davem@davemloft•net, netdev@vger•kernel.org
Subject: Re: [PATCH net-next,V2] Add LAN9352 Ethernet Driver
Date: Thu, 24 Mar 2016 23:06:07 +0100	[thread overview]
Message-ID: <20160324220607.GE15624@lunn.ch> (raw)
In-Reply-To: <90A7E81AE28BAE4CBDDB3B35F187D264402F31B5@CHN-SV-EXMX02.mchp-main.com>

> It appears the dsa.c is not able to attach my underlying net
> device. And that seems to be due to it is unable to find the
> mdio_bus.


> So I modified my net device driver so that in probe it calls
> of_mdiobus_register instead of mdiobus_register.

> And of_mdiobus_register seems to be looking for some kind of phy
> definitions in the device tree, which it does not find. And so it
> does not appear to register the bus in such a way that dsa.c can
> connect to it.

Hi Bryan

Are the sources for the ethernet driver available? I don't see them in
net-next.

There are two common ways for this to work, depending on the driver
architecture. Marvell devices have a separate mdio driver. In
kirkwood.dtsi you see:

               mdio: mdio-bus@72004 {
                        compatible = "marvell,orion-mdio";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x72004 0x84>;
                        interrupts = <46>;
                        clocks = <&gate_clk 0>;
                        status = "disabled";

                        /* add phy nodes in board file */
                };

and mvmdio.c calls of_mdiobus_register() passing this device node.

The other way is that the mdio is part of the ethernet
driver. e.g. for the Freescale FEC:

&fec1 {
        phy-mode = "rmii";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";

        mdio0: mdio {
                #address-cells = <1>;
                #size-cells = <0>;
                status = "okay";
        };
};

In this case, of_mdiobus_register() is passed the mdio0 device node.

> &gpmc {
> 	status = "okay";
> 	ranges = <0 0 0x10000000 0x08000000>;	// CS0: 128M 
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&gpmc_pins>;
> 	lan9352: ethernet@gpmc {
> 		compatible = "microchip,lan9352";
> 		interrupt-parent = <&gpio0>;
> 		interrupts = <7 8>;//7==GPIO bit 7, 8 = Active low level triggered.
> 
> 		bank-width = <2>;
> 
> 		phy-mode = "mii";
> 
> 		reg = <0 0 0x10000>;
> 
> 		reg-io-width = <4>;
> 		microchip,save-mac-address;
> 		microchip,irq-push-pull;

So i expect to see something like this here:

            	mdio0: mdio {
                	#address-cells = <1>;
                	#size-cells = <0>;
                	status = "okay";
        	};
> 	};
> };
> 
> / {
> 	dsa@0 {
> 		compatible = "microchip,dsa";
> 		#address-cells = <2>;
> 		#size-cells = <0>;
> 		dsa,ethernet = <&lan9352>;
> 		dsa,mii-bus = <&lan9352>;

and this would be

		dsa,mii-bus = <&mdio0>;

> 		switch@0 {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 			reg = <0 0>;	/* MDIO address 0, switch 0 in tree */
> 			port@0 {
> 				reg = <0>;
> 				label = "cpu";
> 			};
> 			port@1 {
> 				reg = <1>;
> 				label = "lan1";
> 			};
> 			port@2 {
> 				reg = <2>;
> 				label = "lan2";
> 			};
> 		};
> 	};
> };

  Andrew

  reply	other threads:[~2016-03-24 22:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 18:58 [PATCH net-next,V2] Add LAN9352 Ethernet Driver Bryan.Whitehead
2016-02-11 21:55 ` Andrew Lunn
2016-02-12 16:51   ` Bryan.Whitehead
2016-02-12 17:11     ` Andrew Lunn
2016-02-16 19:34       ` Bryan.Whitehead
2016-02-16 19:51         ` David Miller
2016-02-16 20:21         ` Andrew Lunn
2016-02-12  0:14 ` Lino Sanfilippo
2016-02-12 19:10   ` Bryan.Whitehead
2016-02-16 22:09     ` Lino Sanfilippo
2016-02-12  2:18 ` Florian Fainelli
2016-02-12  7:20   ` Andrew Lunn
2016-02-12 16:53     ` Bryan.Whitehead
2016-02-12 17:18       ` Andrew Lunn
2016-02-16 19:41         ` Bryan.Whitehead
2016-02-16 19:52           ` David Miller
2016-02-16 20:36           ` Andrew Lunn
2016-02-16 20:43             ` David Miller
2016-02-16 20:48               ` Bryan.Whitehead
2016-02-16 20:52                 ` David Miller
2016-02-16 21:32                   ` Bryan.Whitehead
2016-02-16 21:38                     ` David Miller
2016-02-16 22:15                     ` Andrew Lunn
2016-02-17  0:06                       ` Florian Fainelli
2016-02-17  0:31                         ` Andrew Lunn
2016-02-19 19:29                       ` Bryan.Whitehead
2016-02-19 20:14                         ` Andrew Lunn
2016-02-19 21:21                           ` Bryan.Whitehead
2016-03-24 21:16                           ` Bryan.Whitehead
2016-03-24 22:06                             ` Andrew Lunn [this message]
2016-03-24 22:36                             ` Florian Fainelli
2016-02-16 20:57                 ` Andrew Lunn
2016-02-16 21:37                   ` Bryan.Whitehead
2016-02-16 21:40                     ` David Miller
2016-02-12 23:21   ` Bryan.Whitehead

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160324220607.GE15624@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=Bryan.Whitehead@microchip$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox