Re: [PATCH 1/2] usb: musb: core: Fix handling of the phy notifications

2015-12-07 Thread Tony Lindgren
* Kishon Vijay Abraham I  [151206 23:03]:
> On Tuesday 01 December 2015 11:07 AM, Tony Lindgren wrote:
> > We currently can't unload omap2430 MUSB platform glue driver module and
> > this cause issues for fixing the MUSB code further. The reason we can't
> > remove omap2430 is because it uses the PHY functions and also exports the
> > omap_musb_mailbox function that some PHY drivers are using.
> > 
> > Let's fix the issue by exporting a more generic musb_mailbox function
> > from the MUSB core and allow platform glue layers to register phy_callback
> > function as needed.
> > 
> > And now we can now also get rid of the include/linux/musb-omap.h.
> > 
> > Cc: Bin Liu 
> > Cc: Felipe Balbi 
> > Cc: Kishon Vijay Abraham I 
> > Cc: NeilBrown 
> > Signed-off-by: Tony Lindgren 
> 
> Reviewed-by: Kishon Vijay Abraham I 
> > 
> > Probably best that Felipe merges this patch via the USB tree after
> > comments if that works for Kishon? I have another two fixes for the
> 
> That should be okay.

OK thanks!

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] usb: musb: core: Fix handling of the phy notifications

2015-12-06 Thread Kishon Vijay Abraham I
On Tuesday 01 December 2015 11:07 AM, Tony Lindgren wrote:
> We currently can't unload omap2430 MUSB platform glue driver module and
> this cause issues for fixing the MUSB code further. The reason we can't
> remove omap2430 is because it uses the PHY functions and also exports the
> omap_musb_mailbox function that some PHY drivers are using.
> 
> Let's fix the issue by exporting a more generic musb_mailbox function
> from the MUSB core and allow platform glue layers to register phy_callback
> function as needed.
> 
> And now we can now also get rid of the include/linux/musb-omap.h.
> 
> Cc: Bin Liu 
> Cc: Felipe Balbi 
> Cc: Kishon Vijay Abraham I 
> Cc: NeilBrown 
> Signed-off-by: Tony Lindgren 

Reviewed-by: Kishon Vijay Abraham I 
> 
> ---
> 
> Probably best that Felipe merges this patch via the USB tree after
> comments if that works for Kishon? I have another two fixes for the

That should be okay.

