]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/phy/phy-tahvo.c
usb: move the OTG state from the USB PHY to the OTG structure
[karo-tx-linux.git] / drivers / usb / phy / phy-tahvo.c
index cc61ee44b911dfa5a0b2842a827b5ebfed285f20..04ece535c2f829ce8925b4077e6476c6c06e47db 100644 (file)
@@ -81,33 +81,33 @@ static void check_vbus_state(struct tahvo_usb *tu)
 
        reg = retu_read(rdev, TAHVO_REG_IDSR);
        if (reg & TAHVO_STAT_VBUS) {
-               switch (tu->phy.state) {
+               switch (tu->phy.otg->state) {
                case OTG_STATE_B_IDLE:
                        /* Enable the gadget driver */
                        if (tu->phy.otg->gadget)
                                usb_gadget_vbus_connect(tu->phy.otg->gadget);
-                       tu->phy.state = OTG_STATE_B_PERIPHERAL;
+                       tu->phy.otg->state = OTG_STATE_B_PERIPHERAL;
                        break;
                case OTG_STATE_A_IDLE:
                        /*
                         * Session is now valid assuming the USB hub is driving
                         * Vbus.
                         */
-                       tu->phy.state = OTG_STATE_A_HOST;
+                       tu->phy.otg->state = OTG_STATE_A_HOST;
                        break;
                default:
                        break;
                }
                dev_info(&tu->pt_dev->dev, "USB cable connected\n");
        } else {
-               switch (tu->phy.state) {
+               switch (tu->phy.otg->state) {
                case OTG_STATE_B_PERIPHERAL:
                        if (tu->phy.otg->gadget)
                                usb_gadget_vbus_disconnect(tu->phy.otg->gadget);
-                       tu->phy.state = OTG_STATE_B_IDLE;
+                       tu->phy.otg->state = OTG_STATE_B_IDLE;
                        break;
                case OTG_STATE_A_HOST:
-                       tu->phy.state = OTG_STATE_A_IDLE;
+                       tu->phy.otg->state = OTG_STATE_A_IDLE;
                        break;
                default:
                        break;
@@ -132,14 +132,14 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
        /* 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;
+       tu->phy.otg->state = OTG_STATE_A_IDLE;
 
        check_vbus_state(tu);
 }
 
 static void tahvo_usb_stop_host(struct tahvo_usb *tu)
 {
-       tu->phy.state = OTG_STATE_A_IDLE;
+       tu->phy.otg->state = OTG_STATE_A_IDLE;
 }
 
 static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
@@ -151,7 +151,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
        /* 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;
+       tu->phy.otg->state = OTG_STATE_B_IDLE;
 
        check_vbus_state(tu);
 }
@@ -160,7 +160,7 @@ static void tahvo_usb_stop_peripheral(struct tahvo_usb *tu)
 {
        if (tu->phy.otg->gadget)
                usb_gadget_vbus_disconnect(tu->phy.otg->gadget);
-       tu->phy.state = OTG_STATE_B_IDLE;
+       tu->phy.otg->state = OTG_STATE_B_IDLE;
 }
 
 static void tahvo_usb_power_off(struct tahvo_usb *tu)
@@ -173,7 +173,7 @@ static void tahvo_usb_power_off(struct tahvo_usb *tu)
 
        /* Power off transceiver */
        retu_write(rdev, TAHVO_REG_USBR, 0);
-       tu->phy.state = OTG_STATE_UNDEFINED;
+       tu->phy.otg->state = OTG_STATE_UNDEFINED;
 }
 
 static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend)
@@ -379,7 +379,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
        /* Create OTG interface */
        tahvo_usb_power_off(tu);
        tu->phy.dev = &pdev->dev;
-       tu->phy.state = OTG_STATE_UNDEFINED;
+       tu->phy.otg->state = OTG_STATE_UNDEFINED;
        tu->phy.label = DRIVER_NAME;
        tu->phy.set_suspend = tahvo_usb_set_suspend;