SAMV7 USB DCD: A few more fixed from early intergration. Still does not work

This commit is contained in:
Gregory Nutt 2015-03-25 09:04:51 -06:00
parent 43d6e5f13c
commit 6b5fd920ed
2 changed files with 7 additions and 20 deletions

View File

@ -232,7 +232,7 @@
#define USBHS_DEVINT_UPRSM (1 << 6) /* Bit 6: Upstream Resume Interrupt */
#define USBHS_DEVINT_PEP_SHIFT (12) /* Bits 12-23: Endpoint interrupts (1) */
#define USBHS_DEVINT_PEP_MASK (0xfff << USBHS_DEVINT_PEP_SHIFT)
# define USBHS_DEVINT_PEP(n) (1 << +((n)+12)) /* Endpoint n Interrupt, n=0-11 (1) */
# define USBHS_DEVINT_PEP(n) (1 << ((n)+12)) /* Endpoint n Interrupt, n=0-11 (1) */
# define USBHS_DEVINT_PEP0 (1 << 12) /* Bit 12: Endpoint 0 Interrupt (1) */
# define USBHS_DEVINT_PEP1 (1 << 13) /* Bit 13: Endpoint 1 Interrupt (1) */
# define USBHS_DEVINT_PEP2 (1 << 14) /* Bit 14: Endpoint 2 Interrupt (1) */
@ -747,9 +747,9 @@
#define USBHS_CTRL_RDERRE (1 << 4) /* Bit 4: Remote Device Connection Error Interrupt Enable */
#define USBHS_CTRL_FRZCLK (1 << 14) /* Bit 14: Freeze USB Clock */
#define USBHS_CTRL_USBE (1 << 15) /* Bit 15: USBHS Enable */
#define USBHS_CTRL_UIMOD (1 << 25) /* Bit 25: USBHS Mode */
#define USBHS_CTRL_UIMOD_MASK (1 << 25) /* Bit 25: USBHS Mode */
# define USBHS_CTRL_UIMOD_HOST (0 << 25) /* 0=Host mode */
# define USBHS_CTRL_UIMOD_DEVICE (1 << 25) /* 1= Device mode */
# define USBHS_CTRL_UIMOD_DEVICE (1 << 25) /* 1=Device mode */
/* General Status Register */

View File

@ -1704,7 +1704,7 @@ static void sam_req_cancel(struct sam_ep_s *privep, int16_t result)
epno = USB_EPNO(privep->ep.eplog);
if (epno != 0)
{
sam_putreg(~USBHS_DEVINT_DMA(epno), SAM_USBHS_DEVIDR);
sam_putreg(USBHS_DEVINT_DMA(epno), SAM_USBHS_DEVIDR);
}
/* Then complete every queued request with the specified status */
@ -4197,8 +4197,8 @@ static void sam_reset(struct sam_usbdev_s *priv)
{
struct sam_ep_s *privep = &priv->eplist[epno];
/* Cancel any queued requests. Since they are canceled
* with status -ESHUTDOWN, then will not be requeued
/* Cancel any queued requests. Since they are cancelled
* with status -ESHUTDOWN, then will not be re-queued
* until the configuration is reset. NOTE: This should
* not be necessary... the CLASS_DISCONNECT above should
* result in the class implementation calling sam_ep_disable
@ -4312,22 +4312,9 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
/* Stop any DMA transfer */
sam_putreg(0, SAM_USBHS_DEVDMACTRL(i));
/* Reset DMA channel (Buffer count and Control field) */
sam_putreg(USBHS_DEVDMACTRL_LDNXTDSC, SAM_USBHS_DEVDMACTRL(i));
/* Reset DMA channel */
sam_putreg(0, SAM_USBHS_DEVDMACTRL(i));
/* Clear DMA channel status (read to clear) */
regval = sam_getreg(SAM_USBHS_DEVDMASTA(i));
sam_putreg(regval, SAM_USBHS_DEVDMACTRL(i));
}
/* Disable all interrupts. Disable all endpoints */
/* Disable all endpoint interrupts. Disable all endpoints */
sam_putreg(USBHS_DEVEPT_ALLEPEN, SAM_USBHS_DEVIDR);
sam_putreg(0, SAM_USBHS_DEVEPT);