aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-03-10 05:05:33 -0400
committerKishon Vijay Abraham I <kishon@ti.com>2015-03-10 07:48:09 -0400
commit739ae3452d0ee199b3cfe5e52214d9ccd8e358ea (patch)
tree31d6e58fea5527eab8e458ebfa8e89a6c93860ae /drivers/phy
parent298fe56ee2b9551ca8cd675e7a6ebaf1c03632f8 (diff)
phy: berlin-usb: Set drvdata for phy and use it
At the context where we have pointer to struct phy, it's useful to call phy_get_drvdata() to get the address of priv. With this change, we can remove the to_phy_berlin_usb_priv() macro and remove *phy from struct phy_berlin_usb_priv. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-berlin-usb.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c
index 9f7cc7eed292..c6fc95b53083 100644
--- a/drivers/phy/phy-berlin-usb.c
+++ b/drivers/phy/phy-berlin-usb.c
@@ -103,9 +103,6 @@
103#define MODE_TEST_EN BIT(11) 103#define MODE_TEST_EN BIT(11)
104#define ANA_TEST_DC_CTRL(x) ((x) << 12) 104#define ANA_TEST_DC_CTRL(x) ((x) << 12)
105 105
106#define to_phy_berlin_usb_priv(p) \
107 container_of((p), struct phy_berlin_usb_priv, phy)
108
109static const u32 phy_berlin_pll_dividers[] = { 106static const u32 phy_berlin_pll_dividers[] = {
110 /* Berlin 2 */ 107 /* Berlin 2 */
111 CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54), 108 CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
@@ -115,14 +112,13 @@ static const u32 phy_berlin_pll_dividers[] = {
115 112
116struct phy_berlin_usb_priv { 113struct phy_berlin_usb_priv {
117 void __iomem *base; 114 void __iomem *base;
118 struct phy *phy;
119 struct reset_control *rst_ctrl; 115 struct reset_control *rst_ctrl;
120 u32 pll_divider; 116 u32 pll_divider;
121}; 117};
122 118
123static int phy_berlin_usb_power_on(struct phy *phy) 119static int phy_berlin_usb_power_on(struct phy *phy)
124{ 120{
125 struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent); 121 struct phy_berlin_usb_priv *priv = phy_get_drvdata(phy);
126 122
127 reset_control_reset(priv->rst_ctrl); 123 reset_control_reset(priv->rst_ctrl);
128 124
@@ -175,6 +171,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
175 of_match_device(phy_berlin_sata_of_match, &pdev->dev); 171 of_match_device(phy_berlin_sata_of_match, &pdev->dev);
176 struct phy_berlin_usb_priv *priv; 172 struct phy_berlin_usb_priv *priv;
177 struct resource *res; 173 struct resource *res;
174 struct phy *phy;
178 struct phy_provider *phy_provider; 175 struct phy_provider *phy_provider;
179 176
180 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 177 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -192,13 +189,14 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
192 189
193 priv->pll_divider = *((u32 *)match->data); 190 priv->pll_divider = *((u32 *)match->data);
194 191
195 priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops); 192 phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
196 if (IS_ERR(priv->phy)) { 193 if (IS_ERR(phy)) {
197 dev_err(&pdev->dev, "failed to create PHY\n"); 194 dev_err(&pdev->dev, "failed to create PHY\n");
198 return PTR_ERR(priv->phy); 195 return PTR_ERR(phy);
199 } 196 }
200 197
201 platform_set_drvdata(pdev, priv); 198 platform_set_drvdata(pdev, priv);
199 phy_set_drvdata(phy, priv);
202 200
203 phy_provider = 201 phy_provider =
204 devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); 202 devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);