Lines Matching defs:phy

3  * Allwinner sun50i(H6) USB 3.0 phy driver
7 * Based on phy-sun9i-usb.c, which is:
21 #include <linux/phy/phy.h>
56 struct phy *phy;
62 static void sun50i_usb3_phy_open(struct sun50i_usb3_phy *phy)
66 val = readl(phy->regs + SUNXI_PHY_EXTERNAL_CONTROL);
69 writel(val, phy->regs + SUNXI_PHY_EXTERNAL_CONTROL);
71 val = readl(phy->regs + SUNXI_PIPE_CLOCK_CONTROL);
73 writel(val, phy->regs + SUNXI_PIPE_CLOCK_CONTROL);
75 val = readl(phy->regs + SUNXI_ISCR);
77 writel(val, phy->regs + SUNXI_ISCR);
84 writel(0x0047fc87, phy->regs + SUNXI_PHY_TUNE_LOW);
86 val = readl(phy->regs + SUNXI_PHY_TUNE_HIGH);
95 writel(val, phy->regs + SUNXI_PHY_TUNE_HIGH);
98 static int sun50i_usb3_phy_init(struct phy *_phy)
100 struct sun50i_usb3_phy *phy = phy_get_drvdata(_phy);
103 ret = clk_prepare_enable(phy->clk);
107 ret = reset_control_deassert(phy->reset);
109 clk_disable_unprepare(phy->clk);
113 sun50i_usb3_phy_open(phy);
117 static int sun50i_usb3_phy_exit(struct phy *_phy)
119 struct sun50i_usb3_phy *phy = phy_get_drvdata(_phy);
121 reset_control_assert(phy->reset);
122 clk_disable_unprepare(phy->clk);
135 struct sun50i_usb3_phy *phy;
139 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
140 if (!phy)
143 phy->clk = devm_clk_get(dev, NULL);
144 if (IS_ERR(phy->clk)) {
145 if (PTR_ERR(phy->clk) != -EPROBE_DEFER)
146 dev_err(dev, "failed to get phy clock\n");
147 return PTR_ERR(phy->clk);
150 phy->reset = devm_reset_control_get(dev, NULL);
151 if (IS_ERR(phy->reset)) {
153 return PTR_ERR(phy->reset);
156 phy->regs = devm_platform_ioremap_resource(pdev, 0);
157 if (IS_ERR(phy->regs))
158 return PTR_ERR(phy->regs);
160 phy->phy = devm_phy_create(dev, NULL, &sun50i_usb3_phy_ops);
161 if (IS_ERR(phy->phy)) {
163 return PTR_ERR(phy->phy);
166 phy_set_drvdata(phy->phy, phy);
173 { .compatible = "allwinner,sun50i-h6-usb3-phy" },
182 .name = "sun50i-usb3-phy",
187 MODULE_DESCRIPTION("Allwinner H6 USB 3.0 phy driver");