Commit Graph

3989 Commits

Author SHA1 Message Date
Shamile Khan
bdf1dca078 cyan: Enable Hash computation to facilitate Software Sync.
BUG=chrome-os-partner:40526
TEST=Enable Software Sync in Coreboot and Depthcharge. Compile
EC followed by Coreboot and program Coreboot. Compile a new
version of EC and program it. Reboot and check EC version of
RW image when Login Screen appears. The version should not be
the latest.
BRANCH=none

Change-Id: Ib6f5aa57fdda607a5c1cf59c8786a4a3a46b575f
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/276426
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-16 04:26:04 +00:00
Alec Berg
1a78faf247 tcpc: initialize CC termination based on default PD role
Initialize CC termination variable based on the default PD role.

BUG=chrome-os-partner:40920
BRANCH=none
TEST=load on glados. test by rebooting PD from PD console with
nothing plugged into the type-C ports. Without this change, the
EC gets stuck in SNK_DISCONNECTED_DEBOUNCE, because the PD defaults
to using the wrong termination and so the PD thinks the CC ADC
readings represent Ra. At this point you have to reboot EC to get
back to normal functionality. With this change, rebooting PD does
not wedge the PD protocol state machine.

Change-Id: I4eb6d881d8fc995be4d6a99ffa69e484141343f2
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277666
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-16 04:25:58 +00:00
Shamile Khan
b46faa6af7 mec1322: Compute hash for RW image by using the RW image resident in flash.
BUG=chrome-os-partner:41063
TEST=Enable Software Sync in Coreboot and Depthcharge.
Enable hash computation in EC. Compile EC followed by
Coreboot and program Coreboot followed by EC on a Cyan
system. System should boot to Chrome Login Screen.
BRANCH=none

Change-Id: I4b53e9e55e4da279366eb1283a11a010c52b865f
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/276305
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-16 04:25:52 +00:00
Ben Lok
65adf18a63 oak: fixing hardware tests build errors for oak
To avoid hardware tests build errors of oak

BRANCH=None
BUG=None
TEST=make -j BOARD=oak tests

Change-Id: Ia1874c2d271508414e32e89a05763c144d9e3b84
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/277625
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Rong Chang <rongchang@chromium.org>
2015-06-15 21:08:43 +00:00
Divya Jyothi
b99f00b7f9 mec1322: Added support for sysjump.
changes added to support flashrom are:
sysjump support to be able to copy the RO/RW image
and jump to it without causing AP to reboot while
its alreday ON.

LPC init should be reinitialized on sysjump

corrected gpio_set_flags_by_mask to make sure we
update the register only for GPIO_LOW condition and not
all else conditions.

BUG=chrome-os-partner:38103
TEST=commands : flashrom -p ec -w ec.bin
                flashrom -p ec -r ec.bin
BRANCH=none

Change-Id: I23892f0378d756052030e73034c3acdd41477e34
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/272000
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-14 22:18:34 +00:00
Shawn Nematbakhsh
5ea69a7b3b coderam: Don't assume that RO/RW images reside at start of code memory
RO/RW images may reside at an offset to the start of code memory,
defined at the chip-level by CONFIG_R*_MEM_OFF.

BUG=chrome-os-partner:38103
TEST=Manual on Cyan. Verify sysjump works correctly in both directions.
BRANCH=None

Change-Id: I54c5f20335a5646d49afcc8d3fa2eb90ca9349d0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274434
Reviewed-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
2015-06-13 07:12:38 +00:00
Vincent Palatin
1dfd58daf6 pd: ryu: set data role to UFP with debug accessory
When a USB-PD debug accessory is plugged, set the default data role to
UFP (USB device) on Ryu.

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

BRANCH=smaug
BUG=none
TEST=On Ryu, plug a SuzyQ and connect with ADB using a A-A cable.

Change-Id: Ifa62b097532880ab5cadb7f2ab7774eec752f1e6
Reviewed-on: https://chromium-review.googlesource.com/277276
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:48 +00:00
Gwendal Grignou
c86743ce59 accel: Fix BMM150 init sequence
Without this change, after a while, the data from the accelerometer is
garbled, weaker than expected.

BUG=chromium:494270
TEST=Check that with this change, the accelerometer vector is always
around 1G.
BRANCH=smaug

Change-Id: I9bb4acd208e8fa4111fc91e35c4cb5636f9425f4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276666
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:42 +00:00
Alec Berg
46644763f0 tcpc: disable TX timer as early as possible after DMA done
Move disabling the TX timer up to as soon as possible after
DMA transmit is complete to avoid potentially clocking another
bit, which could corrupt the end of the transaction.

