|
76 | 76 | #define AM65_CPSW_PORTN_REG_TS_CTL_LTYPE2 0x31C |
77 | 77 |
|
78 | 78 | #define AM65_CPSW_SGMII_CONTROL_REG 0x010 |
| 79 | +#define AM65_CPSW_SGMII_MR_ADV_ABILITY_REG 0x018 |
79 | 80 | #define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE BIT(0) |
80 | 81 |
|
81 | 82 | #define AM65_CPSW_CTL_VLAN_AWARE BIT(1) |
@@ -1496,9 +1497,14 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in |
1496 | 1497 | struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); |
1497 | 1498 | struct am65_cpsw_common *common = port->common; |
1498 | 1499 |
|
1499 | | - if (common->pdata.extra_modes & BIT(state->interface)) |
| 1500 | + if (common->pdata.extra_modes & BIT(state->interface)) { |
| 1501 | + if (state->interface == PHY_INTERFACE_MODE_SGMII) |
| 1502 | + writel(ADVERTISE_SGMII, |
| 1503 | + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); |
| 1504 | + |
1500 | 1505 | writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, |
1501 | 1506 | port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); |
| 1507 | + } |
1502 | 1508 | } |
1503 | 1509 |
|
1504 | 1510 | static void am65_cpsw_nuss_mac_link_down(struct phylink_config *config, unsigned int mode, |
@@ -1539,6 +1545,8 @@ static void am65_cpsw_nuss_mac_link_up(struct phylink_config *config, struct phy |
1539 | 1545 |
|
1540 | 1546 | if (speed == SPEED_1000) |
1541 | 1547 | mac_control |= CPSW_SL_CTL_GIG; |
| 1548 | + if (interface == PHY_INTERFACE_MODE_SGMII) |
| 1549 | + mac_control |= CPSW_SL_CTL_EXT_EN; |
1542 | 1550 | if (speed == SPEED_10 && phy_interface_mode_is_rgmii(interface)) |
1543 | 1551 | /* Can be used with in band mode only */ |
1544 | 1552 | mac_control |= CPSW_SL_CTL_EXT_EN; |
@@ -2143,15 +2151,31 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx) |
2143 | 2151 | port->slave.phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; |
2144 | 2152 | port->slave.phylink_config.mac_managed_pm = true; /* MAC does PM */ |
2145 | 2153 |
|
2146 | | - if (phy_interface_mode_is_rgmii(port->slave.phy_if)) { |
| 2154 | + switch (port->slave.phy_if) { |
| 2155 | + case PHY_INTERFACE_MODE_RGMII: |
| 2156 | + case PHY_INTERFACE_MODE_RGMII_ID: |
| 2157 | + case PHY_INTERFACE_MODE_RGMII_RXID: |
| 2158 | + case PHY_INTERFACE_MODE_RGMII_TXID: |
2147 | 2159 | phy_interface_set_rgmii(port->slave.phylink_config.supported_interfaces); |
2148 | | - } else if (port->slave.phy_if == PHY_INTERFACE_MODE_RMII) { |
| 2160 | + break; |
| 2161 | + |
| 2162 | + case PHY_INTERFACE_MODE_RMII: |
2149 | 2163 | __set_bit(PHY_INTERFACE_MODE_RMII, |
2150 | 2164 | port->slave.phylink_config.supported_interfaces); |
2151 | | - } else if (common->pdata.extra_modes & BIT(port->slave.phy_if)) { |
2152 | | - __set_bit(PHY_INTERFACE_MODE_QSGMII, |
2153 | | - port->slave.phylink_config.supported_interfaces); |
2154 | | - } else { |
| 2165 | + break; |
| 2166 | + |
| 2167 | + case PHY_INTERFACE_MODE_QSGMII: |
| 2168 | + case PHY_INTERFACE_MODE_SGMII: |
| 2169 | + if (common->pdata.extra_modes & BIT(port->slave.phy_if)) { |
| 2170 | + __set_bit(port->slave.phy_if, |
| 2171 | + port->slave.phylink_config.supported_interfaces); |
| 2172 | + } else { |
| 2173 | + dev_err(dev, "selected phy-mode is not supported\n"); |
| 2174 | + return -EOPNOTSUPP; |
| 2175 | + } |
| 2176 | + break; |
| 2177 | + |
| 2178 | + default: |
2155 | 2179 | dev_err(dev, "selected phy-mode is not supported\n"); |
2156 | 2180 | return -EOPNOTSUPP; |
2157 | 2181 | } |
@@ -2753,14 +2777,14 @@ static const struct am65_cpsw_pdata j7200_cpswxg_pdata = { |
2753 | 2777 | .quirks = 0, |
2754 | 2778 | .ale_dev_id = "am64-cpswxg", |
2755 | 2779 | .fdqring_mode = K3_RINGACC_RING_MODE_RING, |
2756 | | - .extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII), |
| 2780 | + .extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII) | BIT(PHY_INTERFACE_MODE_SGMII), |
2757 | 2781 | }; |
2758 | 2782 |
|
2759 | 2783 | static const struct am65_cpsw_pdata j721e_cpswxg_pdata = { |
2760 | 2784 | .quirks = 0, |
2761 | 2785 | .ale_dev_id = "am64-cpswxg", |
2762 | 2786 | .fdqring_mode = K3_RINGACC_RING_MODE_MESSAGE, |
2763 | | - .extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII), |
| 2787 | + .extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII) | BIT(PHY_INTERFACE_MODE_SGMII), |
2764 | 2788 | }; |
2765 | 2789 |
|
2766 | 2790 | static const struct of_device_id am65_cpsw_nuss_of_mtable[] = { |
|
0 commit comments