summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Porter <mporter@linaro.org>2013-12-19 14:23:02 (GMT)
committerMarek Szyprowski <m.szyprowski@samsung.com>2014-05-15 05:29:19 (GMT)
commit54018807f6d7eb0726356439ebe49ccce8dc5bcd (patch)
tree846804a3b09caaa81a9237c729f205d1e488ea34
parentf9f64891ed707220b26cc42f442e8e7f6286d327 (diff)
downloadlinux-3.10-54018807f6d7eb0726356439ebe49ccce8dc5bcd.zip
linux-3.10-54018807f6d7eb0726356439ebe49ccce8dc5bcd.tar.gz
linux-3.10-54018807f6d7eb0726356439ebe49ccce8dc5bcd.tar.bz2
phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter <mporter@linaro.org> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> [backport from upstream commit 8feed347d33bb630d426b9f2ed88cbdf9795f624] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: I327ac9c7fb50d39e0351c15ea72b3748957ea03d
-rw-r--r--include/linux/phy/phy.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 6d72269..e273e5a 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -38,6 +38,14 @@ struct phy_ops {
};
/**
+ * struct phy_attrs - represents phy attributes
+ * @bus_width: Data path width implemented by PHY
+ */
+struct phy_attrs {
+ u32 bus_width;
+};
+
+/**
* struct phy - represents the phy device
* @dev: phy device
* @id: id of the phy device
@@ -46,6 +54,7 @@ struct phy_ops {
* @mutex: mutex to protect phy_ops
* @init_count: used to protect when the PHY is used by multiple consumers
* @power_count: used to protect when the PHY is used by multiple consumers
+ * @phy_attrs: used to specify PHY specific attributes
*/
struct phy {
struct device dev;
@@ -55,6 +64,7 @@ struct phy {
struct mutex mutex;
int init_count;
int power_count;
+ struct phy_attrs attrs;
};
/**
@@ -127,6 +137,14 @@ 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);
+static inline int phy_get_bus_width(struct phy *phy)
+{
+ return phy->attrs.bus_width;
+}
+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 *dev, const char *string);
struct phy *devm_phy_get(struct device *dev, const char *string);
void phy_put(struct phy *phy);
@@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy)
return -ENOSYS;
}
+static inline int phy_get_bus_width(struct phy *phy)
+{
+ return -ENOSYS;
+}
+
+static inline void phy_set_bus_width(struct phy *phy, int bus_width)
+{
+ return;
+}
+
static inline struct phy *phy_get(struct device *dev, const char *string)
{
return ERR_PTR(-ENOSYS);