netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
@ 2014-11-12 13:07 Oliver Graute
  2014-11-12 19:19 ` Florian Fainelli
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-12 13:07 UTC (permalink / raw)
  To: netdev

Hello,

how do I specify the DSA node and the MDIO node in the Device Tree
Binding to integrate a Marvell 88e6071 switch with a imx28 board?

On my board the Marvell switch 88e6071 is connected via phy1 (on a
imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
are connected via the same MDIO Bus.

I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
right choice for imx28 fec ethernet controller is it?)

I already know that I need to adapt the DSA driver for this new
switch. But currently I can't access the switch ports because my MDIO
Bus is not configured correctly. It always ends with:

dmesg | grep -E "mii|dsa|mdio"
[    2.528900] libphy: fec_enet_mii_bus: probed
[    3.028061] !!!!Enter dsa Probe!!!!!
[    3.037640] !!!!!Enter dsa_of_probe!!!!!
[    3.041736] !!!!before of_parse_phandle dsa,mii-bus!!!!!
[    3.047123] !!!! mdio->name=ethernet-phy !!!!!
[    3.051658] !!!!before of_mdio_find_bus!!!!!
[    3.055950] !!!!!enter of_mdio_find_bus!!!!!
[    3.074074] !!!!!enter of_mdio_bus_match!!!!!
[    3.078451] !!!!!enter of_mdio_bus_match!!!!!
[    3.088915] !!!!Leave of_mdio_find_bus !!!!!
[    3.093268] !!!! return  of_mdio_find_bus =22 !!!!!
[    3.098166] dsa_of_probe returns=-22
[    3.101858] dsa: probe of dsa.5 failed with error -22
[   19.169423] fec 800f0000.ethernet eth0: Freescale FEC PHY driver
[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:00, irq=-1)
[   20.038786] fec 800f4000.ethernet eth1: Freescale FEC PHY driver
[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)

because the method  of_mdio_find_bus returns with EINVAL

I suspect that the problem is the fact that the Kernel is not getting
connected to the MDIO bus.
what is wrong here?

dsa@0 {
        compatible = "marvell,dsa";
        #address-cells = <2>;
        #size-cells = <0>;
        interrupts = <10>;
        dsa,ethernet = <&eth1>;
         dsa,mii-bus = <&ethphy1>;

        switch@0 {
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5 0>;   /* MDIO address 5, switch 0 in tree */

            port@0 {
                reg = <0>;
                label = "lan1";
                phy-handle = <&ethphy1>;
            };

            port@1 {
                reg = <1>;
                label = "lan2";
            };

            port@2 {
                reg = <2>;
                label = "lan3";
            };

            port@3 {
                reg = <3>;
                label = "lan4";
            };

            port@4 {
                reg = <4>;
                label = "lan5";
            };

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

        };
    };


eth1: eth1 {
    status = "okay";
    ethernet1-port@1 {
        phy-handle = <&ethphy1>;
    };
};


mdio_bus: mdio {
        #address-cells = <1>;
        #size-cells = <0>;
        device_type = "mdio";
        //compatible = "fsl,gianfar-mdio";
        compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
        reg = <0xe00 0x188>;
        status = "okay";

         ethphy0: ethernet-phy@0 {
                 reg = <0>;

         };

         ethphy1: ethernet-phy@1 {
                 reg = <1>;
                };
                 //reg = <0xff>; */ /* No PHY attached */
                 //speed = <1000>;
                 //duple = <1>;
       };

Best regards,

Oliver Graute

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-12 13:07 Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface Oliver Graute
@ 2014-11-12 19:19 ` Florian Fainelli
  2014-11-13 15:15   ` Oliver Graute
  0 siblings, 1 reply; 16+ messages in thread
From: Florian Fainelli @ 2014-11-12 19:19 UTC (permalink / raw)
  To: Oliver Graute, netdev

On 11/12/2014 05:07 AM, Oliver Graute wrote:
> Hello,
> 
> how do I specify the DSA node and the MDIO node in the Device Tree
> Binding to integrate a Marvell 88e6071 switch with a imx28 board?

If you do not CC the people actively working on this, chances are that
they will just miss your email.

> 
> On my board the Marvell switch 88e6071 is connected via phy1 (on a
> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
> are connected via the same MDIO Bus.
> 
> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
> right choice for imx28 fec ethernet controller is it?)
> 
> I already know that I need to adapt the DSA driver for this new
> switch. But currently I can't access the switch ports because my MDIO
> Bus is not configured correctly. It always ends with:
> 
> dmesg | grep -E "mii|dsa|mdio"
> [    2.528900] libphy: fec_enet_mii_bus: probed
> [    3.028061] !!!!Enter dsa Probe!!!!!
> [    3.037640] !!!!!Enter dsa_of_probe!!!!!
> [    3.041736] !!!!before of_parse_phandle dsa,mii-bus!!!!!
> [    3.047123] !!!! mdio->name=ethernet-phy !!!!!
> [    3.051658] !!!!before of_mdio_find_bus!!!!!
> [    3.055950] !!!!!enter of_mdio_find_bus!!!!!
> [    3.074074] !!!!!enter of_mdio_bus_match!!!!!
> [    3.078451] !!!!!enter of_mdio_bus_match!!!!!
> [    3.088915] !!!!Leave of_mdio_find_bus !!!!!
> [    3.093268] !!!! return  of_mdio_find_bus =22 !!!!!
> [    3.098166] dsa_of_probe returns=-22
> [    3.101858] dsa: probe of dsa.5 failed with error -22
> [   19.169423] fec 800f0000.ethernet eth0: Freescale FEC PHY driver
> [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:00, irq=-1)
> [   20.038786] fec 800f4000.ethernet eth1: Freescale FEC PHY driver
> [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
> 
> because the method  of_mdio_find_bus returns with EINVAL
> 
> I suspect that the problem is the fact that the Kernel is not getting
> connected to the MDIO bus.
> what is wrong here?
> 
> dsa@0 {
>         compatible = "marvell,dsa";
>         #address-cells = <2>;
>         #size-cells = <0>;
>         interrupts = <10>;
>         dsa,ethernet = <&eth1>;
>          dsa,mii-bus = <&ethphy1>;

This should be phandle to the MDIO bus controller, not a node within
its, so in your case this should be dsa,mii-bus = <&mdio_bus>;

> 
>         switch@0 {
>             #address-cells = <1>;
>             #size-cells = <0>;
>             reg = <5 0>;   /* MDIO address 5, switch 0 in tree */
> 
>             port@0 {
>                 reg = <0>;
>                 label = "lan1";
>                 phy-handle = <&ethphy1>;
>             };
> 
>             port@1 {
>                 reg = <1>;
>                 label = "lan2";
>             };
> 
>             port@2 {
>                 reg = <2>;
>                 label = "lan3";
>             };
> 
>             port@3 {
>                 reg = <3>;
>                 label = "lan4";
>             };
> 
>             port@4 {
>                 reg = <4>;
>                 label = "lan5";
>             };
> 
>             port@5 {
>                 reg = <5>;
>                 label = "cpu";
>             };
> 
>         };
>     };
> 
> 
> eth1: eth1 {
>     status = "okay";
>     ethernet1-port@1 {
>         phy-handle = <&ethphy1>;

You probably want to use a fixed-link node here to provide a link status
that is always UP as seen from the CPU Ethernet MAC perspective, so
something like this:

fixed-link {
	speed = <1000>;
	full-duplex;
};

>     };
> };
> 
> 
> mdio_bus: mdio {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         device_type = "mdio";
>         //compatible = "fsl,gianfar-mdio";
>         compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
>         reg = <0xe00 0x188>;
>         status = "okay";
> 
>          ethphy0: ethernet-phy@0 {
>                  reg = <0>;
> 
>          };
> 
>          ethphy1: ethernet-phy@1 {
>                  reg = <1>;
>                 };
>                  //reg = <0xff>; */ /* No PHY attached */
>                  //speed = <1000>;
>                  //duple = <1>;
>        };
> 
> Best regards,
> 
> Oliver Graute
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-12 19:19 ` Florian Fainelli
@ 2014-11-13 15:15   ` Oliver Graute
  2014-11-13 20:03     ` Florian Fainelli
  2014-11-17 16:45     ` Fabio Estevam
  0 siblings, 2 replies; 16+ messages in thread
From: Oliver Graute @ 2014-11-13 15:15 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev

Hello Florian,

On Wed, Nov 12, 2014 at 8:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 11/12/2014 05:07 AM, Oliver Graute wrote:
>> Hello,
>>
>> how do I specify the DSA node and the MDIO node in the Device Tree
>> Binding to integrate a Marvell 88e6071 switch with a imx28 board?
>>
>> On my board the Marvell switch 88e6071 is connected via phy1 (on a
>> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
>> are connected via the same MDIO Bus.
>>
>> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
>> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
>> right choice for imx28 fec ethernet controller is it?)
>>

I changed my DeviceTree according to your proposal. Now I got a ENODEV 19
in dsa_of_probe. Because  of_find_device_by_node(ethernet) is returning 0.
Is my ethernet setting still wrong?

dsa@0 {
        compatible = "marvell,dsa";
        #address-cells = <2>;
        #size-cells = <0>;

        interrupts = <10>;
        dsa,ethernet = <&eth1>;
        dsa,mii-bus = <&mdio_bus>;

        switch@0 {
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5 0>;   /* MDIO address 5, switch 0 in tree */

            port@0 {
                reg = <0>;
                label = "lan1";
                phy-handle = <&ethphy1>;
            };

            port@1 {
                reg = <1>;
                label = "lan2";
            };

            port@2 {
                reg = <2>;
                label = "lan3";
            };

            port@3 {
                reg = <3>;
                label = "lan4";
            };

            port@4 {
                reg = <4>;
                label = "lan5";
            };

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

        };
    };

eth1: eth1 {
    status = "okay";
    ethernet1-port@1 {
        phy-handle = <&ethphy1>;

        fixed-link {
                speed = <1000>;
                full-duplex;
            };
    };
};

mdio_bus: mdio@800f0040 {
        #address-cells = <1>;
        #size-cells = <0>;
        device_type = "mdio";
        //compatible = "fsl,gianfar-mdio";
        compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
        reg = <0x800f0040 0x188>;
        status = "okay";

         ethphy0: ethernet-phy@0 {
                compatible = "fsl,gianfar-mdio";
                device_type = "network";
                model = "FEC";
                reg = <0x00>;

         };

         ethphy1: ethernet-phy@1 {
                 compatible = "fsl,gianfar-mdio";
                 device_type = "network";
                 model = "FEC";
                 reg = <0x01>;
                };
                 //reg = <0xff>; */ /* No PHY attached */
                 //speed = <1000>;
                 //duple = <1>;
       };

modprobe dsa_core
[  151.720180] !!!!!enter dsa_init_module!!!!!
[  151.724713] !!!!Enter dsa Probe!!!!!
[  151.728321] Distributed Switch Architecture driver version 0.1
[  151.739026] !!!!!Enter dsa_of_probe!!!!!
[  151.744515] !!!!!mdio->name=mdio mdio->type=mdio
mdio->full_name=/mdio@800f0040 !!!!!
[  151.753559] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
[  151.761419] !!!!before of_mdio_find_bus!!!!!
[  151.765732] !!!!!enter of_mdio_find_bus!!!!!
[  151.772418] !!!!!!enter class_find_device!!!!!
[  151.776908] !!!!!!enter class_dev_iter_init!!!!!
[  151.783512] !!!!!!iter->type->name=(null) !!!!!
[  151.788085] !!!!!!leave class_dev_iter_init!!!!!
[  151.794439] !!!!!enter of_mdio_bus_match!!!!!
[  151.798845] !!!!!enter of_mdio_bus_match!!!!!
[  151.804967] !!!!!enter of_mdio_bus_match!!!!!
[  151.809381] !!!!!!leave class_find_device return dev=!!!!!
[  151.816668] !!!!Leave of_mdio_find_bus !!!!!
[  151.822057] !!!!before of_parse_phandle dsa,ethernet!!!!!
[  151.827553] !!!!before of find_device_by_node!!!!!
[  151.834819] !!!!!ethernet->name=eth1 ethernet->type=<NULL>
ethernet->full_name=/eth1 !!!!!
[  151.844540] !!!!! enter of_find_device_by_node !!!!!
[  151.850692] !!!!! Leave of_find_device_by_node dev=0 !!!!!
[  151.856221] !!!! return  of_find-device_by_node =19 !!!!!
[  151.863419] dsa_of_probe returns=-19
[  151.873509] !!!!!leave dsa_init_module!!!!!


Best Regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-13 15:15   ` Oliver Graute
@ 2014-11-13 20:03     ` Florian Fainelli
  2014-11-14  7:39       ` Oliver Graute
  2014-11-17 16:45     ` Fabio Estevam
  1 sibling, 1 reply; 16+ messages in thread
From: Florian Fainelli @ 2014-11-13 20:03 UTC (permalink / raw)
  To: Oliver Graute; +Cc: netdev

On 11/13/2014 07:15 AM, Oliver Graute wrote:
> Hello Florian,
> 
> On Wed, Nov 12, 2014 at 8:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>> On 11/12/2014 05:07 AM, Oliver Graute wrote:
>>> Hello,
>>>
>>> how do I specify the DSA node and the MDIO node in the Device Tree
>>> Binding to integrate a Marvell 88e6071 switch with a imx28 board?
>>>
>>> On my board the Marvell switch 88e6071 is connected via phy1 (on a
>>> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
>>> are connected via the same MDIO Bus.
>>>
>>> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
>>> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
>>> right choice for imx28 fec ethernet controller is it?)
>>>
> 
> I changed my DeviceTree according to your proposal. Now I got a ENODEV 19
> in dsa_of_probe. Because  of_find_device_by_node(ethernet) is returning 0.
> Is my ethernet setting still wrong?

Is your ethernet driver also modular? If so, you will need it to be
loaded *before* dsa. of_find_device_by_node() also needs the ethernet
driver to be a platform_driver.

NB: I have a patch that looks up a net_device based on the struct
device_node that might be better to use, since it makes no assumption
about whether that is a platform_device/pci_device etc...

> 
> dsa@0 {
>         compatible = "marvell,dsa";
>         #address-cells = <2>;
>         #size-cells = <0>;
> 
>         interrupts = <10>;
>         dsa,ethernet = <&eth1>;
>         dsa,mii-bus = <&mdio_bus>;
> 
>         switch@0 {
>             #address-cells = <1>;
>             #size-cells = <0>;
>             reg = <5 0>;   /* MDIO address 5, switch 0 in tree */
> 
>             port@0 {
>                 reg = <0>;
>                 label = "lan1";
>                 phy-handle = <&ethphy1>;
>             };
> 
>             port@1 {
>                 reg = <1>;
>                 label = "lan2";
>             };
> 
>             port@2 {
>                 reg = <2>;
>                 label = "lan3";
>             };
> 
>             port@3 {
>                 reg = <3>;
>                 label = "lan4";
>             };
> 
>             port@4 {
>                 reg = <4>;
>                 label = "lan5";
>             };
> 
>             port@5 {
>                 reg = <5>;
>                 label = "cpu";
>             };
> 
>         };
>     };
> 
> eth1: eth1 {
>     status = "okay";
>     ethernet1-port@1 {
>         phy-handle = <&ethphy1>;
> 
>         fixed-link {
>                 speed = <1000>;
>                 full-duplex;
>             };
>     };
> };
> 
> mdio_bus: mdio@800f0040 {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         device_type = "mdio";
>         //compatible = "fsl,gianfar-mdio";
>         compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
>         reg = <0x800f0040 0x188>;
>         status = "okay";
> 
>          ethphy0: ethernet-phy@0 {
>                 compatible = "fsl,gianfar-mdio";
>                 device_type = "network";
>                 model = "FEC";
>                 reg = <0x00>;
> 
>          };
> 
>          ethphy1: ethernet-phy@1 {
>                  compatible = "fsl,gianfar-mdio";
>                  device_type = "network";
>                  model = "FEC";
>                  reg = <0x01>;
>                 };
>                  //reg = <0xff>; */ /* No PHY attached */
>                  //speed = <1000>;
>                  //duple = <1>;
>        };
> 
> modprobe dsa_core
> [  151.720180] !!!!!enter dsa_init_module!!!!!
> [  151.724713] !!!!Enter dsa Probe!!!!!
> [  151.728321] Distributed Switch Architecture driver version 0.1
> [  151.739026] !!!!!Enter dsa_of_probe!!!!!
> [  151.744515] !!!!!mdio->name=mdio mdio->type=mdio
> mdio->full_name=/mdio@800f0040 !!!!!
> [  151.753559] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
> [  151.761419] !!!!before of_mdio_find_bus!!!!!
> [  151.765732] !!!!!enter of_mdio_find_bus!!!!!
> [  151.772418] !!!!!!enter class_find_device!!!!!
> [  151.776908] !!!!!!enter class_dev_iter_init!!!!!
> [  151.783512] !!!!!!iter->type->name=(null) !!!!!
> [  151.788085] !!!!!!leave class_dev_iter_init!!!!!
> [  151.794439] !!!!!enter of_mdio_bus_match!!!!!
> [  151.798845] !!!!!enter of_mdio_bus_match!!!!!
> [  151.804967] !!!!!enter of_mdio_bus_match!!!!!
> [  151.809381] !!!!!!leave class_find_device return dev=!!!!!
> [  151.816668] !!!!Leave of_mdio_find_bus !!!!!
> [  151.822057] !!!!before of_parse_phandle dsa,ethernet!!!!!
> [  151.827553] !!!!before of find_device_by_node!!!!!
> [  151.834819] !!!!!ethernet->name=eth1 ethernet->type=<NULL>
> ethernet->full_name=/eth1 !!!!!
> [  151.844540] !!!!! enter of_find_device_by_node !!!!!
> [  151.850692] !!!!! Leave of_find_device_by_node dev=0 !!!!!
> [  151.856221] !!!! return  of_find-device_by_node =19 !!!!!
> [  151.863419] dsa_of_probe returns=-19
> [  151.873509] !!!!!leave dsa_init_module!!!!!
> 
> 
> Best Regards,
> 
> Oliver
> 

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-13 20:03     ` Florian Fainelli
@ 2014-11-14  7:39       ` Oliver Graute
  2014-11-14 14:52         ` Oliver Graute
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-14  7:39 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev

On Thu, Nov 13, 2014 at 9:03 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 11/13/2014 07:15 AM, Oliver Graute wrote:
>> Hello Florian,
>>
>> On Wed, Nov 12, 2014 at 8:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>> On 11/12/2014 05:07 AM, Oliver Graute wrote:
>>>> Hello,
>>>>
>>>> how do I specify the DSA node and the MDIO node in the Device Tree
>>>> Binding to integrate a Marvell 88e6071 switch with a imx28 board?
>>>>
>>>> On my board the Marvell switch 88e6071 is connected via phy1 (on a
>>>> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
>>>> are connected via the same MDIO Bus.
>>>>
>>>> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
>>>> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
>>>> right choice for imx28 fec ethernet controller is it?)
>>>>
>>
>> I changed my DeviceTree according to your proposal. Now I got a ENODEV 19
>> in dsa_of_probe. Because  of_find_device_by_node(ethernet) is returning 0.
>> Is my ethernet setting still wrong?
>
> Is your ethernet driver also modular? If so, you will need it to be
> loaded *before* dsa. of_find_device_by_node() also needs the ethernet
> driver to be a platform_driver.

No my Freescale FEC PHY driver is not a module. FEC is a imx28/arm
platform driver or not?

I loaded the DSA as a Kernel module to make sure that the DSA probing
is happening when the switch is really on. I enable the SWITCH ON Pin
on bootup with a systemd started script. Then I write some registers
on the switch with a userspace mii tool. This manually writing of some
switch registers works fine via the MII Bus using ioctl(SIOCGMIIPHY).

