Commit Graph

5034 Commits

Author SHA1 Message Date
Anatol Pomazau
e4565cca1a Add bionic compatibility
TEST=Build ectool for Android and run it
BUG=None
BRANCH=master

Signed-off-by: Anatol Pomazau <anatol@google.com>

Change-Id: I5f148adfc24591523a7d8c50817c8095072071c3
Reviewed-on: https://chromium-review.googlesource.com/327220
Commit-Ready: Anatol Pomazau <anatol@google.com>
Tested-by: Anatol Pomazau <anatol@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-10 18:19:24 -08:00
Aseda Aboagye
c0c4402623 util: ec3po: Allow changing interrogation modes.
Currently, a majority of the users don't use the experimental EC console
and as it stands, they have to wait approximately 300ms after pressing
enter after every command.

This commit adds a OOBM command to change the interrogation mode.
Additionally, it allows this command to be entered from the EC console.

Usage:

  interrogate <never | always | auto> [enhanced]

Type the percent key to enter the (primitive) OOBM console.  From
there a user can enter 'interrogate never' followed by enter to
completely disable the interrogation that occurs.

By default, the EC-3PO console will start in the 'always' state.

BUG=None
BRANCH=None
TEST=./util/ec3po/run_tests.sh
TEST=Run cros lint --debug for all changed files.

Change-Id: I10eef0c796eab4e0af1c232a3d3da8898ba3d348
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/327035
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2016-02-10 15:45:53 -08:00
Vadim Bendebury
e10691fa7c cr50: remove RO dependency on tpm2
The RO image is now required to be signed following a cumbersome
procedure. It turns out that it is rebuilt even if the underlying
source files do not change. The reason being that it depends on tpm2
library and even includes it during linking (without actually linking
anything in), this was done to simplify the makefile.

This patch decouples the RO image from the tpm2 library, as a result
the RO image is not rebuilt every time make runs.

BRANCH=none
BUG=chrome-os-partner:49950
TEST=ran several times the following commands:

   $ rm -rf build/cr50 && make BOARD=cr50 -j

    there is no race conditions, the library is built in time.

  - verified that running 'make' the second time does not cause the RO
    image to be rebuilt any more.

Change-Id: Idbf84f6ac01e1a6d3da363489b8fc74fd5a54da5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327192
2016-02-10 15:45:52 -08:00
Mulin Chao
3d2ad2985a nuc: Modify divider of apb2 to 1 if it's freq isn't divisible by 1MHz
We found the deviation of ITIM32 is huge since apb2's clock isn't divisible
by 1MHz. (The default resolution of hwtimer is 1us.)

The solution is set the freq of apb2 the same as core clock. Note apb2 is
twice value of original one. It will increase power consumption slightly.
But we found the difference is acceptable no matter core clock is 15M
or 13MHz.

In this version, we also use the arrays to adjust i2c bus timing if
bus' freq is 400K or 1MHz for all source clock freqs of i2c.

Modified sources:
1. i2c.c: Support all source clock freqs of i2c for best bus timing.
2. clock.c: Set divider of apb2 if it's clock isn't divisible by 1MHz.
3. uart.c: Modified baud-rate for apb2 which is the same as core clock.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I6089caaaf9aa16186d7c6acf6f5fea0682a55655
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/327120
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-10 15:45:52 -08:00
Mulin Chao
71a8c02982 nuc: Fixed bug that some of DP80's data is skipping
Fixed the bug that some of DP80's data is skipping if the speed of writing
by host is high. The solution is grabbing all data and sending them to UART
until FIFO of DP80 is empty in ISR.

Modified sources:
1. lpc.c: Fixed the bug that some of DP80's data is skipping.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: Ie53a5c7f0a80a1f836b571a00871cb57b42c87db
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/326931
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-10 15:45:51 -08:00
Nadim Taha
27ce00c164 Cr50: Fixes a glitching issue during GPIO initialization.
The output enable bit was being set before the output value was
initialized.

