Commit Graph

3928 Commits

Author SHA1 Message Date
Bill Richardson
09f8a93bb8 Cr50: Fix compilation without CONFIG_USB_HID defined.
Just a minor tweak to #ifdef a bit of code that is only
meaningful if CONFIG_USB_HID is defined.

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

Change-Id: I3491f67d7145d7c4a7e4f6ad3944172f0f49327c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275130
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-04 02:40:38 +00:00
Shawn Nematbakhsh
1de5ac02ec skylake: Use a simulated power button press to force-shutdown the AP
Holding the power button is currently the best known way to bring the AP
back to a state where it is shutdown and not powered.

BUG=chrome-os-partner:40826, chrome-os-partner:40677
TEST=Run `apshutdown` on glados, verify that power state machine transitions
to G3 after several seconds. Run `powerbtn`, verify that state machine
transitions back to S0.
BRANCH=None

Change-Id: Ia799c5f199127f31bd24907b93946c6289d381f8
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275060
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-06-04 01:15:55 +00:00
Vincent Palatin
45f7ddadd1 i2c: fix read-only I2C transfers on STM32F0/F3
Ensure that we put a proper start bit if the transfer only contains a
read but has the start flag set.

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

BRANCH=smaug
BUG=chrome-os-partner:40919
TEST=On Smaug (P6), at the Linux prompt, do
"cat /sys/class/power_supply/bq27742-0/current_now" and see a proper
value rather than an error.

Change-Id: I10cc9907476b3cfb006f2c1540688139366c9195
Reviewed-on: https://chromium-review.googlesource.com/275079
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Puthikorn Voravootivat <puthik@chromium.org>
2015-06-04 01:15:50 +00:00
Chiranjeevi Rapolu
7b5c67609f Increase charger/console/hook stack sizes.
Charger task is overflowing and causing crash.
Increased charger task stack size by 128 bytes.
Also increased console/hook by 128 bytes as these
are also close to its limit.

BRANCH=None
BUG=chrome-os-partner:40766
TEST=1.Program EC image.
2. Run various tests to verify charger stack doesn't
   overflow.

Change-Id: I6e350584508fa3a47769982b1e0cf3e3aea9ded6
Signed-off-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/274204
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
2015-06-04 01:15:44 +00:00
Vijay Hiremath
157543b287 Cyan: Correct the accelerometer orientation matrices
BUG=chrome-os-partner:40177
BRANCH=none
TEST=Verified the lid angle from accelinfo console command
     by rotating the lid.

Change-Id: Ib91258285990942f0307ae8b29983f588e972747
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/274850
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-04 01:15:39 +00:00
Aaron Durbin
460037b6e9 glados: remove tests for glados
Without this change emerge fails. Hit the tests with
a big hammer.

TEST=emerge-glados chromeos-ec
BRANCH=None
BUG=None

Change-Id: Ieb8f380520f078f91d5a676e3e6fcc687d6050a5
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275007
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-03 22:27:45 +00:00
Shawn Nematbakhsh
904bf6f575 mec1322: Implement i2c_set_timeout
Allow timeout to be set at runtime by controller.

BUG=chrome-os-partner:40780
TEST=Manual on Glados. Verify PD I2C communication is functional.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I582e47c7bebfed7a639789c90064d86ffe1a5401
Reviewed-on: https://chromium-review.googlesource.com/274967
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-03 21:01:26 +00:00
Gwendal Grignou
c70fb0f9eb motion: Add MOTIONSENSE_CMD_DATA: retrieve single sensor data
MOTIONSENSE_CMD_DATA return the value of a sinlge sensor.

BRANCH=none
BUG=chrome-os-partner:39900
TEST=On Smaug, using the new cros-ec-sensors driver,
check sensors data using iio sysfs interface.

Change-Id: I618ff050e0c7b4247ac56cfb0ca25e351270e1d6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274824
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-03 19:46:19 +00:00
Alec Berg
b88495f718 glados_pd: fix typo in config for PD port 1
Fix typo in usb_pd_config.h for enabling transmit on port 1.

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

Change-Id: I452920eda02ab7f612b5047b2944b16515ab828a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274898
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-03 18:30:41 +00:00
Alec Berg
884a72b752 glados_pd: clean-up end of PD transmission
Clean up pd_tx_disable() so that it doesn't toggle a couple times
when we stop transmitting. Need to first set the CC pin to Hi-Z
and then the TX_DATA line since the CC pin is normally held low
during transmission.

BUG=none
BRANCH=none
TEST=test on glados. use twinkie to capture traffic and note that
without this change, the CC line toggles an extra time at the end
of each transmission. With this change it is a lot cleaner.

Change-Id: If26c7a10bbb08bc55b972bb0145115836579d37b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274884
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-03 03:50:13 +00:00
Alec Berg
e3cd6444aa pd: implement TCPC RX Detect register to enable/disable TCPC RX
Implement the TCPC RX Detect register and use it for the TCPM to
enable and disable PD communication. When no type-C connection,
disable TCPC RX so that we don't send goodCRC when we are not
ready. Once TCPM establishes a type-C connection, enable TCPC RX.

BUG=none
BRANCH=none
TEST=tested on glados and on samus. On glados, without this change,
sometimes when you plug in zinger, we get into a hard reset loop
because TCPC is sending goodCRC to source cap while TCPM is still
debouncing CC and is not ready. With this change, we reliably form
PD contract.

Also tested enabling and disabling PD comms from the TCPM console
with "pd enable 0|1".

Change-Id: I8c9e696f2597978436f6ceccfe06ffb021c95ea3
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274811
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-03 03:50:06 +00:00
Shawn Nematbakhsh
457d9086f3 glados: Use reasonable task stack size defaults
Copy task stack sizes from Samus. These can be tuned later if necessary.

BUG=chrome-os-partner:40790,chrome-os-partner:40677
TEST=`make buildall -j`
BRANCH=None

Change-Id: I862c55ca924879ffb08062eaf1466fd3d4a3090c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274415
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-02 20:48:52 +00:00
Duncan Laurie
79db6d22a2 glados: Enable port80 task
Having port80 codes is useful for bringup

BUG=chrome-os-partner:40677
BRANCH=none
TEST=boot on glados and see port80 output

Change-Id: I58d0024043dc52b24a12525cb14115efbb6dd295
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274148
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-02 20:48:47 +00:00
Eric Caruso
35e37cdf43 uart_buffering: extend CONSOLE_READ command for easy log concatenation
I'm planning to add functionality to the kernel which periodically
dumps the EC console log and concatenates it so we can use it in bug
reports and feedback. However, stitching together logs collected
using the existing SNAPSHOT/READ commands is difficult. This adds a
new version of READ which acts mostly the same but will only give you
the difference between the two most recent snapshots when you pass
the corresponding argument.

BRANCH=ToT
BUG=chromium:492721
TEST=On samus with kernel interface, cat
  /sys/kernel/debug/cros_ec/console_log
  and verify that the most recent bit of the log is printed,
  use spammy commands like 'accelinfo on' and make sure nothing breaks,
  check that 'ectool console' behavior has not changed

Change-Id: Ib8216caa917715820c3e265400f0db2125e8808b
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273581
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-06-02 01:02:58 +00:00
Alec Berg
2b56419578 glados_pd: add initial support for glados PD
Initial support for glados PD. Charging and PD
communication only work on port 0.

BUG=none
BRANCH=none
TEST=make BOARD=glados, make BOARD=glados_pd
Connect hoho to glados and verify power contract successful.
Connect zinger to glados and verify power contract and
charging.

Change-Id: I42e7b8d154a79de2f8502648d9af7d4cfc00a266
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273138
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-01 23:47:04 +00:00
Vincent Palatin
f58eff6700 ryu_p4p5: enable MBKP events for PD events
enable the MKBP event feature to send host event
and wire up the PD specific events.

This is the P5 version of the following Ryu CL:
https://chromium-review.googlesource.com/273620

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

BRANCH=none
BUG=chrome-os-partner:33194
TEST=On Ryu P5, plug/unplug USB devices and add kernel trace to see the
PD events happening.

Change-Id: Ibe3a3e75919419bd97610c69303c43bca6107210
Reviewed-on: https://chromium-review.googlesource.com/274144
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-01 05:15:56 +00:00
Alec Berg
52cbad1062 oak: Add PD communication to oak
Add TCPM on EC side and TCPC on PD side to allow PD
communication. Enable PD communication on port 0.

BUG=none
BRANCH=none
TEST=load on oak. plug in hoho on port 0, and make sure
we successfully negotiate a PD contract. (note: you have
to manually enable 5V VBUS right now)

Change-Id: I0ce7c016545bc56c5e10f66b49b73722187f12dc
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/271829
Reviewed-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Commit-Queue: Sheng-liang Song <ssl@chromium.org>
2015-05-30 16:34:40 +00:00
Sheng-Liang Song
7a54beba50 sb_firmware: fixed the last write delays
BUG=chrome-os-partner:40569
BRANCH=none
TEST=Begin
1. Install noraml linux images
2. Connected Battery which is having old firmware(100)
3. power on DUT and goto crosh (In normal mode)
4. run "battery_firmware update "
5. Remove AC to interrupt the update
6. Power OFF and power on the DUT again
7. Now seen critical firmware update screen.
8. Reboot around 4 min.
9. See login window.
End

Change-Id: I2090cfa9200a7402a5fba2e111073dd1d7e7b422
Signed-off-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273660
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-05-30 02:11:11 +00:00
Vincent Palatin
ebc3b8b93c keyboard_mkbp: fix interrupt handling with MKBP_EVENT
When CONFIG_MKBP_EVENT is enabled, the current code is incorrect because
we have a race condition when sending a new event (we force first the
interrupt, then send the actual event content to the mkbp event
framework which forces again the interrupt level).
If the software still called EC_CMD_MKBP_STATE while CONFIG_MKBP_EVENT
is enabled, this will kill the interrupt as soon as the FIFO is empty
even though other events are pending in order to be backward compatible
with firmware using the interrupt has a hint when polling the keyboard.

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

BRANCH=none
BUG=chrome-os-partner:33194
TEST=make buildall
fiddle with keyboard on Oak.

Change-Id: Iafaf4174124934328c4a0172adeca651e5551f28
Reviewed-on: https://chromium-review.googlesource.com/274070
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-30 01:04:52 +00:00
Todd Broch
61ee1d7323 mcdp28x0: Use custom appstest command for get_info
Firmware's original get_info command always returns the same values
for family, chipid, irom & fw despite indeed having different
versions.

Currently its:
  family:000e chipid:0001 irom:1.0.0 fw:0.0.0

As we have a new stepping of the chip ('BB') and a corresponding new
firmware (>=0.74) we need a mechanism to verify and log this change.

CL uses the newly hatched appstest command (0x12) message 0x28 to
surface information that properly reflects both hardware and firmware
running.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:35939
TEST=manual,

For devices running 0.54 | 0.74 fw see gpio MCDP_READY asserted.

With CONFIG_CMD_MCDP in board/hoho/board.h see the following responses
when executing 'mcdp info'

Stepping | FW   | Response
--------------------------------------------------------------------
'BA'       0.53   fails as expected
'BA'       0.54   family:0010 chipid:2850 irom:2.0.0 fw:0.54.0
'BB'       0.73   fails as expected
'BB'       0.74   family:0010 chipid:2850 irom:2.1.0 fw:0.74.0

Change-Id: I2c36393a298c617f903389dab24da631b60ec574
Reviewed-on: https://chromium-review.googlesource.com/274049
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-05-30 01:04:47 +00:00
Todd Broch
362ed174eb mcdp28x0: add appstest console command.
Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:35939
TEST=manual, with CONFIG_CMD_MCDP in board/hoho/board.h

Try appstest commands on hoho and see them work.

Change-Id: I0b3f674251f0d7c68ba4958fd3376b7c8d81b13f
Reviewed-on: https://chromium-review.googlesource.com/272792
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-05-30 01:04:42 +00:00
Shawn Nematbakhsh
0727ac31e8 glados: Fix typo in 'muxes' I2C bus
'muxes' refers to bus 0, port 1, not bus 0, port 0.

BUG=chrome-os-partner:40677
BRANCH=None
TEST=Manual on Glados. Run 'i2cscan', verify that bus "1" is scanned,
and devices respond with ACK.

Change-Id: I734306928a128fea5e70b37735a71a64483f4e88
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274125
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-30 01:04:36 +00:00
Gwendal Grignou
c89ebdb66c ectool: query packet size and set them properly internally.
Allow to negotiate the packet command and responses to
whatever values the EC can support.
Set the buffer size including the necessary V3 header.

If the EC run v3 protocol with large packet support, but the kernel
does not have v3 support (3.10), we can not support sending or
receiving large commands.
Be aware that on 3.10, commands like ectool console will fail if
the EC wants to send command larger than the kernel can handle.

Copied kernel_version_ge from libusb-1.0.19/libusb/os/linux_usbfs.c.

BUG=chrome-os-partner:31989,chrome-os-partner:31660,chromium:454324,chrome-os-partner:39265
BRANCH=none
TEST=Build a special firmware to exchange 300 bytes.
Check ectool console works with the righ size.
Check that ectool is calling uname.
Check on Nyan_big: without change, "ectool version" crashes kernel. With
changes, "ectool version" works.

In conseuqence, it reverts commit be0bd9b835,
"ectool: Do not increase buffer size after probe max size from ec"

Change-Id: I54ffd43488ea81272f30789dc87a261085769fe0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274086
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-05-30 01:04:29 +00:00
Bill Richardson
1ade8e02a7 Cr50: Use USB structs instead of byte arrays for readability
The USB spec mandates that all structs are little-endian over the
wire. Since we're a little-endian architecture (and the code
we're changing is intentionally chip-specific), we can just cast
the hardware buffer into the correct struct. This makes the code
easier to read and understand.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ib2d3b04f4db1a531cb3f5ada1a2e6ee82e8a23aa
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274130
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-29 23:58:10 +00:00
Shawn Nematbakhsh
3c2be1a440 glados: Initialize PMIC V12 / V0.85A supply
This change is necessary to ensure power-up of edge-case Skylake parts.

BUG=chrome-os-partner:40677
TEST=Manual on Glados. Boot system to S0, run "i2cxfer r 4 0x60 0x38",
verify that 0x7a is read.
BRANCH=None

Change-Id: Id9e62731aaa75fb2357a05d898ba2d4d28f87d9e
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274114
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-05-29 23:58:05 +00:00
Shawn Nematbakhsh
9fe1c5f2e7 power: skylake: Wait for PCH_SLP_SUS_L deassertion when leaving G3
PCH_SLP_SUS_L can take up to 29ms to be deasserted after power-on or
RTC reset.

BUG=chrome-os-partner:40677
BRANCH=None
TEST=Manual on glados. Power board, verify that state machine
transitions to S0. Run "reboot" on EC console, verify that state machine
again transitions to S0.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I3f6e89eee1190a3fe84fdc7d939c05dfe5b94953
Reviewed-on: https://chromium-review.googlesource.com/274077
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-05-29 23:58:00 +00: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
Alec Berg
eaf2f26831 tcpc: fix alert bit masks for transmit
Fix alert transmit complete bit mask typo

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I70f9276f6448190aba5bafdbdab957fb8f0a4517
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274085
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-29 21:47:56 +00:00
Alec Berg
b00ecbc2fe pd: fix tcpc alert to handle multiple alert bits set at once
Fix tcpc_alert() so it can handle multiple alert bits. This is
needed since the initial version of tcpc_alert() is read/clear
and so we need to service all bits or else it will get lost.

BUG=none
BRANCH=none
TEST=test on glados. see multiple alert bits and handle both
of them.

Change-Id: I4d2a19a5d5d6f85cad3d67a96217d65e6e65715c
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274084
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-29 21:47:51 +00:00
Shawn Nematbakhsh
a7ba11c82c mec1322: i2c: Fix open transaction i2x_xfer
- Don't re-send our slave address if we're not generating a start
  condition.
- Handle repeated start vs new transaction properly in the Rx case.

BUG=chrome-os-partner:40677
BRANCH=none
TEST=Manual on glados. Verify 'battery' dumps correct info, and i2cscan
succeeds. Also verify that tcpc communication with PD transmits the expected
data.

Change-Id: I30315d2d82857d6031fda6d4e6a787a52ec01382
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273956
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-05-29 02:54:42 +00:00
Todd Broch
14ba846eea pd: Refine HPD debounce values.
Change refines HPD debounce values into both upstream and downstream
values for packetizing across the type-C link.

For LVL, the upstream type-C device will packetize any HPD transition
>=2ms as either HIGH or LOW.  On the downstream side the value is
driven immediately.  Additional debouncing should be done by true
upstream device according to specification.

For IRQ, the upstream type-C device will packetize any HPD pulse
>250usec as an IRQ.  On the downstream side it will be de-packetized
to create 750usec pulse.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:39717
TEST=samus|macbook(2015) + hoho|dingdong|apple HDMI type-C dongles
still drive screens successfully.

Change-Id: Ide58f3b2d675a82c12ca6afc2be53ca6e2561ace
Reviewed-on: https://chromium-review.googlesource.com/273867
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-05-29 01:37:38 +00:00
Vincent Palatin
e4cd9121a5 ryu: add PD event logging
Enable the logging of important event on the PD stack and coming from
the PD accessories.

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

BRANCH=none
BUG=none
TEST=On Ryu P6, plug/unplug type-C devices, then read the kernel log and
see the various events reported there.

Change-Id: I93a8dd72d1280271a82c62597ec99159832cae15
Reviewed-on: https://chromium-review.googlesource.com/273635
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-28 23:02:24 +00:00
Vincent Palatin
4d5f547ef1 ryu: enable MBKP events for PD events
enable the MKBP event feature to send host event
and wire up the PD specific events.

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

BRANCH=none
BUG=chrome-os-partner:33194
TEST=On Ryu P6, plug/unplug USB devices and add kernel trace to see the
PD events happening.

Change-Id: I21f47884a869987c917e56ed9b3f914815af51e4
Reviewed-on: https://chromium-review.googlesource.com/273620
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-05-28 23:02:18 +00:00
Shawn Nematbakhsh
f863bd1b95 power/skylake: Always enable PP*_EN signals for bring-up
Always enable these signals to help debug power sequencing. We'll need
to revert this change later.

BUG=chrome-os-partner:40677
BRANCH=none
TEST=sequence to S0 on glados and stay there

Change-Id: Ia845532fe7aed71bcb42b4ca6a9bfa20aa9e3e00
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273900
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-05-28 23:02:14 +00:00
Bill Richardson
14dc626061 cleanup: Remove device-specific stuff from include/usb.h
This moves the STM32-specific code out of the common header file
and into the chip directory where it belongs. Note that this
doesn't actually change the code for non-STM32 SoCs; that will
happen in a separate CL for clarity.

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

Change-Id: Ifdf0086e86a1088fb011b9ac4d6c70ab8da47aec
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273577
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-28 23:02:08 +00:00
Kevin K Wong
878c09d64b mec1322: Added KBD SERIRQ support
BUG=chrome-os-partner:24107
TEST=Keyboard keys are printed correctly on Kunimitsu.
BRANCH=none

Change-Id: Ia4ed6c1166fa20dc8623ea8d7147b6f587cbf993
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/272504
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Vijay P Hiremath <vijay.p.hiremath@intel.com>
2015-05-28 19:08:29 +00:00
Vincent Palatin
3d69e505fc pd: fix type-C current limit detection
There was a small typo in get_typec_current_limit() since the
introduction of the new TCPCI constants, we need to find the current
limit by using the voltage values measured on the sink side.

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

BRANCH=none
BUG=chrome-os-partner:40719
TEST=Connect Donette to Ryu and see the current limit set to 3.0A using
the "charger" command.

Change-Id: Icb4a5ea4997265dc1edeeb4d3cc69e416b864707
Reviewed-on: https://chromium-review.googlesource.com/273679
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-28 19:08:23 +00:00
Shawn Nematbakhsh
38c5ed2053 power: skylake: Always mirror rsmrst input to output
This change will help us to debug power sequencing and will likely need
to be reverted later.

BUG=chrome-os-partner:40677
BRANCH=none
TEST=sequence to S0 on glados and stay there

Change-Id: I85d1f0f97a3c93cf26c766a749feb23f9cf4ac62
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273680
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-05-28 19:08:18 +00:00
Ted Kuo
e71ce1be8f Initialize the memory-mapped AC_PRESENT flag
The memory-mapped AC_PRESENT flag needs to be initialized for
the batteryless projects.

BUG=chrome-os-partner:40384
TEST=make -j buildall, make -j tests
BRANCH=None
Signed-off-by: Ted Kuo <tedkuo@ami.com.tw>

Change-Id: Ia64ad6564f99b4aae060d29a572b4fe173da62d9
Reviewed-on: https://chromium-review.googlesource.com/273082
Tested-by: Ted Kuo <tedkuo@ami.com.tw>
Reviewed-by: Mohammed Habibulla <moch@google.com>
Commit-Queue: Ted Kuo <tedkuo@ami.com.tw>
(cherry picked from commit 6cc0ece36d4190e2461f7e44767e0f77f47401b8)
Reviewed-on: https://chromium-review.googlesource.com/273462
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-28 03:18:06 +00:00
Duncan Laurie
98f8a4d497 glados: Treat RTCRST as active low signal
Change this to not be driven low by default.

BUG=chrome-os-partner:40677
BRANCH=none
TEST=sequence to S0 on glados and stay there

Change-Id: I6f97c17a809fd3f69911ab117f589475c5f30b0a
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273419
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-05-27 23:18:54 +00:00
Bill Richardson
d032e8f8f0 extra: add simple USB console app for discovery-stm32f072
This provides a very simple console interface for talking to the
discovery-stm32f072 board over its USB connection. It's a simpler
way to check that the board is working than configuring udev
and/or various drivers to recognize USB device 18d1:500f as a
serial console.

BUG=none
BRANCH=none
TEST=manual

Connect a discovery-stm32f072, then

  cd extra/usb_console
  make
  ./usb_console

Change-Id: Ib25baebe5b4f3a930cdc3a1367d6d20d05b70c56
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273570
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-05-27 23:18:47 +00:00
Alec Berg
13df9780cb pd: avoid re-sending discovery VDMs after power swap
Avoid re-sending discovery VDMs after power swap from source
to sink.

BUG=chrome-os-partner:40657
BRANCH=samus
TEST=tested connecting samus to samus. tested power swapping
back and forth and verify that we don't re-send discovery VDMs.
Tested soft reset and verified that we don't re-send discovery
VDMs. Tested hard reset and verified that we DO re-send
discovery VDMs.

Change-Id: Ib48c134f460eb776b7c6f5c1d86a5b56bb08ebcc
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273420
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-27 21:30:35 +00:00
Kevin K Wong
dc065dcb31 strago: Added board version support.
BUG=none
TEST=Verified correct board version is returned via "version" console command.
BRANCH=none

Change-Id: I85a21fc7afe5fb918541e3196ce5a8bd24b09b7d
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/272986
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-05-27 21:30:30 +00:00
Vincent Palatin
245ee9f8d9 pd: never answer malformed VDM
When we are receiving a VDM which seems malformed, don't try to send an
answer, else we can ping-pong broken messages with the other side.

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

BRANCH=none
BUG=none
TEST=plug Ryu P6 to plankton, no longer see endless "ERR:CMDT:1" error
messages.

Change-Id: If5b581c5c68996c60e37ac6d96638fd5df24356f
Reviewed-on: https://chromium-review.googlesource.com/273525
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-05-27 21:30:25 +00:00
Rong Chang
a2075a5430 tcpm: return all non-zero errors
TCPM functions calls I2C read/write, which returns positive error codes
on stm32f0 based EC.

BRANCH=none
BUG=none
TEST=none

Change-Id: I8119074e7411e2fd88dd6ca696fc7b698d462623
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273506
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-05-27 19:40:22 +00:00
Alec Berg
488f8c9565 oak_pd: add initial support for oak PD
Add initial support for Oak PD MCU on rev1 boards.
This does not include USB PD communication.

BUG=none
BRANCH=none
TEST=build and load on oak and get console. test we
resond to host commands from EC using "pdcmd 0 0" on
EC console.

Change-Id: I92045cf0fd682279ada6c286f5399f0e258a6305
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/271828
2015-05-27 19:40:18 +00:00
Alec Berg
97934e4041 pd: fix duplicate PD receive event on combined TCPM/TCPC
Fix duplicate PD RX event when using combined TCPM/TCPC. Problem
is that PD_EVENT_RX is already set in the phy layer in pd_rx_event
when CC edges are detected. Therefore, we shouldn't set it again
when the TCPC detects that receiving has started.

BUG=none
BRANCH=none
TEST=test on samus. without this change we occasionally get a
PD error and hard reset under certain timing circumstances due
to the repeated event. with this change, those errors go away.

Change-Id: If1034a549b75740f327e16810e81c9aa28d71b00
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273418
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-05-27 19:40:11 +00:00
Kevin K Wong
11df27d5f7 cyan: Added board version support.
BUG=none
TEST=Verified correct board version is returned via "version" console command.
BRANCH=none

Change-Id: I97cf9911e3279ea7b6ad2f3bb383cde43c5114ba
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/272985
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-05-27 19:40:05 +00:00
Shawn Nematbakhsh
1b2f6b6451 i2c: Make i2c_xfer a wrapper function to chip_i2c_xfer
i2c_xfer was previously implemented at the chip-level, but now we want
to add some global retry logic. Rename the chip-level i2c_xfer functions
to chip_i2c_xfer and add a new global wrapper function i2c_xfer.

BUG=chrome-os-partner:39613
TEST=Run "battery" from EC console on Cyan, verify that values + strings
are correctly printed.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: If37c85cc3cf94fd53feb6931553e10c30ad6cad6
Reviewed-on: https://chromium-review.googlesource.com/272939
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-27 19:40:00 +00:00
Rong Chang
315afdff42 oak: Simplify GPIO list
Oak's initial commit was merged at same time with CL that changed GPIO
macros. This change fixes oak build by applying new GPIO macros.

BRANCH=none
BUG=none
TEST=make BOARD=oak -j

Change-Id: I1b60a85b83aa46c81c5dd7fea44bb221646c0cf0
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273510
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-05-27 17:51:47 +00:00