From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Khoronzhuk Date: Thu, 23 Jul 2015 14:16:40 +0300 Subject: [U-Boot] [PATCH 1/1] driver: net: keystone_net: fix phy mode configuration In-Reply-To: <1437642108-20155-1-git-send-email-mugunthanvnm@ti.com> References: <1437642108-20155-1-git-send-email-mugunthanvnm@ti.com> Message-ID: <55B0CD18.2090202@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, Mugunthan You are right, phy mode is a board property. But just for clarifying, does Ethernet SS, which contains SGMII on board, support another i/f mode except SGMII? Can it work w/o SerDes? On 23.07.15 12:01, Mugunthan V N wrote: > Phy mode is a board property and it can be different between > multiple board and ports, so it should not be hardcoded in > driver to one specific mode. So adding a field in eth_priv_t > structure to pass phy mode to driver. > > Cc: Murali Karicheri > Cc: Lokesh Vutla > Cc: Vitaly Andrianov > Cc: Joe Hershberger > Signed-off-by: Mugunthan V N > --- > arch/arm/include/asm/ti-common/keystone_net.h | 2 ++ > board/ti/ks2_evm/board_k2e.c | 8 ++++++++ > board/ti/ks2_evm/board_k2hk.c | 4 ++++ > board/ti/ks2_evm/board_k2l.c | 4 ++++ > drivers/net/keystone_net.c | 4 ++-- > 5 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/include/asm/ti-common/keystone_net.h b/arch/arm/include/asm/ti-common/keystone_net.h > index 011c03c..235a9fa 100644 > --- a/arch/arm/include/asm/ti-common/keystone_net.h > +++ b/arch/arm/include/asm/ti-common/keystone_net.h > @@ -11,6 +11,7 @@ > #define _KEYSTONE_NET_H_ > > #include > +#include > > /* EMAC */ > #ifdef CONFIG_KSNET_NETCP_V1_0 > @@ -239,6 +240,7 @@ struct eth_priv_t { > int phy_addr; > int slave_port; > int sgmii_link_type; > + phy_interface_t phy_if; > struct phy_device *phy_dev; > }; > > diff --git a/board/ti/ks2_evm/board_k2e.c b/board/ti/ks2_evm/board_k2e.c > index 43dfc48..59c6516 100644 > --- a/board/ti/ks2_evm/board_k2e.c > +++ b/board/ti/ks2_evm/board_k2e.c > @@ -47,6 +47,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 0, > .slave_port = 1, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC1", > @@ -54,6 +55,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 1, > .slave_port = 2, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC2", > @@ -61,6 +63,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 2, > .slave_port = 3, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC3", > @@ -68,6 +71,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 3, > .slave_port = 4, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC4", > @@ -75,6 +79,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 4, > .slave_port = 5, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC5", > @@ -82,6 +87,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 5, > .slave_port = 6, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC6", > @@ -89,6 +95,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 6, > .slave_port = 7, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2E_EMAC7", > @@ -96,6 +103,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 7, > .slave_port = 8, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > }; > > diff --git a/board/ti/ks2_evm/board_k2hk.c b/board/ti/ks2_evm/board_k2hk.c > index ed181f4..acd4205 100644 > --- a/board/ti/ks2_evm/board_k2hk.c > +++ b/board/ti/ks2_evm/board_k2hk.c > @@ -54,6 +54,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 0, > .slave_port = 1, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2HK_EMAC1", > @@ -61,6 +62,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 1, > .slave_port = 2, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2HK_EMAC2", > @@ -68,6 +70,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 2, > .slave_port = 3, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2HK_EMAC3", > @@ -75,6 +78,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 3, > .slave_port = 4, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > }; > > diff --git a/board/ti/ks2_evm/board_k2l.c b/board/ti/ks2_evm/board_k2l.c > index 729a193..41e7f70 100644 > --- a/board/ti/ks2_evm/board_k2l.c > +++ b/board/ti/ks2_evm/board_k2l.c > @@ -50,6 +50,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 0, > .slave_port = 1, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2L_EMAC1", > @@ -57,6 +58,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 1, > .slave_port = 2, > .sgmii_link_type = SGMII_LINK_MAC_PHY, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2L_EMAC2", > @@ -64,6 +66,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 2, > .slave_port = 3, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > { > .int_name = "K2L_EMAC3", > @@ -71,6 +74,7 @@ struct eth_priv_t eth_priv_cfg[] = { > .phy_addr = 3, > .slave_port = 4, > .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED, > + .phy_if = PHY_INTERFACE_MODE_SGMII, > }, > }; > > diff --git a/drivers/net/keystone_net.c b/drivers/net/keystone_net.c > index 0c5fdee..21e17bf 100644 > --- a/drivers/net/keystone_net.c > +++ b/drivers/net/keystone_net.c > @@ -559,11 +559,11 @@ int keystone2_emac_initialize(struct eth_priv_t *eth_priv) > /* Create phy device and bind it with driver */ > #ifdef CONFIG_KSNET_MDIO_PHY_CONFIG_ENABLE > phy_dev = phy_connect(mdio_bus, eth_priv->phy_addr, > - dev, PHY_INTERFACE_MODE_SGMII); > + dev, eth_priv->phy_if); > phy_config(phy_dev); > #else > phy_dev = phy_find_by_mask(mdio_bus, 1 << eth_priv->phy_addr, > - PHY_INTERFACE_MODE_SGMII); > + eth_priv->phy_if); > phy_dev->dev = dev; > #endif > eth_priv->phy_dev = phy_dev; >