diff --git a/arch/arm/src/samv7/chip/sam_usbhs.h b/arch/arm/src/samv7/chip/sam_usbhs.h index f6357821908..c4ef7b91d65 100644 --- a/arch/arm/src/samv7/chip/sam_usbhs.h +++ b/arch/arm/src/samv7/chip/sam_usbhs.h @@ -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 */ diff --git a/arch/arm/src/samv7/sam_usbdevhs.c b/arch/arm/src/samv7/sam_usbdevhs.c index a89dfb8570f..3bb1739b540 100644 --- a/arch/arm/src/samv7/sam_usbdevhs.c +++ b/arch/arm/src/samv7/sam_usbdevhs.c @@ -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);