|
21 | 21 | #include <linux/io.h>
|
22 | 22 | #include <linux/module.h>
|
23 | 23 | #include <linux/of_mdio.h>
|
| 24 | +#include <linux/of_net.h> |
24 | 25 | #include <linux/of_address.h>
|
25 | 26 | #include <linux/if_vlan.h>
|
26 | 27 | #include <linux/ptp_classify.h>
|
@@ -707,6 +708,7 @@ struct gbe_slave {
|
707 | 708 | u32 link_interface;
|
708 | 709 | u32 mac_control;
|
709 | 710 | u8 phy_port_t;
|
| 711 | + struct device_node *node; |
710 | 712 | struct device_node *phy_node;
|
711 | 713 | struct ts_ctl ts_ctl;
|
712 | 714 | struct list_head slave_list;
|
@@ -2322,6 +2324,21 @@ static int gbe_slave_open(struct gbe_intf *gbe_intf)
|
2322 | 2324 | has_phy = true;
|
2323 | 2325 | phy_mode = PHY_INTERFACE_MODE_SGMII;
|
2324 | 2326 | slave->phy_port_t = PORT_MII;
|
| 2327 | + } else if (slave->link_interface == RGMII_LINK_MAC_PHY) { |
| 2328 | + has_phy = true; |
| 2329 | + phy_mode = of_get_phy_mode(slave->node); |
| 2330 | + /* if phy-mode is not present, default to |
| 2331 | + * PHY_INTERFACE_MODE_RGMII |
| 2332 | + */ |
| 2333 | + if (phy_mode < 0) |
| 2334 | + phy_mode = PHY_INTERFACE_MODE_RGMII; |
| 2335 | + |
| 2336 | + if (!phy_interface_mode_is_rgmii(phy_mode)) { |
| 2337 | + dev_err(priv->dev, |
| 2338 | + "Unsupported phy mode %d\n", phy_mode); |
| 2339 | + return -EINVAL; |
| 2340 | + } |
| 2341 | + slave->phy_port_t = PORT_MII; |
2325 | 2342 | } else if (slave->link_interface == XGMII_LINK_MAC_PHY) {
|
2326 | 2343 | has_phy = true;
|
2327 | 2344 | phy_mode = PHY_INTERFACE_MODE_NA;
|
@@ -2947,6 +2964,7 @@ static int init_slave(struct gbe_priv *gbe_dev, struct gbe_slave *slave,
|
2947 | 2964 | slave->link_interface = SGMII_LINK_MAC_PHY;
|
2948 | 2965 | }
|
2949 | 2966 |
|
| 2967 | + slave->node = node; |
2950 | 2968 | slave->open = false;
|
2951 | 2969 | if ((slave->link_interface == SGMII_LINK_MAC_PHY) ||
|
2952 | 2970 | (slave->link_interface == RGMII_LINK_MAC_PHY) ||
|
|
0 commit comments