From 04223a96180ffd0771a53729bd948d77fe2bd917 Mon Sep 17 00:00:00 2001
From: Frank Benkert <frank.benkert@avat.de>
Date: Wed, 25 May 2016 07:20:48 -0600
Subject: [PATCH] SAMV7: USBHS: Remove disabling of whole usb on suspend

This fix removes the disabling of the whole USB peripheral on suspend
interrupt. Its enough to freeze the clock instead.

When disabling the whole peripheral, the next wakeup-interrupt comes
up with an disabled clocking. The unfreeze clock has no effect, because
the master clock is disabled. This makes all registers, including the
IDR unwriteable and the IRQ falls in an endless loop blocking the whole
system.

Furthermore the disabling of the peripheral clock prevents hotplugging
or reconnecting the USB.
---
 arch/arm/src/samv7/sam_usbdevhs.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/src/samv7/sam_usbdevhs.c b/arch/arm/src/samv7/sam_usbdevhs.c
index 80bf1619c5..de6872e92e 100644
--- a/arch/arm/src/samv7/sam_usbdevhs.c
+++ b/arch/arm/src/samv7/sam_usbdevhs.c
@@ -3259,15 +3259,6 @@ static void sam_suspend(struct sam_usbdev_s *priv)
       priv->prevstate = priv->devstate;
       priv->devstate  = USBHS_DEVSTATE_SUSPENDED;
 
-      /* Disable clocking to the USBHS peripheral
-       *
-       * NOTE: The Atmel sample code disables USB clocking here (via the PMC
-       * CKGR_UCKR).  However, we cannot really do that here because that
-       * clocking is also needed by the UHPHS host.
-       */
-
-      sam_usbhs_disableclk();
-
       /* Let the board-specific logic know that we have entered the
        * suspend state.  This may trigger additional reduced power
        * consumption measures.
-- 
GitLab