Commit 572de608 authored by Sean Wang's avatar Sean Wang Committed by David S. Miller

net: ethernet: mediatek: add extension of phy-mode for TRGMII

adds PHY-mode "trgmii" as an extension for the operation
mode of the PHY interface for PHY_INTERFACE_MODE_TRGMII.
and adds a variable trgmii inside mtk_mac as the indication
to make the difference between the MAC connected to internal
switch or connected to external PHY by the given configuration
on the board and then to perform the corresponding setup on
TRGMII hardware module.
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60cd6e63
...@@ -244,6 +244,8 @@ static int mtk_phy_connect(struct mtk_mac *mac) ...@@ -244,6 +244,8 @@ static int mtk_phy_connect(struct mtk_mac *mac)
return -ENODEV; return -ENODEV;
switch (of_get_phy_mode(np)) { switch (of_get_phy_mode(np)) {
case PHY_INTERFACE_MODE_TRGMII:
mac->trgmii = true;
case PHY_INTERFACE_MODE_RGMII_TXID: case PHY_INTERFACE_MODE_RGMII_TXID:
case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_ID:
......
...@@ -529,6 +529,8 @@ struct mtk_eth { ...@@ -529,6 +529,8 @@ struct mtk_eth {
* @hw: Backpointer to our main datastruture * @hw: Backpointer to our main datastruture
* @hw_stats: Packet statistics counter * @hw_stats: Packet statistics counter
* @phy_dev: The attached PHY if available * @phy_dev: The attached PHY if available
* @trgmii Indicate if the MAC uses TRGMII connected to internal
switch
*/ */
struct mtk_mac { struct mtk_mac {
int id; int id;
...@@ -539,6 +541,7 @@ struct mtk_mac { ...@@ -539,6 +541,7 @@ struct mtk_mac {
struct phy_device *phy_dev; struct phy_device *phy_dev;
__be32 hwlro_ip[MTK_MAX_LRO_IP_CNT]; __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
int hwlro_ip_cnt; int hwlro_ip_cnt;
bool trgmii;
}; };
/* the struct describing the SoC. these are declared in the soc_xyz.c files */ /* the struct describing the SoC. these are declared in the soc_xyz.c files */
......
...@@ -80,6 +80,7 @@ typedef enum { ...@@ -80,6 +80,7 @@ typedef enum {
PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XGMII,
PHY_INTERFACE_MODE_MOCA, PHY_INTERFACE_MODE_MOCA,
PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_QSGMII,
PHY_INTERFACE_MODE_TRGMII,
PHY_INTERFACE_MODE_MAX, PHY_INTERFACE_MODE_MAX,
} phy_interface_t; } phy_interface_t;
...@@ -123,6 +124,8 @@ static inline const char *phy_modes(phy_interface_t interface) ...@@ -123,6 +124,8 @@ static inline const char *phy_modes(phy_interface_t interface)
return "moca"; return "moca";
case PHY_INTERFACE_MODE_QSGMII: case PHY_INTERFACE_MODE_QSGMII:
return "qsgmii"; return "qsgmii";
case PHY_INTERFACE_MODE_TRGMII:
return "trgmii";
default: default:
return "unknown"; return "unknown";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment