servo_v4: servo_micro: cr50: fix usb power declaration

Servo_micro sets usb config maxpower to 100mA.

Servo_v4 is set to self powered as it's powered by a
shared vbus and not be the bub it's connected to.

cr50 is self powered as no power is transmitted as part of CCD.

* Add CONFIG_USB_MAXPOWER_MA to define USB maximum power draw requested
per board.
* Add CONFIG_USB_SELF_POWERED to indicate that a device is not
powered by allocated USB power.

BUG=chromium:631302
TEST=lsusb reports 100mA bMaxPower (micro), Self powered (v4)
BRANCH=None

Change-Id: I79b8ce46f32d94f16104a4a8080104e30dce7f2c
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363153
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Nick Sanders
2016-07-26 08:22:34 -07:00
committed by chrome-bot
parent 1e7b5f3c07
commit 3e42a3b059
6 changed files with 32 additions and 4 deletions

View File

@@ -57,6 +57,7 @@
#define CONFIG_CASE_CLOSED_DEBUG
#define CONFIG_USB_PID 0x5014
#define CONFIG_USB_SELF_POWERED
/* Enable SPI Master (SPI) module */
#define CONFIG_SPI_MASTER

View File

@@ -35,6 +35,9 @@
#define CONFIG_USB_CONSOLE
#define CONFIG_USB_UPDATE
#undef CONFIG_USB_MAXPOWER_MA
#define CONFIG_USB_MAXPOWER_MA 100
#define CONFIG_USB_SERIALNO
#define DEFAULT_SERIALNO "Uninitialized"

View File

@@ -29,6 +29,8 @@
#define CONFIG_USB_CONSOLE
#define CONFIG_USB_UPDATE
#define CONFIG_USB_SELF_POWERED
#define CONFIG_USB_SERIALNO
#define DEFAULT_SERIALNO "Uninitialized"

View File

@@ -191,6 +191,14 @@ static void showregs(void)
#define CONFIG_USB_BCD_DEV 0x0100 /* 1.00 */
#endif
#ifndef USB_BMATTRIBUTES
#ifdef CONFIG_USB_SELF_POWERED
#define USB_BMATTRIBUTES 0xc0 /* Self powered. */
#else
#define USB_BMATTRIBUTES 0x80 /* Bus powered. */
#endif
#endif
/* USB Standard Device Descriptor */
static const struct usb_device_descriptor dev_desc = {
.bLength = USB_DT_DEVICE_SIZE,
@@ -217,8 +225,8 @@ const struct usb_config_descriptor USB_CONF_DESC(conf) = {
.bNumInterfaces = USB_IFACE_COUNT,
.bConfigurationValue = 1, /* Caution: hard-coded value */
.iConfiguration = USB_STR_VERSION,
.bmAttributes = 0x80, /* bus powered */
.bMaxPower = 250, /* MaxPower 500 mA */
.bmAttributes = USB_BMATTRIBUTES, /* bus or self powered */
.bMaxPower = (CONFIG_USB_MAXPOWER_MA / 2),
};
const uint8_t usb_string_desc[] = {

View File

@@ -35,6 +35,14 @@
#define CONFIG_USB_BCD_DEV 0x0100 /* 1.00 */
#endif
#ifndef USB_BMATTRIBUTES
#ifdef CONFIG_USB_SELF_POWERED
#define USB_BMATTRIBUTES 0xc0 /* Self powered. */
#else
#define USB_BMATTRIBUTES 0x80 /* Bus powered. */
#endif
#endif
#ifndef CONFIG_USB_SERIALNO
#define USB_STR_SERIALNO 0
#else
@@ -67,8 +75,8 @@ const struct usb_config_descriptor USB_CONF_DESC(conf) = {
.bNumInterfaces = USB_IFACE_COUNT,
.bConfigurationValue = 1,
.iConfiguration = USB_STR_VERSION,
.bmAttributes = 0x80, /* bus powered */
.bMaxPower = 250, /* MaxPower 500 mA */
.bmAttributes = USB_BMATTRIBUTES, /* bus or self powered */
.bMaxPower = (CONFIG_USB_MAXPOWER_MA / 2),
};
const uint8_t usb_string_desc[] = {

View File

@@ -2113,6 +2113,12 @@
/* Support programmable USB device iSerial field. */
#undef CONFIG_USB_SERIALNO
/* Support reporting of configuration bMaxPower in mA */
#define CONFIG_USB_MAXPOWER_MA 500
/* Support reporting as self powered in USB configuration. */
#undef CONFIG_USB_SELF_POWERED
/******************************************************************************/
/* USB port switch */