summaryrefslogtreecommitdiff
path: root/board/gdsys
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2022-04-07 01:33:08 +0300
committerRamon Fried <ramon@neureality.ai>2022-04-10 08:44:13 +0300
commite24b58f5ed4f9a0b5b1c80a5f35aa71fcad7f233 (patch)
treecb51b913a077436d179a8a5ad5547c876320f525 /board/gdsys
parentb638814e91f772beb1c05e4d04cf6513ac37af59 (diff)
downloadu-boot-e24b58f5ed4f9a0b5b1c80a5f35aa71fcad7f233.tar.xz
net: phy: don't require PHY interface mode during PHY creation
Currently we require PHY interface mode to be known when finding/creating the PHY - the functions * phy_connect_phy_id() * phy_device_create() * create_phy_by_mask() * search_for_existing_phy() * get_phy_device_by_mask() * phy_find_by_mask() all require the interface parameter, but the only thing done with it is that it is assigned to phydev->interface. This makes it impossible to find a PHY device without overwriting the set mode. Since the interface mode is not used during .probe() and should be used at first in .config(), drop the interface parameter from these functions. Make the default value of phydev->interface (in phy_device_create()) to be PHY_INTERFACE_MODE_NA. Move the interface parameter to phy_connect_dev(), where it should be. Change all occurrences treewide. In occurrences where we don't call phy_connect_dev() for some reason (they only configure the PHY without connecting it to an ethernet controller), set phydev->interface = value from phy_find_by_mask call. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Diffstat (limited to 'board/gdsys')
-rw-r--r--board/gdsys/a38x/controlcenterdc.c7
-rw-r--r--board/gdsys/a38x/ihs_phys.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c
index 7d65400ccb..ccebba7272 100644
--- a/board/gdsys/a38x/controlcenterdc.c
+++ b/board/gdsys/a38x/controlcenterdc.c
@@ -194,11 +194,12 @@ void init_host_phys(struct mii_dev *bus)
for (k = 0; k < 2; ++k) {
struct phy_device *phydev;
- phydev = phy_find_by_mask(bus, 1 << k,
- PHY_INTERFACE_MODE_SGMII);
+ phydev = phy_find_by_mask(bus, 1 << k);
- if (phydev)
+ if (phydev) {
+ phydev->interface = PHY_INTERFACE_MODE_SGMII;
phy_config(phydev);
+ }
}
}
diff --git a/board/gdsys/a38x/ihs_phys.c b/board/gdsys/a38x/ihs_phys.c
index e09c0006b7..60a5c37aef 100644
--- a/board/gdsys/a38x/ihs_phys.c
+++ b/board/gdsys/a38x/ihs_phys.c
@@ -28,6 +28,7 @@ static void ihs_phy_config(struct phy_device *phydev, bool qinpn, bool qoutpn)
{
u16 reg;
+ phydev->interface = PHY_INTERFACE_MODE_MII;
phy_config(phydev);
/* enable QSGMII autonegotiation with flow control */
@@ -142,10 +143,9 @@ struct porttype *get_porttype(uint octo_phy_mask, uint k)
int init_single_phy(struct porttype *porttype, struct mii_dev *bus,
uint bus_idx, uint m, uint phy_idx)
{
- struct phy_device *phydev = phy_find_by_mask(
- bus, 1 << (m * 8 + phy_idx),
- PHY_INTERFACE_MODE_MII);
+ struct phy_device *phydev;
+ phydev = phy_find_by_mask(bus, BIT(m * 8 + phy_idx));
printf(" %u", bus_idx * 32 + m * 8 + phy_idx);
if (!phydev)