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>
This commit is contained in:
parent
298fe56ee2
commit
739ae3452d
|
@ -103,9 +103,6 @@
|
||||||
#define MODE_TEST_EN BIT(11)
|
#define MODE_TEST_EN BIT(11)
|
||||||
#define ANA_TEST_DC_CTRL(x) ((x) << 12)
|
#define ANA_TEST_DC_CTRL(x) ((x) << 12)
|
||||||
|
|
||||||
#define to_phy_berlin_usb_priv(p) \
|
|
||||||
container_of((p), struct phy_berlin_usb_priv, phy)
|
|
||||||
|
|
||||||
static const u32 phy_berlin_pll_dividers[] = {
|
static const u32 phy_berlin_pll_dividers[] = {
|
||||||
/* Berlin 2 */
|
/* Berlin 2 */
|
||||||
CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
|
CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
|
||||||
|
@ -115,14 +112,13 @@ static const u32 phy_berlin_pll_dividers[] = {
|
||||||
|
|
||||||
struct phy_berlin_usb_priv {
|
struct phy_berlin_usb_priv {
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct phy *phy;
|
|
||||||
struct reset_control *rst_ctrl;
|
struct reset_control *rst_ctrl;
|
||||||
u32 pll_divider;
|
u32 pll_divider;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int phy_berlin_usb_power_on(struct phy *phy)
|
static int phy_berlin_usb_power_on(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent);
|
struct phy_berlin_usb_priv *priv = phy_get_drvdata(phy);
|
||||||
|
|
||||||
reset_control_reset(priv->rst_ctrl);
|
reset_control_reset(priv->rst_ctrl);
|
||||||
|
|
||||||
|
@ -175,6 +171,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
|
||||||
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
|
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
|
||||||
struct phy_berlin_usb_priv *priv;
|
struct phy_berlin_usb_priv *priv;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
struct phy *phy;
|
||||||
struct phy_provider *phy_provider;
|
struct phy_provider *phy_provider;
|
||||||
|
|
||||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||||
|
@ -192,13 +189,14 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
priv->pll_divider = *((u32 *)match->data);
|
priv->pll_divider = *((u32 *)match->data);
|
||||||
|
|
||||||
priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
|
phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
|
||||||
if (IS_ERR(priv->phy)) {
|
if (IS_ERR(phy)) {
|
||||||
dev_err(&pdev->dev, "failed to create PHY\n");
|
dev_err(&pdev->dev, "failed to create PHY\n");
|
||||||
return PTR_ERR(priv->phy);
|
return PTR_ERR(phy);
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, priv);
|
platform_set_drvdata(pdev, priv);
|
||||||
|
phy_set_drvdata(phy, priv);
|
||||||
|
|
||||||
phy_provider =
|
phy_provider =
|
||||||
devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
|
devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
|
||||||
|
|
Loading…
Reference in New Issue