BRANCH=none
BUG=none
TEST=Confirmed the fix with a logic analyzer

Change-Id: If8228d716b4924b5fd65b8f59436f4b37f05644e
Signed-off-by: Nadim Taha <ntaha@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327212
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-10 22:03:03 +00:00
nagendra modadugu
388a7fa8cf CR50: remove incorrect output length check in RSA decrypt
The required output length is not known until padding
verification completes (this check is already done
in the appropriate padding check functions).

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpm2/ pass.

Change-Id: I452244d052b7f334a6907bd653645671033a0890
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/327074
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-02-10 12:44:16 -08:00
Patrick Georgi
e7b5e7b050 core/*/ec.lds.S: quote paths containing OUTDIR
If OUTDIR brings in a "@", the build breaks because that delimits the
path, leading to invalid file names.
This can happen (and happened) when building on a Jenkins CI instance
which uses jobname@number as path for parallel checkouts on a
single build node.

BRANCH=none
BUG=none
TEST=build with make out=foo@bar ... failed and works now.

Change-Id: Id0594f0d7312419110091443755ec11b5f8ee2d8
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/327110
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2016-02-10 12:44:15 -08:00
Archana Patni
192806b8da skylake: set and clear wake masks in S0 <-> S0ix transitions
In the S0 <-> S3 transition, Coreboot sends EC messages to set/clear the
wake masks when the SMI is invoked. For S0ix, EC sets and clears the
wake mask via this patch.

These functions are directly invoked from the state machine transition states.
During S0ix entry, the wake mask for lid open is enabled. During S0ix exit,
the wake mask for lid open is cleared. All pending events are also cleared

BRANCH=none
BUG=chrome-os-partner:48834
TEST=test lidopen in S0ix

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Change-Id: I52a15f502ef637f7b7e4b559820deecb831d818f
Reviewed-on: https://chromium-review.googlesource.com/320190
Commit-Ready: Divya Jyothi <divya.jyothi@intel.com>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-10 12:44:15 -08:00
Vadim Bendebury
40018bb45b cr50: test: use gcc for linking
For some reason the default linker does not find libftdi1 anymore.
Other Chrome OS packages linking to this library still build just
fine, it turns out they are using the default gcc for linking.

Let's do the same for building tpmtest library.

BRANCH=none
BUG=none
TEST=the following sequence now works fine:

     cd test/tmp_test
     touch *
     make

  and the resulting library allows to successfully run TPM tests on
  the b1 board.

Change-Id: I10fe51a4747a3527b500d3255d8347e6a689c345
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327065
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-10 12:44:14 -08:00
Vadim Bendebury
d5e598646d cr50: configure GPIOs properly
The SPS GPIOs are hard wired, so there is no need to configure the
mux, but the default mode of pin operation is "output". The three SPS
input pins (CLK, CS, and MOSI) need to be explicitly configured as
such.

BRANCH=none
BUG=chrome-os-partner:50141
TEST=spiraw and TPM tests now pass

Change-Id: Ie8f6c6c3cd09420aab831113a1456227d2b3c44b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327064
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-10 12:44:14 -08:00
nagendra modadugu
cd5745f99c CR50: Include NUL byte from label for OAEP pad calculation
If a label is specified, then the NUL terminating
character is considered part of the label per the
TPM2 implementation.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpm2/ pass.

Change-Id: If5fccc293f7ab52fd6c33e2f3c38695c2921d919
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/326910
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Marius Schilder <mschilder@chromium.org>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-02-09 19:51:05 -08:00
Icarus Sparry
5dca5807bd MEC1322 port80 Acknowledge interrupt
In normal operation the 16 bit timer number 1 is set up to count every
microsecond, and every 1000 counts (i.e. every millisecond) to assert an
IRQ (Interrupt Request). After a microsecond the IRQ is deasserted.when
the count is again not at its limit.

The IRQ handler ignores the IRQ from the timer itself.

If the clock is stopped or the autoreload of the counter is disabled
then the value of the count is left unchanged. If this count is the
limit then the IRQ will remain asserted. For stopping the clock this is
approximatly a 1 in 1000 chance, or is certain if the autoreload is
disabled.

If the IRQ from the timer continues to be asserted, then the NVIC will
continue to generate a fresh call to the IRQ handler as each previous
exception completes.

The fix is to do what almost every IRQ handler does for almost every
processor, and clear the request in the peripheral that is causing the
interrupt, rather than hoping that the timer will clear it itself. This
agrees with how the event timer is used. There may be a lurking bug in
the system timer handler as well as it also expects the timer to clear
its own IRQ.

BUG=chrome-os-partner:48499
TEST=Pass 2000s of continuous calls to port_80_interrupt_disable() /
port_80_interrupt_enable() without WDT being triggered. Stop the
autoreload and see it doesn't watchdog.
BRANCH=glados

Change-Id: I4726854b7784e2e4a39b8cb74c350206d71f90df
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/326781
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-09 19:51:04 -08:00
Shawn Nematbakhsh
0251aacd43 mec1322: i2c: Print port name on failure
Referring to i2c ports as i2c0 thru i2c4 is confusing, due to the
special naming of controller 0 ports, so use their actual names from the
datasheet.

BUG=None
TEST=Trigger failure on i2c0_1, verify that "i2c0_1 bad status .." is
seen on console.
BRANCH=glados, strago

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ibd0d638e5af1c0a64e6f4b1a709b790b6b10d5e6
Reviewed-on: https://chromium-review.googlesource.com/325822
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-09 19:51:01 -08:00
Shawn Nematbakhsh
9c053ea898 mec1322: clock: Use full-speed 48MHz processor clock during EC boot
EC boot / hash computing can be a bottleneck for system boot time.
Reduce this bottleneck by running our processor at 48 MHz through boot,
until vboot hashing of RW completes.

BUG=chrome-os-partner:49583
TEST=Boot chell, verify vboot hash completes within 1 sec of EC boot and
'cbmem' delta between 'vboot select&load kernel' and 'finished EC
verification' is reduced to ~250 ms (which includes sysjump time).
BRANCH=glados

Change-Id: I18d87e685b89decef761e51517bfcfc43dcf8ef0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326792
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-09 19:51:00 -08:00
li feng
c7b96d514d Driver: isl9237: configures ACOK assertion to switching time
Isl9237 default setting sets 1.3s debounce time from ACOK assertion
to switching. It's too long for EC being notified AC is present.
Change the value to 150ms.

BUG=none
BRANCH=glados
TEST=In Kunimitsu system, plug in Zinger and capture timestamp when EC
receive AC_PRESENT interrupt, it's reduced by ~1.2s.

Change-Id: I2b027eef816949527138f7b8b53d5408fc823093
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/326844
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-09 19:51:00 -08:00
Kyoung Kim
d790358250 Kunimitsu: S0ix/S3 EC power improvement
USB2_OTG_ID and USB2_OTG_VBUSSENSE pins were floated due to open drain
configuration. Improve EC power and remove power difference between
S3 and S0ix. Improve EC power for SOC G3.

BRANCH=firmware-glados-7820.B
BUG=none
TEST=measure EC powers at S3/SOC-G3 and S0ix and check if there are
difference.

Change-Id: I6471a05a1f5f75b5c805e80190a3cc7ac96d7c3b
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/326901
Reviewed-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit 31bff74cff46bf80518cc269da304a1090cb7eea)
Reviewed-on: https://chromium-review.googlesource.com/326991
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
2016-02-09 19:50:58 -08:00
Vadim Bendebury
a766634323 cr50: integrate register definitions consistent with real silicon
The new register definitions file has been supplied, it is not
defining some fields which were present only in FPGA. Some tweaks are
required to accommodate this.

BRANCH=none
BUG=chrome-os-partner:50141
TEST=new code successfully boots on the evaluation board

Change-Id: Ie4158554e0aaf039d59669558861a763a23f0ceb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326803
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-09 01:26:06 -08:00
Vijay Hiremath
cb190ca868 charger: Settings for charger current in no battery condition
In case of no battery condition, current code sets the charger input
current to the charger maximum input current. To avoid damage to the
board, set the charger input current to the maximum current that the
board can support.

BUG=none
BRANCH=none
TEST=Manually tested on kunimitsu, removed the battery & then using EC
     console command 'charger', verified that the current value is set
     to 3000mA.

Change-Id: I94c40228a6362822c841a6e0c226bea0d3398b73
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/325522
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-08 20:25:19 -08:00
li feng
97c341cce5 kunimitsu: reduce PD log size
Before pd logging enabled, there is about 1320 bytes for
shared meory; after pd logging is enabled and reserved 512 bytes,
only around 780 bytes for shared memory. In shared_mem_acquire(),
we request 1024(ChUNK_SIZE) while 780 only available. This causes
hashing abort and could not boot to RW.

BUG=chrome-os-partner:50127
BRANCH=glados
TEST=In kunimitsu system, boot to RO and check available shared
memory is higher than 1024; system can soft sync, boot to RW.

Change-Id: Ic521a1eb95491cbe9351a800d6471449cbd7b084
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/326762
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-08 20:25:17 -08:00
Duncan Laurie
75142ba99a chell: Blink LED in S0iX
Blink the LED in S3 as well as S0iX states so there is no user visible
difference in their behavior.

BUG=chrome-os-partner:49274
BRANCH=glados
TEST=Enter S0iX on chell (need SKU4) and verify LED blinks.  Also verify
that the LED still blinks in S3.

Change-Id: I91b123de17787159f4e7d6aca2e86b80885b8f4e
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326740
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-08 17:07:37 -08:00
nagendra modadugu
7ac69e594b CR50: Add initial elliptic curve crypto implementation.
This change adds support for NIST-P256 curve operations.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=new tests under test/tpm2/ pass.

Change-Id: I03a35ff3ab8af3c52282d882937880bfa2bdcd32
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/324540
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-02-08 15:24:29 -08:00
Mary Ruthven
89424bfbed fmap: note fmap_name dependency
fmap_decode now checks the fmap name to determine if the fmap it is
decoding is the correct one. This change puts a comment in the ec fmap
header to note the use.

BUG=none
BRANCH=none
TEST=make buildall -j
CQ-DEPEND=CL:322262

Change-Id: Icdd56eef5474b51cb178b6ba37c530c2357341b2
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326450
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-02-08 13:47:49 -08:00
nagendra modadugu
e68019e349 CR50: enable the bignum library to handle word un-aligned keys
The TPM2 api does not require keys to be word-aligned,
so have the compiler generate alignment-safe reads where
necessary.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpm2/ pass, more TCG tests pass.

Change-Id: I247e29f2bec139ab7ed4010ffb58cdae77ba9e0b
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/326201
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-02-08 13:47:49 -08:00
Scott
cb663d93a2 Plankton: Added support for normal dualrole operation
Added a 'drp' option to the console command usbc_action that is
used to toggle dualrole mode operation on and off. The default
Plankton operation is not affected as this control is initialized
to be disabled. When dualrole mode is enabled, then both CC lines
are used and monitored.

BRANCH=none
BUG=chrome-os-partner:50074
TEST=Manual
Tested Plankton connected to Samus. Verified that when dualrole mode
is enabled that it can connect as both SRC and SNK. Tested with Type C
cable initially connected and disconnected. In addition, verified that
power role swaps behave correctly, and that when disabled, default
Plankton operation is resumed.

Change-Id: I60adfa25844a01a50ba45d5d92e17a3318f3e0a0
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/325545
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-08 12:09:08 -08:00
Vadim Bendebury
c17c447a25 cr50: provide plumbing for prod mode RO signing
Creating bootloader for the chip involves signing the image with an
'air gap' - some physical presence action is required. We don't want
this to be required when the builder is building cr50 for test
purposes.

The solution is to keep using the dummy private key when building by
default, and invoking make differently when building an image which
would be accepted by the hardware.

Setting CR50_RO_KEY variable in the environment or in the make command
line will cause the signer use the value of this variable as the name
of the file containing the key to use for signing the RO image.

Should this file be a public key, the signer will stop and look for a
fob containing the matching private key, and will stream the RO image
through the fob for signing.

Using the fob requires that the signer runs under sudo, but we do not
want the generated files to belong to root, some more code is added to
change the generated files' ownership to user running the make.

BRANCH=none
BUG=chrome-os-partner:49950
TEST=ran the following tests:
 - verified that the build still succeeds by default.

 - invoked make as follows:

   CR50_RO_KEY=cr50_rom0-dev-blsign.pem.pub  make BOARD=cr50

  observed the signer stop to wait for the user to interact with the
  USB fob and proceed. Made sure that the generated image runs
  successfully on the evaluation board.

 - verified that 'make BOARD=cr50 clean' still works (i.e. none of the
   generated files is owned by root).

Change-Id: I733ec6386c1dfd838d83d22fb589fa64e5eeaced
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:06 -08:00
Vadim Bendebury
d6c6dc5150 cr50: signer: pick up latest and greatest
These are relevant changes in the FPGA tree since the most recent sync
up.

BRANCH=none
BUG=chrome-os-partner:50141
TEST=image signed by the new signer boots successfully.

Change-Id: Id30c5da614aa5c2496305f9687bce06030449beb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326483
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:06 -08:00
Vadim Bendebury
c1117fb707 cr50: no need to check for USB inclusion
With transitioning to silicon there is no need to check if the
hardware includes USB subsystem or not.

BRANCH=none
BUG=chrome-os-partner:50141
TEST=the cr50 image successfully boots to the ec prompt

Change-Id: I593205cf307e0fce5e74ea695ed1cf5bfea8fde4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326482
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:05 -08:00
Vadim Bendebury
ce52342554 cr50: add public key for RO verification
This key matches the private key used by the chip's rom to verify the
first stage user firmware.

By virtue of the fact that this is a public key, the signer, in case
this key is used, will look for a fob storing the matching private key
to sign the read-only portion of the image.

BRANCH=none
BUG=chrome-os-partner:49950
TEST=none yet

Change-Id: I0c55d5250a354eae8294560ef7b442fee6445b4f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326481
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:05 -08:00
Aseda Aboagye
cef39847f4 flash_ec: Disconnect EC-3PO interps when flashing.
Since the stm32 MCUs are programmed over the UART, we need to make
some changes to allow the interpreter to stop listening to the UART
PTY when flash_ec needs those PTYs.  Otherwise, the EC-3PO interpreter
will interfere with the programming and cause the flash to fail every
time.

BUG=chromium:571170
BRANCH=None
TEST=Use flash_ec to program both veyron_jerry and samus_pd with no
interruptions.
TEST=Use flash_ec to program veyron_jerry without servod changes with
no interruptions.

CQ-DEPEND=CL:321084
CQ-DEPEND=CL:318900

Change-Id: I350fdb708d30c4ec6f18e5dc4abd621370522381
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/320629
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-02-06 17:28:00 -08:00
Mulin Chao
f700e3bb0e nuc: Add support for CONFIG_LOW_POWER_S0.
To get better power consumption in S0, we add FW support for
CONFIG_LOW_POWER_S0.

Before entering deep idle in S0, we must enable Host interrupt to wake up
EC if it needs to service LPC bus.

This version also add a new bit of sleep_mask (SLEEP_MASK_FAN) in system.h
to prevent EC enter deep idle if fan's duty isn't zero. Normally, the freq of
PWM fan is 25 kHz. It means we must select apb2 clock as the source clock of
PWM fan. Or fan would stop when ec enters deep idle because of no PWM signal.

In hwtimer.c, we reset the preload counter to maximum value in ITEI32's ISR
since preload counter is changed by __hw_clock_source_set all the time.
We also found there're no event set if it's deadline is over 32 bits but
current source clock isn't. To prevent ec doesn't wake-up in deep-idle even if
ITIM32 expires, FW set an event for ITIM32 after process_timers().

Modified sources:
1. wheatley/board.h: Add CONFIG_LOW_POWER_S0 definition.
2. clock.c: Enable Host interrupt for LPC.
3. clock.c: Disable LP_WK_CTL for better power consumption.
4. gpio.c: Add ISR for Host interrupt.
5. uart.c: Introduce bit 6 of USTAT to make sure transmitting is completed.
6. register.h: Add uart_clear_pending_wakeup function.
7. hwtimer.c: Fixed watchdog issue when ITIM32 is closed to overflow.
8. fan.c: Enable deep sleep if duty cycle is zero.
9. include/system.h: Add SLEEP_MASK_FAN for fan control loop.
10. core/cortex-m/task.c: Add "isb" to flash the garbage data in the
    instruction pipeline.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: Ibe3630d0d68cf3f32206adb2afa1b5958916a2be
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/324651
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-06 01:57:58 -08:00
Luigi Semenzato
4ec554dd8f ectool: add inject-keys.py
A simple wrapper for "ectool kbpress" to do basic automation
when working remotely (for instance, logging in).

Includes a test script.

BUG=b:26349756
TEST=ran on platform in various ways
BRANCH=none
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>

Change-Id: I96fdd99aa228b51cf22f9323facdc4ddb59db9ff
Reviewed-on: https://chromium-review.googlesource.com/322286
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-05 06:02:49 -08:00
nagendra modadugu
c68e5a7c9b CR50: Add initialization code required by TPM2 compliance tests.
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524,chrome-os-partner:50115
TEST=initial TPM2 tests pass

Change-Id: Ie614f29e578fb177245c33e6d1a896534a8d6095
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/326180
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-02-05 06:02:46 -08:00
Mulin Chao
ff52ac20c1 common: Fix sleep mask for multi-port lock.
This change use a simple counter to to prevent ec enter sleep if there's
any i2c port active. Once there's no i2c port active, we enable sleep bit of
i2c in i2c_lock() func. Please note FW disables interrupt during changing
counter to prevent preemptive conditions.

Modified sources:
1. common/i2c.c: Fix sleep mask for multi-port lock.

BUG=crbug.com/537759
TEST=make buildall -j; test on wheatley when CONFIG_LOW_POWER_S0 is deifned.
BRANCH=none

Change-Id: I17c226108fee0e5d656fa157808179898f9a8dbf
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/325256
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-04 19:15:06 -08:00
Nadim Taha
1b9e6b2375 Cr50: Modified the flash driver to retry operations as appropriate.
The max retry counts are based on the TSMC specification. This is a necessary
change given that we're using their smart program/erase algorithms.

BRANCH=none
BUG=chrome-os-partner:45366
TEST=Tested RW updates.

Change-Id: I18ca09e54ce13f2cf75dac32fb2457d5963ca040
Signed-off-by: Nadim Taha <ntaha@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/325535
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-04 20:56:10 +00:00
li feng
00fbe2a0aa kunimitus: add VCONN swap ability
BUG=none
BRANCH=glados
TEST=make -j buildall

Change-Id: Ifa4273acbeab8b8463eddae2d9dde9c158f337a3
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/325529
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-03 21:34:56 -08:00
Shawn Nematbakhsh
c5e0634054 cleanup: Fix signed vs unsigned typing
- ec_response_thermal_get_threshold.value is unsigned, so it can not be
  less than zero.
- make power_button_wait_for_release() take a signed int, to match its
  existing usage.

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

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie5748df3d9904d1e417adc38fee18f8cb3ce9750
Reviewed-on: https://chromium-review.googlesource.com/325840
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 21:34:47 -08:00
Aseda Aboagye
086e501be3 util: ec3po: Add OOBM queue and dynamic loglevels.
This commit adds an Out Of Band Managament queue which will allow the
console to receive commands outside of the PTY which it can take
action on.  The first use of this is to dynamically change the logging
level.  Prior to this change, changing the log level using dut-control
would not affect the log level of the console or interpreter.

BUG=None
BRANCH=None
TEST=Launch modified servod; issue dut-control loglevel:debug, verify
that debug messages from both servod and ec3po are emitted.  Then
issue dut-control loglevel:info and verify that no debug messages from
either are emitted.

Change-Id: I692824742b018da9540a81305985f6f355f716e6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325134
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 17:16:33 -08:00
Anton Staaf
f6f06c95d6 NPCX: Move control of PD GPIO hibernation state to board
Use board_set_gpio_hibernate_state to configure the PD GPIO's to support
charging while hibernating.

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

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

Change-Id: I7b960967670c07f4861a59345bc23c97d3f61cc0
Reviewed-on: https://chromium-review.googlesource.com/325443
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-02-03 17:16:31 -08:00
Stefan Reinauer
bc404c94b4 Enforce compilation without system headers
This patch introduces HOST_CPPFLAGS to be used for all
objects being compiled with HOSTCC rather then the target
compiler.

Since glibc is not linked into the EC, no glibc include files
should be included in the EC code base. Hence, create local
definitions for clock_t and wchar_t that match what the glibc
include would have done, and remove some unneeded includes.

Due to very eager optimization, we have to give gcc a little
notch to not kick out memset.

Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
BUG=chrome-os-partner:43025
BUG=chrome-os-partner:49517
BRANCH=none
TEST=compile tested

Change-Id: Idf3a2881fa8352756b0927b09c6a97473358f239
Reviewed-on: https://chromium-review.googlesource.com/322435
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-02-03 15:00:50 -08:00
Bruce
fc9ed52397 Chell: Setting battery charging maximum value of temperature
Setting battery charging maximum value of temperature.
If battery temperture is over than 45 degree, set charge current to
0 mA, and charge state to idle. Then LED will turn to white in idle
state.

BUG=chrome-os-partner:49695
BRANCH=glados
TEST=check the battery will not charge when battery temperture is
over than 45 degree, and LED turn to white. Then temperture is less
than 45 degree, the battery will charge and LED turn to amber.

Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/323982
Reviewed-by: Shawn N <shawnn@chromium.org>
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
(cherry picked from commit 4994d85d3b6c589e3ac297697aeb36456f2401a6)
Change-Id: Ic7d3fe0c482fab76041c5ae3f35402e529576b1c
Reviewed-on: https://chromium-review.googlesource.com/325487
2016-02-03 15:00:45 -08:00
Aseda Aboagye
8d3fe8d54d util: ec3po: Change console permissions to 660.
666 gives out permissions to everyone and should be avoided.  A
similar change is made in servod.

BUG=None
BRANCH=None
TEST=Run console.py and verify that the created PTY has the
permissions of 660.

Change-Id: Ib58952af5f9681fdc2ef351b2c2ac2ec10109095
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325493
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 15:00:19 -08:00
nagendra modadugu
dfb7901709 CR50: fix unaligned memory accesses in dcrypto/aes.
BRANCH=none
TEST=new tests under test/tpm2/ pass.
BUG=chrome-os-partner:43025,chrome-os-partner:47524

Change-Id: Ibfc92eae8238954a861a8e91432f90db6d174ead
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325495
Commit-Ready: Vadim Bendebury <vbendeb@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
2016-02-03 14:59:36 -08:00
Todd Broch
1ca9536835 kunimitsu: lars: enable USB PD logging.
Enable USB PD logging.

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

BUG=chrome-os-partner:45933
BRANCH=none
TEST=make -j buildall
make -j BOARD=kunimitsu tests

Change-Id: I05f80712e2efe59a3a3cdf333885b111cc79953b
Reviewed-on: https://chromium-review.googlesource.com/325380
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-03 14:59:36 -08:00
nagendra modadugu
18197b8034 CR50: fix incomplete hash state initialization.
The hashAlg field is expected to be populated
by _cpri__StartHash.

BRANCH=none
TEST=new tests under test/tpm2/ pass.
BUG=chrome-os-partner:43025,chrome-os-partner:47524

Change-Id: I237183c916fa800a82853aee8def7d734f53d6e9
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325386
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
2016-02-02 23:48:49 -08:00
Vijay Hiremath
33fe5e437d charger/Kunimitsu: Fix for boot from cut-off battery
Battery in cut-off mode wakes when voltage is applied to the PACK
and takes approximately 2 to 3 seconds to initialize before capable
of providing the power. Hence made the battery present status to
BP_NO in case of cut-off mode. Once the battery is ready new status
is updated as BP_YES.
When the battery status changes from BP_NO to BP_YES, charger input
current is set to board specific charger input current which is not
sufficient to boot the AP hence the system reboots. To avoid this
issue, added code to write charger manager negotiated current to
charger input current when the battery status changes from BP_NO to
BP_YES.

BRANCH=none
BUG=chrome-os-partner:49224
TEST=Manually tested on Kunimitsu.
     Used console command 'cutoff' to put the battery in cut-off mode.
     Inserted the adopter to wake the system, system doesn't reboot &
     the battery charges.

Change-Id: Ia5a1457506b4bef0b3dd27993e4b60ae64c8f746
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/322430
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-02 23:48:33 -08:00
CHLin
0c50cae42e nuc: Reduce the period of watchdog check timer
There is probability to fail in firmware_ECWatchdog FAFT test by using
CONFIG_WATCHDOG_PERIOD_MS period for check timer. Use
CONFIG_AUX_TIMER_PERIOD_MS instead can fix it.

Modified drivers:
1. watchdog.c: change watchdog check timer period from
CONFIG_WATCHDOG_PERIOD_MS to CONFIG_AUX_TIMER_PERIOD_MS.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I93e700968751ecd58f032c2f5866cf4f2eb0ffe4
Signed-off-by: CHLin <chlin56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/324712
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-02 23:48:28 -08:00
nagendra modadugu
83b9a7ea70 CR50: define EMBEDDED_MODE=1 for code under cr50.
EMBEDDED_MODE was missing from code compiled under
cr50/tpm2, which resulted in code under third_party/tpm2
and cr50/tpm2 inferring differing declarations for
a given type.

BRANCH=none
TEST=tests under test/tpm2 pass
BUG=chrome-os-partner:43025,chrome-os-partner:47524

Change-Id: I56935f5ae8fc45e6b7f71eb239b3e0c325086795
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325471
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
2016-02-02 23:48:11 -08:00
Shawn Nematbakhsh
990ca7a1bc pd: Reinitialize state variables on TCPC reset
Resetting our state to default without also resetting the power role may
lead to a state / role mismatch.

BUG=chrome-os-partner:49563
TEST=Verify kunimitsu correctly detects charger at either polarity on
sysjump.
BRANCH=glados

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I239df9793773429e9b84a847e55d6753577fab32
Reviewed-on: https://chromium-review.googlesource.com/325385
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-02 23:48:04 -08:00
Vadim Bendebury
9abc13d25a cr50: signer should be a dependency for RW_B target too
The makefile is missing an explicit dependency which ensures that the
signer utility is available by the time the RW_B image is built. This
works most of the time, but once in a while RW_B gets ahead in the
race and the build fails.

Adding explicit dependency will prevent this from happening.

BRANCH=none
BUG=chromium:578761
TEST=make buildall -j still succeeds.

Change-Id: I7f5223f51e71b1d78de012bf5d934f1a17c86cc0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/325031
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2016-02-02 17:20:10 -08:00