Commit Graph

4818 Commits

Author SHA1 Message Date
Gwendal Grignou
cef0fdb90e motion: At shutdown, access sensors only if initialized.
When sensor_shutdown() is called, the sensors may already been powered
off, or will be soon.
In that case, do not attempts to access them.
Check their state before setting range or disabling activities.

BRANCH=smaug
BUG=chromium:557966
TEST=compile

Change-Id: I60640b120a23f9aab393a93c4c67ef17222ced4e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314382
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 01:11:09 -08:00
Ryan Zhang
6ebcb4b272 lars_pd: preparing new PD firmware for one-typeC-port PD
Since two port may cause some unexpected problem in a
one port board.

I've cloned this from glados_pd without any code changes
and I'll remove the second port settings at another CL.

BUG=None
BRANCH=lars
TEST=`make BOARD=lars_pd -j`

Change-Id: I84b3d2fa705ff089aabd52ab71d9fb59eecdd027
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314637
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-01 01:11:08 -08:00
Shawn Nematbakhsh
326bff520b fusb302: Don't flush RX FIFO on GoodCRC
Depending on timing, additional important messages may reside on our RX
FIFO at the time we process GoodCRC. Therefore, rather than flushing the
RX FIFO, simply read and discard the GoodCRC message.

BUG=chrome-os-partner:314492
BRANCH=None
TEST=Manual on Snoball with subsequent PWM changes. Verify PD contact
can be established with samus.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I4f4fab1bc318d1bce1effffad9a792c5b4a43761
Reviewed-on: https://chromium-review.googlesource.com/314871
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 01:11:07 -08:00
Ben Lok
9ea7ca8d87 pd: send power change event to AP whenever input power is changed
Send power change event to AP whenever input power is changed,
ensure that AP gets the latest power charging info.

BUG=chrome-os-partner:47677
BRANCH=none
TEST=tested on Oak by plug/unplug AC adapter to type-C ports and
verifying the UI battery icon shows the correct status instantly.

Change-Id: I7465afcd8bc9b1c56ecf70fc74446866a8ab1b9a
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/313926
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 01:11:04 -08:00
Shawn Nematbakhsh
af3172cd7e mec1322_evb: Remove board
This board is no longer in use.

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

Change-Id: Ie0d03e0a817ba101c01909f95955d51f8dfae03c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314920
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-30 18:54:16 -08:00
Shawn Nematbakhsh
4421d75c24 mec1322: i2c: Assume read-no-write transactions are repeated start
If we're doing a read transaction without a write and asked to send a
start condition, assume that the slave has already been addressed and
make a repeated start.

BUG=chromium:561143
TEST=Verify "ectool i2cxfer 1 0x25 1 2" succeeds on glados
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic60a5c0f0fa32d5541b3cc6dce48cac28f26cd06
Reviewed-on: https://chromium-review.googlesource.com/314313
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-30 18:54:04 -08:00
Shawn Nematbakhsh
07bf28b77c mec1322: i2c: Add hard-timeout for status wait
Add a hard timeout to wait_for_interrupt() so that we won't wait
forever, even if we get into a state where interrupts fire yet our
status is not as expected.

BUG=chromium:561143
TEST=Verify "ectool i2cxfer 1 0x25 1 2" doesn't watchdog on glados
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I39773370bb7e45a8f0c0cdb4a463904643f72587
Reviewed-on: https://chromium-review.googlesource.com/314253
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-30 16:25:39 -08:00
Ryan Zhang
1051a7e2d5 Lars: update for proto board
Following kunimitsu settings of
https://chromium-review.googlesource.com/#/c/312559/

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: If226f5b8a46cfb8ffb19015a0a7cc684d1b61175
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314643
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-30 14:30:24 -08:00
Ryan Zhang
29467c60c6 Lars: update I2C port MACRO
Since Lars has only one usb charge port

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: If164dfd90e3536a2e6a3097c8a7f7add408c8da9
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314638
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-30 14:30:24 -08:00
Shawn Nematbakhsh
6e4848c200 task: Don't discard events on mutex contention
On mutex contention, call task_wait_event_mask(), which will wait for
a mutex event without clearing other pending events.

