Commit Graph

3041 Commits

Author SHA1 Message Date
Vadim Bendebury
e7ebdfeefc g: cr50: update INFO1 mask when corrupting the second image
The INFO1 mask field contents serves as input for the rollback
protection mechanism, when the RO decides if an RW is allowed to run
on the device.

The existing code updates INFO1 mask to match the lowest rollback
priority of the two images (RW_A and RW_B) present on the device.

INFO1 mask should be also updated when the current image is endorsed
by the host. In this case the alternative RW is destroyed, so the
INFO1 mask could be set based solely on the currently running image.

This patch refactors the code to allow setting INFO1 mask based on one
or both RW headers' contents.

BRANCH=cr50
BUG=b:62138152

TEST=verified that "normal" INFO1 mask updates still work as before,
     the mask is modified to match the image with the lowest rollback
     priority.

     Also verified that when the VENDOR_CC_INVALIDATE_INACTIVE_RW
     command is received the INFO1 mask is updated based on the
     currently running image.

Change-Id: I23172388674e1f3a4c2489e139dd197a84029f54
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/541738
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-21 18:48:05 -07:00
Divagar Mohandass
9fb10386a7 Poppy: Configure camera PMIC to low power mode.
This change will configure camera PMIC to low power mode
in S3 and S0ix sleep state and resumes it in S0 state.

BUG=b:62779726
BRANCH=None
TEST=`Build/Flash EC and verify the PP3300_DX_CAM signal is
toggling during S3/S0ix cycle.`

Change-Id: I9f376762100ac9b208df4a39160e4acd3b7b925e
Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/539316
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-21 04:19:06 -07:00
Caveh Jalali
053cb4bb24 ps8751: assert reset for at least 1ms.
the 1ms reset hold time isn't in the ps8751 datasheets (yet), but
that's what our parade support contact recommended.  i'm applying this
fix to reef (electro) and coral as these two boards were missing any
sort of reset hold time.  other boards using the ps8751 seem to
already have a 1ms or 10ms delay.

TEST=rebuilt, reload EC image on electro... no ill effects noted.

BUG=b:62642003
BRANCH=reef

Change-Id: I39a989375e789118d062f82e9baaa041e5e6b033
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/540742
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-20 17:24:17 -07:00
Nicolas Boichat
1442cbdebb hammer: Adjust trackpad dimensions
BRANCH=none
BUG=b:35582031
TEST=Flash and boot hammer, no more trackpad dimension mismatch error.

Change-Id: If4bd9db456617a52d1890543e7cae34a563122dd
Reviewed-on: https://chromium-review.googlesource.com/523502
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-19 21:03:33 -07:00
Daisuke Nojiri
5ce3d32538 Fizz: Verify and jump to RW image
BUG=b:37316498
BRANCH=none
TEST=Boot Fizz

Change-Id: Iaceb64bcf5d54145c26e86ce62a14d5732a22e78
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/517406
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-19 21:03:30 -07:00
Daisuke Nojiri
627f3a8ac2 KBL/SKL: Add wait between DSW_PWROK and PWRBTN
This patch adds wait between DSW_PWROK and PWRBTN assert. It is
required to be 95 msec or longer for Kaby Lake and Sky Lake.
Refer to the timing diagram for G3 to S0 on Sky Lake or Kaby Lake
platform design guide for details.

BUG=b:62584658
BRANCH=none
TEST=On Fizz, measured time between DSW_PWROK high and PWRBTN assert
for 1:AC plug-in, 2:recovery+power press, 3: reboot ec command.

Change-Id: I89a14ac9a49e20a332bd662d90be62f8ea23b003
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/534901
2017-06-19 21:03:29 -07:00
Vadim Bendebury
12fd77967f cr50: handle board ID mismatch gracefully
If Cr50 happens to start on a chip where Board ID programmed in INFO1
does not match the contents of the RW header, it means that for some
reason the other RW is not operational and the current image is the
only viable one.

