Overview
Discussion of low-level PHY structures and operations, starting at include/linux/phy/phy.h and seeing where it goes from there.
Structures -- struct phy and associated stuff
struct phy
struct phy {
struct device dev;
int id;
const struct phy_ops *ops;
struct mutex mutex;
int init_count;
int power_count;
struct phy_attrs attrs;
struct regulator *pwr;
};
struct phy_attrs and PHY mode
struct phy_attrs {
u32 bus_width;
enum phy_mode mode;
};
enum phy_mode {
PHY_MODE_INVALID,
PHY_MODE_USB_HOST,
PHY_MODE_USB_HOST_LS,
PHY_MODE_USB_HOST_FS,
PHY_MODE_USB_HOST_HS,
PHY_MODE_USB_HOST_SS,
PHY_MODE_USB_DEVICE,
PHY_MODE_USB_DEVICE_LS,
PHY_MODE_USB_DEVICE_FS,
PHY_MODE_USB_DEVICE_HS,
PHY_MODE_USB_DEVICE_SS,
PHY_MODE_USB_OTG,
PHY_MODE_SGMII,
PHY_MODE_2500SGMII,
PHY_MODE_QSGMII,
PHY_MODE_10GKR,
PHY_MODE_UFS_HS_A,
PHY_MODE_UFS_HS_B,
PHY_MODE_PCIE,
};
struct phy_ops
struct phy_ops {
int (*init)(struct phy *phy);
int (*exit)(struct phy *phy);
int (*power_on)(struct phy *phy);
int (*power_off)(struct phy *phy);
int (*set_mode)(struct phy *phy, enum phy_mode mode);
int (*reset)(struct phy *phy);
int (*calibrate)(struct phy *phy);
struct module *owner;
};
struct phy_provider
struct phy_provider {
struct device *dev;
struct device_node *children;
struct module *owner;
struct list_head list;
struct phy * (*of_xlate)(struct device *dev,
struct of_phandle_args *args);
};
struct phy_lookup
struct phy_lookup {
struct list_head node;
const char *dev_id;
const char *con_id;
struct phy *phy;
};