Thanks
Kishon
> phy-twl4030-usb.c coming after this series but they can be merged
> separately and won't conflict with this patch.
> 
> ---
>  drivers/phy/phy-twl4030-usb.c | 32 
>  drivers/usb/musb/musb_core.c  | 21 +
>  drivers/usb/musb/musb_core.h  |  2 ++
>  drivers/usb/musb/omap2430.c   | 27 ++-
>  drivers/usb/phy/phy-twl6030-usb.c | 30 +++---
>  include/linux/usb/musb-omap.h | 30 --
>  include/linux/usb/musb.h  | 15 +++
>  7 files changed, 83 insertions(+), 74 deletions(-)
>  delete mode 100644 include/linux/usb/musb-omap.h
> 
> diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
> index 3a707dd..4a3fc6e 100644
> --- a/drivers/phy/phy-twl4030-usb.c
> +++ b/drivers/phy/phy-twl4030-usb.c
> @@ -34,7 +34,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -148,10 +148,10 @@
>   * If VBUS is valid or ID is ground, then we know a
>   * cable is present and we need to be runtime-enabled
>   */
> -static inline bool cable_present(enum omap_musb_vbus_id_status stat)
> +static inline bool cable_present(enum musb_vbus_id_status stat)
>  {
> - return stat == OMAP_MUSB_VBUS_VALID ||
> - stat == OMAP_MUSB_ID_GROUND;
> + return stat == MUSB_VBUS_VALID ||
> + stat == MUSB_ID_GROUND;
>  }
>  
>  struct twl4030_usb {
> @@ -170,7 +170,7 @@ struct twl4030_usb {
>   enum twl4030_usb_mode   usb_mode;
>  
>   int irq;
> - enum omap_musb_vbus_id_status linkstat;
> + enum musb_vbus_id_status linkstat;
>   boolvbus_supplied;
>  
>   struct delayed_work id_workaround_work;
> @@ -276,11 +276,11 @@ static bool twl4030_is_driving_vbus(struct twl4030_usb 
> *twl)
>   return (ret & (ULPI_OTG_DRVVBUS | ULPI_OTG_CHRGVBUS)) ? true : false;
>  }
>  
> -static enum omap_musb_vbus_id_status
> +static enum musb_vbus_id_status
>   twl4030_usb_linkstat(struct twl4030_usb *twl)
>  {
>   int status;
> - enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
> + enum musb_vbus_id_status linkstat = MUSB_UNKNOWN;
>  
>   twl->vbus_supplied = false;
>  
> @@ -306,14 +306,14 @@ static enum omap_musb_vbus_id_status
>   }
>  
>   if (status & BIT(2))
> - linkstat = OMAP_MUSB_ID_GROUND;
> + linkstat = MUSB_ID_GROUND;
>   else if (status & BIT(7))
> - linkstat = OMAP_MUSB_VBUS_VALID;
> + linkstat = MUSB_VBUS_VALID;
>   else
> - linkstat = OMAP_MUSB_VBUS_OFF;
> + linkstat = MUSB_VBUS_OFF;
>   } else {
> - if (twl->linkstat != OMAP_MUSB_UNKNOWN)
> - linkstat = OMAP_MUSB_VBUS_OFF;
> + if (twl->linkstat != MUSB_UNKNOWN)
> + linkstat = MUSB_VBUS_OFF;
>   }
>  
>   dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
> @@ -535,7 +535,7 @@ static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, 
> NULL);
>  static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
>  {
>   struct twl4030_usb *twl = _twl;
> - enum omap_musb_vbus_id_status status;
> + enum musb_vbus_id_status status;
>   bool status_changed = false;
>  
>   status = twl4030_usb_linkstat(twl);
> @@ -567,11 +567,11 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
>   pm_runtime_mark_last_busy(twl->dev);
>   pm_runtime_put_autosuspend(twl->dev);
>   }
> - omap_musb_mailbox(status);
> + musb_mailbox(status);
>   }
>  
>   /* don't schedule during sleep - irq works right then */
> - if (status == OMAP_MUSB_ID_GROUND && pm_runtime_active(twl->dev)) {
> + if (status == MUSB_ID_GROUND && pm_runtime_active(twl->dev)) {
>   cancel_delayed_work(&twl->id_w

[PATCH 1/2] usb: musb: core: Fix handling of the phy notifications

2015-11-30 Thread Tony Lindgren
We currently can't unload omap2430 MUSB platform glue driver module and
this cause issues for fixing the MUSB code further. The reason we can't
remove omap2430 is because it uses the PHY functions and also exports the
omap_musb_mailbox function that some PHY drivers are using.

Let's fix the issue by exporting a more generic musb_mailbox function
from the MUSB core and allow platform glue layers to register phy_callback
function as needed.

And now we can now also get rid of the include/linux/musb-omap.h.

Cc: Bin Liu 
Cc: Felipe Balbi 
Cc: Kishon Vijay Abraham I 
Cc: NeilBrown 
Signed-off-by: Tony Lindgren 

---

Probably best that Felipe merges this patch via the USB tree after
comments if that works for Kishon? I have another two fixes for the
phy-twl4030-usb.c coming after this series but they can be merged
separately and won't conflict with this patch.

---
 drivers/phy/phy-twl4030-usb.c | 32 
 drivers/usb/musb/musb_core.c  | 21 +
 drivers/usb/musb/musb_core.h  |  2 ++
 drivers/usb/musb/omap2430.c   | 27 ++-
 drivers/usb/phy/phy-twl6030-usb.c | 30 +++---
 include/linux/usb/musb-omap.h | 30 --
 include/linux/usb/musb.h  | 15 +++
 7 files changed, 83 insertions(+), 74 deletions(-)
 delete mode 100644 include/linux/usb/musb-omap.h

diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 3a707dd..4a3fc6e 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -34,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -148,10 +148,10 @@
  * If VBUS is valid or ID is ground, then we know a
  * cable is present and we need to be runtime-enabled
  */
-static inline bool cable_present(enum omap_musb_vbus_id_status stat)
+static inline bool cable_present(enum musb_vbus_id_status stat)
 {
-   return stat == OMAP_MUSB_VBUS_VALID ||
-   stat == OMAP_MUSB_ID_GROUND;
+   return stat == MUSB_VBUS_VALID ||
+   stat == MUSB_ID_GROUND;
 }
 
 struct twl4030_usb {
@@ -170,7 +170,7 @@ struct twl4030_usb {
enum twl4030_usb_mode   usb_mode;
 
int irq;
-   enum omap_musb_vbus_id_status linkstat;
+   enum musb_vbus_id_status linkstat;
boolvbus_supplied;
 
struct delayed_work id_workaround_work;
@@ -276,11 +276,11 @@ static bool twl4030_is_driving_vbus(struct twl4030_usb 
*twl)
return (ret & (ULPI_OTG_DRVVBUS | ULPI_OTG_CHRGVBUS)) ? true : false;
 }
 
-static enum omap_musb_vbus_id_status
+static enum musb_vbus_id_status
twl4030_usb_linkstat(struct twl4030_usb *twl)
 {
int status;
-   enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
+   enum musb_vbus_id_status linkstat = MUSB_UNKNOWN;
 
twl->vbus_supplied = false;
 
@@ -306,14 +306,14 @@ static enum omap_musb_vbus_id_status
}
 
if (status & BIT(2))
-   linkstat = OMAP_MUSB_ID_GROUND;
+   linkstat = MUSB_ID_GROUND;
else if (status & BIT(7))
-   linkstat = OMAP_MUSB_VBUS_VALID;
+   linkstat = MUSB_VBUS_VALID;
else
-   linkstat = OMAP_MUSB_VBUS_OFF;
+   linkstat = MUSB_VBUS_OFF;
} else {
-   if (twl->linkstat != OMAP_MUSB_UNKNOWN)
-   linkstat = OMAP_MUSB_VBUS_OFF;
+   if (twl->linkstat != MUSB_UNKNOWN)
+   linkstat = MUSB_VBUS_OFF;
}
 
dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
@@ -535,7 +535,7 @@ static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, NULL);
 static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
 {
struct twl4030_usb *twl = _twl;
-   enum omap_musb_vbus_id_status status;
+   enum musb_vbus_id_status status;
bool status_changed = false;
 
status = twl4030_usb_linkstat(twl);
@@ -567,11 +567,11 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
pm_runtime_mark_last_busy(twl->dev);
pm_runtime_put_autosuspend(twl->dev);
}
-   omap_musb_mailbox(status);
+   musb_mailbox(status);
}
 
/* don't schedule during sleep - irq works right then */
-   if (status == OMAP_MUSB_ID_GROUND && pm_runtime_active(twl->dev)) {
+   if (status == MUSB_ID_GROUND && pm_runtime_active(twl->dev)) {
cancel_delayed_work(&twl->id_workaround_work);
schedule_delayed_work(&twl->id_workaround_work, HZ);
}
@@ -670,7 +670,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
twl->dev= &pdev->dev;
twl->irq= platform_get_irq(pdev, 0);
twl->