In this case the Cr50 starts but operates in limited mode (only
commands for updating the image and reporting state are handled). In
this case the reason for recovery could be seen on the Recovery
screen, and the update could be done once Chrome OS boots in recovery
mode.

BRANCH=none
BUG=b:35586335
TEST=verified the following:
  - if an image with wrong board ID is started, it tries to fall back
    (sets the counter to a value above threshold and reboots)

  - if the fallback fails, the image keeps running in the limited
    capabilities mode but the update is possible, observed that the
    new image took over worked after powercycling the device.

  - observed proper error message on the recovery screen showing where
    the error comes from

Change-Id: I46ba75392f8e891bb8503fb15aea2c56b5805e83
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/535978
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-16 21:10:54 -07:00
Nick Sanders
fd528684dd mn50: fix usb_update
Add support for update related vendor commands in mn50 by relocating
relevant code from board/cr50 to chip/g.

BUG=b:36910757
BRANCH=None
TEST=./extra/usb_updater/usb_updater -d 18d1:502a build/mn50/ec.bin

Change-Id: Iec0fe5585b5b6eb099f9254dfb0e5b02d5106abc
Reviewed-on: https://chromium-review.googlesource.com/537999
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-06-16 17:24:28 -07:00
Scott Collyer
28167cbc26 eve: Make sure both LEDs are updated when charger is connected
When an external charger is connected, only the LED on the side the
charger is connected should be on, the other side should be off. The
existing LED behavior was incorrect in that only the side that was
charging was being updated and the other side would remain in its
previous state.

This CL adds a fix so that if only one LED is being controlled, the
other side is always turned off. In addition, the logic for double tap
events was changed slightly so that if a double tap event is in
progress and a charger is connected, the new state will be updated as
soon as the charge state is changed instead of waiting for the double
tap event to complete.

BUG=b:62481906
BRANCH=eve
TEST=Manual With battery level < 15% so that both LEDs are red when
the charger isn't connected, connect charger and verified that the LED
on the side the charger is connected turns white and the LED on the
other side turns off.

Change-Id: I7462629409496383adb43445e732dd6ca2f9f589
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/537960
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-06-16 17:24:27 -07:00
Shawn Nematbakhsh
89b8ff1cba cleanup: motion_sense: Remove driver data structure externs
Driver data structs are now accessed through the drv_data pointer.

BUG=chromium:733352
BRANCH=None
TEST=`make buildall -j`

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I8fedb425708a08ae6900ade6f17967fe2bc75ebf
Reviewed-on: https://chromium-review.googlesource.com/537217
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-15 23:54:00 -07:00
Vadim Bendebury
c54375df26 cr50: check for board ID match at startup
When starting up the Cr50 should check if this image is supposed to
run on a chip with the board ID value read from INFO1.

If it is not supposed to run on this chip, and there is no rollback
counter overflow, set the rollback counter to a value which will
trigger a rollback and reboot.

If rollback counter has already exceeded the threshold - set a flag
indicating that the image is running in the "mismatch" mode and
continue.

BRANCH=cr50
BUG=b:35586335
TEST=with the rest of the patches applied verified both falling back
      to an older image and continuing running with the flag set if
      rollback is not possible.

Change-Id: I58d97de61dc446aaf1dd06b6e2b6bb426c14a172
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/535977
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-15 20:13:51 -07:00
Furquan Shaikh
94a9cfc02f eve/fizz/poppy: Enable panic backup/restore
BUG=b:62076222
BRANCH=None
TEST=make -j buildall

Change-Id: Id1482cc959233b41b0d917e8650866651d9a61fe
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/530137
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-15 17:27:53 -07:00
Shawn Nematbakhsh
520f1aff77 coral: Remove unused / unassigned variables
Defects reported by Coverity.

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

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I083ef9e499076f7009717ccbe0a3ab0a055e1bed
Reviewed-on: https://chromium-review.googlesource.com/535836
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-06-15 15:17:15 -07:00
Shamile Khan
fcf7edff8c poppy: Enable ship mode on rev1.
rev1 (Soraka) was using proto settings. Instead use the settings described
in fuel gauge specification.

BRANCH=none
BUG=b:62552007
TEST=On soraka, check that the system goes to ship mode and no error
     messages appear, using "ectool batterycutoff" from OS or "cutoff"
     from EC console.

Change-Id: I04e6b08265d20395d13e28e93cb14c1d49b376df
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/531736
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-15 15:17:14 -07:00
Nicolas Boichat
a9364ca5d4 hammer: Add support for base pairing
x25519 requires quite a bit more stack size (1696/2048), so
increase its size.

BRANCH=none
BUG=b:38486828
TEST=Flash hammer, ./usb_updater2 -c always reports the same
     device public key, and authenticator is correct.

Change-Id: I51dff9f10167d654561ef7f199b9b9206511b7e9
Reviewed-on: https://chromium-review.googlesource.com/532476
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-15 09:37:57 -07:00
Furquan Shaikh
c860bc15c5 poppy: Add LED support for sysrq debug mode
BUG=b:37970194,b:36394093
BRANCH=None
TEST=Verified that LED blinks when in debug mode and stops blinking on
exit from debug mode.

Change-Id: I536d0eeffdc59bef940ea1f0f01d7c595320d9c4
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/529766
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-15 04:39:31 -07:00
Nicolas Boichat
43391ca415 poppy: Increase base debounce time to 20ms
From our testing, 5ms seems a little short: 20ms is probably better.

BRANCH=none
BUG=b:62393957
BUG=b:35586668
TEST=Test that base is always detected.

Change-Id: I8d0041fc387568cfa0983584ca1d68711c70d9cf
Reviewed-on: https://chromium-review.googlesource.com/535214
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-14 01:19:31 -07:00
Philip Chen
9f37e4a655 scarlet: Turn on CONFIG_TABLET_MODE_SWITCH
BUG=b:62594071
BRANCH=scarlet
TEST=boot scarlet and confirm it's in tablet mode

Change-Id: I85cc53bb66d70acc9f5c77bd7c428447159dabb0
Reviewed-on: https://chromium-review.googlesource.com/534937
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2017-06-13 23:30:11 -07:00
Vadim Bendebury
68079d94a6 g: show RW headers' Board ID fields in 'version' output
The contents of the board ID fields of the Cr50 image headers is an
important piece of information which determines if an image can run on
a particular H1 chip.

This patch adds this information to the output of the 'version'
command, printing both the contents of the fields of the RW images and
if the image would run with the current INFO1 board ID contents (Yes
or NO).

The board_id feature is in fact g chipset specific, this is why
board_id support files are being moved from the cr50 board scope to
the g chip scope.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=observed expected output in the version command:
  > bid
  Board ID: 000000fa, flags 000000ff
  > vers
  Chip:    g cr50 B2-C
  Board:   0
  RO_A:  * 0.0.10/29d77172
  RO_B:    0.0.10/c2a3f8f9
  RW_A:  * 0.0.20/DBG/cr50_v1.1.6542-856c3aff4
  RW_B:    0.0.20/DBG/cr50_v1.1.6543-2c68a2630+
  BID A:   00000000:00000000:00000000 Yes
  BID B:   000000ea:0000fffc:000000ff  No
  Build:   0.0.20/DBG/cr50_v1.1.6542-856c3aff4
           tpm2:v0.0.289-cb2de5a
           cryptoc:v0.0.8-6283eee
           2017-06-09 15:34:19 vbendeb@eskimo.mtv.corp.google.com
  >

Change-Id: I5b283abf304a7408ca8f424407044fca238185e1
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/530033
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-13 21:23:59 -07:00
Puthikorn Voravootivat
01213a574f eve: Lower VCCIO from 975 to 850 mV
BUG=b:62413556, b:62465979
BRANCH=none
TEST=power consumption is lower