BUG=none
BRANCH=smaug
TEST=load on glados and use a scope to verify the end of transmit
is clean.

Change-Id: If52ba2475eeb9752da0acc8efc957c1f472bc711
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277298
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:36 +00:00
Shawn Nematbakhsh
cb16cf9b65 skylake: Properly handle apshutdown when AP is already shutdown
If the AP is already shutdown, apshutdown would previously power the AP
up with a power press. Fix this by making sure we're not already in G3
before triggering the power press.

BUG=chrome-os-partner:40677
TEST=Run 'apshutdown' on glados while in G3, verify that AP does not
power up.
BRANCH=None

Change-Id: I8b898b034dcf40f0acef4fb6098af0aebba566c6
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277400
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-13 02:53:32 +00:00
Alec Berg
e22b900c6e tcpc: change pd_tx_done() to only wait for DMA done event
Change pd_tx_done() to wait specifically for the DMA complete
event using task_wait_event_mask().

This fixes a potential bug where if we get another event, for
example a TCPM event, while waiting for transmit to complete
we restore the pending event after we are done.

BUG=none
BRANCH=smaug
TEST=run on glados and make a bunch of contracts with zinger.

Change-Id: Ie28d97eba3edcc7a98fe842e8b7eb6b9d7707047
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277297
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:24 +00:00
Alec Berg
31171730a8 tcpc: Avoid missampling CC line immediately after transmit
Change TCPC to not sample CC ADC channels immediately after transmit
because we are likely to get a response immediately after transmit
and this could cause us to sample while traffic is on the line and
cause us to record the wrong voltage.

BUG=none
BRANCH=smaug
TEST=test on glados. put a print when TCPM is notified of CC voltage
change. without this CL, we occasionally get a false CC voltage
change. with this change, CC status stays consistent.

Change-Id: I9199a0ed98632b1f26b2b5b98f34928e4de328bf
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277296
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:18 +00:00
Alec Berg
1599e7a6f1 glados_pd: oak_pd: fix PD tx_disable timing
Disabling CC TX_DATA needs to be very fast to avoid clocking out
an extra garbage bit at the end of transmit. This change fixes
pd_tx_disable() to disable the TX_DATA line as fast as possible.

BUG=chrome-os-partner:40920
BRANCH=none
TEST=test on glados with scope attached to CC. note before this
change we occasionally get a garbage bit at the end of CC transmit.
With this change, it looks clean.

Change-Id: I86b47881e3846b2e3dd4fc2afcf2d28386a068a6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277295
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 02:53:12 +00:00
Vincent Palatin
181913141d pd: do not glitch USB when going to S5 in debug mode
When we are going to S5 with a debug accessory plugged, we cannot
transition through the 'PD_DRP_FORCE_SINK' else we would
disable/re-enable the USB muxes triggering disconnections/glitches on
the USB debug console.
So, rework the management of the dual role toggling special case
(used to detect debug accessories) : remove the special DRP state and
re-write the conditions.

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

BRANCH=smaug
BUG=chrome-os-partner:41399
TEST=on Ryu, connect to the EC console through Suzy-Q and issue
the "apshutdown" command, then see the EC USB console is randomly
disconnected/re-connected or acting up.

Change-Id: Id44a9360a836e7c10a30f5afb2971bc7c3d01a5c
Reviewed-on: https://chromium-review.googlesource.com/277275
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 01:25:13 +00:00
Vincent Palatin
e96c8885d4 pd: do not sleep when case closed debug communication is enabled
The case closed debugging feature is using the USB controller, so it
needs to disable the low power STOP mode of the MCU which is
incompatible with USB communication.

As the possibility of doing PD communication when a PD debug accessory
is plugged "re-appeared", just set/use the USB_PD sleep disable bit with
the debug accessory rather than creating a new one.

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

BRANCH=smaug
BUG=chrome-os-partner:41399
TEST=on Ryu, connect to the EC console through Suzy-Q and issue the
"apshutdown" command, then see the EC USB console is still alive.

Change-Id: I8668b28220202ce6419f18cff13d57d410e3e9f3
Reviewed-on: https://chromium-review.googlesource.com/277116
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-06-12 23:51:51 +00:00
Shawn Nematbakhsh
2af21940a3 core: Assert if task_get_current() cannot return a valid task ID
If task_get_current() is called early during initialization when we have
not yet done a context switch, our current_task pointer is invalid. Add
an assert to detect this case and put it behind CONFIG_DEBUG_BRINGUP, a
new config that's intended to enable possibly-costly pre-production
debugging.

