T1042 Device Tree Fman RGMII-ID

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

T1042 Device Tree Fman RGMII-ID

跳至解决方案
6,009 次查看
stefanlange
Contributor III

Hello NXP team,

 

 

we have a design with a custom NXP T1042 PowerPC Module located on a custom baseboard. 

Both module and baseboard are new designs.

 

 

I here have a support request regarding the Fman device tree content and syntax.

 

 

There are 5 Ethernet Interfaces in use, 3 via SGMII, 2 via RGMII.

 

 

The RGMIIs require editing the specific TX and RX RGMII delays in the phy.

 

 

I have implemented this in the device tree to my best guess (see attached).

 

 

However it seems the parameter

phy-connection-type = "rgmii-id";

is ignored during kernel boot, and thus the RGMII delay values are not set.

 

 

I also changed the parameter phy-connection-type = "sgmii"; to phy-connection-type = "aaa"; for a test

The debug print still remained at "sgmii"; it seems phy-connection-type as put in the device tree is not used at all.

 

 

See attached my .dts file and a bootlog with debug prints and comments (marked with "?").

 

 

I figure I wrote the .dts wrong in some way. I could not find a different device tree that I could use as a template.

Maybe you can shed some light.

 

 

Thank you and best regards,

Stefan

Original Attachment has been moved to: tqmt1042.dts.zip

Original Attachment has been moved to: TQMT1042_Bootlog.txt.zip

标签 (1)
1 解答
3,448 次查看
stefanlange
Contributor III

Hello all,

for what it's worth, I wrote a quick dirty patch for myself to solve this issue for myself.

See below.

Best regards,

Stefan

####################

commit c6dffe1f34476fbb0653328521ab4124f204b007

Author: Stefan Lange <s.lange@gateware.de>

Date:   Wed Jul 13 17:37:34 2016 +0200

        Workaround to enable rgmii-id phy-connection-type with QorIQ Frame Manag

        Dirty Workaround:

        Get the true external PHY's connection type

        Workaround as FMAN overwrites the "phy-connection-type"-property

        with "rgmii" if "rgmii-id" is noted in the device tree.

        The new variable "external_phy_if" is successively used in the

        "init_phy" function further above in this .c-file.

        See also: https://community.nxp.com/thread/398029

diff --git a/arch/powerpc/boot/dts/fsl/tqmt1042.dts b/arch/powerpc/boot/dts/fsl/

index cde8d2f..e81d236 100644

--- a/arch/powerpc/boot/dts/fsl/tqmt1042.dts

+++ b/arch/powerpc/boot/dts/fsl/tqmt1042.dts

@@ -263,12 +263,14 @@

                        enet3: ethernet@e6000 {

                                phy-handle = <&phy_rgmii_0>;

                                phy-connection-type = "rgmii-id";

+                               external-phy-connection-type = "rgmii-id";

                        };

                        /* MAC5: RGMII DP83867 */

                        enet4: ethernet@e8000 {

                                phy-handle = <&phy_rgmii_1>;

                                phy-connection-type = "rgmii-id";

+                               external-phy-connection-type = "rgmii-id";

                        };

                        /* external, dedicated MDIO */

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/fr

index e33d9d2..254e88c 100644

--- a/drivers/net/ethernet/freescale/fman/mac.c

+++ b/drivers/net/ethernet/freescale/fman/mac.c

@@ -67,6 +67,7 @@ struct mac_priv_s {

        struct fixed_phy_status         *fixed_link;

        u16                             speed;

        u16                             max_speed;

+       phy_interface_t                 external_phy_if;

        int (*enable)(struct fman_mac *mac_dev, enum comm_mode mode);

        int (*disable)(struct fman_mac *mac_dev, enum comm_mode mode);

@@ -476,8 +477,14 @@ static int init_phy(struct net_device *net_dev,

        struct phy_device       *phy_dev;

        struct mac_priv_s       *priv = mac_dev->priv;

-       phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

+       if (priv->external_phy_if) {

+               phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

+                                priv->external_phy_if);

+       }

+       else {

+               phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

                                 priv->phy_if);

+       }

        if (!phy_dev) {

                netdev_err(net_dev, "Could not connect to PHY\n");

                return -ENODEV;

@@ -881,6 +888,23 @@ static int mac_probe(struct platform_device *_of_dev)

                priv->phy_if = str2phy(char_prop);

        }

