Lines Matching refs:phy

3  * Allwinner sun9i USB phy driver
7 * Based on phy-sun4i-usb.c from
18 #include <linux/phy/phy.h>
36 struct phy *phy;
44 static void sun9i_usb_phy_passby(struct sun9i_usb_phy *phy, int enable)
52 if (phy->type == USBPHY_INTERFACE_MODE_HSIC)
56 reg_value = readl(phy->pmu);
63 writel(reg_value, phy->pmu);
66 static int sun9i_usb_phy_init(struct phy *_phy)
68 struct sun9i_usb_phy *phy = phy_get_drvdata(_phy);
71 ret = clk_prepare_enable(phy->clk);
75 ret = clk_prepare_enable(phy->hsic_clk);
79 ret = reset_control_deassert(phy->reset);
83 sun9i_usb_phy_passby(phy, 1);
87 clk_disable_unprepare(phy->hsic_clk);
90 clk_disable_unprepare(phy->clk);
96 static int sun9i_usb_phy_exit(struct phy *_phy)
98 struct sun9i_usb_phy *phy = phy_get_drvdata(_phy);
100 sun9i_usb_phy_passby(phy, 0);
101 reset_control_assert(phy->reset);
102 clk_disable_unprepare(phy->hsic_clk);
103 clk_disable_unprepare(phy->clk);
116 struct sun9i_usb_phy *phy;
122 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
123 if (!phy)
126 phy->type = of_usb_get_phy_mode(np);
127 if (phy->type == USBPHY_INTERFACE_MODE_HSIC) {
128 phy->clk = devm_clk_get(dev, "hsic_480M");
129 if (IS_ERR(phy->clk)) {
131 return PTR_ERR(phy->clk);
134 phy->hsic_clk = devm_clk_get(dev, "hsic_12M");
135 if (IS_ERR(phy->hsic_clk)) {
137 return PTR_ERR(phy->hsic_clk);
140 phy->reset = devm_reset_control_get(dev, "hsic");
141 if (IS_ERR(phy->reset)) {
143 return PTR_ERR(phy->reset);
146 phy->clk = devm_clk_get(dev, "phy");
147 if (IS_ERR(phy->clk)) {
148 dev_err(dev, "failed to get phy clock\n");
149 return PTR_ERR(phy->clk);
152 phy->reset = devm_reset_control_get(dev, "phy");
153 if (IS_ERR(phy->reset)) {
155 return PTR_ERR(phy->reset);
160 phy->pmu = devm_ioremap_resource(dev, res);
161 if (IS_ERR(phy->pmu))
162 return PTR_ERR(phy->pmu);
164 phy->phy = devm_phy_create(dev, NULL, &sun9i_usb_phy_ops);
165 if (IS_ERR(phy->phy)) {
167 return PTR_ERR(phy->phy);
170 phy_set_drvdata(phy->phy, phy);
177 { .compatible = "allwinner,sun9i-a80-usb-phy" },
186 .name = "sun9i-usb-phy",
191 MODULE_DESCRIPTION("Allwinner sun9i USB phy driver");