Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/pbio/drv/usb/usb_common_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#if PBDRV_CONFIG_USB

#include <pbio/version.h>

#include "usb_common_desc.h"

#if PBIO_VERSION_LEVEL_HEX == 0xA
Expand Down
11 changes: 7 additions & 4 deletions lib/pbio/drv/usb/usb_ev3.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,14 +813,17 @@ static pbio_error_t pbdrv_usb_ev3_process_thread(pbio_os_state_t *state, void *c
}

void pbdrv_usb_init(void) {
// If we came straight from a firmware update, we need to send a disconnect
// to the host, then reset the USB controller.
USBDevDisconnect(USB0_BASE);

PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_USB0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_SWRSTDISABLE);
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_USB0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);

// This reset sequence is from Example 34-1 in the AM1808 TRM (spruh82c.pdf)
// Because PHYs and clocking are... as they tend to be, use the precise sequence
// of operations specified.

// Power on and reset the controller
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_USB0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);
USBReset(USB0_BASE);

// Reset the PHY
HWREG(CFGCHIP2_USBPHYCTRL) |= CFGCHIP2_RESET;
for (int i = 0; i < 50; i++) {
Expand Down
8 changes: 4 additions & 4 deletions lib/pbio/include/pbio/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
#include <pbio/util.h>

/** The current major version. */
#define PBIO_VERSION_MAJOR 3
#define PBIO_VERSION_MAJOR 4

/** The current minor version. */
#define PBIO_VERSION_MINOR 6
#define PBIO_VERSION_MINOR 0

/** The current patch version. */
#define PBIO_VERSION_MICRO 1
#define PBIO_VERSION_MICRO 0

/** The current prerelease level as a hex digit. */
#define PBIO_VERSION_LEVEL_HEX 0xF
#define PBIO_VERSION_LEVEL_HEX 0xA

/** The current prerelease serial. */
#define PBIO_VERSION_SERIAL 0
Expand Down
7 changes: 3 additions & 4 deletions lib/tiam1808/drivers/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,7 @@ void USBEnableOtgIntr(unsigned int ulBase)
unsigned int reg;

reg = HWREG(ulBase + USB_0_CTRL);
reg &= 0xFFFFFFF7;
reg &= ~USBOTG_CTRL_UINT;
HWREG(ulBase + USB_0_CTRL) = reg;

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

reg = HWREG(ulBase + USB_0_CTRL);
reg |= 1;
reg |= USBOTG_CTRL_RESET;

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

/* Wait till Reset bit is cleared */
while(((HWREG(ulBase + USB_0_CTRL)) & 0x1 )== 1);

while(((HWREG(ulBase + USB_0_CTRL)) & USBOTG_CTRL_RESET) == USBOTG_CTRL_RESET);
}

void USBClearOtgIntr(unsigned int ulBase)
Expand Down