Change-Id: I573ba2c68b97389a51a2524184a44c49e0eb692d
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/528525
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-13 21:23:56 -07:00
Nicolas Boichat
d5bb8390a8 hammer: Use unique board ID to generate USB serial number
BRANCH=none
BUG=b:62280271
TEST=Flash hammer
     lsusb -d 18d1:5022 -v -v | grep iSerial
     shows different chip IDs on different boards.

Change-Id: I249967df133a8aa8a2b5c570fb940dd03fae4169
Reviewed-on: https://chromium-review.googlesource.com/523046
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-13 21:23:56 -07:00
Scott Collyer
2cb6448035 coral: Remove support for magnetometer and barometer sensors
Since Reef was the starting point for /board/coral, coral inherited
support for both the BMI150 magnetometer and BMI280 barometer
sensors. Coral does not need to support either of these sensors.

This CL removes support for both of these sensors.

BUG=b:62519010
BRANCH=none
TEST=Manual Run 'make BOARD=coral' and verify it builds. Used
accelinfo EC console command to verify that other sensor readings are
working. My test setup does not have ALS sensor so couldn't confirm
that operation.

Change-Id: I75abe2f10c8f0ff318f4795e6b88c9aff3d8a9ad
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/530448
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-06-13 15:12:35 -07:00
Nicolas Boichat
9ebcc894be test/entropy: Add host test and compute entropy
Check that added entropy is at least somewhat acceptable.

BRANCH=none
BUG=b:38486828
TEST=make BOARD=hammer -j tests
     ./util/flash_ec --board=hammer --image=build/hammer/test-entropy.bin
     EC console: runtest, get around 4000/1000 (=4) bits of entropy, value
     matches (roughly) the value obtained using the awk script.
TEST=make run-entropy

Change-Id: I88d0e9ec0e38ab3ec70d3e8163b8ac1556df978d
Reviewed-on: https://chromium-review.googlesource.com/523482
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-13 05:23:33 -07:00
Scott Collyer
3423baba30 coral: Update board version table to account for 16 levels
Coral has 16 voltage levels utilized for board ID. Compared to 8 for
Reef. This CL updates the board_version table to account for 16 board
version entries. In addition, insted of using a fixed error percentage
upper error bar, the table entries have been set to be the mid point
between two consecutive voltage levels.

MOdified the existing board_get_version() function so that it calls a
common function since this needs to be repeated for both board ID and
board SKUs. Modified gpio enable signal name to match the
schematic. Coral uses an active high enable.

Added an EC console command with options id|sku0|sku1 to test each
option. This CL does not include the function which will be used with
the host command interface so the AP can retrieve the sku 0|1 values.

BUG=b:62519010
BRANCH=none
TEST=MANUAL
Using the console command board_id shows the following:
> board_id
Wrong number of params
Usage: board_id <id | sku0 | sku1>
> board_id id
[44.484516 ID/SKU ADC 2 = 123 mV]
Board id|sku: chan 2 = 0
> board_id sku0
[56.850566 ID/SKU ADC 4 = 123 mV]
Board id|sku: chan 4 = 0
> board_id sku1
[65.547598 ID/SKU ADC 3 = 123 mV]
Board id|sku: chan 3 = 0

Change-Id: Iaba146c12c6d9d2c57973569d51c1b7ad3212455
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/530907
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-06-12 12:30:35 -07:00
Nicolas Boichat
32d883ff53 poppy: Add 4th board id strap, with ternary encoding
The first 3 board id straps stay binary, and the 4th is a tristate,
set as Z on all existing boards, so we translate Z=>0, 0=>1, 1=>2.

A few examples:
Z000 => rev0  (Z=>0 * 8 + 0b000 = 0)
Z010 => rev2  (Z=>0 * 8 + 0b010 = 2)
Z111 => rev7  (Z=>0 * 8 + 0b111 = 7)
0000 => rev8  (0=>1 * 8 + 0b000 = 8)
1001 => rev17 (1=>2 * 8 + 0b001 = 17)

