Commit Graph

12 Commits

Author SHA1 Message Date
Anton Staaf
e35494e4ac USB: Fix definitions for usb_uint
I managed to mess this up previously, the STM32L and STM32F should
use uint32_t and so should the STM32F3 it turns out.  Only the
STM32F0 uses uint16_t right now.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: Ieca4368c4280a0f25c928b6670aeccbaf8eabbef
Reviewed-on: https://chromium-review.googlesource.com/227740
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@google.com>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-11-10 19:11:50 +00:00
Anton Staaf
8513e23df1 USB: Remove special case for iVersion string descriptor
Previously the version string was special cased in the USB stack
because the build system prevented the inclusion of ec_version.h in
any file other than common/version.c.  This lead to common/version.c
being the only place that the USB version string could be computed
and thus the special case of filling in the version string descriptor
at run time.  This made the USB stack more complex, and lead to the
common/version.c file including usb.h, which is actually STM32
specific.

Now, the portion of ec_version.h that is deterministic is only
updated when something in the tree actually changes (by way of a
conditional in the makefile), and ec_version.h no longer has to
depend on all object files (other than the special version.o).
This allows anyone to include ec_version.h as needed.  In particular,
each board that wants to define a USB version string can directly
include ec_version.h and do so.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     touch files and verify rebuilds happen correctly

Change-Id: Ic84d0b9da90f82ebb4630fb550ec841071e25a49
Reviewed-on: https://chromium-review.googlesource.com/227211
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-11-04 21:34:39 +00:00
Anton Staaf
bde06f7697 USB: stm32f3: use correct values for USB RAM size and usb_uint
The RAM size was copied from the STM32F0 definition which was
not correct, and the usb_uint computation was only checking for
the STM32F0 family, assuming that all others were the old
uint32_t access size.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I28951351601254ea6ebabaec2687d6bfe716b699
Reviewed-on: https://chromium-review.googlesource.com/227210
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-11-04 18:14:20 +00:00
Todd Broch
aac88442d7 pd: dingdong/hoho: inhibit USB Billboard.
USB Billboard class can be used to advertise an alternate mode capable
device that hasn't entered a mode.  Additionally it can remain after
mode entry providing its Billboard capabilities descriptor is
updated.

This CL postpones enumeration which previously occurred after boot
until tAMETimeout has passed and alternate mode has NOT been entered.
Future CL could choose to also (re)enumerate with mode capabilities
although this is not required by the USB PD specification.

BRANCH=none
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual,
With DFP_U which does not enter mode see Billboard class enumerate
else it does not.

Change-Id: I59a0815cd0ea551ba9a878907c0184df4ba9480c
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/224663
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-31 06:29:28 +00:00
Alec Berg
498abf833c samus_pd: add host command to get type-c port power info
Get type-c port power info including power role, charger type,
and charging info. Also added host command to get number of type-c
ports.

Also adds new charging suppliers for pericom identified chargers
including DCP, CDP, SDP, proprietary, and other chargers. Priority
of these for charging is set in samus board file.

BUG=chrome-os-partner:32650
BRANCH=samus
TEST=run 'ectool --name=cros_pd usbpdpower' and verify correct
status with minimuffin, zinger, and type-C to type-A adapter.

Change-Id: I1dabbe7de4185a23df5684a5ea9a2d944f1f6ff5
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/223523
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-30 04:31:34 +00:00
Anton Staaf
4626fd37df USB: Add simple serial subclass support
This uses the newly allocated simple serial SubClass
and Protocol identifiers to make enumeration of serial
consoles over USB easier.  The simple usb serial kernel
driver can select based on vid/class/subclass/protocol,
making it trivial to attach to serial consoles.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Enable USB console on discovery-stm32f072 and verify
     that a new ttyUSB? device is discovered.

Change-Id: I6d3e414a20753573c2ee90a48fb1d5dce2c3972d
Reviewed-on: https://chromium-review.googlesource.com/225869
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-10-29 18:37:48 +00:00
Shawn Nematbakhsh
7eaa290c35 usb_pd_protocol: Add support for charge_manager and voltage reporting
Integrate charge_manager and include several API changes designed
for reporting voltage.

1. Make pd_choose_voltage set the chosen voltage for use by caller.
2. Add voltage parameter to pd_set_input_current.
3. Add pd_get_role to grab the sync / source state of a port.
4. Add charge manager PD + type C port initialization to the pd
   state machine.