BUG=chrome-os-partner:40677
TEST=Manual on glados. Define CONFIG_DEBUG_BRINGUP, then call i2c_write from
board_init and verify the new assert fails. Remove the i2c_write and verify
the new assert passes.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6014ccf739dcc4c8f4f960be2b89f01e423b65b5
Reviewed-on: https://chromium-review.googlesource.com/273541
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-12 22:21:15 +00:00
Shawn Nematbakhsh
35fbc972e9 charge_manager: Don't cutoff charger when no battery is attached
We normally do not charge from non-dedicated chargers. The process of
determining whether a charger is dedicated or not involves PD protocol
communication, so it can take some time to reach a determination. If no
battery is attached, the charger is likely our only source of power, so
don't cut it off.

BUG=chrome-os-partner:41258
TEST=Attach donette to glados system with no battery, verify that glados
boots to EC console and doesn't reset or panic.
BRANCH=None

Change-Id: I7c9cfcbd37b37ef16010cf1f246d8fddba6f6283
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277074
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-12 18:23:28 +00:00
Shawn Nematbakhsh
3062442361 glados: Enable BC1.2 USB charging
Enable charger detection through the pericom chips.

BUG=chrome-os-partner:40920
TEST=Manual on Glados. Plug 1A Apple charger, verify that port is
selected and charge limit is set correctly on both ports. Also verify
that Zinger still charges correctly.
BRANCH=None

Change-Id: I7e462194560965b6140446f3444be225e5503616
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276886
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-12 16:37:54 +00:00
Shamile Khan
a0bec46ef3 spi/mec1322: Ensure that SPI Flash write chunks do not cross
Page Boundary.

If SPI Flash write is at an offset within the page and the length
is greater than remainder of the page, the Flash page gets
corrupted as addressing wraps to the beginning of page and
previously written data gets overwritten. This change splits SPI
Flash writes in such cases into two operations in different pages.

BUG=None
BRANCH=None
TEST=During Software Sync, Depthcharge sends Flash write chunks that
cross page boundary. With this change, the RW parition does not get
corrupted. This can be confirmed by executing a successful
"sysjump RW" after a Software Sync.

Change-Id: I46349eea0d8e927353de7cb55a61e9960291adb6
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/275760
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-12 16:37:47 +00:00
Shawn Nematbakhsh
5b7cfac64e usb: pi3usb9281: Allow flexible chip configurations
Previously we supported using a single pi3usb9281 chip, or using two
chips on the same i2c bus behind a mux. Now that we need to support a
third configuration of multiple chips on different busses, it makes
sense to be able to configure the configuration freely at the board
level.

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: I120dcb1c3ceb6f013b92407effcd8cb66e7ffcce
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276511
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-12 16:37:39 +00:00
Todd Broch
9941f088d7 mec1322: Add servo serialname to flash_ec's flashrom call.
If host running flash_ec has multiple servo's connected it must use
the USB serialname to identify the proper FTDI device to run flashrom
on correctly.  CL adds serial param to flashrom call to do just that.

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

BRANCH=none
BUG=none
TEST=manual, successfully write glados EC w/ multiple servo V2's
connected to the same host.

Change-Id: I35c7d170f9bb80e96f69efae634cf70893eeef63
Reviewed-on: https://chromium-review.googlesource.com/276761
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-11 18:27:30 +00:00
Gwendal Grignou
e51399aae8 commands: Add EC FIFO commands
Add command to read the sensors events FIFO from the AP:
FIFO_INFO: get information on the FIFO state
FIFO_READ: read and update the consumer pointer
FIFO_FLUSH: insert a flush meta event and force a interrupt.

A new MKBP event is added to tell the host the FIFO needs processing.

BRANCH=smaug
TEST=Test on ryu
BUG=chrome-os-partner:39900

Change-Id: I11c0cf8cdc3087eb9e323f7d6780e6cf3a16257f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276264
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-11 18:27:24 +00:00
Todd Broch
e310a2be62 mcdp28x0: Add more useful error codes.
BRANCH=samus
BUG=none
TEST=compiles

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

Change-Id: Id925acbafcb49dbf503f666a7edb79b7eb25fecd
Reviewed-on: https://chromium-review.googlesource.com/276554
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-06-11 05:40:11 +00:00
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