summaryrefslogtreecommitdiffstats
path: root/include/linux/phy/phy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/phy/phy.h')
-rw-r--r--include/linux/phy/phy.h90
1 files changed, 61 insertions, 29 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index e2fe42d90e..9f01bc3e9f 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -20,12 +20,36 @@
struct phy;
+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_UFS_HS_A,
+ PHY_MODE_UFS_HS_B,
+ PHY_MODE_PCIE,
+ PHY_MODE_ETHERNET,
+ PHY_MODE_MIPI_DPHY,
+ PHY_MODE_SATA,
+ PHY_MODE_LVDS,
+ PHY_MODE_DP
+};
+
/**
* struct phy_ops - set of function pointers for performing phy operations
* @init: operation to be performed for initializing phy
* @exit: operation to be performed while exiting
* @power_on: powering on the phy
* @power_off: powering off the phy
+ * @set_mode: set the mode of the phy
* @owner: the module owner containing the ops
*/
struct phy_ops {
@@ -33,15 +57,18 @@ struct phy_ops {
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 submode);
struct usb_phy *(*to_usbphy)(struct phy *phy);
};
/**
* struct phy_attrs - represents phy attributes
* @bus_width: Data path width implemented by PHY
+ * @mode: PHY mode
*/
struct phy_attrs {
u32 bus_width;
+ enum phy_mode mode;
};
/**
@@ -55,7 +82,7 @@ struct phy_attrs {
* @phy_attrs: used to specify PHY specific attributes
*/
struct phy {
- struct device_d dev;
+ struct device dev;
int id;
const struct phy_ops *ops;
int init_count;
@@ -72,10 +99,10 @@ struct phy {
* @list: to maintain a linked list of PHY providers
*/
struct phy_provider {
- struct device_d *dev;
+ struct device *dev;
struct list_head list;
- struct phy * (*of_xlate)(struct device_d *dev,
- struct of_phandle_args *args);
+ struct phy * (*of_xlate)(struct device *dev,
+ struct of_phandle_args *args);
};
/**
@@ -125,6 +152,9 @@ int phy_init(struct phy *phy);
int phy_exit(struct phy *phy);
int phy_power_on(struct phy *phy);
int phy_power_off(struct phy *phy);
+int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
+#define phy_set_mode(phy, mode) \
+ phy_set_mode_ext(phy, mode, 0)
static inline int phy_get_bus_width(struct phy *phy)
{
return phy->attrs.bus_width;
@@ -133,23 +163,21 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
{
phy->attrs.bus_width = bus_width;
}
-struct phy *phy_get(struct device_d *dev, const char *string);
-struct phy *phy_optional_get(struct device_d *dev, const char *string);
-struct phy *of_phy_get_by_phandle(struct device_d *dev, const char *phandle,
+struct phy *phy_get(struct device *dev, const char *string);
+struct phy *phy_optional_get(struct device *dev, const char *string);
+struct phy *of_phy_get_by_phandle(struct device *dev, const char *phandle,
u8 index);
void phy_put(struct phy *phy);
struct phy *of_phy_get(struct device_node *np, const char *con_id);
-struct phy *of_phy_simple_xlate(struct device_d *dev,
- struct of_phandle_args *args);
-struct phy *phy_create(struct device_d *dev, struct device_node *node,
+struct phy *phy_create(struct device *dev, struct device_node *node,
const struct phy_ops *ops);
void phy_destroy(struct phy *phy);
-struct phy_provider *__of_phy_provider_register(struct device_d *dev,
- struct phy * (*of_xlate)(struct device_d *dev,
- struct of_phandle_args *args));
+struct phy_provider *__of_phy_provider_register(struct device *dev,
+ struct phy * (*of_xlate)(struct device *dev,
+ struct of_phandle_args *args));
void of_phy_provider_unregister(struct phy_provider *phy_provider);
struct usb_phy *phy_to_usbphy(struct phy *phy);
-struct phy *phy_get_by_index(struct device_d *dev, int index);
+struct phy *phy_get_by_index(struct device *dev, int index);
#else
static inline int phy_init(struct phy *phy)
{
@@ -179,6 +207,17 @@ static inline int phy_power_off(struct phy *phy)
return -ENOSYS;
}
+static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode,
+ int submode)
+{
+ if (!phy)
+ return 0;
+ return -ENOSYS;
+}
+
+#define phy_set_mode(phy, mode) \
+ phy_set_mode_ext(phy, mode, 0)
+
static inline int phy_get_bus_width(struct phy *phy)
{
return -ENOSYS;
@@ -189,18 +228,18 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
return;
}
-static inline struct phy *phy_get(struct device_d *dev, const char *string)
+static inline struct phy *phy_get(struct device *dev, const char *string)
{
return ERR_PTR(-ENOSYS);
}
-static inline struct phy *phy_optional_get(struct device_d *dev,
+static inline struct phy *phy_optional_get(struct device *dev,
const char *string)
{
- return ERR_PTR(-ENOSYS);
+ return NULL;
}
-static inline struct phy *of_phy_get_by_phandle(struct device_d *dev,
+static inline struct phy *of_phy_get_by_phandle(struct device *dev,
const char *phandle, u8 index)
{
return ERR_PTR(-ENOSYS);
@@ -215,13 +254,7 @@ static inline struct phy *of_phy_get(struct device_node *np, const char *con_id)
return ERR_PTR(-ENOSYS);
}
-static inline struct phy *of_phy_simple_xlate(struct device_d *dev,
- struct of_phandle_args *args)
-{
- return ERR_PTR(-ENOSYS);
-}
-
-static inline struct phy *phy_create(struct device_d *dev,
+static inline struct phy *phy_create(struct device *dev,
struct device_node *node,
const struct phy_ops *ops)
{
@@ -232,9 +265,8 @@ static inline void phy_destroy(struct phy *phy)
{
}
-static inline struct phy_provider *__of_phy_provider_register(
- struct device_d *dev, struct phy * (*of_xlate)(
- struct device_d *dev, struct of_phandle_args *args))
+static inline struct phy_provider *__of_phy_provider_register(struct device *dev,
+ struct phy * (*of_xlate)(struct device *dev, struct of_phandle_args *args))
{
return ERR_PTR(-ENOSYS);
}
@@ -248,7 +280,7 @@ static inline struct usb_phy *phy_to_usbphy(struct phy *phy)
return NULL;
}
-static inline struct phy *phy_get_by_index(struct device_d *dev, int index)
+static inline struct phy *phy_get_by_index(struct device *dev, int index)
{
return ERR_PTR(-ENODEV);
}