Lines Matching +full:hix5hd2 +full:- +full:sata +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0-or-later
12 #include <linux/phy/phy.h>
62 static int hix5hd2_sata_phy_init(struct phy *phy) in hix5hd2_sata_phy_init() argument
64 struct hix5hd2_priv *priv = phy_get_drvdata(phy); in hix5hd2_sata_phy_init()
68 if (priv->peri_ctrl) { in hix5hd2_sata_phy_init()
69 ret = of_property_read_u32_array(phy->dev.of_node, in hix5hd2_sata_phy_init()
70 "hisilicon,power-reg", in hix5hd2_sata_phy_init()
73 dev_err(&phy->dev, "Fail read hisilicon,power-reg\n"); in hix5hd2_sata_phy_init()
77 regmap_update_bits(priv->peri_ctrl, data[0], in hix5hd2_sata_phy_init()
81 /* reset phy */ in hix5hd2_sata_phy_init()
82 val = readl_relaxed(priv->base + SATA_PHY0_CTLL); in hix5hd2_sata_phy_init()
86 writel_relaxed(val, priv->base + SATA_PHY0_CTLL); in hix5hd2_sata_phy_init()
89 writel_relaxed(val, priv->base + SATA_PHY0_CTLL); in hix5hd2_sata_phy_init()
91 val = readl_relaxed(priv->base + SATA_PORT_PHYCTL1); in hix5hd2_sata_phy_init()
96 writel_relaxed(val, priv->base + SATA_PORT_PHYCTL1); in hix5hd2_sata_phy_init()
98 val = readl_relaxed(priv->base + SATA_PORT_PHYCTL2); in hix5hd2_sata_phy_init()
103 writel_relaxed(val, priv->base + SATA_PORT_PHYCTL2); in hix5hd2_sata_phy_init()
106 val = readl_relaxed(priv->base + SATA_PORT_PHYCTL); in hix5hd2_sata_phy_init()
111 writel_relaxed(val, priv->base + SATA_PORT_PHYCTL); in hix5hd2_sata_phy_init()
118 writel_relaxed(val, priv->base + SATA_PORT_PHYCTL); in hix5hd2_sata_phy_init()
124 writel_relaxed(val, priv->base + SATA_PORT_PHYCTL); in hix5hd2_sata_phy_init()
137 struct device *dev = &pdev->dev; in hix5hd2_sata_phy_probe()
139 struct phy *phy; in hix5hd2_sata_phy_probe() local
144 return -ENOMEM; in hix5hd2_sata_phy_probe()
148 return -EINVAL; in hix5hd2_sata_phy_probe()
150 priv->base = devm_ioremap(dev, res->start, resource_size(res)); in hix5hd2_sata_phy_probe()
151 if (!priv->base) in hix5hd2_sata_phy_probe()
152 return -ENOMEM; in hix5hd2_sata_phy_probe()
154 priv->peri_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node, in hix5hd2_sata_phy_probe()
155 "hisilicon,peripheral-syscon"); in hix5hd2_sata_phy_probe()
156 if (IS_ERR(priv->peri_ctrl)) in hix5hd2_sata_phy_probe()
157 priv->peri_ctrl = NULL; in hix5hd2_sata_phy_probe()
159 phy = devm_phy_create(dev, NULL, &hix5hd2_sata_phy_ops); in hix5hd2_sata_phy_probe()
160 if (IS_ERR(phy)) { in hix5hd2_sata_phy_probe()
161 dev_err(dev, "failed to create PHY\n"); in hix5hd2_sata_phy_probe()
162 return PTR_ERR(phy); in hix5hd2_sata_phy_probe()
165 phy_set_drvdata(phy, priv); in hix5hd2_sata_phy_probe()
171 {.compatible = "hisilicon,hix5hd2-sata-phy",},
179 .name = "hix5hd2-sata-phy",
186 MODULE_DESCRIPTION("HISILICON HIX5HD2 SATA PHY driver");
187 MODULE_ALIAS("platform:hix5hd2-sata-phy");