BRANCH=none
BUG=b:62242438
TEST=make BOARD=poppy -j, flash, rev0/1/2 shows "Board ID" correctly.

Change-Id: Ifde5e1200b19a17a677875b0464775bd1cd8af1f
Reviewed-on: https://chromium-review.googlesource.com/522083
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-11 23:17:19 -07:00
Nicolas Boichat
3a8bba3bc3 gpio: Move gpio_get_ternary to common gpio functions
Also, convert from usleep to udelay, as the calling site may not
necessarily be in task context.

BRANCH=none
BUG=b:62242438
TEST=make buildall -j

Change-Id: I9f36f0de4259716a92183b28324c90d974a96239
Reviewed-on: https://chromium-review.googlesource.com/530884
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-11 23:17:19 -07:00
Furquan Shaikh
cabd486cb2 poppy: Implement workaround for broken reset flags
Boards Rev1 and Rev2 will lose VBAT on power cycle and therefore
cannot successfully save the reset flag state.

Implement workaround that will allow these boards to continue to
work for FAFT testing by indicating to the skylake chipset power code
that it should skip the PMIC reset when doing 'reboot ap-off'.

BUG=b:62504451
BRANCH=None
TEST=Verified that "reboot ap-off" works fine on Rev1.

Change-Id: I97ee346c0e8796375dc295cfa7a86cd0d57d4e4f
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/530515
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-11 08:30:17 -07:00
Dino Li
52c5b31c22 reef_it8320: make modifications to GPIO list
This patch makes a few changes to gpio.inc.

- When pre-initialize GPIOs, set default level to low:
  ENTERING_RW and USB2_OTG_VBUSSENSE.

- Disable internal pull-up (not necessary if
  output type is push-pull):
  USB_Cx_5V_EN.

- Set output type to open-drain:
  EN_USB_Cx_3A and USB_C0_CCx_VCONN_EN.
  The USB_C0_CCx_VCONN_EN is externally pulled up to PP3300_PD_A.
  The EN_USB_Cx_3A is pulled to EN_USB_Cx_5V_OUT and connected
  to base of BJT directly. The output current will be huge
  if it is set as push-pull.

BRANCH=none
BUG=none
TEST=1. built and booted on reef_it8320.
     2. plug-in a device on one port and add load current
        on vbus to check if current limit sit at 3A.

Change-Id: I71fec59cd1696fff417d9cddc287e993988aea33
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/528034
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-10 19:41:37 -07:00
Mulin Chao
a08d004e97 npcx: clock: Add support for external 32kHz crystal osc.
In this CL, we add selecting LFCLK sources functionality for npcx7 ec
series. (Please notice not all of npcx7 ec series support this feature.)
Beside internal LFCLK source, ec also can choose the external 32kHz
crystal oscillator as LFCLK source for the specific application. We also
introduce a new definition, CONFIG_CLOCK_SRC_EXTERNAL, to switch this
feature in the board level driver.

This CL also adds:
1. LFCG register definitions in registers.h.
2. Change the order of each npcx modules by memory address.

BRANCH=none
BUG=none
TEST=Output LFCLK source through GPIO75. Compare with external 32kHz
crystal osc. on npcx7_evb and make sure the sources are the same.

Change-Id: I137146bf51ccb51266b9aac1e2e28bcea87dc4f5
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/520745
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-09 21:44:06 -07:00
Nicolas Boichat
14a3a3ac23 poppy: Adjust lid reference matrix
BRANCH=none
BUG=b:62396794
TEST=With this change, display rotates correctly when screen is rotated.

Change-Id: I0dc2cd88ed36deef73c7e6d4d458e546fa0b254d
Reviewed-on: https://chromium-review.googlesource.com/526754
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-09 15:33:41 -07:00
Nicolas Boichat
2a783457a9 poppy: Enable vbus discharge using PD discharge registers
poppy uses an ISL charger, which, unlike bd9995* charger based
systems, cannot provide an interrupt when VBUS falls below/rises
above a certain threshold.