But i would like to integrate the switch with a full dsa driver.
currently its failing with dsa_of_probe returns=-19

> NB: I have a patch that looks up a net_device based on the struct
> device_node that might be better to use, since it makes no assumption
> about whether that is a platform_device/pci_device etc...

can you give me a link to this patch?

Best Regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-14  7:39       ` Oliver Graute
@ 2014-11-14 14:52         ` Oliver Graute
  2014-11-14 17:09           ` Florian Fainelli
  2014-11-17 15:58           ` Oliver Graute
  0 siblings, 2 replies; 16+ messages in thread
From: Oliver Graute @ 2014-11-14 14:52 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev

On Fri, Nov 14, 2014 at 8:39 AM, Oliver Graute <oliver.graute@gmail.com> wrote:
> On Thu, Nov 13, 2014 at 9:03 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>> On 11/13/2014 07:15 AM, Oliver Graute wrote:
>>> Hello Florian,
>>>
>>> On Wed, Nov 12, 2014 at 8:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>> On 11/12/2014 05:07 AM, Oliver Graute wrote:
>>>>> Hello,
>>>>>
>>>>> how do I specify the DSA node and the MDIO node in the Device Tree
>>>>> Binding to integrate a Marvell 88e6071 switch with a imx28 board?
>>>>>
>>>>> On my board the Marvell switch 88e6071 is connected via phy1 (on a
>>>>> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
>>>>> are connected via the same MDIO Bus.
>>>>>
>>>>> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
>>>>> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
>>>>> right choice for imx28 fec ethernet controller is it?)
>>>>>
>>>
>>> I changed my DeviceTree according to your proposal. Now I got a ENODEV 19
>>> in dsa_of_probe. Because  of_find_device_by_node(ethernet) is returning 0.
>>> Is my ethernet setting still wrong?
>>
>> Is your ethernet driver also modular? If so, you will need it to be
>> loaded *before* dsa. of_find_device_by_node() also needs the ethernet
>> driver to be a platform_driver.
>
> No my Freescale FEC PHY driver is not a module. FEC is a imx28/arm
> platform driver or not?
>
> I loaded the DSA as a Kernel module to make sure that the DSA probing
> is happening when the switch is really on. I enable the SWITCH ON Pin
> on bootup with a systemd started script. Then I write some registers
> on the switch with a userspace mii tool. This manually writing of some
> switch registers works fine via the MII Bus using ioctl(SIOCGMIIPHY).
>
> But i would like to integrate the switch with a full dsa driver.
> currently its failing with dsa_of_probe returns=-19
>

