Commit Graph

11 Commits

Author SHA1 Message Date
Randall Spangler
69e10e84aa chip/g: Fix usb_console read-only
Currently, the console inhibited output when is_readonly=1, and only
inhibited input when is_enabled=0.  That's harmless in the current
implementation, because common/case_closed_debug() only ever calls it
with enabled=0/readonly=1 or enabled=1/readonly=0.  But if we ever do
decide to use enabled=1/readonly=1, that would have acted like
write-only, not read-only.

Fix that.

BUG=none
BRANCH=cr50
TEST=Attach to cr50 USB console, console is read/write.
     Hack USB console to set is_readonly=1, console is read-only.

Change-Id: I04258fe2b040a00f98067d8be48a0632eb16e9c1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/647336
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-09-01 16:41:54 -07:00
Nicolas Boichat
391056f9ee usb: Cleanup headers
Let's split the usb headers in 3 different parts, instead of having
usb_descriptor.h pull in usb_hw.h and usb_api.h.

 - usb_api.h: EC functions related to usb (e.g. connect/disconnect)
 - usb_descriptor.h: common USB names and structures
 - usb_hw.h: Functions required for interactive with EC's USB HW

BRANCH=none
BUG=b:35587171
TEST=make buildall -j

Change-Id: I37ead61e3be5e7ae464f1c9137cf02eaab0ff92e
Reviewed-on: https://chromium-review.googlesource.com/454861
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-16 11:25:50 -07:00
Vadim Bendebury
83b6d69732 g: increase usb console TX buffer size to 4K
Increasing the USB console TX buffer size allows to see pretty much
all early startup messages generated before USB console is
initialized.

There is still plenty of room left in SRAM, 23K on cr50, much more on
all other g based boards.

BRANCH=none
BUG=none
TEST=observed better USB console output on cr50 restarts.

Change-Id: I82f37ee7f3aecd8b7e95f3d421789c11375b2fd4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364811
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Nadim Taha <ntaha@chromium.org>
2016-08-01 13:45:00 -07:00
Anton Staaf
068cd08506 Deferred: Use deferred_data instead of function pointer
Previously calls to hook_call_deferred were passed the function to call,
which was then looked up in the .rodata.deferred section with a linear
search.  This linear search can be replaced with a subtract by passing
the pointer to the deferred_data object created when DECLARE_DEFERRED
was invoked.

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

BRANCH=None
BUG=None
CQ-DEPEND=CL:*255812
TEST=make buildall -j

Change-Id: I951dd1541302875b102dd086154cf05591694440
Reviewed-on: https://chromium-review.googlesource.com/334315
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-18 17:32:40 -07:00
Vadim Bendebury
1e7c280491 g: fix usb console LF handling
It was observed that when connecting to the CR50 console over USB,
there the line feed (LF) characters are not supplemented by carriage
return (CR), which causes weird console output.

Detailed examination has shown that uart_putc() does not do the right
thing itself and also bypasses __tx_char() used by uart_puts(), which
does the right thing.

The simplest solution is to have uart_putc() re-use all the smarts of
uart_puts().

BRANCH=none
BUG=none
TEST=verified that usb console output does not suffer from the "lost
     CR" syndrome any more.

Change-Id: I2a1f84b2524c41eb6e84186141b0b9ac55e87ee0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339217
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-18 11:30:19 -07:00
Mary Ruthven
a5e74e6b45 cr50: forward console through USB
This change adds support for forwarding the EC console through USB.

BUG=chrome-os-partner:49960
BRANCH=none
TEST=load the google-serial udev rules in extra/usb_serial/, build the
raiden.ko module, and then check that the console can be accessed from
/dev/google/Cr50/serial/Shell

Change-Id: I35e0bb39fdc8f9485a14c03eb3a4d2f024884e17
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/334132
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-07 13:00:41 -07:00
Shawn Nematbakhsh
6f4595ff7a cleanup: Rename usb.h to usb_descriptor.h
Rename usb.h to usb_descriptor.h to prevent conflict with a
commonly-used libusb header.

BUG=chromium:552006
BRANCH=None
TEST=`make buildall -j`

Change-Id: I6145ce120e1fda41bc5c4d4da0313272e76839c7
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311429
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-08 17:31:11 -08:00
Vincent Palatin
96093145cb update case closed debugging partial mode policy
When a debug accessory is connected to the type-C port while the write
protection is enabled, put the case closed debugging in "partial" mode
rather than "full".

Update the "partial" mode to provide read-only access to the AP and EC
consoles.

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

BRANCH=smaug
BUG=chrome-os-partner:44700
TEST=check the EC console input/output over USB is still working with SuzyQ
on a write-protected system, verify that the console input is disabled.

Change-Id: I5baa03d6e738d06437c45469f46b286e76a755a4
Reviewed-on: https://chromium-review.googlesource.com/297141
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-08 13:49:09 -07:00
Bill Richardson
41533aab3a Cr50: USB hardware uses 8-bit buffers, not 16-bit
Our USB buffers are just arrays of uint8_t in program RAM, so
let's treat them that way. The DMA descriptors are in normal RAM,
too.

BUG=chrome-os-partner:40693
BRANCH=none
TEST=make buildall

Change-Id: Ibafe1a557a328bbf8cf37ce113675fcd35bad376
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273918
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-29 23:57:52 +00:00
Vadim Bendebury
fab26ee891 cr50: allow using ccprintf() early in the process
Attempts to use ccprinf() before both uart and usb consoles have been
initialized cause the device lock up. Luckily both console channels
are buffered (and usb console buffering is about to be greatly
improved), all what needs to be done is to hold on to the attempts to
start transmit interrupts until hardware has been initialized.

BRANCH=none
BUG=none
TEST=attempts to print something on the console early in the process
     do not cause the device to lock up any more, and the printouts
     show up where expected.

Change-Id: I16cd1fab79bceaf7c2334a955fdb6046d21ed550
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/268379
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-04-30 02:31:07 +00:00
Vincent Palatin
4d0aad8894 cr50: add USB support
Add a USB device driver for the Synopsys DWC USB device controller.

The common USB protocol stack code still need to be de-duplicated with
the STM32 implementation.

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

BRANCH=none
BUG=chrome-os-partner:33919
TEST=plug Cr50 to a Linux workstation and see USB descriptors using
"lsusb -v -d 18d1:5014"

Change-Id: I4a367241053de2c2d94aa06f82ea4bee51f9f89a
Reviewed-on: https://chromium-review.googlesource.com/231160
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-04-02 20:27:46 +00:00