usb: musb: core: Fix handling of the phy notifications
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / drivers / usb / musb / omap2430.c
index 1bd9232ff76fcb774e6b1e9e1fb8acdb62ef267d..bf05f807729f8b40912e55fe208347890032a3fb 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/err.h>
 #include <linux/delay.h>
-#include <linux/usb/musb-omap.h>
+#include <linux/usb/musb.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/of_platform.h>
 
@@ -46,7 +46,7 @@
 struct omap2430_glue {
        struct device           *dev;
        struct platform_device  *musb;
-       enum omap_musb_vbus_id_status status;
+       enum musb_vbus_id_status status;
        struct work_struct      omap_musb_mailbox_work;
        struct device           *control_otghs;
 };
@@ -234,7 +234,7 @@ static inline void omap2430_low_level_init(struct musb *musb)
        musb_writel(musb->mregs, OTG_FORCESTDBY, l);
 }
 
-void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
+static void omap2430_musb_mailbox(enum musb_vbus_id_status status)
 {
        struct omap2430_glue    *glue = _glue;
 
@@ -251,7 +251,6 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
 
        schedule_work(&glue->omap_musb_mailbox_work);
 }
-EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
@@ -262,7 +261,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
        struct usb_otg *otg = musb->xceiv->otg;
 
        switch (glue->status) {
-       case OMAP_MUSB_ID_GROUND:
+       case MUSB_ID_GROUND:
                dev_dbg(dev, "ID GND\n");
 
                otg->default_a = true;
@@ -276,7 +275,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
                }
                break;
 
-       case OMAP_MUSB_VBUS_VALID:
+       case MUSB_VBUS_VALID:
                dev_dbg(dev, "VBUS Connect\n");
 
                otg->default_a = false;
@@ -287,8 +286,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
                omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
                break;
 
-       case OMAP_MUSB_ID_FLOAT:
-       case OMAP_MUSB_VBUS_OFF:
+       case MUSB_ID_FLOAT:
+       case MUSB_VBUS_OFF:
                dev_dbg(dev, "VBUS Disconnect\n");
 
                musb->xceiv->last_event = USB_EVENT_NONE;
@@ -430,7 +429,7 @@ static int omap2430_musb_init(struct musb *musb)
 
        setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
 
-       if (glue->status != OMAP_MUSB_UNKNOWN)
+       if (glue->status != MUSB_UNKNOWN)
                omap_musb_set_mailbox(glue);
 
        phy_init(musb->phy);
@@ -455,7 +454,7 @@ static void omap2430_musb_enable(struct musb *musb)
 
        switch (glue->status) {
 
-       case OMAP_MUSB_ID_GROUND:
+       case MUSB_ID_GROUND:
                omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
                if (data->interface_type != MUSB_INTERFACE_UTMI)
                        break;
@@ -474,7 +473,7 @@ static void omap2430_musb_enable(struct musb *musb)
                }
                break;
 
-       case OMAP_MUSB_VBUS_VALID:
+       case MUSB_VBUS_VALID:
                omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
                break;
 
@@ -488,7 +487,7 @@ static void omap2430_musb_disable(struct musb *musb)
        struct device *dev = musb->controller;
        struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
-       if (glue->status != OMAP_MUSB_UNKNOWN)
+       if (glue->status != MUSB_UNKNOWN)
                omap_control_usb_set_mode(glue->control_otghs,
                        USB_MODE_DISCONNECT);
 }
@@ -520,6 +519,8 @@ static const struct musb_platform_ops omap2430_ops = {
 
        .enable         = omap2430_musb_enable,
        .disable        = omap2430_musb_disable,
+
+       .phy_callback   = omap2430_musb_mailbox,
 };
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);
@@ -551,7 +552,7 @@ static int omap2430_probe(struct platform_device *pdev)
 
        glue->dev                       = &pdev->dev;
        glue->musb                      = musb;
-       glue->status                    = OMAP_MUSB_UNKNOWN;
+       glue->status                    = MUSB_UNKNOWN;
        glue->control_otghs = ERR_PTR(-ENODEV);
 
        if (np) {