Lines Matching refs:phy

56 	struct phy		*phy;  member
61 static void u2_phy_w32(struct ralink_usb_phy *phy, u32 val, u32 reg) in u2_phy_w32() argument
63 writel(val, phy->base + reg); in u2_phy_w32()
66 static u32 u2_phy_r32(struct ralink_usb_phy *phy, u32 reg) in u2_phy_r32() argument
68 return readl(phy->base + reg); in u2_phy_r32()
71 static void ralink_usb_phy_init(struct ralink_usb_phy *phy) in ralink_usb_phy_init() argument
73 u2_phy_r32(phy, OFS_U2_PHY_AC2); in ralink_usb_phy_init()
74 u2_phy_r32(phy, OFS_U2_PHY_ACR0); in ralink_usb_phy_init()
75 u2_phy_r32(phy, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
77 u2_phy_w32(phy, 0x00ffff02, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
78 u2_phy_r32(phy, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
79 u2_phy_w32(phy, 0x00555502, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
80 u2_phy_r32(phy, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
81 u2_phy_w32(phy, 0x00aaaa02, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
82 u2_phy_r32(phy, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
83 u2_phy_w32(phy, 0x00000402, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
84 u2_phy_r32(phy, OFS_U2_PHY_DCR0); in ralink_usb_phy_init()
85 u2_phy_w32(phy, 0x0048086a, OFS_U2_PHY_AC0); in ralink_usb_phy_init()
86 u2_phy_w32(phy, 0x4400001c, OFS_U2_PHY_AC1); in ralink_usb_phy_init()
87 u2_phy_w32(phy, 0xc0200000, OFS_U2_PHY_ACR3); in ralink_usb_phy_init()
88 u2_phy_w32(phy, 0x02000000, OFS_U2_PHY_DTM0); in ralink_usb_phy_init()
91 static int ralink_usb_phy_power_on(struct phy *_phy) in ralink_usb_phy_power_on()
93 struct ralink_usb_phy *phy = phy_get_drvdata(_phy); in ralink_usb_phy_power_on() local
97 regmap_update_bits(phy->sysctl, RT_SYSC_REG_CLKCFG1, in ralink_usb_phy_power_on()
98 phy->clk, phy->clk); in ralink_usb_phy_power_on()
101 regmap_update_bits(phy->sysctl, RT_SYSC_REG_SYSCFG1, in ralink_usb_phy_power_on()
106 reset_control_deassert(phy->rsthost); in ralink_usb_phy_power_on()
107 reset_control_deassert(phy->rstdev); in ralink_usb_phy_power_on()
115 if (phy->base) in ralink_usb_phy_power_on()
116 ralink_usb_phy_init(phy); in ralink_usb_phy_power_on()
119 regmap_read(phy->sysctl, RT_SYSC_REG_USB_PHY_CFG, &t); in ralink_usb_phy_power_on()
120 dev_info(&phy->phy->dev, "remote usb device wakeup %s\n", in ralink_usb_phy_power_on()
123 dev_info(&phy->phy->dev, "UTMI 8bit 60MHz\n"); in ralink_usb_phy_power_on()
125 dev_info(&phy->phy->dev, "UTMI 16bit 30MHz\n"); in ralink_usb_phy_power_on()
130 static int ralink_usb_phy_power_off(struct phy *_phy) in ralink_usb_phy_power_off()
132 struct ralink_usb_phy *phy = phy_get_drvdata(_phy); in ralink_usb_phy_power_off() local
135 regmap_update_bits(phy->sysctl, RT_SYSC_REG_CLKCFG1, in ralink_usb_phy_power_off()
136 phy->clk, 0); in ralink_usb_phy_power_off()
139 reset_control_assert(phy->rstdev); in ralink_usb_phy_power_off()
140 reset_control_assert(phy->rsthost); in ralink_usb_phy_power_off()
174 struct ralink_usb_phy *phy; in ralink_usb_phy_probe() local
176 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in ralink_usb_phy_probe()
177 if (!phy) in ralink_usb_phy_probe()
180 phy->clk = (uintptr_t)device_get_match_data(&pdev->dev); in ralink_usb_phy_probe()
181 phy->base = NULL; in ralink_usb_phy_probe()
183 phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl"); in ralink_usb_phy_probe()
184 if (IS_ERR(phy->sysctl)) { in ralink_usb_phy_probe()
186 return PTR_ERR(phy->sysctl); in ralink_usb_phy_probe()
191 phy->base = devm_platform_ioremap_resource(pdev, 0); in ralink_usb_phy_probe()
192 if (IS_ERR(phy->base)) { in ralink_usb_phy_probe()
194 return PTR_ERR(phy->base); in ralink_usb_phy_probe()
198 phy->rsthost = devm_reset_control_get(&pdev->dev, "host"); in ralink_usb_phy_probe()
199 if (IS_ERR(phy->rsthost)) { in ralink_usb_phy_probe()
201 return PTR_ERR(phy->rsthost); in ralink_usb_phy_probe()
204 phy->rstdev = devm_reset_control_get(&pdev->dev, "device"); in ralink_usb_phy_probe()
205 if (IS_ERR(phy->rstdev)) { in ralink_usb_phy_probe()
207 return PTR_ERR(phy->rstdev); in ralink_usb_phy_probe()
210 phy->phy = devm_phy_create(dev, NULL, &ralink_usb_phy_ops); in ralink_usb_phy_probe()
211 if (IS_ERR(phy->phy)) { in ralink_usb_phy_probe()
213 return PTR_ERR(phy->phy); in ralink_usb_phy_probe()
215 phy_set_drvdata(phy->phy, phy); in ralink_usb_phy_probe()