Lines Matching +full:sata +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * phy-mvebu-sata.c: SATA Phy driver for the Marvell mvebu SoCs.
11 #include <linux/phy/phy.h>
29 static int phy_mvebu_sata_power_on(struct phy *phy) in phy_mvebu_sata_power_on() argument
31 struct priv *priv = phy_get_drvdata(phy); in phy_mvebu_sata_power_on()
34 clk_prepare_enable(priv->clk); in phy_mvebu_sata_power_on()
37 reg = readl(priv->base + SATA_PHY_MODE_2); in phy_mvebu_sata_power_on()
40 writel(reg , priv->base + SATA_PHY_MODE_2); in phy_mvebu_sata_power_on()
42 /* Enable PHY */ in phy_mvebu_sata_power_on()
43 reg = readl(priv->base + SATA_IF_CTRL); in phy_mvebu_sata_power_on()
45 writel(reg, priv->base + SATA_IF_CTRL); in phy_mvebu_sata_power_on()
47 clk_disable_unprepare(priv->clk); in phy_mvebu_sata_power_on()
52 static int phy_mvebu_sata_power_off(struct phy *phy) in phy_mvebu_sata_power_off() argument
54 struct priv *priv = phy_get_drvdata(phy); in phy_mvebu_sata_power_off()
57 clk_prepare_enable(priv->clk); in phy_mvebu_sata_power_off()
60 reg = readl(priv->base + SATA_PHY_MODE_2); in phy_mvebu_sata_power_off()
63 writel(reg, priv->base + SATA_PHY_MODE_2); in phy_mvebu_sata_power_off()
65 /* Disable PHY */ in phy_mvebu_sata_power_off()
66 reg = readl(priv->base + SATA_IF_CTRL); in phy_mvebu_sata_power_off()
68 writel(reg, priv->base + SATA_IF_CTRL); in phy_mvebu_sata_power_off()
70 clk_disable_unprepare(priv->clk); in phy_mvebu_sata_power_off()
85 struct phy *phy; in phy_mvebu_sata_probe() local
87 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in phy_mvebu_sata_probe()
89 return -ENOMEM; in phy_mvebu_sata_probe()
91 priv->base = devm_platform_ioremap_resource(pdev, 0); in phy_mvebu_sata_probe()
92 if (IS_ERR(priv->base)) in phy_mvebu_sata_probe()
93 return PTR_ERR(priv->base); in phy_mvebu_sata_probe()
95 priv->clk = devm_clk_get(&pdev->dev, "sata"); in phy_mvebu_sata_probe()
96 if (IS_ERR(priv->clk)) in phy_mvebu_sata_probe()
97 return PTR_ERR(priv->clk); in phy_mvebu_sata_probe()
99 phy = devm_phy_create(&pdev->dev, NULL, &phy_mvebu_sata_ops); in phy_mvebu_sata_probe()
100 if (IS_ERR(phy)) in phy_mvebu_sata_probe()
101 return PTR_ERR(phy); in phy_mvebu_sata_probe()
103 phy_set_drvdata(phy, priv); in phy_mvebu_sata_probe()
105 phy_provider = devm_of_phy_provider_register(&pdev->dev, in phy_mvebu_sata_probe()
111 phy_mvebu_sata_power_off(phy); in phy_mvebu_sata_probe()
117 { .compatible = "marvell,mvebu-sata-phy" },
124 .name = "phy-mvebu-sata",