static void tahvo_usb_irq_work(struct work_struct *work) { struct tahvo_usb *tu = container_of(work, struct tahvo_usb, irq_work); mutex_lock(&tu->serialize); check_vbus_state(tu); mutex_unlock(&tu->serialize); }
static irqreturn_t tahvo_usb_vbus_interrupt(int irq, void *_tu) { struct tahvo_usb *tu = _tu; check_vbus_state(tu); return IRQ_HANDLED; }
static irqreturn_t tahvo_usb_vbus_interrupt(int irq, void *_tu) { struct tahvo_usb *tu = _tu; mutex_lock(&tu->serialize); check_vbus_state(tu); mutex_unlock(&tu->serialize); return IRQ_HANDLED; }
static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) { struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent); extcon_set_cable_state(&tu->extcon, "USB-HOST", false); /* Power up transceiver and set it in USB peripheral mode */ retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | USBR_NSUSPEND | USBR_SLAVE_SW); tu->phy.state = OTG_STATE_B_IDLE; check_vbus_state(tu); }
static void tahvo_usb_become_host(struct tahvo_usb *tu) { struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent); extcon_set_cable_state(&tu->extcon, "USB-HOST", true); /* Power up the transceiver in USB host mode */ retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND | USBR_MASTER_SW2 | USBR_MASTER_SW1); tu->phy.state = OTG_STATE_A_IDLE; check_vbus_state(tu); }
static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) { /* Clear system and transceiver controlled bits * and enable ID to mark peripheral mode and * BSESSEND to mark no Vbus */ omap_otg_init(); OTG_CTRL_REG = (OTG_CTRL_REG & ~(OTG_CTRL_XCVR_MASK|OTG_CTRL_SYS_MASK|OTG_BSESSVLD)) | OTG_ID | OTG_BSESSEND; /* Power up transceiver and set it in USB perhiperal mode */ tahvo_write_reg(TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | USBR_NSUSPEND | USBR_SLAVE_SW); tu->otg.state = OTG_STATE_B_IDLE; check_vbus_state(tu); }
static void tahvo_usb_become_host(struct tahvo_usb *tu) { u32 l; /* Clear system and transceiver controlled bits * also mark the A-session is always valid */ omap_otg_init(); l = OTG_CTRL_REG; l &= ~(OTG_CTRL_XCVR_MASK|OTG_CTRL_SYS_MASK); l |= OTG_ASESSVLD; OTG_CTRL_REG = l; /* Power up the transceiver in USB host mode */ tahvo_write_reg(TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND | USBR_MASTER_SW2 | USBR_MASTER_SW1); tu->otg.state = OTG_STATE_A_IDLE; check_vbus_state(tu); }