SAMV7 USB device: Finish option to force full speed mdoe

This commit is contained in:
Gregory Nutt 2015-04-06 10:07:12 -06:00
parent 6f9f4bd9a3
commit 5dab61f434
3 changed files with 22 additions and 10 deletions

View File

@ -1253,6 +1253,19 @@ endmenu # EMAC0 device driver options
menu "USB High Speed Device Controller driver (DCD) options" menu "USB High Speed Device Controller driver (DCD) options"
depends on SAMV7_USBDEVHS depends on SAMV7_USBDEVHS
config SAMV7_USBDEVHS_LOWPOWER
bool "Low-power mode"
default n
depends on EXPERIMENTAL
---help---
The USBHS can work in two modes:
- Normal mode where High speed, Full speed and Low speed are
available.
- Low-power mode where only Full speed and Low speed are available.
This options selects the low-power mode.
config SAMV7_USBHS_SCATTERGATHER config SAMV7_USBHS_SCATTERGATHER
bool bool
default n default n

View File

@ -59,11 +59,6 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ***********************************************************/
/* Not yet supported */
#undef CONFIG_SAMV7_USBDEVHS_LOWPOWER
/* Board Settings **********************************************************/ /* Board Settings **********************************************************/
/* PMC register settings based on the board configuration values defined /* PMC register settings based on the board configuration values defined
* in board.h * in board.h

View File

@ -4141,7 +4141,7 @@ static int sam_pullup(FAR struct usbdev_s *dev, bool enable)
/* Un-freeze clocking. /* Un-freeze clocking.
* *
* When the clock is frozen, on certain bits in the USBCH_CTRL * When the clock is frozen, on certain bits in the USBCH_CTRL
* register can be modified (FRZCLK, USBE, and LS). In addtion, * register can be modified (FRZCLK, USBE, and LS). In addition,
* only the asynchronous interrupt sources can trigger the USB * only the asynchronous interrupt sources can trigger the USB
* interrupt: * interrupt:
* *
@ -4357,20 +4357,24 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
* unfreeze clocking (FRZCLK = 0) * unfreeze clocking (FRZCLK = 0)
*/ */
regval |= USBHS_CTRL_USBE; regval |= USBHS_CTRL_UIMOD_DEVICE;
sam_putreg(regval, SAM_USBHS_CTRL); sam_putreg(regval, SAM_USBHS_CTRL);
regval |= USBHS_CTRL_UIMOD_DEVICE; regval |= USBHS_CTRL_USBE;
sam_putreg(regval, SAM_USBHS_CTRL); sam_putreg(regval, SAM_USBHS_CTRL);
regval &= ~USBHS_CTRL_FRZCLK; regval &= ~USBHS_CTRL_FRZCLK;
sam_putreg(regval, SAM_USBHS_CTRL); sam_putreg(regval, SAM_USBHS_CTRL);
/* Select High Speed */ /* Select High Speed or force Full Speed */
regval = sam_getreg(SAM_USBHS_DEVCTRL); regval = sam_getreg(SAM_USBHS_DEVCTRL);
regval &= ~USBHS_DEVCTRL_SPDCONF_MASK; regval &= ~USBHS_DEVCTRL_SPDCONF_MASK;
#ifdef CONFIG_SAMV7_USBDEVHS_LOWPOWER
regval |= USBHS_DEVCTRL_SPDCONF_LOWPOWER;
#else
regval |= USBHS_DEVCTRL_SPDCONF_NORMAL; regval |= USBHS_DEVCTRL_SPDCONF_NORMAL;
#endif
sam_putreg(regval, SAM_USBHS_DEVCTRL); sam_putreg(regval, SAM_USBHS_DEVCTRL);
/* Wait for UTMI clocking to be usable */ /* Wait for UTMI clocking to be usable */
@ -4383,7 +4387,7 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
regval &= ~USBHS_DEVCTRL_LS; regval &= ~USBHS_DEVCTRL_LS;
sam_putreg(regval, SAM_USBHS_DEVCTRL); sam_putreg(regval, SAM_USBHS_DEVCTRL);
/* Reset and disable all endpoints, initializing endpoint 0. */ /* Reset and disable all endpoints, re-initializing endpoint 0. */
sam_epset_reset(priv, SAM_EPSET_ALL); sam_epset_reset(priv, SAM_EPSET_ALL);
sam_ep0_configure(priv); sam_ep0_configure(priv);