the dsa_core driver is probing the mii_bus before eth0 and eth1 are
detected via the FEC Driver.

[   20.716253] !!!!!enter dsa_init_module!!!!!
[   20.777046] !!!!Enter dsa Probe!!!!!
[   20.803422] Distributed Switch Architecture driver version 0.1
[   20.809295] !!!!!Enter dsa_of_probe!!!!!
[   20.888268] !!!!!mdio->name=mdio mdio->type=mdio
mdio->full_name=/mdio@800f0040 !!!!!
[   20.999618] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
[   21.097805] !!!!before of_mdio_find_bus!!!!!
[   21.137278] !!!!!enter of_mdio_find_bus!!!!!
[   21.190232] !!!!!enter of_mdio_bus_match!!!!!
[   21.194635] !!!!!enter of_mdio_bus_match!!!!!
[   21.199000] !!!!!enter of_mdio_bus_match!!!!!
[   21.300627] !!!!Leave of_mdio_find_bus !!!!!
[   21.304949] !!!!after of_mdio_find_bus mdio_bus=Freescale
PowerQUICC MII Bus !!!!!
[   21.456904] !!!!before of_parse_phandle dsa,ethernet!!!!!
[   21.570569] !!!!before of find_device_by_node!!!!!
[   21.575416] !!!!!ethernet->name=ethernet ethernet->type=<NULL>
ethernet->full_name=/ahb@80080000/ethernet@800f4000 !!!!!
[   21.860234] !!!!! enter of_find_device_by_node !!!!!
[   21.865284] !!!!! Leave of_find_device_by_node dev=c790fe10 !!!!!
[   21.970600] !!!!! dev->init_name=(null) !!!!!
[   21.975001] before to_platform_device test->name=800f4000.ethernet
[   22.088915] !!!!before of kzalloc!!!!!
[   22.134753] !!!!before pd->netdev!!!!!
[   22.138548] !!!!before dev_to_net_device!!!!!
[   22.210241] !!!!dev_put(dev)!!!!!
[   22.213600] !!!!kzalloc!!!!!
[   22.216493] !!!!platform_set_drv_data!!!!!
[   22.313247] !!!!!enter dev_to_mii_bus!!!!!
[   22.317393] !!!!!enter dsa_switch_setup!!!!!
[   22.394756] !!!!name=!!!!!
[   22.397691] !!!!bus->name=Freescale PowerQUICC MII Bus!!!!!
[   22.502050] !!!!pd->sw_addr=3!!!!!
[   22.505489] !!!!Enter dsa_switch_probe!!!!!
[   22.509685] !!!!Leave dsa_switch_probe!!!!!
[   22.630239] eth1[0]: could not detect attached switch
[   22.635337] eth1[0]: couldn't create dsa switch instance (error -22)
[   22.740538] !!!!Leave dsa Probe!!!!!
[   22.794305] !!!!!leave dsa_init_module!!!!!

[   65.954070] fec 800f0000.ethernet eth0: Freescale FEC PHY driver
[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:00, irq=-1)
[   66.067135] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   66.532877] fec 800f4000.ethernet eth1: Freescale FEC PHY driver
[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)

if i manually rmmod and modprobe the dsa_core driver  after FEC PHY
detection again i got a  EEXIST 17

modprobe dsa_core
[  212.770578] !!!!!enter dsa_init_module!!!!!
[  212.775121] !!!!Enter dsa Probe!!!!!
[  212.778726] Distributed Switch Architecture driver version 0.1
[  212.791071] !!!!!Enter dsa_of_probe!!!!!
[  212.795191] !!!!!mdio->name=mdio mdio->type=mdio
mdio->full_name=/mdio@800f0040 !!!!!
[  212.805452] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
[  212.813355] !!!!before of_mdio_find_bus!!!!!
[  212.817669] !!!!!enter of_mdio_find_bus!!!!!
[  212.823707] !!!!!enter of_mdio_bus_match!!!!!
[  212.828111] !!!!!enter of_mdio_bus_match!!!!!
[  212.834213] !!!!!enter of_mdio_bus_match!!!!!
[  212.838620] !!!!Leave of_mdio_find_bus !!!!!
[  212.844655] !!!!after of_mdio_find_bus mdio_bus=Freescale
PowerQUICC MII Bus !!!!!
[  212.853684] !!!!before of_parse_phandle dsa,ethernet!!!!!
[  212.859179] !!!!before of find_device_by_node!!!!!
[  212.866019] !!!!!ethernet->name=ethernet ethernet->type=<NULL>
ethernet->full_name=/ahb@80080000/ethernet@800f4000 !!!!!
[  212.878029] !!!!! enter of_find_device_by_node !!!!!
[  212.884159] !!!!! Leave of_find_device_by_node dev=c790fe10 !!!!!
[  212.891366] !!!!! dev->init_name=(null) !!!!!
[  212.895769]
[  212.895769] before to_platform_device test->name=800f4000.ethernet
[  212.905738] !!!!before of kzalloc!!!!!
[  212.909586] !!!!before pd->netdev!!!!!
[  212.915402] !!!!before dev_to_net_device!!!!!
[  212.919817] !!!!dev_put(dev)!!!!!
[  212.925431] dsa: probe of dsa.5 failed with error -17
[  212.936922] !!!!!leave dsa_init_module!!!!!


best regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-14 14:52         ` Oliver Graute
@ 2014-11-14 17:09           ` Florian Fainelli
  2014-11-17 15:58           ` Oliver Graute
  1 sibling, 0 replies; 16+ messages in thread
From: Florian Fainelli @ 2014-11-14 17:09 UTC (permalink / raw)
  To: Oliver Graute; +Cc: netdev

On 11/14/2014 06:52 AM, Oliver Graute wrote:
> On Fri, Nov 14, 2014 at 8:39 AM, Oliver Graute <oliver.graute@gmail.com> wrote:
>> On Thu, Nov 13, 2014 at 9:03 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>> On 11/13/2014 07:15 AM, Oliver Graute wrote:
>>>> Hello Florian,
>>>>
>>>> On Wed, Nov 12, 2014 at 8:19 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>>> On 11/12/2014 05:07 AM, Oliver Graute wrote:
>>>>>> Hello,
>>>>>>
>>>>>> how do I specify the DSA node and the MDIO node in the Device Tree
>>>>>> Binding to integrate a Marvell 88e6071 switch with a imx28 board?
>>>>>>
>>>>>> On my board the Marvell switch 88e6071 is connected via phy1 (on a
>>>>>> imx28 PCB) to phy5 on the Marvell switch (on a Switch PCB). All phys
>>>>>> are connected via the same MDIO Bus.
>>>>>>
>>>>>> I enabled the Marvell DSA Support Driver, Gianfar Ethernet Driver and
>>>>>> Freescale PQ MDIO Driver in the Kernel (I' am not sure if this is the
>>>>>> right choice for imx28 fec ethernet controller is it?)
>>>>>>
>>>>
>>>> I changed my DeviceTree according to your proposal. Now I got a ENODEV 19
>>>> in dsa_of_probe. Because  of_find_device_by_node(ethernet) is returning 0.
>>>> Is my ethernet setting still wrong?
>>>
>>> Is your ethernet driver also modular? If so, you will need it to be
>>> loaded *before* dsa. of_find_device_by_node() also needs the ethernet
>>> driver to be a platform_driver.
>>
>> No my Freescale FEC PHY driver is not a module. FEC is a imx28/arm
>> platform driver or not?
>>
>> I loaded the DSA as a Kernel module to make sure that the DSA probing
>> is happening when the switch is really on. I enable the SWITCH ON Pin
>> on bootup with a systemd started script. Then I write some registers
>> on the switch with a userspace mii tool. This manually writing of some
>> switch registers works fine via the MII Bus using ioctl(SIOCGMIIPHY).
>>
>> But i would like to integrate the switch with a full dsa driver.
>> currently its failing with dsa_of_probe returns=-19
>>
> 
> the dsa_core driver is probing the mii_bus before eth0 and eth1 are
> detected via the FEC Driver.

DSA is typically built into the kernel and few people have actually
tried to make modules work with it. You may have to play with
EPROBE_DEFER and similar to satisfy the ordering. I would start with
building these drivers in the kernel, make them work together, and then
see what is missing to make it work in a modular build configuration.

> 
> [   20.716253] !!!!!enter dsa_init_module!!!!!
> [   20.777046] !!!!Enter dsa Probe!!!!!
> [   20.803422] Distributed Switch Architecture driver version 0.1
> [   20.809295] !!!!!Enter dsa_of_probe!!!!!
> [   20.888268] !!!!!mdio->name=mdio mdio->type=mdio
> mdio->full_name=/mdio@800f0040 !!!!!
> [   20.999618] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
> [   21.097805] !!!!before of_mdio_find_bus!!!!!
> [   21.137278] !!!!!enter of_mdio_find_bus!!!!!
> [   21.190232] !!!!!enter of_mdio_bus_match!!!!!
> [   21.194635] !!!!!enter of_mdio_bus_match!!!!!
> [   21.199000] !!!!!enter of_mdio_bus_match!!!!!
> [   21.300627] !!!!Leave of_mdio_find_bus !!!!!
> [   21.304949] !!!!after of_mdio_find_bus mdio_bus=Freescale
> PowerQUICC MII Bus !!!!!
> [   21.456904] !!!!before of_parse_phandle dsa,ethernet!!!!!
> [   21.570569] !!!!before of find_device_by_node!!!!!
> [   21.575416] !!!!!ethernet->name=ethernet ethernet->type=<NULL>
> ethernet->full_name=/ahb@80080000/ethernet@800f4000 !!!!!
> [   21.860234] !!!!! enter of_find_device_by_node !!!!!
> [   21.865284] !!!!! Leave of_find_device_by_node dev=c790fe10 !!!!!
> [   21.970600] !!!!! dev->init_name=(null) !!!!!
> [   21.975001] before to_platform_device test->name=800f4000.ethernet
> [   22.088915] !!!!before of kzalloc!!!!!
> [   22.134753] !!!!before pd->netdev!!!!!
> [   22.138548] !!!!before dev_to_net_device!!!!!
> [   22.210241] !!!!dev_put(dev)!!!!!
> [   22.213600] !!!!kzalloc!!!!!
> [   22.216493] !!!!platform_set_drv_data!!!!!
> [   22.313247] !!!!!enter dev_to_mii_bus!!!!!
> [   22.317393] !!!!!enter dsa_switch_setup!!!!!
> [   22.394756] !!!!name=!!!!!
> [   22.397691] !!!!bus->name=Freescale PowerQUICC MII Bus!!!!!
> [   22.502050] !!!!pd->sw_addr=3!!!!!
> [   22.505489] !!!!Enter dsa_switch_probe!!!!!
> [   22.509685] !!!!Leave dsa_switch_probe!!!!!
> [   22.630239] eth1[0]: could not detect attached switch
> [   22.635337] eth1[0]: couldn't create dsa switch instance (error -22)
> [   22.740538] !!!!Leave dsa Probe!!!!!
> [   22.794305] !!!!!leave dsa_init_module!!!!!
> 
> [   65.954070] fec 800f0000.ethernet eth0: Freescale FEC PHY driver
> [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:00, irq=-1)
> [   66.067135] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> [   66.532877] fec 800f4000.ethernet eth1: Freescale FEC PHY driver
> [Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
> 
> if i manually rmmod and modprobe the dsa_core driver  after FEC PHY
> detection again i got a  EEXIST 17
> 
> modprobe dsa_core
> [  212.770578] !!!!!enter dsa_init_module!!!!!
> [  212.775121] !!!!Enter dsa Probe!!!!!
> [  212.778726] Distributed Switch Architecture driver version 0.1
> [  212.791071] !!!!!Enter dsa_of_probe!!!!!
> [  212.795191] !!!!!mdio->name=mdio mdio->type=mdio
> mdio->full_name=/mdio@800f0040 !!!!!
> [  212.805452] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
> [  212.813355] !!!!before of_mdio_find_bus!!!!!
> [  212.817669] !!!!!enter of_mdio_find_bus!!!!!
> [  212.823707] !!!!!enter of_mdio_bus_match!!!!!
> [  212.828111] !!!!!enter of_mdio_bus_match!!!!!
> [  212.834213] !!!!!enter of_mdio_bus_match!!!!!
> [  212.838620] !!!!Leave of_mdio_find_bus !!!!!
> [  212.844655] !!!!after of_mdio_find_bus mdio_bus=Freescale
> PowerQUICC MII Bus !!!!!
> [  212.853684] !!!!before of_parse_phandle dsa,ethernet!!!!!
> [  212.859179] !!!!before of find_device_by_node!!!!!
> [  212.866019] !!!!!ethernet->name=ethernet ethernet->type=<NULL>
> ethernet->full_name=/ahb@80080000/ethernet@800f4000 !!!!!
> [  212.878029] !!!!! enter of_find_device_by_node !!!!!
> [  212.884159] !!!!! Leave of_find_device_by_node dev=c790fe10 !!!!!
> [  212.891366] !!!!! dev->init_name=(null) !!!!!
> [  212.895769]
> [  212.895769] before to_platform_device test->name=800f4000.ethernet
> [  212.905738] !!!!before of kzalloc!!!!!
> [  212.909586] !!!!before pd->netdev!!!!!
> [  212.915402] !!!!before dev_to_net_device!!!!!
> [  212.919817] !!!!dev_put(dev)!!!!!
> [  212.925431] dsa: probe of dsa.5 failed with error -17
> [  212.936922] !!!!!leave dsa_init_module!!!!!
> 
> 
> best regards,
> 
> Oliver
> 

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-14 14:52         ` Oliver Graute
  2014-11-14 17:09           ` Florian Fainelli
@ 2014-11-17 15:58           ` Oliver Graute
  2014-11-17 16:09             ` Andrew Lunn
  1 sibling, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-17 15:58 UTC (permalink / raw)
  To: netdev; +Cc: andrew, Florian Fainelli, buytenh

Hello,

I'am still failing to probe the DSA switch via the mii bus. I'am
unsure if i really probe it on the right way (mii bus and mii address)

The  IMX28 CPU board has two connected phys. These are successfully
probed by fec_enet_mii_probe and appear as eth0 and eth1 Interface. So
some mii bus probing is working fine there.

fec 800f0000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ8041]
(mii_bus:phy_addr=800f0000.etherne:01, irq=-1)
fec 800f4000.ethernet eth1: Freescale FEC PHY driver [Micrel KSZ8041]
(mii_bus:phy_addr=800f0000.etherne:03, irq=-1)

The last phy1 is connected with phy5 of the the switch board . All
phys are connected on the same mii bus of IMX28.
In the DSA part of the Device Tree I use the compatible Flag:
"fsl,gianfar-mdio"; That load the "bus->name=Freescale PowerQUICC MII
Bus"

Is this the right mii bus choice for me here on a imx28 board? or is
that another non existing mii bus?

Then I adapted a bit the 88E6060 driver to a 88e6071 driver. But
currently i only try to readout  the revison number.

Revsion Number:

88E6071 = 0x071

static char *mv88e6071_probe(struct mii_bus *bus, int sw_addr)
{
int ret;

ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
if (ret >= 0) {
ret &= 0xfff0;
if (ret == 0x0710)
return "Marvell 88E6071";
}

return NULL;
}


Part of my Device Tree

ahb@80080000 {

usb0: usb@80080000 {
vbus-supply = <&reg_usb0_vbus>;
status = "okay";
};

usb1: usb@80090000 {
vbus-supply = <&reg_usb1_vbus>;
status = "okay";
};

mac0: ethernet@800f0000 {
phy-mode = "rmii";
pinctrl-names = "default";
pinctrl-0 = <&mac0_pins_a>;
//phy-supply = <&reg_fec_3v3>;
phy-reset-gpios = <&gpio4 13 0>;
phy-reset-duration = <100>;
status = "okay";

       ethernet0-port@0 {
                phy-handle = <&ethphy0>;

                fixed-link {
                    speed = <1000>;
                    full-duplex;
                    };

};
};

mac1: ethernet@800f4000 {
phy-mode = "rmii";
pinctrl-names = "default";
pinctrl-0 = <&mac1_pins_a>;
status = "okay";

            ethernet1-port@1 {
                phy-handle = <&ethphy1>;

                fixed-link {
                    speed = <1000>;
                    full-duplex;
                    };
};
    };

    };

/*
 *   Marvell Distributed Switch Architecture Device Tree Bindings
 *
 *   A DSA node can contain multiple switch chips which are therefore
child nodes of
 *   the parent DSA node. The maximum number of allowed child nodes is 4
 */

dsa@0 {
        compatible = "marvell,dsa";
        #address-cells = <2>;
        #size-cells = <0>;

        interrupts = <10>;
        //dsa,ethernet = <&ethphy1>;
        //dsa,ethernet = <&eth1>;
        dsa,ethernet = <&mac1>;
        //dsa,ethernet = <&mac0>;
        dsa,mii-bus = <&mdio_bus>;

        switch@0 {
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5 0>;   /* MDIO address 5, switch 0 in tree */

            port@0 {
                reg = <0>;
                label = "lan1";
                phy-handle = <&ethphy1>;
            };

            port@1 {
                reg = <1>;
                label = "lan2";
            };

            port@2 {
                reg = <2>;
                label = "lan3";
            };

            port@3 {
                reg = <3>;
                label = "lan4";
            };

            port@4 {
                reg = <4>;
                label = "lan5";
            };

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



eth3: eth3 {
    status = "okay";
    ethernet1-port@1 {
        phy-handle = <&ethphy1>;

        fixed-link {
                speed = <1000>;
                full-duplex;
            };
    };
};

mdio_bus: mdio@800f0040 {
        #address-cells = <1>;
        #size-cells = <0>;
   device_type = "mdio";
        //reg = <24520 20>;
        //reg = <0xd0072004 0x4>;
        compatible = "fsl,gianfar-mdio";
        //compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
        //reg = <0xe00 0x188>;
        reg = <0x800f0040 0x188>;
        status = "okay";

         ethphy0: ethernet-phy@0 {

                compatible = "fsl,gianfar-mdio";
                device_type = "network";
                model = "FEC";

                reg = <0>;
         };

         ethphy1: ethernet-phy@1 {

                 compatible = "fsl,gianfar-mdio";
                 device_type = "network";
                 model = "FEC";

                 reg = <1>;
                };
                 //reg = <0xff>; */ /* No PHY attached */
                 //speed = <1000>;
                 //duple = <1>;
       };

dmesg Output

[   19.759175] fep->mii_bus->name=fec_enet_mii_bus
[   19.842656] fec 800f4000.ethernet eth1: Freescale FEC PHY driver
[Micrel KSZ8041] (mii_bus:phy_addr=800f0000.etherne:03, irq=-1)
[   19.887013] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   20.900994] libphy: 800f0000.etherne:01 - Link is Up - 100/Full
[   20.907002] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>[   21.198275] systemd-journald[161]: Received SIGUSR1
[   23.066029] !!!!!enter dsa_init_module!!!!!
[   23.134637] !!!!Enter dsa Probe!!!!!
[   23.138256] Distributed Switch Architecture driver version 0.1
[   23.214204] !!!!!Enter dsa_of_probe!!!!!
[   23.218323] !!!!!mdio->name=mdio mdio->type=mdio
mdio->full_name=/mdio@800f0040 !!!!!
[   23.330114] !!!!!np->name=dsa np->type=<NULL> np->full_name=/dsa@0 !!!!!
[   23.336859] !!!!before of_mdio_find_bus!!!!!
[   23.433145] !!!!!enter of_mdio_find_bus!!!!!
[   23.437464] !!!!!enter of_mdio_bus_match!!!!!
[   23.590106] !!!!!enter of_mdio_bus_match!!!!!
[   23.594510] !!!!!enter of_mdio_bus_match!!!!!
[   23.598881] !!!!Leave of_mdio_find_bus !!!!!
[   23.855136] !!!!before of_parse_phandle dsa,ethernet!!!!!
[   23.898976] !!!!before of find_device_by_node!!!!!
[   23.948053] !!!!!ethernet->name=ethernet ethernet->type=<NULL>
ethernet->full_name=/ahb@80080000/ethernet@800f4000 !!!!!
[   24.050100] !!!!! enter of_find_device_by_node !!!!!
[   24.055150] !!!!! Leave of_find_device_by_node dev=c790fe10 !!!!!
[   24.189562] !!!!! dev->init_name=(null) !!!!!
[   24.230110]
[   24.230110] before to_platform_device test->name=800f4000.ethernet
[   24.237904] !!!!before of kzalloc!!!!!
[   24.331061] !!!!before pd->netdev!!!!!
[   24.420120] !!!!before dev_to_net_device!!!!!
[   24.424536] !!!!dev_put(dev)!!!!!
[   24.427864] !!!!kzalloc!!!!!
[   24.515908] !!!!platform_set_drv_data!!!!!
[   24.594206] !!!!!enter dev_to_mii_bus!!!!!
[   24.598353] !!!!!enter dsa_switch_setup!!!!!
[   24.667627] !!!!name=!!!!!
[   24.710108] !!!!bus->name=Freescale PowerQUICC MII Bus!!!!!
[   24.715729] !!!!pd->sw_addr=5!!!!!
[   24.719138] !!!!Enter dsa_switch_probe!!!!!
[   24.752377] libphy: 800f0000.etherne:03 - Link is Up - 100/Full
[   24.758382] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   24.920168] !!!!Leave dsa_switch_probe!!!!!
[   24.924406] eth1[0]: could not detect attached switch
[   24.929476] eth1[0]: couldn't create dsa switch instance (error -22)
[   25.090113] !!!!Leave dsa Probe!!!!!
[   25.120641] !!!!!leave dsa_init_module!!!!!

Best regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-17 15:58           ` Oliver Graute
@ 2014-11-17 16:09             ` Andrew Lunn
  2014-11-18  8:30               ` Oliver Graute
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2014-11-17 16:09 UTC (permalink / raw)
  To: Oliver Graute; +Cc: netdev, andrew, Florian Fainelli, buytenh

