Advertisement
mpthompson

mx23_hostdistcondetect.patch

Aug 23rd, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
  2. index 128a804..368235b 100644
  3. --- a/drivers/usb/core/hub.c
  4. +++ b/drivers/usb/core/hub.c
  5. @@ -30,6 +30,19 @@
  6. #include <asm/uaccess.h>
  7. #include <asm/byteorder.h>
  8.  
  9. +#ifdef CONFIG_USB_MXS_PHY
  10. +#include <linux/io.h>
  11. +#include <linux/of_platform.h>
  12. +
  13. +#define USB_MXS_PHY_HACK
  14. +
  15. +#define HW_USBPHY_CTRL 0x30
  16. +#define HW_USBPHY_CTRL_SET 0x34
  17. +#define HW_USBPHY_CTRL_CLR 0x38
  18. +
  19. +#define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1)
  20. +#endif
  21. +
  22. #include "usb.h"
  23.  
  24. /* if we are in debug mode, always announce new devices */
  25. @@ -3894,6 +3907,15 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
  26. break;
  27. }
  28. }
  29. +
  30. +#ifdef USB_MXS_PHY_HACK
  31. + /* Enable HOSTDISCONDETECT after second reset. */
  32. + if (of_machine_is_compatible("fsl,imx23"))
  33. + if ((port1 == 1) && (udev->speed == USB_SPEED_HIGH))
  34. + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
  35. + hcd->phy->io_priv + HW_USBPHY_CTRL_SET);
  36. +#endif
  37. +
  38. if (retval)
  39. goto fail;
  40.  
  41. @@ -4050,6 +4072,14 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
  42. "port %d, status %04x, change %04x, %s\n",
  43. port1, portstatus, portchange, portspeed(hub, portstatus));
  44.  
  45. +#ifdef USB_MXS_PHY_HACK
  46. + /* Clear HOSTDISCONDETECT if not a connection. */
  47. + if (of_machine_is_compatible("fsl,imx23"))
  48. + if ((port1 == 1) && !(portstatus & USB_PORT_STAT_CONNECTION))
  49. + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
  50. + hcd->phy->io_priv + HW_USBPHY_CTRL_CLR);
  51. +#endif
  52. +
  53. if (hub->has_indicators) {
  54. set_port_led(hub, port1, HUB_LED_AUTO);
  55. hub->indicator[port1-1] = INDICATOR_AUTO;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement