cc2538: usb: Make the GPIO driving the pull-up optional

The data sheet recommends that the USB pull-up resistor be driven by a GPIO so
that it can be controlled by software, but this is not mandatory. Hence, leave
the choice so that CC253-based boards not using this option can build and work
fine.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
This commit is contained in:
Benoît Thébaudeau 2013-11-25 15:15:35 +01:00
parent d2f3795a30
commit 270ed237fd

View file

@ -54,8 +54,12 @@
#include <stdbool.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
#ifdef USB_PULLUP_PORT
#define USB_PULLUP_PORT_BASE GPIO_PORT_TO_BASE(USB_PULLUP_PORT)
#endif
#ifdef USB_PULLUP_PIN
#define USB_PULLUP_PIN_MASK GPIO_PIN_MASK(USB_PULLUP_PIN)
#endif
/*---------------------------------------------------------------------------*/
/* EP max FIFO sizes without double buffering */
#if CTRL_EP_SIZE > 32
@ -332,9 +336,11 @@ usb_arch_setup(void)
/* Wait until USB PLL is stable */
while(!(REG(USB_CTRL) & USB_CTRL_PLL_LOCKED));
/* Enable pull-up on usb port */
/* Enable pull-up on usb port if driven by GPIO */
#if defined(USB_PULLUP_PORT_BASE) && defined(USB_PULLUP_PIN_MASK)
GPIO_SET_OUTPUT(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK);
GPIO_SET_PIN(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK);
#endif
for(i = 0; i < USB_MAX_ENDPOINTS; i++) {
usb_endpoints[i].flags = 0;