> dsa@0 {
>         compatible = "marvell,dsa";
>         #address-cells = <2>;
>         #size-cells = <0>;
> 
>         interrupts = <10>;
>         //dsa,ethernet = <&ethphy1>;
>         //dsa,ethernet = <&eth1>;
>         dsa,ethernet = <&mac1>;
>         //dsa,ethernet = <&mac0>;
>         dsa,mii-bus = <&mdio_bus>;
> 
>         switch@0 {
>             #address-cells = <1>;
>             #size-cells = <0>;
>             reg = <5 0>;   /* MDIO address 5, switch 0 in tree */

Hi Oliver

How do you have the strapping pins on the switch set? They determine
what address on the mdio bus the chip responds to.

Does your u-boot have commands to read arbitrary phy registers?
Generally, reading a register that does not exist gives 0xffff.  So
try some reads at different addresses and see what you can find.

    Andrew

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-13 15:15   ` Oliver Graute
  2014-11-13 20:03     ` Florian Fainelli
@ 2014-11-17 16:45     ` Fabio Estevam
  2014-11-17 16:54       ` Oliver Graute
  1 sibling, 1 reply; 16+ messages in thread
From: Fabio Estevam @ 2014-11-17 16:45 UTC (permalink / raw)
  To: Oliver Graute; +Cc: Florian Fainelli, netdev@vger.kernel.org

On Thu, Nov 13, 2014 at 1:15 PM, Oliver Graute <oliver.graute@gmail.com> wrote:


> mdio_bus: mdio@800f0040 {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         device_type = "mdio";
>         //compatible = "fsl,gianfar-mdio";
>         compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";

These compatible strings are for PowerQuicc devices, not for mx28.

>         reg = <0x800f0040 0x188>;
>         status = "okay";
>
>          ethphy0: ethernet-phy@0 {
>                 compatible = "fsl,gianfar-mdio";

Same here.

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-17 16:45     ` Fabio Estevam
@ 2014-11-17 16:54       ` Oliver Graute
  2014-11-18  0:39         ` Fabio Estevam
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-17 16:54 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Florian Fainelli, netdev@vger.kernel.org

Hello Fabio,

and what's the correct one for the imx28 CPU?

Best Regards,

Oliver


On Mon, Nov 17, 2014 at 5:45 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Thu, Nov 13, 2014 at 1:15 PM, Oliver Graute <oliver.graute@gmail.com> wrote:
>
>
>> mdio_bus: mdio@800f0040 {
>>         #address-cells = <1>;
>>         #size-cells = <0>;
>>         device_type = "mdio";
>>         //compatible = "fsl,gianfar-mdio";
>>         compatible = "fsl,mpc875-fec-mdio", "fsl,pq1-fec-mdio";
>
> These compatible strings are for PowerQuicc devices, not for mx28.
>
>>         reg = <0x800f0040 0x188>;
>>         status = "okay";
>>
>>          ethphy0: ethernet-phy@0 {
>>                 compatible = "fsl,gianfar-mdio";
>
> Same here.

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-17 16:54       ` Oliver Graute
@ 2014-11-18  0:39         ` Fabio Estevam
  0 siblings, 0 replies; 16+ messages in thread
From: Fabio Estevam @ 2014-11-18  0:39 UTC (permalink / raw)
  To: Oliver Graute; +Cc: Florian Fainelli, netdev@vger.kernel.org

Hi Oliver,

On Mon, Nov 17, 2014 at 2:54 PM, Oliver Graute <oliver.graute@gmail.com> wrote:
> Hello Fabio,
>
> and what's the correct one for the imx28 CPU?

I am not familiar with it, sorry.

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-17 16:09             ` Andrew Lunn
@ 2014-11-18  8:30               ` Oliver Graute
  2014-11-18 18:23                 ` Florian Fainelli
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-18  8:30 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev@vger.kernel.org, Florian Fainelli, buytenh

> Hi Oliver
>
> How do you have the strapping pins on the switch set? They determine
> what address on the mdio bus the chip responds to.

On the circuit diagram the PIN 54  (P5_IND1/P5ID1) is set to
"Configuration Address: 0101"
P5_MODE[3:0]=0111 = Single RMII MAC Mode (100Mbps FD with 50 MHz clock input)
PIN 59 R1_LED/NO_CPU Configuration: CPU is attached SMI address is 0x10 to 0x1F

But what is the mdio address of the whole switch? or can I only
address individual phy ports?

The Port 5 Pins of the  Marvell 88e6071 switch are connected via RMII
to a Micrel Phy KSZ8051. And this Micrel Phy is connected to the MAC
of IMX28 CPU (also RMII).

> Does your u-boot have commands to read arbitrary phy registers?
> Generally, reading a register that does not exist gives 0xffff.  So
> try some reads at different addresses and see what you can find.

I can read phy registers from the Marvell switch by a Tool called
mii_demo it is a bit like mii_diag. It can read PHY registers from the
switch Ports via IOCTL.
This is working via some undefined ioctl SIOCSMIIREG2, SIOCGMIIPHY2.


Example:
#read SMI PHY Command Register 18 from Switch with IEEE 802.3 Clause 22
mii_demo -rd eth0 23 0x18

0x1680

Best regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-18  8:30               ` Oliver Graute
@ 2014-11-18 18:23                 ` Florian Fainelli
  2014-11-19  7:49                   ` Oliver Graute
  0 siblings, 1 reply; 16+ messages in thread
From: Florian Fainelli @ 2014-11-18 18:23 UTC (permalink / raw)
  To: Oliver Graute, Andrew Lunn; +Cc: netdev@vger.kernel.org, buytenh

On 11/18/2014 12:30 AM, Oliver Graute wrote:
>> Hi Oliver
>>
>> How do you have the strapping pins on the switch set? They determine
>> what address on the mdio bus the chip responds to.
> 
> On the circuit diagram the PIN 54  (P5_IND1/P5ID1) is set to
> "Configuration Address: 0101"
> P5_MODE[3:0]=0111 = Single RMII MAC Mode (100Mbps FD with 50 MHz clock input)
> PIN 59 R1_LED/NO_CPU Configuration: CPU is attached SMI address is 0x10 to 0x1F
> 
> But what is the mdio address of the whole switch? or can I only
> address individual phy ports?

You should specify in the Device Tree the switch pseudo-PHY address,
typically 16 for Marvell switches. You can still access the individual
ports' PHY addresses using address 0 through N.

> 
> The Port 5 Pins of the  Marvell 88e6071 switch are connected via RMII
> to a Micrel Phy KSZ8051. And this Micrel Phy is connected to the MAC
> of IMX28 CPU (also RMII).
> 
>> Does your u-boot have commands to read arbitrary phy registers?
>> Generally, reading a register that does not exist gives 0xffff.  So
>> try some reads at different addresses and see what you can find.
> 
> I can read phy registers from the Marvell switch by a Tool called
> mii_demo it is a bit like mii_diag. It can read PHY registers from the
> switch Ports via IOCTL.
> This is working via some undefined ioctl SIOCSMIIREG2, SIOCGMIIPHY2.
> 
> 
> Example:
> #read SMI PHY Command Register 18 from Switch with IEEE 802.3 Clause 22
> mii_demo -rd eth0 23 0x18
> 
> 0x1680
> 
> Best regards,
> 
> Oliver
> 

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-18 18:23                 ` Florian Fainelli
@ 2014-11-19  7:49                   ` Oliver Graute
  2014-11-19 15:08                     ` Andrew Lunn
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Graute @ 2014-11-19  7:49 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: Andrew Lunn, netdev@vger.kernel.org, buytenh

On Tue, Nov 18, 2014 at 7:23 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 11/18/2014 12:30 AM, Oliver Graute wrote:
>>> Hi Oliver
>>>
>>> How do you have the strapping pins on the switch set? They determine
>>> what address on the mdio bus the chip responds to.
>>
>> On the circuit diagram the PIN 54  (P5_IND1/P5ID1) is set to
>> "Configuration Address: 0101"
>> P5_MODE[3:0]=0111 = Single RMII MAC Mode (100Mbps FD with 50 MHz clock input)
>> PIN 59 R1_LED/NO_CPU Configuration: CPU is attached SMI address is 0x10 to 0x1F
>>
>> But what is the mdio address of the whole switch? or can I only
>> address individual phy ports?
>
> You should specify in the Device Tree the switch pseudo-PHY address,
> typically 16 for Marvell switches. You can still access the individual
> ports' PHY addresses using address 0 through N.
>

How do I do that exactly? do you have an example Device Tree Snippet?


Best regards,

Oliver

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

* Re: Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface
  2014-11-19  7:49                   ` Oliver Graute
@ 2014-11-19 15:08                     ` Andrew Lunn
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2014-11-19 15:08 UTC (permalink / raw)
  To: Oliver Graute
  Cc: Florian Fainelli, Andrew Lunn, netdev@vger.kernel.org, buytenh

On Wed, Nov 19, 2014 at 08:49:50AM +0100, Oliver Graute wrote:
> On Tue, Nov 18, 2014 at 7:23 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> > On 11/18/2014 12:30 AM, Oliver Graute wrote:
> >>> Hi Oliver
> >>>
> >>> How do you have the strapping pins on the switch set? They determine
> >>> what address on the mdio bus the chip responds to.
> >>
> >> On the circuit diagram the PIN 54  (P5_IND1/P5ID1) is set to
> >> "Configuration Address: 0101"
> >> P5_MODE[3:0]=0111 = Single RMII MAC Mode (100Mbps FD with 50 MHz clock input)
> >> PIN 59 R1_LED/NO_CPU Configuration: CPU is attached SMI address is 0x10 to 0x1F
> >>
> >> But what is the mdio address of the whole switch? or can I only
> >> address individual phy ports?
> >
> > You should specify in the Device Tree the switch pseudo-PHY address,
> > typically 16 for Marvell switches. You can still access the individual
> > ports' PHY addresses using address 0 through N.
> >
> 
> How do I do that exactly? do you have an example Device Tree Snippet?

Here is an example for a Dlink DIR665.

http://www.spinics.net/lists/arm-kernel/msg374004.html

you need to modify this line:

reg = <0 0>;	/* MDIO address 0, switch 0 in tree */

Change the first 0 to 0x10.

       Andrew

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

end of thread, other threads:[~2014-11-19 15:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 13:07 Device Tree Binding for Marvell DSA Switch on imx28 board over Mdio Interface Oliver Graute
2014-11-12 19:19 ` Florian Fainelli
2014-11-13 15:15   ` Oliver Graute
2014-11-13 20:03     ` Florian Fainelli
2014-11-14  7:39       ` Oliver Graute
2014-11-14 14:52         ` Oliver Graute
2014-11-14 17:09           ` Florian Fainelli
2014-11-17 15:58           ` Oliver Graute
2014-11-17 16:09             ` Andrew Lunn
2014-11-18  8:30               ` Oliver Graute
2014-11-18 18:23                 ` Florian Fainelli
2014-11-19  7:49                   ` Oliver Graute
2014-11-19 15:08                     ` Andrew Lunn
2014-11-17 16:45     ` Fabio Estevam
2014-11-17 16:54       ` Oliver Graute
2014-11-18  0:39         ` Fabio Estevam

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).