Lines Matching refs:glue
92 struct sunxi_glue *glue = container_of(work, struct sunxi_glue, work); in sunxi_musb_work() local
95 if (!test_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) in sunxi_musb_work()
98 if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) { in sunxi_musb_work()
99 struct musb *musb = glue->musb; in sunxi_musb_work()
106 if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { in sunxi_musb_work()
107 set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); in sunxi_musb_work()
112 clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); in sunxi_musb_work()
122 vbus_on = test_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); in sunxi_musb_work()
123 phy_on = test_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); in sunxi_musb_work()
127 phy_power_on(glue->phy); in sunxi_musb_work()
128 set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); in sunxi_musb_work()
130 phy_power_off(glue->phy); in sunxi_musb_work()
131 clear_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags); in sunxi_musb_work()
135 if (test_and_clear_bit(SUNXI_MUSB_FL_PHY_MODE_PEND, &glue->flags)) in sunxi_musb_work()
136 phy_set_mode(glue->phy, glue->phy_mode); in sunxi_musb_work()
141 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_set_vbus() local
144 set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); in sunxi_musb_set_vbus()
147 clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); in sunxi_musb_set_vbus()
150 schedule_work(&glue->work); in sunxi_musb_set_vbus()
155 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_pre_root_reset_end() local
157 sun4i_usb_phy_set_squelch_detect(glue->phy, false); in sunxi_musb_pre_root_reset_end()
162 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_post_root_reset_end() local
164 sun4i_usb_phy_set_squelch_detect(glue->phy, true); in sunxi_musb_post_root_reset_end()
202 struct sunxi_glue *glue = container_of(nb, struct sunxi_glue, host_nb); in sunxi_musb_host_notifier() local
205 set_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags); in sunxi_musb_host_notifier()
207 clear_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags); in sunxi_musb_host_notifier()
209 set_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags); in sunxi_musb_host_notifier()
210 schedule_work(&glue->work); in sunxi_musb_host_notifier()
217 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_init() local
221 musb->phy = glue->phy; in sunxi_musb_init()
222 musb->xceiv = glue->xceiv; in sunxi_musb_init()
224 if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) { in sunxi_musb_init()
230 ret = clk_prepare_enable(glue->clk); in sunxi_musb_init()
234 if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags)) { in sunxi_musb_init()
235 ret = reset_control_deassert(glue->rst); in sunxi_musb_init()
243 ret = devm_extcon_register_notifier(glue->dev, glue->extcon, in sunxi_musb_init()
244 EXTCON_USB_HOST, &glue->host_nb); in sunxi_musb_init()
248 ret = phy_init(glue->phy); in sunxi_musb_init()
260 if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags)) in sunxi_musb_init()
261 reset_control_assert(glue->rst); in sunxi_musb_init()
263 clk_disable_unprepare(glue->clk); in sunxi_musb_init()
265 if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) in sunxi_musb_init()
272 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_exit() local
276 cancel_work_sync(&glue->work); in sunxi_musb_exit()
277 if (test_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags)) in sunxi_musb_exit()
278 phy_power_off(glue->phy); in sunxi_musb_exit()
280 phy_exit(glue->phy); in sunxi_musb_exit()
282 if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags)) in sunxi_musb_exit()
283 reset_control_assert(glue->rst); in sunxi_musb_exit()
285 clk_disable_unprepare(glue->clk); in sunxi_musb_exit()
286 if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) in sunxi_musb_exit()
289 devm_usb_put_phy(glue->dev, glue->xceiv); in sunxi_musb_exit()
296 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_enable() local
298 glue->musb = musb; in sunxi_musb_enable()
301 if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags)) in sunxi_musb_enable()
304 schedule_work(&glue->work); in sunxi_musb_enable()
309 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_disable() local
311 clear_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags); in sunxi_musb_disable()
326 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_set_mode() local
345 if (glue->phy_mode == new_mode) in sunxi_musb_set_mode()
361 glue->phy_mode = new_mode; in sunxi_musb_set_mode()
362 set_bit(SUNXI_MUSB_FL_PHY_MODE_PEND, &glue->flags); in sunxi_musb_set_mode()
363 schedule_work(&glue->work); in sunxi_musb_set_mode()
370 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent); in sunxi_musb_recover() local
376 set_bit(SUNXI_MUSB_FL_PHY_MODE_PEND, &glue->flags); in sunxi_musb_recover()
377 schedule_work(&glue->work); in sunxi_musb_recover()
412 struct sunxi_glue *glue; in sunxi_musb_readb() local
436 glue = dev_get_drvdata(sunxi_musb->controller->parent); in sunxi_musb_readb()
439 &glue->flags)) in sunxi_musb_readb()
670 struct sunxi_glue *glue; in sunxi_musb_probe() local
679 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); in sunxi_musb_probe()
680 if (!glue) in sunxi_musb_probe()
688 glue->phy_mode = PHY_MODE_USB_HOST; in sunxi_musb_probe()
694 glue->phy_mode = PHY_MODE_USB_DEVICE; in sunxi_musb_probe()
700 glue->phy_mode = PHY_MODE_USB_OTG; in sunxi_musb_probe()
713 glue->dev = &pdev->dev; in sunxi_musb_probe()
714 INIT_WORK(&glue->work, sunxi_musb_work); in sunxi_musb_probe()
715 glue->host_nb.notifier_call = sunxi_musb_host_notifier; in sunxi_musb_probe()
718 set_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags); in sunxi_musb_probe()
721 set_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags); in sunxi_musb_probe()
725 set_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags); in sunxi_musb_probe()
726 set_bit(SUNXI_MUSB_FL_NO_CONFIGDATA, &glue->flags); in sunxi_musb_probe()
729 glue->clk = devm_clk_get(&pdev->dev, NULL); in sunxi_musb_probe()
730 if (IS_ERR(glue->clk)) { in sunxi_musb_probe()
732 PTR_ERR(glue->clk)); in sunxi_musb_probe()
733 return PTR_ERR(glue->clk); in sunxi_musb_probe()
736 if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags)) { in sunxi_musb_probe()
737 glue->rst = devm_reset_control_get(&pdev->dev, NULL); in sunxi_musb_probe()
738 if (IS_ERR(glue->rst)) { in sunxi_musb_probe()
739 if (PTR_ERR(glue->rst) == -EPROBE_DEFER) in sunxi_musb_probe()
742 PTR_ERR(glue->rst)); in sunxi_musb_probe()
743 return PTR_ERR(glue->rst); in sunxi_musb_probe()
747 glue->extcon = extcon_get_edev_by_phandle(&pdev->dev, 0); in sunxi_musb_probe()
748 if (IS_ERR(glue->extcon)) { in sunxi_musb_probe()
749 if (PTR_ERR(glue->extcon) == -EPROBE_DEFER) in sunxi_musb_probe()
752 return PTR_ERR(glue->extcon); in sunxi_musb_probe()
755 glue->phy = devm_phy_get(&pdev->dev, "usb"); in sunxi_musb_probe()
756 if (IS_ERR(glue->phy)) { in sunxi_musb_probe()
757 if (PTR_ERR(glue->phy) == -EPROBE_DEFER) in sunxi_musb_probe()
760 PTR_ERR(glue->phy)); in sunxi_musb_probe()
761 return PTR_ERR(glue->phy); in sunxi_musb_probe()
764 glue->usb_phy = usb_phy_generic_register(); in sunxi_musb_probe()
765 if (IS_ERR(glue->usb_phy)) { in sunxi_musb_probe()
767 PTR_ERR(glue->usb_phy)); in sunxi_musb_probe()
768 return PTR_ERR(glue->usb_phy); in sunxi_musb_probe()
771 glue->xceiv = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); in sunxi_musb_probe()
772 if (IS_ERR(glue->xceiv)) { in sunxi_musb_probe()
773 ret = PTR_ERR(glue->xceiv); in sunxi_musb_probe()
778 platform_set_drvdata(pdev, glue); in sunxi_musb_probe()
791 glue->musb_pdev = platform_device_register_full(&pinfo); in sunxi_musb_probe()
792 if (IS_ERR(glue->musb_pdev)) { in sunxi_musb_probe()
793 ret = PTR_ERR(glue->musb_pdev); in sunxi_musb_probe()
801 usb_phy_generic_unregister(glue->usb_phy); in sunxi_musb_probe()
807 struct sunxi_glue *glue = platform_get_drvdata(pdev); in sunxi_musb_remove() local
808 struct platform_device *usb_phy = glue->usb_phy; in sunxi_musb_remove()
810 platform_device_unregister(glue->musb_pdev); in sunxi_musb_remove()