Lines Matching refs:otg
19 #include <linux/usb/otg.h>
224 return usb_otg_state_string(isp->phy.otg->state);
239 isp->phy.otg->state = OTG_STATE_UNDEFINED;
268 if (!isp->phy.otg->host)
274 dev = isp->phy.otg->host->controller;
286 if (!isp->phy.otg->host)
289 dev = isp->phy.otg->host->controller;
296 isp->phy.otg->gadget->b_hnp_enable = 0;
297 isp->phy.otg->gadget->a_hnp_support = 0;
298 isp->phy.otg->gadget->a_alt_hnp_support = 0;
299 return usb_gadget_vbus_disconnect(isp->phy.otg->gadget);
329 if (isp->phy.otg->state == OTG_STATE_A_IDLE)
332 isp->phy.otg->default_a = 1;
333 if (isp->phy.otg->host) {
334 isp->phy.otg->host->is_b_host = 0;
337 if (isp->phy.otg->gadget) {
338 isp->phy.otg->gadget->is_a_peripheral = 1;
341 isp->phy.otg->state = OTG_STATE_A_IDLE;
353 if (isp->phy.otg->state == OTG_STATE_B_IDLE)
356 isp->phy.otg->default_a = 0;
357 if (isp->phy.otg->host) {
358 isp->phy.otg->host->is_b_host = 1;
361 if (isp->phy.otg->gadget) {
362 isp->phy.otg->gadget->is_a_peripheral = 0;
365 isp->phy.otg->state = OTG_STATE_B_IDLE;
379 pr_debug("otg: %06x, %s %s, otg/%02x stat/%02x.%02x\n",
464 if (isp->phy.otg->state == state && !extra)
466 pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
488 else if (isp->phy.otg->state == OTG_STATE_A_WAIT_VFALL) {
495 if (isp->phy.otg->state == OTG_STATE_B_IDLE
496 || isp->phy.otg->state
503 if (isp->phy.otg->state == OTG_STATE_A_IDLE
504 || isp->phy.otg->state == OTG_STATE_UNDEFINED) {
538 switch (isp->phy.otg->state) {
544 if (isp->phy.otg->gadget->b_hnp_enable) {
545 isp->phy.otg->state = OTG_STATE_B_WAIT_ACON;
572 if (!(isp->phy.otg->host))
575 switch (isp->phy.otg->state) {
586 isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL;
595 isp->phy.otg->state = OTG_STATE_A_WAIT_VRISE;
615 switch (isp->phy.otg->state) {
619 isp->phy.otg->state = OTG_STATE_B_PERIPHERAL;
625 isp->phy.otg->state = OTG_STATE_A_PERIPHERAL;
637 dump_regs(isp, "otg->isp1301");
646 struct usb_otg *otg = isp->phy.otg;
656 pr_debug("otg: B_SRP_TIMEOUT, %06x\n", omap_readl(OTG_CTRL));
663 if (isp->phy.otg->state == OTG_STATE_B_SRP_INIT)
671 pr_debug("otg: %s B_HNP_FAIL, %06x\n",
681 isp->phy.otg->state = OTG_STATE_B_PERIPHERAL;
689 pr_debug("otg: %s SRP_DETECT, %06x\n",
693 switch (isp->phy.otg->state) {
695 if (!otg->host)
717 pr_info("otg: BCON_TMOUT from %s, %06x\n",
724 isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL;
732 printk(KERN_ERR "otg: %s, VBUS_ERR %04x ctrl %06x\n",
738 isp->phy.otg->state = OTG_STATE_A_VBUS_ERR;
750 printk(KERN_NOTICE "otg: %s, SWITCH to %s, ctrl %06x\n",
759 switch (isp->phy.otg->state) {
775 if (otg->host) {
776 switch (isp->phy.otg->state) {
778 isp->phy.otg->state = OTG_STATE_B_HOST;
783 isp->phy.otg->state = OTG_STATE_A_HOST;
787 isp->phy.otg->state = OTG_STATE_A_WAIT_BCON;
801 usb_bus_start_enum(otg->host, otg->host->otg_port);
836 pr_debug("otg: %s, %s %06x\n",
916 usb_gadget_vbus_connect(isp->phy.otg->gadget);
926 isp->phy.otg->state = OTG_STATE_B_PERIPHERAL;
934 struct usb_otg *otg = isp->phy.otg;
936 enum usb_otg_state state = isp->phy.otg->state;
944 if (otg->default_a) {
959 isp->phy.otg->state = OTG_STATE_A_HOST;
967 isp->phy.otg->state = OTG_STATE_A_VBUS_ERR;
976 usb_gadget_vbus_disconnect(otg->gadget);
983 if (otg->host && state == OTG_STATE_A_IDLE)
993 if (otg->default_a) {
996 isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL;
1009 isp->phy.otg->state = OTG_STATE_B_IDLE;
1020 switch (isp->phy.otg->state) {
1042 if (otg->gadget && (isp_bstat & OTG_B_SESS_VLD)) {
1054 pr_debug("otg: unsupported b-device %s\n",
1060 if (state != isp->phy.otg->state)
1073 dump_regs(isp, "isp1301->otg");
1097 /* transfer state from otg engine to isp1301 */
1103 /* transfer state from isp1301 to otg engine */
1118 switch (isp->phy.otg->state) {
1121 isp->phy.otg->state = OTG_STATE_A_HOST;
1130 isp->phy.otg->state = OTG_STATE_B_HOST;
1193 kfree(isp->phy.otg);
1263 isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
1265 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1273 otg->host = NULL;
1278 otg->host = host;
1281 if (otg->gadget)
1287 otg->host = host;
1319 isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
1321 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1328 if (!otg->default_a)
1330 usb_gadget_vbus_disconnect(otg->gadget);
1331 otg->gadget = NULL;
1337 otg->gadget = gadget;
1340 if (otg->host)
1345 otg->gadget = gadget;
1358 isp->phy.otg->state = OTG_STATE_B_IDLE;
1393 if (dev->otg->state == OTG_STATE_B_PERIPHERAL)
1399 isp1301_start_srp(struct usb_otg *otg)
1401 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1404 if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE)
1414 isp->phy.otg->state = OTG_STATE_B_SRP_INIT;
1416 pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
1425 isp1301_start_hnp(struct usb_otg *otg)
1428 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1433 if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
1435 if (!otg->default_a && (otg->gadget == NULL
1436 || !otg->gadget->b_hnp_enable))
1442 switch (isp->phy.otg->state) {
1444 isp->phy.otg->state = OTG_STATE_B_PERIPHERAL;
1454 usb_gadget_vbus_connect(otg->gadget);
1466 pr_debug("otg: HNP %s, %06x ...\n",
1491 isp->phy.otg = kzalloc(sizeof *isp->phy.otg, GFP_KERNEL);
1492 if (!isp->phy.otg) {
1571 isp->phy.otg->usb_phy = &isp->phy;
1572 isp->phy.otg->set_host = isp1301_set_host,
1573 isp->phy.otg->set_peripheral = isp1301_set_peripheral,
1574 isp->phy.otg->start_srp = isp1301_start_srp,
1575 isp->phy.otg->start_hnp = isp1301_start_hnp,
1601 kfree(isp->phy.otg);