dts for P2041 connect to ethernet switch?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dts for P2041 connect to ethernet switch?

77,998 Views
juncai
Contributor II

I have a custom board with Marvell 88E6097 ethernet switch which is connected directly to freescale P2041 processor.

nxp.png

I use the kernel source from  The Linux Kernel Archives , for debug, I only use eth0 in the dts like this:

        fman@400000 {
            ethernet@e0000 {
                /* phy-handle = <&phy_sgmii_4>; */
                phy-connection-type = "sgmii";
                sgmii-autoneg-disable = <1>;
                sgmii-fixed-link = <1>;
            };
            /* ethernet@e2000 { */
                /* phy-handle = <&phy_sgmii_5>; */
                /* phy-connection-type = "sgmii"; */
            /* }; */
    };

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

        interrupts = <10>;
        dsa,ethernet = <&enet0>;
        dsa,mii-bus = <&mdio0>;

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

            port@0 {
                reg = <0>;
                label = "lan1";
            };

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

            port@4 {
                reg = <8>;
                label = "cpu";
                /* phy-handle = "&phy_sgmii_4"; */
            };
        };
    };

check the log, I found phylib find the device, and DSA can't found the etherenet dev.

libphy: Fixed MDIO Bus: probed
libphy: mdio_driver_register: mv88e6085
iommu: Adding device ffe488000.port to group 21
libphy: Freescale PowerQUICC MII Bus: probed
fsl_mac ffe4e0000.ethernet: FMan dTSEC version: 0x08240101
fsl_mac ffe4e0000.ethernet: FMan MAC address: 00:04:9f:ef:05:01

Distributed Switch Architecture driver version 0.1
junote dsa_of_probe device tree done
junote dsa_of_probe net device node = ethernet done
junote not find dev

use log to check the blocking position, I found the function of_find_net_device_by_node in dsa.c.

check again, I found it blocked by class_find_device in net_sysfs.c

so there should be some error with dts file about ethernet config. please help me to check it. thanks.

Labels (1)
Tags (1)
0 Kudos
Reply
3 Replies

3,951 Views
kwagyeman
Contributor I

You just need to modify the PFE firmware in the pfeng_netif_logif_create function to assign the device tree handle to fix this error:

Change:

/* Set the sysfs physical device reference for the network logical device */
SET_NETDEV_DEV(netdev, dev);


To:

/* Set the sysfs physical device reference for the network logical device */
SET_NETDEV_DEV(netdev, dev);

/* Set the device tree node so dsa works. */
netdev->dev.of_node = netif_cfg->dn;

 

0 Kudos
Reply

4,764 Views
juncai
Contributor II

thanks, I update dts file as follows:

fman@400000 {
            eth0:ethernet@e0000 {
                /* phy-handle = <&phy_sgmii_4>; */
                phy-connection-type = "sgmii";
                /* sgmii-autoneg-disable = <1>; */
                /* sgmii-fixed-link = <1>; */
                fixed-link {
                    speed = <1000>;
                    full-duplex;
                };
            };
            eth1:ethernet@e2000 {
                /* phy-handle = <&phy_sgmii_5>; */
                phy-connection-type = "sgmii";
                /* sgmii-autoneg-disable = <1>; */
                /* sgmii-fixed-link = <1>; */
                fixed-link {
                    speed = <1000>;
                    full-duplex;
                };
            };

            mdio@e1120 {
                switch@4{
                    compatible = "marvell,mv88e6085";
                    #address-cell = <1>;
                    #size-cell = <0>;
                    reg = <4>;

                    dsa,member = <0 0>;

                    ports {
                        #address-cells = <1>;
                        #size-cells = <0>;

                        ports@0 {
                            reg = <0>;
                            label = "lan0";
                        };

                        ports@1 {
                            reg = <1>;
                            label = "lan1";
                        };
                        ports@8 {
                            reg = <8>;
                            label = "cpu";
                            ethernet = <&eth0>;
                            phy-mode = "sgmii";
                            fixed-link {
                                speed = <1000>;
                                full-duplex;
                            };
                        ports@9 {
                            reg = <9>;
                            label = "cpu";
                            ethernet = <&eth1>;
                            phy-mode = "sgmii";
                            fixed-link {
                                speed = <1000>;
                                full-duplex;
                            };

                        };
                    };
                };
            };
        };


    };

and get phy information:

libphy: Fixed MDIO Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus mdio@ffe4e1120:04: mdio_device_register
mv88e6085 mdio@ffe4e1120:04: switch 0x99 detected: Marvell 88E6097/88E6097F, revision 2

fsl-hv: no hypervisor found
ipip: IPv4 and MPLS over IPv4 tunneling driver
ip_tables: (C) 2000-2006 Netfilter Core Team
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
8021q: 802.1Q VLAN Support v1.8
Key type dns_resolver registered
mv88e6085 mdio@ffe4e1120:04: switch 0x99 detected: Marvell 88E6097/88E6097F, revision 2
libphy: /soc@ffe000000/fman@400000/mdio@e1120/switch@4: probed
mmc0: new high speed SDHC card at address 1234
mmcblk0: mmc0:1234 SA08G 7.29 GiB (ro)
 mmcblk0: p1
mv88e6085 mdio@ffe4e1120:04: switch 0x99 detected: Marvell 88E6097/88E6097F, revision 2
libphy: /soc@ffe000000/fman@400000/mdio@e1120/switch@4: probed

change to another linux version, found problem as the first post, still block by of_find_net_device_by_node.

 

/ # ifconfig eth0 up
mv88e6085 mdio@ffe4e1120:04: switch 0x99 detected: Marvell 88E6097/88E6097F, revision 2
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
libphy: /soc@ffe000000/fman@400000/mdio@e1120/switch@4: probed
junote login dsa_ds_parse
junote login dsa_cpu_parse
junote leave  of_parse_phandle
/ # junote dsa_cpu_parse port 8, err= -517

0 Kudos
Reply

4,764 Views
Pavel
NXP Employee
NXP Employee

Datasheet for Marvell 88E6097 is not available. It requires NDA from Marvell.

Look at the following pages:

https://patchwork.codeaurora.org/patch/135019/

http://lists.infradead.org/pipermail/linux-arm-kernel/2016-December/474703.html

 

It looks like similar setting is needed for the 88E6097.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------