Lines Matching refs:ta

51 static int get_flipped(struct tca_apb *ta, bool *flipped)  in get_flipped()  argument
56 ret = extcon_get_property(ta->phy.edev, EXTCON_USB_HOST, in get_flipped()
59 dev_err(ta->phy.dev, "no polarity property from extcon\n"); in get_flipped()
70 struct tca_apb *ta = container_of(phy, struct tca_apb, phy); in phy_init() local
74 if (ta->phy_initialized) in phy_init()
78 reset_control_deassert(ta->resets[i]); in phy_init()
82 dev_err(ta->phy.dev, "SRAM init failed, 0x%x\n", val); in phy_init()
88 ta->phy_initialized = true; in phy_init()
89 if (!ta->phy.edev) { in phy_init()
90 writel(TCPC_CONN, ta->phy.io_priv + TCPC_OFFSET); in phy_init()
94 schedule_work(&ta->wk); in phy_init()
101 struct tca_apb *ta = container_of(phy, struct tca_apb, phy); in phy_shutdown() local
104 if (!ta->phy_initialized) in phy_shutdown()
107 ta->phy_initialized = false; in phy_shutdown()
108 flush_work(&ta->wk); in phy_shutdown()
109 ta->phy.set_vbus(&ta->phy, false); in phy_shutdown()
111 ta->connected = false; in phy_shutdown()
112 writel(TCPC_DISCONN, ta->phy.io_priv + TCPC_OFFSET); in phy_shutdown()
115 reset_control_assert(ta->resets[i]); in phy_shutdown()
120 struct tca_apb *ta = container_of(phy, struct tca_apb, phy); in phy_set_vbus() local
123 if (!!on == ta->regulator_enabled) in phy_set_vbus()
127 ret = regulator_enable(ta->vbus); in phy_set_vbus()
129 ret = regulator_disable(ta->vbus); in phy_set_vbus()
132 ta->regulator_enabled = on; in phy_set_vbus()
134 dev_dbg(ta->phy.dev, "set vbus: %d\n", on); in phy_set_vbus()
140 struct tca_apb *ta = container_of(work, struct tca_apb, wk); in tca_work() local
146 ret = get_flipped(ta, &flipped); in tca_work()
150 connected = extcon_get_state(ta->phy.edev, EXTCON_USB_HOST); in tca_work()
151 if (connected == ta->connected) in tca_work()
154 ta->connected = connected; in tca_work()
159 dev_dbg(ta->phy.dev, "connected%s\n", flipped ? " flipped" : ""); in tca_work()
162 dev_dbg(ta->phy.dev, "disconnected\n"); in tca_work()
165 writel(val, ta->phy.io_priv + TCPC_OFFSET); in tca_work()
167 ret = ta->phy.set_vbus(&ta->phy, connected); in tca_work()
169 dev_err(ta->phy.dev, "failed to set VBUS\n"); in tca_work()
174 struct tca_apb *ta = container_of(nb, struct tca_apb, phy.id_nb); in id_notifier() local
176 if (ta->phy_initialized) in id_notifier()
177 schedule_work(&ta->wk); in id_notifier()
192 struct tca_apb *ta; in phy_probe() local
195 ta = devm_kzalloc(dev, sizeof(*ta), GFP_KERNEL); in phy_probe()
196 if (!ta) in phy_probe()
199 platform_set_drvdata(pdev, ta); in phy_probe()
200 INIT_WORK(&ta->wk, tca_work); in phy_probe()
202 phy = &ta->phy; in phy_probe()
216 ta->vbus = devm_regulator_get(dev, "vbus"); in phy_probe()
217 if (IS_ERR(ta->vbus)) in phy_probe()
218 return PTR_ERR(ta->vbus); in phy_probe()
229 ta->resets[i] = devm_reset_control_get_exclusive(dev, PHY_RESETS[i]); in phy_probe()
230 if (IS_ERR(ta->resets[i])) { in phy_probe()
232 return PTR_ERR(ta->resets[i]); in phy_probe()
240 reset_control_assert(ta->resets[i]); in phy_probe()
257 struct tca_apb *ta = platform_get_drvdata(pdev); in phy_remove() local
259 usb_remove_phy(&ta->phy); in phy_remove()