+       /*

+        * Dirty Workaround:

+        * Get the true external PHY's connection type

+        * Workaround as FMAN overwrites the "phy-connection-type"-property

+        * with "rgmii" if "rgmii-id" is noted in the device tree.

+        * The new variable "external_phy_if" is successively used in the

+        * "init_phy" function further above in this .c-file.

+        * See also: https://community.nxp.com/thread/398029

+        */

+       char_prop = (const char *)of_get_property(mac_node,

+                                                 "external-phy-connection-type"

+       if (char_prop) {

+               dev_info(dev,"'external-phy-connection-type' property present in

+               dev_info(dev,"'external-phy-connection-type' set to %s \n", char

+               priv->external_phy_if = str2phy(char_prop);

+       }

+

        priv->speed             = phy2speed[priv->phy_if];

        priv->max_speed         = priv->speed;

        mac_dev->if_support     = DTSEC_SUPPORTED;

在原帖中查看解决方案

9 回复数
3,449 次查看
stefanlange
Contributor III

Hello all,

for what it's worth, I wrote a quick dirty patch for myself to solve this issue for myself.

See below.

Best regards,

Stefan

####################

commit c6dffe1f34476fbb0653328521ab4124f204b007

Author: Stefan Lange <s.lange@gateware.de>

Date:   Wed Jul 13 17:37:34 2016 +0200

        Workaround to enable rgmii-id phy-connection-type with QorIQ Frame Manag

        Dirty Workaround:

        Get the true external PHY's connection type

        Workaround as FMAN overwrites the "phy-connection-type"-property

        with "rgmii" if "rgmii-id" is noted in the device tree.

        The new variable "external_phy_if" is successively used in the

        "init_phy" function further above in this .c-file.

        See also: https://community.nxp.com/thread/398029

diff --git a/arch/powerpc/boot/dts/fsl/tqmt1042.dts b/arch/powerpc/boot/dts/fsl/

index cde8d2f..e81d236 100644

--- a/arch/powerpc/boot/dts/fsl/tqmt1042.dts

+++ b/arch/powerpc/boot/dts/fsl/tqmt1042.dts

@@ -263,12 +263,14 @@

                        enet3: ethernet@e6000 {

                                phy-handle = <&phy_rgmii_0>;

                                phy-connection-type = "rgmii-id";

+                               external-phy-connection-type = "rgmii-id";

                        };

                        /* MAC5: RGMII DP83867 */

                        enet4: ethernet@e8000 {

                                phy-handle = <&phy_rgmii_1>;

                                phy-connection-type = "rgmii-id";

+                               external-phy-connection-type = "rgmii-id";

                        };

                        /* external, dedicated MDIO */

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/fr

index e33d9d2..254e88c 100644

--- a/drivers/net/ethernet/freescale/fman/mac.c

+++ b/drivers/net/ethernet/freescale/fman/mac.c

@@ -67,6 +67,7 @@ struct mac_priv_s {

        struct fixed_phy_status         *fixed_link;

        u16                             speed;

        u16                             max_speed;

+       phy_interface_t                 external_phy_if;

        int (*enable)(struct fman_mac *mac_dev, enum comm_mode mode);

        int (*disable)(struct fman_mac *mac_dev, enum comm_mode mode);

@@ -476,8 +477,14 @@ static int init_phy(struct net_device *net_dev,

        struct phy_device       *phy_dev;

        struct mac_priv_s       *priv = mac_dev->priv;

-       phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

+       if (priv->external_phy_if) {

+               phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

+                                priv->external_phy_if);

+       }

+       else {

+               phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,

                                 priv->phy_if);

+       }

        if (!phy_dev) {

                netdev_err(net_dev, "Could not connect to PHY\n");

                return -ENODEV;

@@ -881,6 +888,23 @@ static int mac_probe(struct platform_device *_of_dev)

                priv->phy_if = str2phy(char_prop);

        }

+       /*

+        * Dirty Workaround:

+        * Get the true external PHY's connection type

+        * Workaround as FMAN overwrites the "phy-connection-type"-property

+        * with "rgmii" if "rgmii-id" is noted in the device tree.

+        * The new variable "external_phy_if" is successively used in the

+        * "init_phy" function further above in this .c-file.

+        * See also: https://community.nxp.com/thread/398029

+        */

+       char_prop = (const char *)of_get_property(mac_node,

+                                                 "external-phy-connection-type"

+       if (char_prop) {

+               dev_info(dev,"'external-phy-connection-type' property present in

+               dev_info(dev,"'external-phy-connection-type' set to %s \n", char

+               priv->external_phy_if = str2phy(char_prop);

+       }

+

        priv->speed             = phy2speed[priv->phy_if];

        priv->max_speed         = priv->speed;

        mac_dev->if_support     = DTSEC_SUPPORTED;

3,448 次查看
stefanlange
Contributor III

Hello NXP team,

this issue is still pending.

We would be glad about a hint.

Best regards,

Stefan

0 项奖励
回复
3,448 次查看
stefanlange
Contributor III

Hello Avinash,

still waiting on the reply from NXP.

With some ethernet PHYs it is possible to set the RGMII delay via external strapping resistors. This might be a fallback solution in your case.

Best regards,
Stefan

0 项奖励
回复
3,448 次查看
avinashh
Contributor III

Hi Stefan,

I am experiencing a similar problem with my P2041 processor RGMII port, my RGMII-0 is working but not at 1Gbps and my RGMII-1 is not working at all even after implementing the delays in the PHY registers in the U-boot.

Maybe if you get a solution to your problem, you can help us also,

the link to my service request is: RGMII ETHERNET port of P2041 processor is showing alive in uboot but not pinging in kern

Thanks

Avinash

0 项奖励
回复
3,448 次查看
bpe
NXP Employee
NXP Employee

Your observations are fully correct. T1042 has no internal delay on

RGMII signlas, See Note 2 to Table 48 of T1042 HW spec. You cannot

configure for it in any way. The interface type is configured at reset and cannot be

changed in software, see T1042RM, Table 4-11, fields EC1, EC2. For

this reason,  'phy-connection-type' property is there only for the sake of

completeness. The actual interface type is determined from the chip

registers that reflect RCW settings.


Have a great day,
Platon

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

0 项奖励
回复
3,448 次查看
stefanlange
Contributor III

Hello Platon,

thanks for your response.

This is in a way what I had expected.

But how can I set the external(!) RGMII phy's registers?

Best regards,

Stefan

3,448 次查看
bpe
NXP Employee
NXP Employee

In general, controlling a PHY is a burden of it's driver. Consult at your PHY manufacturer/documentation and driver

maintainer/source/documentation for supported methods of setting the PHY parameters.

Typically,  MAC/PHY interface type and parameters are fully static, thus internal delays are either

pin-configured at PHY reset, if the PHY has that option, or setup once by u-Boot. Linux actually don't

have to do anything with  it.


Have a great day,
Platon

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

0 项奖励
回复
3,448 次查看
stefanlange
Contributor III

Hello NXP team,

this issue is still pending.

We would be glad about a hint.

Best regards,

Stefan

3,448 次查看
stefanlange
Contributor III

Hello Platon,

we are setting the PHY's internal delays in u-boot and the interface is working correctly in u-boot.

However once the ethernet interface is initialized / used in linux, e.g. via ifconfig fm1-gb3 <ipaddr>, linux resets thePHY and the delay settings are lost.

The DP83867 driver accounts for this, it has the option of setting tx-internal-delay, rx-internal-delay via the device tree.

But: The respective routines in the driver are called only if the ethernet device tree node is set to

phy-connection-type = "rgmii-id";

As the phy-connection-type attribute is ignored and hard-set to "rgmii", is there a way I can achieve the DP83867 sees phy-connection-type = "rgmii-id", or is there any other smart way to solve this?

Thanks & best regards,

Stefan