Skip to content

Commit 43f7da7

Browse files
committed
pbio/drv/usb_ev3: use correct register for reset
Use the correct register when calling USBReset(). Also replace some hard-coded values with macros in the related TI library.
1 parent 1808d73 commit 43f7da7

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/pbio/drv/usb/usb_ev3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ void pbdrv_usb_init(void) {
819819

820820
// Power on and reset the controller
821821
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_USB0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);
822-
USBReset(USB0_BASE);
822+
USBReset(USB_0_OTGBASE);
823823

824824
// Reset the PHY
825825
HWREG(CFGCHIP2_USBPHYCTRL) |= CFGCHIP2_RESET;

lib/tiam1808/drivers/usb.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ void USBEnableOtgIntr(unsigned int ulBase)
31513151
unsigned int reg;
31523152

31533153
reg = HWREG(ulBase + USB_0_CTRL);
3154-
reg &= 0xFFFFFFF7;
3154+
reg &= ~USBOTG_CTRL_UINT;
31553155
HWREG(ulBase + USB_0_CTRL) = reg;
31563156

31573157
/* This API enables the USB Interrupts through subsystem specific wrapper
@@ -3171,14 +3171,13 @@ void USBReset(unsigned int ulBase)
31713171
unsigned int reg;
31723172

31733173
reg = HWREG(ulBase + USB_0_CTRL);
3174-
reg |= 1;
3174+
reg |= USBOTG_CTRL_RESET;
31753175

31763176
/* Set the Reset Bit */
31773177
HWREG(ulBase + USB_0_CTRL) = reg;
31783178

31793179
/* Wait till Reset bit is cleared */
3180-
while(((HWREG(ulBase + USB_0_CTRL)) & 0x1 )== 1);
3181-
3180+
while(((HWREG(ulBase + USB_0_CTRL)) & USBOTG_CTRL_RESET) == USBOTG_CTRL_RESET);
31823181
}
31833182

31843183
void USBClearOtgIntr(unsigned int ulBase)

0 commit comments

Comments
 (0)