BUG=chrome-os-partner:32003
TEST=Manual on samus. Insert Apple charger, verify charge limit is
selected appropriately. Insert PD charger, verify that charge port
switches to PD port. Remove + reinsert chargers, verify that port /
limit is selected appropriately. Remove battery, insert power source, verify
that our power source port never becomes disabled.
BRANCH=samus

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Idf3198c71d2ddf1e401e766fc82a4b7a02aed068
Reviewed-on: https://chromium-review.googlesource.com/223758
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-10-22 02:23:35 +00:00
Vincent Palatin
46102d3b4e usb: export firmware version
Remove the meaningless version string in iSerialNumber, which was incorrect
since this string should be unique to a device if it exists.

Export the firmware version string as the configuration string, so it's
traceable to a given firmware build/sources.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=samus
BUG=none
TEST=make buildall
from a workstation, do "sudo lsusb -v" and see the full version string
exported as the configuration name.

Change-Id: I557df2936421e2926ac0fc0003888370cec3e201
Reviewed-on: https://chromium-review.googlesource.com/222877
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-11 07:29:15 +00:00
Todd Broch
03cbbb2be7 hoho: Add USB Billboard class device.
BRANCH=none
BUG=chrome-os-partner:31192
TEST=manual
Plug hoho into samus and see:
    # lsusb -d 18d1:5010 -v

    Bus 001 Device 007: ID 18d1:5010 Google Inc.
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.01
      bDeviceClass           17
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0        64
      idVendor           0x18d1 Google Inc.
      idProduct          0x5010
      bcdDevice            2.00
      iManufacturer           1 Google Inc.
      iProduct                2 Hoho
      iSerial                 3 v0.001
      bNumConfigurations      1
      Configuration Descriptor:
	bLength                 9
	bDescriptorType         2
	wTotalLength           10
	bNumInterfaces          0
	bConfigurationValue     1
	iConfiguration          0
	bmAttributes         0x80
	  (Bus Powered)
	MaxPower              500mA
    Binary Object Store Descriptor:
      bLength                 5
      bDescriptorType        15
      wTotalLength           73
      bNumDeviceCaps          2
    FIXME: alloc bigger buffer for device capability descriptors
    Device Status:     0x0000
      (Bus Powered)

Change-Id: I1431829f926eaf86477b49591e9b0adf2b4cb3a6
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221571
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-11 02:22:36 +00:00
Todd Broch
44e4f7cfe7 usb: Groundwork for USB BOS & Billboard class descriptors.
The BOS (Binary Device Object Store) descriptor was added to the USB
specification (3.0) to allow a richer set of device capability
specific descriptors.

The Billboard class is meant to expose (read-only) the status of USB
devices capable of alternate mode functions.  It's required to use the
BOS descriptor type and at a high level looks like:

  - BOS Device Descriptor (5bytes)
    - Container ID Device Capability Descriptor (20bytes)
    - Billboard Device Capability Descriptor (44byte + 4 * numSVIDs)

This CL adds:
1. Ability for Get Descriptor on BOS descriptors.  Note hidden behind
CONFIG_USB_BOS as these descriptors change USB device requirements
to:
   - bcdUSB >= 0201
   - no interface descriptors

2. structures for all BOS, Container & Billboard descriptor elements
complete w/ CamelCase.

BRANCH=none
BUG=chrome-os-partner:32652
TEST=compiles with CONFIG_USB & CONFIG_USB_BOS enabled.

Change-Id: I1b24bc728f2ebba7d91840801d2ebe576e240e7c
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221570
2014-10-11 02:22:23 +00:00
Dominic Chen
f3c308108b usb: add CONFIG_USB_INHIBIT to prevent automatically starting USB
BUG=none
BRANCH=none
TEST=usb does not autostart, and can be enabled/disabled

Change-Id: I22a7bf3ca9cb7013cc4964dbdabff7524985d9ba
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212509
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-08-16 05:22:50 +00:00
Vincent Palatin
5fa52a895b stm32: add USB driver
Enough USB support to be able to enumerate the device and use bulk or
interrupt endpoints.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:28295
TEST=with the following USB console CL, connect a Fruitpie through USB
and use its console over USB.

Change-Id: I37b7f3b6a754cb82ab5f940ea20122d2e16b3b5b
Reviewed-on: https://chromium-review.googlesource.com/193983
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-06-18 06:08:45 +00:00