mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
12
chip/g/usb.c
12
chip/g/usb.c
@@ -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[] = {
|
||||
|
||||
@@ -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[] = {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user