On poppy rev2 onwards, we have a precise VBUS detection pin coming
from BC1.2 detection chip (PI3USB9281C), we a threshold between
3.1-3.7 V (3.5V typical) so we can use that to
enable discharge, according to this logic:
- When VBUS voltage falls below ~3.5V, and we're not sourcing 5V
  to the port, enable discharge.
- When VBUS voltage rises above ~3.5V, disable discharge.
- When we source 5V to the port, disable discharge.

BRANCH=none
BUG=b:37525769
TEST=Charge out to device (Galaxy S8), and verify that VBUS
     drops to 0.8V much faster than without this patch.
TEST=pd 0 swap power: 28ms (vs 496ms)
TEST=pd 1 swap power: 24ms to 0.875v, 202ms to 0.8v (vs 410ms)
TEST=Disconnect cable (port 0): 65ms (vs 721ms)
TEST=Disconnect cable (port 1): 13ms (vs 515ms)

Change-Id: Ibf2dcf5de31514fa0ce0ebd0c6db53d421a586fe
Reviewed-on: https://chromium-review.googlesource.com/481562
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-09 09:16:29 -07:00
Nick Sanders
f40e79b3f1 servo_v4: enable usb port by default
Set the USB mux and power enable to default to route
the USB3 port to the DUT and enable VBUS.

BUG=b:38391443
BRANCH=None
TEST=ensure that blue port works on power on.

Change-Id: Ie46e422bc083e435379470132159df32f6d644d3
Reviewed-on: https://chromium-review.googlesource.com/527992
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-08 23:20:01 -07:00
philipchen
9f48b9aa0c scarlet: support button triggered recovery mode
BUG=b:36902005, b:62307687
BRANCH=gru
TEST=press POWER+VOL-UP+VOL-DN,
and confirm Scarlet enters recovery mode

Change-Id: I32c352e9526746ea3ad6a8dd762d9f2525d21271
Reviewed-on: https://chromium-review.googlesource.com/468052
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524985
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 16:39:38 -07:00
philipchen
07c4c09b0b scarlet: modify power-on sequence
Merge PP900_USB_EN, PP900_PLL_EN, and PP900_PMU_EN.
Add a new config flag to enable different power-on sequences
on one SOC.

BUG=chrome-os-partner:62207, b:62307687
BRANCH=gru
TEST=build kevin/gru/scarlet

Change-Id: Iec3082384aa321636c59169b2bc55f773463f3d0
Reviewed-on: https://chromium-review.googlesource.com/434158
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524979
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 16:39:37 -07:00
philipchen
62df2b1b8a scarlet: change sensor parameters
Follow-up change for CL:431878

BUG=chrome-os-partner:62207, b:62307687
BRANCH=gru
TEST=make BOARD=scarlet

Change-Id: If5d9c4416f01a0428a7a08dc556dc37f1051b417
Reviewed-on: https://chromium-review.googlesource.com/433222
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524978
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 16:39:37 -07:00
Alexandru M Stan
ac56c1a03d scarlet: fix power button when in S5
Enable CONFIG_POWER_BUTTON_IGNORE_LID to make the "if (!lid_is_open())
return 0" section in raw_power_button_pressed() happy.

BUG=b:35917607, b:62307687
TEST=On scarlet, "apshutdown", confirm it's off ("powerinfo" says G3)
Press the power button, note it turning on (ec console should have
lots of spew)
BRANCH=gru

Change-Id: Idf334776c611517531fdd5351f2efba0b472af86
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/449960
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524983
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
2017-06-08 06:39:44 -07:00
Alexandru M Stan
395cecc8e1 scarlet: Fix Z axis for accelerometer
The Z axis is a little trickier, it's not always obvious that it's backwards.
"ectool motionsense" should show +1g on Z when display is pointing up.

BRANCH=gru
BUG=b:62307687
CQ-DEPEND=CL:524982
TEST=Put display up, "ectool motionsense" shows a largeish
positive value on Z for sensor 0:
localhost ~ # ectool motionsense
Sensor 0: 428   504     17069

Change-Id: I39ee6d524ba907570c85bf9e2fe248e029561999
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/451692
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524984
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 06:39:44 -07:00
philipchen
46c2dbdffc scarlet: Bump hostcmd task stack size
My Scarlet crashed twice when I went to 'chrome://system'.
Meanwhile I saw this message on the ec console:
'Stack overflow in HOSTCMD task!'

Apparently we need something like this:
https://chromium-review.googlesource.com/#/c/446116/

BUG=b:62307687
BRANCH=gru
TEST=build and flash a Scarlet,
the device stay alive when going to 'chrome://system'

Change-Id: I9f16a2cf531abe6293f3fcdd9704d770c170cf16
Reviewed-on: https://chromium-review.googlesource.com/482571
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524986
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 06:39:43 -07:00
Shunqian Zheng
9c7b72b311 scarlet: update the base matrix of accelerometer
This fixs the scarlet display reversion when turning forward or
backward.

BRANCH=gru
BUG=b:62307687
TEST=check display orientation when turn forward/backward, left/right

Change-Id: I28f8eff6e3fb06a705ccb75c86d981f262546a1c
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/451166
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524982
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 04:48:28 -07:00
Jenny TC
30acb338db poppy: add detachbase and attachbase uart console commands
This patch adds two commands to simulate detachbase and
attachbase uart console commands to test & debug automation.

BRANCH=none
BUG=b:37223093
TEST=attach or detach base and check if event is generated

Change-Id: Ie4a487ebd8929f0584da0b59c094f9d9aff13fb7
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/486521
Commit-Ready: Jenny Tc <jenny.tc@intel.corp-partner.google.com>
Tested-by: Jenny Tc <jenny.tc@intel.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-08 02:35:39 -07:00
Aseda Aboagye
cfcbe9da95 cr50: Enable EC UART bit banging.
Cr50 needs to be able to bit bang the EC UART in order to flash certain
ECs such as the STM32 family.  This is because the UART block on the
chip has no provision to change the parity which is necessary for the
STM32 bootloader protocol.

This commit adds a configuration to bit bang the EC UART. It's been
tested at 9600 baud.

BUG=b:35648297
BRANCH=cr50
TEST=With a logic analyzer, verify that TX to the EC can be bit banged
with no issues at 9600.
TEST=With some other changes, verify that cr50 is able to flash an EC
image to an STM32 EC.

Change-Id: Ice72aff133f268b5b7f0868aeec590a21404d1af
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/503474
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-06-07 23:45:31 -07:00
Philip Chen
cb31793924 scarlet: add LED behavior
Amber: charging
Green: fully charged
Red: battery error
Off: no power adapter connected

BUG=chrome-os-partner:62207, b:62307687
CQ-DEPEND=CL:524977
BRANCH=gru
TEST=manually on rev0 board

Change-Id: I4b1ee85ae65b221f7199bf6cc245668de23546a9
Reviewed-on: https://chromium-review.googlesource.com/442365
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524980
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-07 23:45:28 -07:00
philipchen
38288aee73 scarlet: remove USB-A control pins
No USB-A ports on Scarlet.

BUG=chrome-os-partner:62207, b:62307687
CQ-DEPEND=CL:524980
BRANCH=gru
TEST=make BOARD=scarlet
TEST=manually test on gru, USB-A ports don't work anymore.

Change-Id: If8a802067e942e8b73ee7f10285d0752b263727f
Reviewed-on: https://chromium-review.googlesource.com/434502
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524977
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-07 23:45:28 -07:00
philipchen
10c39db1e2 scarlet: add temperature sensor (tmp432)
BUG=chrome-os-partner:62207
BRANCH=gru
TEST=make BOARD=scarlet

Change-Id: I9e0d566b1994914325392d0f2fe6e141fa426a3c
Reviewed-on: https://chromium-review.googlesource.com/433841
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524976
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-07 19:01:03 -07:00
Duncan Laurie
e0b4a3d205 Revert "eve: Set VCCIO rail to 0.85 and disable low power"
This reverts commit 9565b8ba06.

Reason for revert: This is causing memory test failure under specific
reset conditions that is triggered by a specific FAFT test.

BUG=b:35581264
BRANCH=eve
TEST=pass FAFT test firmware_FwScreenPressPower

Original change's description:
> eve: Set VCCIO rail to 0.85 and disable low power
>
> Set the VCCIO rail to 0.85V where it should be for Y-series parts
> instead of forcing it to 1.0V.  The EDS is pretty clear that pushing
> this voltage higher on Y-series parts will have significant power penalty.
> (up to 250mW at 0.95V)
>
> We also don't want this rail dropping in low power mode, which shoudln't
> be happening as S0ix is disabled so SLP_S0 shouldn't assert, but just in
> case disable this as well.
>
> BUG=b:35587084
> BRANCH=eve
> TEST=stress testing on Eve EVT units
>
> Change-Id: I5535fe0d894f283a8d453d61101dfeb6b9287b7c
> Signed-off-by: Duncan Laurie <dlaurie@google.com>
> Reviewed-on: https://chromium-review.googlesource.com/525836
> Reviewed-by: Todd Broch <tbroch@chromium.org>

Change-Id: Ie60ad319421c00df5bf41b9eca03047a37defb88
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/527513
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-06-07 16:59:03 -07:00
philipchen
f490cb8bac scarlet: remove keyboard task/code
BUG=chrome-os-partner:62207
BRANCH=gru
TEST=make BOARD=scarlet

Change-Id: I5f89fd526e96d55ed3902af169de5fd14cb8c0c2
Reviewed-on: https://chromium-review.googlesource.com/433085
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524975
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-07 05:22:57 -07:00
philipchen
859a33ff46 scarlet: remove lid accel and add barometer
Remove lid accelerometer (kx022) driver and dependent code.
Add barometer (bmp280) driver.

BUG=chrome-os-partner:62207
BRANCH=gru
TEST=make BOARD=scarlet
TEST=manually test on gru

Change-Id: I521027b8877b9c45880090b9af736adc339edb2b
Reviewed-on: https://chromium-review.googlesource.com/431878
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524974
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-07 03:02:56 -07:00
Scott Collyer
16da7b4c8c coral: Modify battery_info struct for 3S + 1P style battery
Initial version of battery.c for coral is just a straight copy from
Reef. Updated this file to include the battery being used for the
first HW build. Removed the profile override config for the starting
point as well.

BUG=b:62272260
BRANCH=none
TEST=Run 'make BOARD=coral' and verify it builds. Can't test on actual
HW yet as the boards aren't build yet.

Change-Id: I15fcf438918c03bf1d459f5806dff04c82fe8b46
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/521756
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-06-06 19:32:29 -07:00
Gwendal Grignou
7719869dac board: Add support for nucleo-f411re
Add nucleo-f411re for testing STM32F411.
Fix registers.h to include F411 specific features.

TEST=Check uart,gpio works. Check BMI160 accel/gyro sensor works over
i2c
Install firmware with "make BOARD=nucleo-f411re flash"

BUG=b:38018926
BRANCH=none

Change-Id: I8514d1aa48e06708053e72f8d4be15738eda6cf4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/249994
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2017-06-06 17:09:28 -07:00
Philip Chen
aafff584ae scarlet: Adapt to the master branch
To port Scarlet from firmware-gru-8785.B to master, we need
some change in naming/definition of variables/functions.

BUG=b:62307687
CQ-DEPEND=CL:524034, CL:524973, CL:524981
BRANCH=gru
TEST=build image and boot Scarlet

Change-Id: I20c1a4f311c9250a3bf1a2a5b0c70dd0f7c7e45b
Reviewed-on: https://chromium-review.googlesource.com/524987
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 17:09:27 -07:00