BUG=chrome-os-partner:47918,chromium:435611,chromium:435612
BRANCH=None
TEST=Manual on snoball. Verify samus can successfully negotiate PD power
contract when attached to snoball.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I85cd32f2670246da9e4787025390aba2c93f9c36
Reviewed-on: https://chromium-review.googlesource.com/314492
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-30 12:27:58 -08:00
Mike M Hsieh
0c4408efdc kunimitsu: Modify battery LED colour
Use one gpio instead of two to show amber colour to indicate charging state

BUG=none
BRANCH=none
TEST=checked and verified LED colour while charging
Signed-off-by: Mike Hsieh <mike.m.hsieh@intel.com>

Change-Id: Id3897eea4213efeea96c3e261f9f43e1b96e8dd0
Reviewed-on: https://chromium-review.googlesource.com/304700
Commit-Ready: Mike M Hsieh <mike.m.hsieh@intel.com>
Tested-by: Mike M Hsieh <mike.m.hsieh@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-11-30 02:18:45 -08:00
Bruce
2a09bf95e5 Chell: support LED behavior
Add firmware to support LED behavior for following OEM spec.

BUG=None
BRANCH=None
TEST=check led behavior follow the spec

Change-Id: Ib4250a47a153fbe7de0e1cd4a5869fd3efbcfd1d
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/313898
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-29 18:46:26 -08:00
Ryan Zhang
356c9c5104 Lars: update type-C switch port count
BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: Ieb3bd091096cb70b8b58e539992c4b17fcbfb20d
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/313949
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-27 20:17:42 -08:00
Ryan Zhang
921630d404 Lars: update i2c.mux speed
BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: I8e9c581891cfae6b21f94f536f043adc8eb2b4a3
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314546
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-27 20:17:41 -08:00
Kevin K Wong
d8a516cb9a kunimitsu: remove fab 3 related changes
BUG=chrome-os-partner:44704
BRANCH=none
TEST=verified image can boot on kunimitsu fab 4

Change-Id: If5f48bdd5dee5998fec2c079ee46f34cb604fd38
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/314126
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-26 03:25:36 -08:00
Aseda Aboagye
f14dd412ce ec3po: Add compatibility for older EC images.
The EC-3PO console and interpreter could be used to talk to EC images
which do not have the necessary changes to support the new enhancements.
If this was the case, the interpreter would be very confused and the
user wouldn't be able to use the console.  This commit adds
compatibility support for talking to both non-enhanced and enhanced EC
images.

When the console and interpreter are instantiated, they assume by
default that the EC image they are talking to is non-enhanced.  When the
user presses the carriage return key, the console initiates an
interrogation with the EC image.  The interrogation is a simple
EC_SYN(0xEC) and waits EC_INTERROGATION_TIMEOUT for the correct
EC_ACK(0xC0).  Enhanced EC images will try to reply immediately to a
EC_SYN. Non-enhanced EC images will just ignore the EC_SYN as it's not a
printable character.  Once the interrogation is complete, the console
will either simply pass everything forwards to the EC or provide the
console interface itself.

BUG=chrome-os-partner:46063
BRANCH=None
TEST=Enabled CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS.  Entered some
commands and verified console was working.  Disabled
CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS, reflashed, and verified console
was still working without restarting the EC-3PO console.
TEST=./util/ec3po/console_unittest.py -b
TEST=./util/ec3po/interpreter_unittest.py -b
TEST=cros lint --debug util/ec3po/console.py
TEST=cros lint --debug util/ec3po/console_unittest.py
TEST=cros lint --debug util/ec3po/interpreter.py
TEST=cros lint --debug util/ec3po/interpreter_unittest.py

Change-Id: I4f472afbdd7e898bee308c239b68ace0f4049842
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/313002
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-26 01:39:36 -08:00
Ryan Zhang
1d0785da90 Lars: update GPIO setting
Expected PIN macros to expand in Decimal instead of Octal.

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Change-Id: I1c469a6031a6b2c64db75c362d1915b7a390f81e
Reviewed-on: https://chromium-review.googlesource.com/314411
Commit-Ready: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-25 23:53:48 -08:00
Ben Lok
cefe19e08f oak: add VCONN swap ability
refer to commit 776bedc3, enable VCONN swap option for oak.

BUG=chrome-os-partner:41838
BRANCH=none
TEST=test on oak. ask for vconn swap and make sure vconn swap
is successful.

Change-Id: I2afa68e073d088302c2c6ba2315a6c9f4551ef87
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/313913
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-25 20:08:07 -08:00
Kevin K Wong
e24ac972e2 ectool: provide lid angle info
Added new host command to support returning lid angle.

New output from ectool:

	System with lid angle support:
	------------------------------------------
	localhost ~ # ectool motionsense lid_angle
	Lid angle: 72

	System without lid angle support:
	------------------------------------------
	localhost ~ # ectool motionsense lid_angle
	EC result 3 (INVALID_PARAM)

BUG=none
BRANCH=none
TEST=run "ectool motionsense lid_angle"
     verify the value matches the physical lid angle position

Change-Id: I4179172c778f643640561e819216f7adfee679d2
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/313345
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-25 18:15:38 -08:00
Shawn Nematbakhsh
767e132d13 pd: Add support for multiple distinct TCPC alert signals
If multiple TCPCs are present on a system then we may have multiple
alert signals, each of which alerts us to the status of a different
TCPC. Make boards with external non cros-ec TCPCs define
tcpc_get_alert_status, which returns alert status based upon any alert
GPIOs present, and then service only ports which are alerting.

BUG=chromium:551683,chrome-os-partner:47851
TEST=Verify snoball PDCMD task sleeps appropriately when no devices are
inserted, and verify ports go to PD_DISCOVERY state when we attach
samus. Also verify that glados / glados_pd can still negotiate PD.
BRANCH=None

Change-Id: Iae6c4e1ef4d6685cb5bf7feef713505925a07c8c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313209
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-25 12:59:17 -08:00
Vadim Bendebury
9665d0b1df cr50: fix _cpri__DrbgGetPutState and _cpri__EccCommitCompute stubs
These functions are mostly no-ops it turns out, maybe something will
be needed to be done for RSA and ECC initialization, for now leaving
those functions commented out as a reminder.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=tests passing before this change still pass.

Change-Id: Iee9aaf133a55a6197c9896ed48efb34a4b3340c6
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314096
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-11-25 11:17:15 -08:00
Vadim Bendebury
9b11d70956 cr50: increase tpm task size
Let's increase it to 4K, this seems to be adequate for tests so far,
but with the enabled stack size monitoring we should find out quickly
if in certain cases this is not enough.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=the test involving the use of SHA hardware does not fail in
     mysterious ways any more.

Change-Id: I86da89ccca42d1a60ce7c1dfef08d21bf44f1eee
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314095
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-25 11:17:14 -08:00
Vadim Bendebury
36ceac483b cr50: enable stack overflow monitoring
The main cr50 application is pretty stack use intensive, let's enable
stack overflow monitoring while project is in development.

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

Change-Id: Iac9404b585664b891b63e9df058cdeb2654fc323
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314094
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-25 11:17:14 -08:00
nagendra modadugu
ae89bb6f49 cr50: SHA1 and SHA256 implementation with hardware support
This change includes hardware and software support for SHA1/256 on
CR50. When running in the RO image, only hardware sha256 support is
included. When running in the RW image, the code auto-selects between
the software and hardware implementation. Software implementation path
is taken if the hardware is currently in use by some other context.

Refactor the CR50 loader to use this abstraction.

The existing software implementation for SHA1 and SHA256 is used for
the software path.

CQ-DEPEND=CL:*239385
BRANCH=none
TEST=EC shell boots fine (implies that SHA256 works)
BUG=chrome-os-partner:43025

Change-Id: I7bcefc12fcef869dac2e48793bd0cb5ce8e80d5b
Signed-off-by: nagendra modadugu <ngm@google.com>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313011
2015-11-25 11:17:13 -08:00
Tom Wai-Hong Tam
f01d71eb5b flash_ec: Don't stop servod or init when claiming EC UART
When flashing the STM32 chip, the flash_ec script stops the processes
which occupy the EC UART in order to avoid their interference. After
flashing, it asks these process to continue.

However, when running FAFT in the lab, the EC UART may be occupied by
servod for sending some EC commands per test requirements. The
flash_ec should not stop the servod; otherwise, all the following
dut-control commands will be failed.

So this change blacklists the process servod and init.

BRANCH=none
BUG=chromium:552073
TEST=Manual
Ran a FAFT test, e.g. firmware_FAFTSetup, which occupies EC UART.
Ran another process, e.g. minicom, which also occupies EC UART.
Ran the flash_ec: flash_ec --chip stm32 --image /tmp/ec.bin
Its output:
INFO: Using ec image : /tmp/ec.bin
INFO: ec UART pty : /dev/ttyO1
INFO: Flashing chip stm32.
INFO: Using serial flasher : /usr/bin/stm32mon
INFO: Sending SIGSTOP to process 2369!
INFO: Sending SIGSTOP to process 7949!
INFO: Skip stopping servod or init: process 1.
INFO: Skip stopping servod or init: process 639.
...
INFO: Restoring servo settings...
INFO: Sending SIGCONT to process 2369!
INFO: Sending SIGCONT to process 7949!

Change-Id: I4d72b7e2caf0ca2963bb9dee51764869e829c569
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313581
Commit-Ready: Wai-Hong Tam <waihong@chromium.org>
Tested-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-24 14:41:40 -08:00
Vijay Hiremath
51afeae605 kunimitsu: update accelerometer standard reference matrix
This is based on kunimitsu fab 4 close chassis system.

BUG=none
BRANCH=none
TEST=Using the "accelinfo" console command verified the
     lid angle by rotating the lid & base.

Change-Id: Ia0491b52fda74b066120f3e2173b73fd1282c9cb
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/306185
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-24 14:41:37 -08:00
Duncan Laurie
feb63bec88 chell: Apply USB EQ settings to PS8740 USB mux
Apply the recommended USB EQ settings for Tx and Rx channel
loss compensation to the PS8740 USB mux chip.  This is called
after the driver is initialized and sets up the chip for the
first time.

BUG=chrome-os-partner:47074
BRANCH=none
TEST=build and boot on chell, read back registers to verify
> i2cxfer r 1 0x34 0x32
0x60 [96]
> i2cxfer r 1 0x34 0x3b
0x60 [96]
> i2cxfer r 1 0x20 0x32
0x60 [96]
> i2cxfer r 1 0x20 0x3b
0x60 [96]

Change-Id: I95334be9eed2858864787500a7483fa043947148
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313748
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-24 11:02:50 -08:00
Duncan Laurie
3df2228c14 ps8740: Add a function to tune USB EQ settings
This adds a new function that can be use to apply USB EQ settings
to the mux.  It currently only exposes the Tx and Rx channel
loss compensation.

BUG=chrome-os-partner:47074
BRANCH=none
TEST=build and boot on chell

Change-Id: I1ec83cdcbb17da8e7289e6633509b64f01b14348
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313747
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-24 11:02:49 -08:00
Duncan Laurie
1ea9dece80 usb_mux: Add a callback for board specific init
This adds a callback for board specific initialization that is called
after the driver init function.  This will allow a board to apply
port-specific tuning (such as USB EQ settings) to the mux chip.

BUG=chrome-os-partner:47074
BRANCH=none
TEST=build and boot on chell

Change-Id: Ib162f9a2c5239678c46b80e5517823b336f6b66c
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313746
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-24 11:02:49 -08:00
Duncan Laurie
156461b212 chell: Update for EVT build
- Disable SLP_S0 as interrupt source for proto boards
- Remove pull-up on PLATFORM_EC_PROCHOT for EVT boards

BUG=chrome-os-partner:47346
BRANCH=none
TEST=build and boot on chell proto

Change-Id: I3196e9fe1c921d66fd841c6ca1c3d8df131db9eb
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313663
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-11-23 19:23:58 -08:00
Vadim Bendebury
46c62e3b6e cr50: dcrypto code belongs with the chip, not with the board
Dcrypto support is a hardware property, it belongs with the chip
sub-tree, not with the board.

This patch just moves the files and modifies the makefiles to pick up
the files at the right spot.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=the image still builds, the devices still boots, the
      test/tmp_test/tpmtest.py still succeeds.

Change-Id: Ie321ac738c11a9f403a7943524c56ec4366db297
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313655
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-11-23 19:23:43 -08:00
Vadim Bendebury
824d9e7a86 cr50: move key ladder initialization into its own files
This is required to be able to consolidate hardware and software hash
implementations.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=the device still boots up.

