Lines Matching refs:otg_dev

48 static void omap_otg_ctrl(struct otg_device *otg_dev, u32 outputs)  in omap_otg_ctrl()  argument
52 l = readl(otg_dev->base + OMAP_OTG_CTRL); in omap_otg_ctrl()
55 writel(l, otg_dev->base + OMAP_OTG_CTRL); in omap_otg_ctrl()
58 static void omap_otg_set_mode(struct otg_device *otg_dev) in omap_otg_set_mode() argument
60 if (!otg_dev->id && otg_dev->vbus) in omap_otg_set_mode()
62 omap_otg_ctrl(otg_dev, OMAP_OTG_ID | OMAP_OTG_BSESSVLD); in omap_otg_set_mode()
63 else if (otg_dev->vbus) in omap_otg_set_mode()
65 omap_otg_ctrl(otg_dev, OMAP_OTG_ASESSVLD); in omap_otg_set_mode()
66 else if (!otg_dev->id) in omap_otg_set_mode()
68 omap_otg_ctrl(otg_dev, OMAP_OTG_ID | OMAP_OTG_BSESSEND); in omap_otg_set_mode()
74 struct otg_device *otg_dev = container_of(nb, struct otg_device, id_nb); in omap_otg_id_notifier() local
76 otg_dev->id = event; in omap_otg_id_notifier()
77 omap_otg_set_mode(otg_dev); in omap_otg_id_notifier()
85 struct otg_device *otg_dev = container_of(nb, struct otg_device, in omap_otg_vbus_notifier() local
88 otg_dev->vbus = event; in omap_otg_vbus_notifier()
89 omap_otg_set_mode(otg_dev); in omap_otg_vbus_notifier()
97 struct otg_device *otg_dev; in omap_otg_probe() local
109 otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL); in omap_otg_probe()
110 if (!otg_dev) in omap_otg_probe()
113 otg_dev->base = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]); in omap_otg_probe()
114 if (IS_ERR(otg_dev->base)) in omap_otg_probe()
115 return PTR_ERR(otg_dev->base); in omap_otg_probe()
117 otg_dev->extcon = extcon; in omap_otg_probe()
118 otg_dev->id_nb.notifier_call = omap_otg_id_notifier; in omap_otg_probe()
119 otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier; in omap_otg_probe()
121 ret = extcon_register_notifier(extcon, EXTCON_USB_HOST, &otg_dev->id_nb); in omap_otg_probe()
125 ret = extcon_register_notifier(extcon, EXTCON_USB, &otg_dev->vbus_nb); in omap_otg_probe()
128 &otg_dev->id_nb); in omap_otg_probe()
132 otg_dev->id = extcon_get_cable_state_(extcon, EXTCON_USB_HOST); in omap_otg_probe()
133 otg_dev->vbus = extcon_get_cable_state_(extcon, EXTCON_USB); in omap_otg_probe()
134 omap_otg_set_mode(otg_dev); in omap_otg_probe()
136 rev = readl(otg_dev->base); in omap_otg_probe()
140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, in omap_otg_probe()
141 otg_dev->vbus); in omap_otg_probe()
148 struct otg_device *otg_dev = platform_get_drvdata(pdev); in omap_otg_remove() local
149 struct extcon_dev *edev = otg_dev->extcon; in omap_otg_remove()
151 extcon_unregister_notifier(edev, EXTCON_USB_HOST,&otg_dev->id_nb); in omap_otg_remove()
152 extcon_unregister_notifier(edev, EXTCON_USB, &otg_dev->vbus_nb); in omap_otg_remove()