lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 24 Mar 2016 23:06:07 +0100
From:	Andrew Lunn <andrew@...n.ch>
To:	Bryan.Whitehead@...rochip.com
Cc:	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH net-next,V2] Add LAN9352 Ethernet Driver

> 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@...04 {
                        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@...c {
> 		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

Powered by blists - more mailing lists