From e2ffeaa16250ec6372412c0f268449803c321db6 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Tue, 18 Jun 2019 11:37:18 +1000 Subject: phy: Include NC-SI in phy setup Add NC-SI to the usual phy handling. This makes two notable changes: - Somewhat similar to a fixed phy, phy_connect() will create an NC-SI phy if CONFIG_PHY_NCSI is defined. - An early return is added to phy_read() and phy_write() to handle a case like the NC-SI phy which does not define a bus. Signed-off-by: Samuel Mendoza-Jonas Reviewed-by: Joel Stanley Acked-by: Joe Hershberger --- include/phy.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/phy.h') diff --git a/include/phy.h b/include/phy.h index 400ca25..edc702a 100644 --- a/include/phy.h +++ b/include/phy.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #define PHY_FIXED_ID 0xa5a55a5a @@ -173,6 +174,11 @@ static inline int phy_read(struct phy_device *phydev, int devad, int regnum) { struct mii_dev *bus = phydev->bus; + if (!bus || !bus->read) { + debug("%s: No bus configured\n", __func__); + return -1; + } + return bus->read(bus, phydev->addr, devad, regnum); } @@ -181,6 +187,11 @@ static inline int phy_write(struct phy_device *phydev, int devad, int regnum, { struct mii_dev *bus = phydev->bus; + if (!bus || !bus->read) { + debug("%s: No bus configured\n", __func__); + return -1; + } + return bus->write(bus, phydev->addr, devad, regnum, val); } @@ -402,6 +413,7 @@ int phy_vitesse_init(void); int phy_xilinx_init(void); int phy_mscc_init(void); int phy_fixed_init(void); +int phy_ncsi_init(void); int phy_xilinx_gmii2rgmii_init(void); int board_phy_config(struct phy_device *phydev); -- cgit v1.1