Change-Id: If420541427bb316b97bc20a21fd3fd8a57708244
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313654
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-11-23 19:23:43 -08:00
Shawn Nematbakhsh
c13c653934 snoball: Enable secondary bias regulator
This regulator must be enabled in order to power snoball through the
VBUS path.

BUG=chrome-os-partner:47851
BRANCH=None
TEST=Boot snoball with 12V supply on VBUS, verify that EC is stable
and not resetting constantly.

Change-Id: Id1b79b69f641e0c80160b161fe177aeb9c3de733
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313811
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-23 15:07:54 -08:00
Vadim Bendebury
6e99eb6814 cr50: fix assert_func stub prototype
__assert_func() is modified to match prototype defined in the global
include file. TPM2 library handling of asserts will have to be
modified later.

BRANCH=none
BUG=chrome-os-partner:43025, chromium:559344
TEST=assert message now include valid pertinent information about the
     point of failure.

Change-Id: I8050c018c36d5d98b879daa2b600fc7c76ef9126
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/312868
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-21 13:12:24 -08:00
Vadim Bendebury
afaaba44f1 cr50: Extended command test utility
The utility builds on the extended command protocol recently
introduced in the EC and allows to test implementation of various
cryptographic primitives available on CR50.

This patch brings in the ftdi_spi_tpm.c and mpsse.c from the AOSP
trunksd package. mpsse.c has been modified to limit its feature set
(no i2c or bigbang support, only SPI0 mode), and ftdit_spi_tpm.c has
been modified to properly present binary strings to the Python swig
wrapper.

The crypro_test.xml file includes descriptions of the tests to perform
on the target. Most of its contents other than the first crypto_test
element are borrowed from NIST AES test vectors set. See file header
for description of the contents format.

The actual test command is the tpmtest.py. When started it establishes
connection with the device, and then reads test vectors from
crypto_test.xml and executes them one at a time.

Starting the test program with the -d command line argument enables
debug output sent to the console.

There are some other programs in ./extras which use the mpsse.c from
AOSP, they will have to be modified to use the local copy.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=ran the following in the directory:
   $ make  # output suppressed
   $ ./tpmtest.py
   Starting MPSSE at 800 kHz
   Connected to device vid:did:rid of 1ae0:0028:00
   \New max timeout: 1 s
   SUCCESS: AES:ECB common
   SUCCESS: AES:ECB128 1
   SUCCESS: AES:ECB192 1
   SUCCESS: AES:ECB256 1
   SUCCESS: AES:ECB256 2
   SUCCESS: AES:CTR128I 1
   SUCCESS: AES:CTR256I 1

  - temporarily corrupted the contents of the clear_text element of 'AES:ECB common':
  $ ./tpmtest.py
  Starting MPSSE at 800 kHz
  Connected to device vid:did:rid of 1ae0:0028:00
  |
  Out text mismatch in node AES:ECB common, operation 1:
  In text:
  74 68 69 73 20 20 69 73 20 74 68 65 20 74 65 78
  74 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20
  65 6e 63 72 79 70 74 65 64 20 69 66 20 65 76 65
  72 79 74 68 69 6e 67 20 69 73 20 67 6f 69 6e 67
  20 66 69 6e 65 2e 20
  Expected out text:
  3d e2 0f f9 ee d9 62 ce f0 8a 17 57 c6 04 86 d0
  3d ec 44 72 d8 79 18 87 3f 31 81 6d 66 4c bb 10
  da 8d e0 9f 63 67 b3 cc 64 b4 e8 bd 12 b0 a9 c9
  09 6d f0 9f a4 e2 ae fb 0d fe 1c 90 6c e2 fe f0
  68 8f b5 34 07 76 e2 a9 72 8e dd 7b 8b 52 2b 8b
  Real out text:
  f9 50 fe 93 c9 3f cb e5 9e e0 a4 7e 51 1a bb a0
  36 2f d1 d6 5f a8 1d 22 5a 1a bb f7 e6 65 89 55
  ad e8 f5 8f 1a 20 ff a5 c4 de 76 3e b8 ef cc 8d
  9d 94 b8 89 22 1c c9 2a 43 58 c3 8c 75 9f 9f 56
  ab 2f 89 1a f6 a0 36 8b 95 23 91 d6 23 47 77 36

