Commit Graph

3966 Commits

Author SHA1 Message Date
Alec Berg
4aee90d559 pd: change pd_transmit() to only wait for TX complete event
Change pd_transmit() to wait specifically for the TX complete
event using task_wait_event_mask(). This fixes a bug that if
another event, it will now restore that event instead of
consuming it.

BUG=chrome-os-partner:40920, chrome-os-partner:41290
BRANCH=smaug
TEST=load onto glados and zinger and attach them a bunch of
times and get stable contract with no hard resets.

Change-Id: I36514ea45b5e2b5fd42acdad94e5786da5bd90b6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276745
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-11 02:57:52 +00:00
Alec Berg
0a7f37d720 core: add task_wait_event_mask() function to other cores
Add task_wait_event_mask() function to core/cortex-m0, core/host
and board/zinger/runtime in order to delay a task until a specific
event occurs.

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

Change-Id: Ic89487fcae5352eec53b745179c7f0d5893ad3e0
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276744
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-11 02:57:45 +00:00
Andrey Petrov
c75e78cd50 mec1322: fix flash_physical_get_writable_flags()
Add spi_enable() before SPI transaction. This fixes a problem where protect
host cmd ended up messing up SPI controller state.

Change-Id: Ief61f279cbd0a90e55ce87d0c350072dc8616c31
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/276338
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
2015-06-11 01:21:14 +00:00
Anton Staaf
bd7e885ae7 Stream: Remove in_stream/out_stream interface
The in_stream and out_stream interfaces were a first attempt
at providing an abstraction for multiple stream like devices
(usart, USB, I2C/LPC host interfaces...).  But, by baking
the queue into the device it proved to be hard to use and
required additional resources (task or deferred hook) to handle
passing data from one stream to another.

Since then the queue policy and producer/consumer interfaces
have replaced the stream interfaces.  This CL removes the old
stream interfaces and updates the only users (deleting the
test echo code from the discovery-stm32f072 board and updating
the mcdp28x0 driver to use the queue interfaces).

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

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

Change-Id: Ic0d2abf81eafc4fb2e61172540151f2d0ba45caf
Reviewed-on: https://chromium-review.googlesource.com/276163
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2015-06-11 00:08:49 +00:00
Kevin K Wong
7fab87e488 mec1322: Fixed I2C handling on Repeat Start.
According to the datasheet, PIN should not be set in the CTRL register.

BUG=none
TEST=Verify with I2C analyzer that no error is observed.
BRANCH=none

Change-Id: Ifed58b413151b40ed951cb71b1164432fea28eca
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/276672
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-10 22:55:25 +00:00
Alec Berg
9c35b48400 glados: add battery cutoff functionality
Add battery cutoff functionality to glados.

BUG=none
BRANCH=none
TEST=use console cutoff command to verify that it cuts off
battery and plug in zinger to verify that it comes out of it
when AC is applied.

Change-Id: I71ae113c398278ad9f67f3a4cedf6885754a5a72
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276690
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-06-10 21:35:54 +00:00
Shawn Nematbakhsh
e05ed041cf charger: Move USB charger / BC1.2 task to common code
Move the task responsible for detection of USB chargers to common code
to reduce code duplication.

BUG=chrome-os-partner:40920
TEST=Manual on samus_pd. Plug USB charger, verify detection is correct
on both charge ports.
BRANCH=None

Change-Id: I362f8b5b51741509e459c66928131f1f6d2a3b1d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276210
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 19:48:08 +00:00
Alec Berg
5d7c4f0cd6 glados: enable battery present detection
Change battery temperature ADC into an input with a
pull-up and use it for battery detection.

BUG=none
BRANCH=none
TEST=boot with and without battery and check gpio
accurately reflects battery status.

Change-Id: Id30a6c2d7eaad2e6f3c69be4bab33dbcf0682e29
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276650
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-06-10 19:48:03 +00:00
Rong Chang
e8dc5e7d83 oak: change board hardware revisions
Per discussion in CL:274728, hardware revision numbers are integer. So
the previous rev1.5 becomes rev2. And the previous rev2 is now rev3.

BRANCH=none
BUG=none
TEST=none

Change-Id: Ic7a1a60ce0b17a3469965cdca99332df0243ce2a
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276577
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:24:12 +00:00
Randall Spangler
fe9e3bf565 Remove obsolete board-specific code
Now that we've removed boards from ToT, also delete board-specific
code used only by the removed boards.

There are still more things to remove (unused charging chips, LED
drivers, COMx support).  More CLs coming.

BUG=chromium:493866
BRANCH=none
TEST=make buildall -j

Change-Id: Ie6bdeaf96e61cadd77e3f6336c73b9b54ff4eabb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276524
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:24:05 +00:00
Rong Chang
4e5b020ca9 oak: enable type-C port 1 power up EC
When EC boots up on type-C port 1 VBUS power, it shouldn't turn off
CHARGE_L control.

BRANCH=none
BUG=chrome-os-partner:41167
TEST=manual
  remove battery, plug type-C charger to port 1.
  check charging LED.

Change-Id: I360715b2f81df5eba0901b854d2dd8e2f0a23651
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276589
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:23:59 +00:00
Rong Chang
5cc37f51d6 oak: initialize charge manager to use BC1.2 suppliers
This change continues porting CL:275686 to oak. Since oak didn't connect
VBUS wake signals to EC, it checks Pericom BC1.2 status on initialize VBUS
suppliers.

BRANCH=none
BUG=chrome-os-partner:41167
TEST=none

Change-Id: Idbc7032329f7c46aee8f35c3fdd1e8e4aa9c001c
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276587
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:23:55 +00:00
Rong Chang
09779ca159 oak: enable battery present detection
Rename BATT_TH to a more meaningful BAT_PRESENT_L. And enable GPIO based
battery detection.

BRANCH=none
BUG=none
TEST=none

Change-Id: Icea2b6def889f887aad862b39fb75aedf72c7042
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276586
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:23:50 +00:00
Rong Chang
2b129cc3b7 oak: enable CHARGE_MANAGER to handle charging on both ports
This CL copies CL:275686 that enables charge manager to handle charging
on two ports.

Since oak has the same PD design, so both CHARGE_L controls need to be
enabled to detect VBUS when no charger is plugged in. That means if
you set chgoverride -1, this actually enable charging on both ports.

BRANCH=none
BUG=chrome-os-partner:41167
TEST=manual
  plug in zinger and donette onto both ports. verify that we charge from
  the first one plugged in.

Change-Id: If5ed360e55f6c6b1a0315a68a5a6d924ae856c6d
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275853
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 15:49:35 +00:00
Rong Chang
ffd83ca8e9 oak: use pdcmd task to handle tcpc interrupt
This change syncs oak with glados change CL:275296.

BRANCH=none
BUG=chrome-os-partner:41167
TEST=manual
  load on oak and plug zinger in both ports many times.

Change-Id: Idc00a50c2d7b7a865e70762e91b2e7a82c6e6896
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275852
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 15:49:31 +00:00
Rong Chang
483eba41c1 oak: add PD support for type-C port 1
Port CL:275072 to oak. Oak rev1 and rev1.5 type-C VBUS input controls
are connected to PD phy instead of EC. This change wakes both USB PD
task to handle power status change. This issue will be fixed in next
hardware revision, or enable TCPC power status alert.

BRANCH=none
BUG=chrome-os-partner:41167
BUG=chrome-os-partner:41226
TEST=manual
  plug type-C charger into port 1

Change-Id: Ifea19276d0eb74f3e4cac509abece362e6e8af17
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275851
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-10 15:49:28 +00:00
Rong Chang
63a9dc19b5 oak: Modify GPIO list for rev 1.5 boards
Rev 1.5 hardware redefined EC and PD phy IO controls. This change adds macro
to map configurations at compile time.

BRANCH=none
BUG=none
TEST=manual
  build and flash ec.bin
  plug type-c charger on port 0

Change-Id: I60c2f1448fbdea9bb72d1f3b19de366cad150087
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274771
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 15:49:19 +00:00
Rong Chang
a585141db0 stm32: switch to ec_boot_mode servo control
hdctools adds an alias ec_boot_mode and remaps spi1_vref with onoff
control. This change switches ARM systems with STM32 EC from
spi1_vref:pp3300 to ec_boot_mode:on.

CQ-DEPEND=CL:275251
BRANCH=none
BUG=chrome-os-partner:40479
TEST=manual
  cd ~/trunk/platform/ec
  util/flash_ec --board oak --image oak_ec.bin
  util/flash_ec --board oak_pd --image oak_pd.bin

Change-Id: I0f3a74eaa7fc937d1372cd51124c6b3d23351581
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274770
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
2015-06-10 14:19:29 +00:00
Todd Broch
339fe7245d mec1322: bugfix for flash_ec dut-control call.
Direct call to shell command 'dut-control' wouldn't account for port
argument in script.  Change to function 'dut_control' within script
that does.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: Id4f77dedb57ce8097059c33371b5cd697fdbdb0d
Reviewed-on: https://chromium-review.googlesource.com/276534
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-06-10 05:04:01 +00:00
Alec Berg
03f711b855 ryu: allow charge manager to control CHARGE_EN gpio
Move control of CHARGE_EN from the PD state machine, where it
was tied to our CC termination value, to charge manager when
charge manager sets the active charge port. This allows ryu
to charge from debug accessory where we advertise Rp but still
want to charge.

BUG=none
BRANCH=smaug
TEST=load onto ryu and plug in zinger, hoho, and suzyQ and make
sure we negotiate a contract with PD partners, and that we
charge from power supplies.

Change-Id: I81d9997c011eac6d5136fca8e97a5da3470a8e8a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276543
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-10 03:33:38 +00:00
Alec Berg
d2c4781266 pd: enable charging through suzyQ debug accessory
Enable charging through debug accessory by setting input
current limit to 3A when debug accessory is detected.
Add new dual-role toggling state for stay sink unless VBUS
is detected, which allows us to detect debug accessory
when we are not normally dual-role toggling.

BUG=none
BRANCH=smaug
TEST=plug suzyQ into ryu in S0 and in S5 and make sure that
we go to the SRC_ACCESSORY state and set charger input
current limit appropriately.

Change-Id: I6262c9d6cd0ae7159f343d36e19d290c2f2e0181
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276368
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-10 03:33:33 +00:00
Alec Berg
8f65ad20e3 glados: limit type-C voltage to 5V to increase charging reliability
Change charging workaround on glados to limit the max input voltage
to 5V. This provides more reliable charging by reducing the noise
on the i2c bus to battery and charger. Note, this limits charging
power to 15W.

BUG=none
BRANCH=none
TEST=load onto 3 different glados boards and charge for 10 minutes
with no i2c errors causing charging to stop.

Change-Id: I4d67b62a18cf40d645b132081a431f9ce187168b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276366
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-09 21:30:39 +00:00
Gwendal Grignou
da1c425471 ectool: Fix cut and paste errors in motionsense
BUG=none
BRANCH=none
TEST=compile

Change-Id: Ie1e5a453f2ffa023599ca6357d1fd2bee95b271d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276263
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-09 20:17:16 +00:00
Gwendal Grignou
46ccd63c1d accel: move X,Y,Z definition
Move definition so that we can use it in accel driver.

BUG=None
TEST=Compile
BRANCH=none

Change-Id: I45d16a91d923cb0538b7fdf4110112566c87b6d0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/269837
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-09 12:10:42 +00:00
Gwendal Grignou
f58d821a5a Queue: add peek_memcpy function
Add queue_peek_memcpy to peek at queue and move the element using
specific memcpy function.
Also change memcpy prototype argument from void const * to const void*.

BUG=none
BRANCH=none
TEST=Compile and use.

Change-Id: I8c582563e7d204ee5568637f819d63404624faf6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274226
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-06-09 12:10:37 +00:00
Alec Berg
930e001165 glados: limit max input current to 1.5A to avoid i2c errors
Add workaround to limit the max input current to 1.5A due to
i2c communication problems at higher currents. Note that this
max should be removed when possible.

This introduces a new CONFIG option to define the maximum input
current limit for a board, as opposed to the already existing
default input current limit.

BUG=none
BRANCH=none
TEST=load on glados, charge with zinger, make sure input current
is set to 1.5A and no recurring i2c errors talking to battery
and charger.

Change-Id: Ib7070772e1bf5475e98a2dc946ae75bf08047b70
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276169
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-06-09 00:13:54 +00:00
Aaron Durbin
38a4903055 glados: switch to isl9237
BUG=None
BRANCH=None
TEST=Charged battery on reworked glados.

Change-Id: If5887b9bee304c24dbd49d5f01abf08e02df3074
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275069
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
2015-06-09 00:13:50 +00:00
Rong Chang
26410eedde charger: Add Intersil charger ISL9237
ISL9237 is a buck-boost narrow output voltage DC charger. This change
provides interfaces to satisfy external dependencies for
charge_state_v2.

ISL9237's charging voltage control is different from smart battery
chargers. And there's no SBC compatible charging mode and status. So
this CL modified charger_set_voltage() behavior by controlling VSYS
voltage.

BRANCH=none
BUG=none
TEST=ran on reworked glados

Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: Ibbbf805bbbe1ee06f87a41cde3e39acbf2e105b4
Reviewed-on: https://chromium-review.googlesource.com/272882
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Trybot-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
2015-06-08 21:49:02 +00:00
Shamile Khan
377384e400 mec1322: Do not restrict SPI flash reads to Word Boundary.
BUG=chrome-os-partner:41145
BRANCH=None
TEST=flashrom can update EC's RW partition.

Change-Id: I29c450c8cffbc8a47228836ce1959f316026e743
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/275633
Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Commit-Queue: Icarus W Sparry <icarus.w.sparry@intel.com>
Tested-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-07 20:26:04 +00:00
Alec Berg
dab5edc1b4 glados: enable CHARGE_MANAGER to handle charging on both ports
Enable CONFIG_CHARGE_MANAGER to handle charging on two ports.
For now, we only use the type-C pull-up supplier and the PD supplier.
This adds Pericom BC1.2 suppliers as well even though we aren't
using them.

Currently, on Glados, we can't detect VBUS unless charge_en GPIO is
asserted. This means, when no charger is plugged in, we must have
both ports enabled. And when one charger is plugged in, we must
disable the other port. Practically, this means we always charge
from first charger plugged in since we can't detect the second one.

And, this means that if you do chgoverride -1, which normally stops
charging, this will actually enable charging on both ports.

BUG=chrome-os-partner:40920
BRANCH=none
TEST=load onto glados and plug in zinger and donette onto both
ports. verify that we always charge from first charger plugged in.
plug in hoho to either port and make sure it gets VBUS.

Change-Id: Ia5d5725ee86b25f6fec0f276d4c471f533c81112
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275686
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-07 19:09:06 +00:00
Alec Berg
ea07b1851b glados: enable ADC channels
Enable ADC channels on Glados. For now only VBUS is scaled
accurately into mV, the rest are ADC counts.

BUG=none
BRANCH=none
TEST="adc" from EC console and verify VBUS measurement matches
for zinger at 20V and donette at 5V.

Change-Id: I1af70df5b851ba654c8feb7c97d190d393421a29
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275685
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-06 02:55:41 +00:00
Alec Berg
58719e3073 pd: use pdcmd task to handle tcpc interrupt
Use the PDCMD task to handle PD MCU interrupts, and use it
to trigger the tcpc_alert().

Note this fixes bug on Glados and Oak that could cause watchdog
reset because tcpc_alert() which uses i2c to talk to tcpc was
called from hooks task and can delay tickling watchdog.

BUG=chrome-os-partner:40920
BRANCH=none
TEST=load on glados and plug zinger into both ports many times.
make sure we get a stable contract and no watchdog reset.

Change-Id: I37625fae2ca0057d2ee8fa1eea6974f2d26d1b91
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275296
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-05 22:35:05 +00:00
Randall Spangler
bdc680d8ed Remove obsolete EC targets
This is needed to allow cleanup and refactoring of the EC codebase in
ToT.  All of these boards use firmware from branches and uploaded to
BCS, so they don't actually care that ToT can't build their firmware.

BUG=chromium:493866
TEST=build on the following using cbuildbot:
    daisy-paladin
    falco-paladin
    link-paladin
    nyan-paladin
    peppy-paladin
    samus-paladin
    squawks-paladin
    daisy_spring-paladin
CQ-DEPEND=CL:274121,CL:274127
BRANCH=none

Change-Id: I19598843755ded7b2385cc712ef463e5de4411b8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274121
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-06-05 19:35:06 +00:00
Kevin K Wong
e856db1258 i2c/mec1322: Lock all I2C port before sysjump.
sysjump could happen anytime during an I2C transaction. After sysjump and EC
reset, I2C pin will be programmed back as GPIO instead of alternate function,
which will cause the I2C transacation to failed.

MEC1322 I2C also depends on interrupt to handle the I2C transaction, however,
sysjump will disable interrupt, which will cause watchdog timeout/reset since
interupt for I2C transaction are disabled.

BUG=none
TEST=After "sysjump <RO/RW>", "i2cscan" is functional and no watchdog reset.
BRANCH=none

Change-Id: I181084822f0769173c724e48afb59d7099fa1566
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/273710
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alexandru Stan <amstan@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
2015-06-05 03:22:06 +00:00
Alec Berg
706fcb19ca glados: add PD support for type-C port 1
Add USB PD support for port 1 (on the flex cable).

BUG=chrome-os-partner:40920
BRANCH=none
TEST=load onto glados and test zinger and hoho in both
polarities on both ports and verify PD contract established.

Change-Id: Ib7ac2e630c0a8f278c8b74c348cc6dc7183f53ec
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275072
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-04 20:51:13 +00:00
li feng
5b2e673948 i2c: Retry i2c operation if fails on nack'd(EC_ERROR_BUSY).
Retry count is defined by CONFIG_I2C_NACK_RETRY_COUNT.

BUG=chrome-os-partner:37494
TEST=Tested on Cyan, observed retry happens on nack'd i2c.
BRANCH=None

Signed-off-by: li feng <li1.feng@intel.com>
Change-Id: I73ed15a52335de6c5a5b647660bfe431a8238716
Reviewed-on: https://chromium-review.googlesource.com/274689
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
2015-06-04 20:51:07 +00:00
Bill Richardson
f64945d8d1 Cr50: Enable USB blob handler (and disable USB console)
This enables the USB blob interface. Due to partner issue 40693,
we have to disable one of the other interfaces, instead of just
adding this one.

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

Also, connect to the Cr50 via USB and run

  cd extra/usb_console
  make
  ./usb_console -p 5014 -e 1

Strings typed into this application will be case-swapped and
returned.

Change-Id: If94006490ec9c6033e8520297aa42ed623d4daf6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275132
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-04 19:33:05 +00:00
Bill Richardson
45d19984ec Cr50: Add usb_blob handler framework
This adds a new task and endpoints to handle large opaque (to the
USB) chunks of data. The expected use case is that the USB
endpoint accepts bytes from the host and passes them blindly to
the blob-handling task. At some point, the blob-handling task may
wish to send bytes back to the host. What those bytes are and
what they mean is determined at higher levels of abstraction.

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

This CL doesn't enable the blob-handler; it just makes it
available. The next CL will enable and test it.

Change-Id: I6eba8e8010466e71efe9c5e06848b9f403df835f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/275131
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-04 19:33:00 +00:00
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