SAMA5 UDPHS: Minor clean-up of STALL logic

This commit is contained in:
Gregory Nutt 2013-09-23 18:10:41 -06:00
parent c68c0cb268
commit 9bb771b8b8
2 changed files with 40 additions and 35 deletions

View File

@ -3597,7 +3597,7 @@ static int sam_ep_submit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
/* Handle IN (device-to-host) requests. NOTE: If the class device is
* using the bi-directional EP0, then we assume that they intend the EP0
* IN functionality.
* IN functionality (EP0 OUT data receipt does not use requests).
*/
else if (USB_ISEPIN(ep->eplog) || epno == EP0)
@ -3708,9 +3708,12 @@ static int sam_ep_stall(struct usbdev_ep_s *ep, bool resume)
privep->epstate = UDPHS_EPSTATE_IDLE;
/* Clear FORCESTALL flag */
/* Clear FORCESTALL request
* REVISIT: Data sheet says to reset toggle to DATA0 only on OUT
* endpoints.
*/
sam_putreg(UDPHS_EPTSTA_TOGGLESQ_MASK | UDPHS_EPTSTA_FRCESTALL,
sam_putreg(UDPHS_EPTCLRSTA_TOGGLESQ | UDPHS_EPTCLRSTA_FRCESTALL,
SAM_UDPHS_EPTCLRSTA(epno));
/* Reset endpoint FIFOs */
@ -3725,13 +3728,9 @@ static int sam_ep_stall(struct usbdev_ep_s *ep, bool resume)
(void)sam_req_write(priv, privep);
}
if ((epno == 0 && privep->epstate == UDPHS_EPSTATE_IDLE) ||
USB_ISEPOUT(ep->eplog))
else
{
/* OUT endpoint (or EP0 with no write request started).
* Restart any queued read requests.
*/
/* OUT endpoint. Restart any queued read requests. */
(void)sam_req_read(priv, privep, 0);
}
@ -3764,22 +3763,18 @@ static int sam_ep_stall(struct usbdev_ep_s *ep, bool resume)
sam_putreg(UDPHS_EPTSETSTA_FRCESTALL, SAM_UDPHS_EPTSETSTA(epno));
/* Enable endpoint/DMA interrupts */
/* Disable endpoint/DMA interrupts. The not be re-enabled until
* the stall is cleared and the next transfer is started. It
* would, of course, be a bad idea to do this on EP0 since it is
* a SETUP request that is going to clear the STALL.
*/
regval = sam_getreg(SAM_UDPHS_IEN);
if ((SAM_EPSET_DMA & SAM_EP_BIT(epno)) != 0)
if (epno != 0)
{
/* Enable the endpoint DMA interrupt */
regval &= ~UDPHS_INT_DMA(epno);
regval = sam_getreg(SAM_UDPHS_IEN);
regval &= ~(UDPHS_INT_DMA(epno) | UDPHS_INT_EPT(epno));
sam_putreg(regval, SAM_UDPHS_IEN);
}
else
{
/* Enable the endpoint interrupt */
regval &= ~UDPHS_INT_EPT(epno);
}
sam_putreg(regval, SAM_UDPHS_IEN);
}
}

View File

@ -1152,20 +1152,31 @@ Configurations
CONFIG_EXAMPLES_USBMSC=y : Enable the USBMSC example
CONFIG_EXAMPLES_USBMSC_NLUNS=1 : One LUN
CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0 : Minor device zero
CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mtdblock0"
: Use a single, LUN: The AT25
: block driver.
NOTE: To prevent file system corruption, make sure that the AT25
is un-mounted *before* exporting the mass storage device to the host:
NOTES:
nsh> umount /mnt/at25
nsh> mscon
a. To prevent file system corruption, make sure that the AT25 is un-
mounted *before* exporting the mass storage device to the host:
The AT25 can be re-mounted after the mass storage class is disconnected:
nsh> umount /mnt/at25
nsh> mscon
nsh> msdis
nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
The AT25 can be re-mounted after the mass storage class is disconnected:
nsh> msdis
nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
b. If you change the value CONFIG_EXAMPLES_USBMSC_DEVPATH1, then you
can export other file systems:
"/dev/mmcsd1" will export the HSMCI1 microSD
"/dev/mmcsd0" will export the HSMCI0 full-size SD slot
"/dev/ram0" could even be used to export a RAM disk. But you would
first have to use mkrd to create the RAM disk and mkfatfs to put
a FAT file system on it.
8. The USB high-speed EHCI and the low-/full- OHCI host drivers are supported
in this configuration.
@ -1302,6 +1313,10 @@ Configurations
device connections; full- and low-speed device connections will be
handed-off to the OHCI HCD.
UDPHS
2013-9-23: The exports AT25 (or RAM disk) works fine with Linux but does
not bring up Windows Explorer with Windows. No idea why yet.
hello:
This configuration directory, performs the (almost) simplest of all
possible examples: examples/hello. This just comes up, says hello
@ -1687,11 +1702,6 @@ Configurations
CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
CONFIG_SYSTEM_USBMONITOR_INTERVAL=1 : Dump trace data every second
CONFIG_SYSTEM_USBMONITOR_TRACEINIT=y : Enable TRACE output
CONFIG_SYSTEM_USBMONITOR_TRACECLASS=y
CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS=y
CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER=y
CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS=y
NOTE: If USB debug output is also enabled, both outpus will appear
on the serial console. However, the debug output will be