Change-Id: I2687ac03236b528e71b92df7cb35606e473ab2c5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313443
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-21 13:12:18 -08:00
Vadim Bendebury
32267c1094 cr50: rename hw generated register definitions file
This common for all g based boards file should not be associated with
a single board.

BRANCH=none
BUG=none
TEST=the device still builds and boots.

Change-Id: I34c49a095abd8e49b492c318823dd8f56609fdc8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313631
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-21 13:12:18 -08:00
Vadim Bendebury
70bb65cd2e cr50: Update to the "final final" FPGA image 20151118_11218@80881
A few minor changes, this is still a USB image, no dcrypto support.

BRANCH=none
BUG=none

TEST=built an image using the new description and signer files, booted
     it on an fpga board:
 > vers
 Chip:    g cr50 B1 20151118_11218
 Board:   0
 RO:      cr50_v1.1.4081-c06cf49-dirty
 RW:
 Build: cr50_v1.1.4081-c06cf49-dirty 2015-11-20 09:56:03 vbendeb@eskimo.mtv.corp.google.com
 >

Change-Id: I29bbaaa512ff604beb209a606acf19282331c96f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313630
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-21 13:12:17 -08:00
Vadim Bendebury
04e0b4cc47 cr50: suppress TPM debug output by default
It is way to chatty because the host is often polls the device for
extended periods of time.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=booted the device, observed calmer console.

Change-Id: Id318b57b274ed6c327a05dcd2bcb09ac2b89cb5c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/312867
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-21 13:12:17 -08:00
Gwendal Grignou
68502864c7 motion: fix ec_rate to be more accurate
In case the actual ODR rate is way higher that the AP asked for,
we don't have to settle to a slower EC rate if
EC rate == AP requested ODR rate.

BRANCH=smaug
BUG=none
TEST=Run android.hardware.cts.SingleSensorTests

Change-Id: I437f47bd942a16694c7efcdbc00201352f0480a6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313641
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-21 09:20:58 -08:00
Gwendal Grignou
708f81e3d1 motion: Fix the number of sample to collect in motion task
AP could collect samples while motion task was still adding timestamp.
A data stream not ending with a timestamp can lead to timestamp error in
the kernel.
This is espcially true if the motion task interrupt the AP back to back,
when sensor ODR changes for instance.

BRANCH=smaug
BUG=b:24367625
TEST=Run android.hardware.cts.SingleSensorTests

Change-Id: I5820216a2cfc0a869db7dc5ef75d4be126a53b4f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313640
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-21 09:20:58 -08:00
Wonjoon Lee
d0cf3227ce charge_state_v2: Set charger input current in the task
When task creating, input_current will be set as condition.
But there is no more handling for this value. so it will remain
even if condition is changed.
This will put input current decision int the loop so that we can
proper input current as battery existence.

BUG=chrome-os-partner:47546
TEST=make buildall, command 'charger' with/without battery.
     and see it is changed dynamically
BRANCH=None

(cherry picked from commit d2ac89d58c34d7cc0a2a3fb591fcdcddbe2e9feb)
Change-Id: Ib72e20faf7c7f302a4e39d43b23176247e5176fa
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/312950
Commit-Ready: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 21:44:45 -08:00
Kyoung Kim
ea3b0a97c8 fan: Disable fan when duty / RPM is set to zero
BRANCH=master
BUG=none
TEST=Check GPIO(fan_t.enable_gpio) if it is low when S3 or S0ix or
0% duty or 0 RPM on kunimitsu.

Change-Id: I6aecae269fa8bb41a811e75089757fe714576160
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/310391
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-19 20:01:59 -08:00
Kyoung Kim
ebf92ecc83 Kunimitsu: Add S0ix on SLP_S0 assertion
On assertion of SLP_S0, EC goes to S0ix while system is in Lucid sleep
and EC is eligable to enter heavy sleep idle task.
Wakeup from S0ix by lid open, any key press, power button or track pad
will be done by PCH block by asserting SLP_S0.
At S0ix, 1 msec pulse will be generated every 8sec and this signal
should be ignored since this is NOT S0ix entry/exit related and defered
interrupt for SLP_S0 were added.

BRANCH=master
BUG=none
TEST=in OS shell, run following commands.
	Following command is valid with coreboot with S0ix patches.
	"echo freeze > /sys/power/state"
	then,
	Measure EC power consumption and compare it with one in S0.
	And on EC console, there should be NO periodic message, "power
	state 4 = S0ix, in 0x001d" every 8 sec.

Change-Id: Ia9cf5256b1ad7234815d4b6dbe2b45788aaf49dd
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/307947
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-19 20:01:58 -08:00
Shawn Nematbakhsh
8704de934e snoball: Correct DMA UART channels
Snoball uses DMA2 + DMA3 for UART1 debug console. No changes are needed
to STM32_SYSCFG_CFGR1 since this is the register default config.

BUG=chrome-os-partner:47851
BRANCH=None
TEST=Boot snoball, verify EC console works in both directions.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Id984b63f8c0c2d5c042265fd86b3d0c71fd68e6f
Reviewed-on: https://chromium-review.googlesource.com/313168
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 18:14:27 -08:00
Shelley Chen
06c2b877d6 flash_ec: Accomodate using flashrom on beaglebone
Currently, using flash_ec for mec1322 chips only
supports flashing from servo v2.  Updated to work from
v3 as well.  This is a resubmission.

BUG=chromium:554230
BRANCH=None
TEST=tested locally with beaglebone/cyan setup at my desk
     Ran flash_ec --board=cyan --chip=mec1322
     --image=/tmp/image.bin.  Also ran with servov2.

Change-Id: Ia2a7edb577350cd4aa1c9835f24f4e3df2e508e2
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313053
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-11-19 18:14:27 -08:00
Shawn Nematbakhsh
0ddef3548b snoball: Use TIM1 for LSB system clock
TIM14 can't be used in our existing master / slave system clock config
due to lacking master mode control / TRGO.

BUG=chrome-os-partner:47851
TEST=Manual on snobal. Verify that timer interrupts function, HOOK_SECOND
hooks are called and watchdog doesn't fire.
BRANCH=None

Change-Id: I659b3cc46cf350fc58d88853fcc3d436b5f37d52
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313189
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 18:14:18 -08:00
Shawn Nematbakhsh
c20cff09e6 stm32: hwtimer: Use correct TIM1 interrupt
Our system timer uses capture compare mode, so the TIM1_CC interrupt
should be used.

BUG=chrome-os-partner:47851
TEST=Set TIM_CLOCK_LSB to 1 on snoball (TIM1), verify that timer
interrupts function, HOOK_SECOND hooks are called and watchdog doesn't
fire.
BRANCH=None

Change-Id: Id5cc18d0cd216b5b448e11cf0bae9696db74eb02
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313188
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 18:14:17 -08:00
Shawn Nematbakhsh
bb9e85321b glados: Make SLP_S0 a non-interrupt input pin
SLP_S0 can reside at an intermediate voltage even with the internal
pull-down. Eliminate interrupt storms by making this pin a
non-interrupt, which also necessitates making the pin a non-power
signal. This change will inhibit us from enabling S0ix later on glados.

BUG=chrome-os-partner:47617
BRANCH=None
TEST=Successfully power sequence on glados.

Change-Id: Ic8644ace136a984be300c6d7ac96be4cd1be40d0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313346
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 16:28:13 -08:00
Gwendal Grignou
87a60df71f motion: improve readability by adding units to variable names.
Throughout the code, there are comparison between frequency (in mHz) and
period (in us). To improve readability, append units (_mhz, _us) after
variable names.

BRANCH=smaug
BUG=none
TEST=compile.

Change-Id: Icc9c66d9f06c526fc3b74fd85ca9759b702ee416
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313221
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 16:28:03 -08:00
Gwendal Grignou
9d7f167446 motion: wake up main task for all changes in EC parameter.
We need to wake up the main task, even if we disable a sensor. It will
force sending the sensors samples in the FIFO and put a timestamp behind
them.
Also, reduce the interrupt period by 10us to be sure we fire interrupt
to the AP even if there are some variation in the timing calculation.

BUG=b:24367625
BRANCH=smaug
TEST=Run ts.SingleSensorTests overnight.

Change-Id: I6d966d52b5cbb72ba5eb936bc2fad6c06c7d8605
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/312986
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-19 16:28:02 -08:00