Commit Graph

7246 Commits

Author SHA1 Message Date
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
206f1dd93b npcx: gpio: Lock VCC_RST# alternative bit of DEVALTA.
This CL locks VCC_RST# alternative bit, NO_VCC1_RST, of DEVALTA
in case the developers switch it to GPO77 unexpectedly by setting
VCC1_RST_LK bit in DEV_CTL4.

BRANCH=none
BUG=none
TEST=Use rw console command to make sure NO_VCC1_RST bit is
locked on npcx7_evb.

Change-Id: Ic7882ef1c8050c3daca85bd241d5368f009e4e2e
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/522206
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-10 01:30:23 -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
Nick Vaccaro
e9215ba711 common: allow report disabling of host events
Adds a mechanism that allows a board to disable interrupting the AP /
kernel when the status of any one of the EC_HOST_EVENTS included in
CONFIG_HOST_EVENT_REPORT_MASK changes state.  Default state enables
reporting of all events; a board can override this by defining
CONFIG_HOST_EVENT_REPORT_MASK in its board.h file.

NOTE: The host_set_events() and host_clear_events() routines no longer
interrupt the AP if none of the host events the AP is interested in
changed state.

BRANCH=none
BUG=chromium:637061
TEST=make buildall passes

Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Change-Id: I678fb9d9dab6890848b94b314efd711842b1fd48
Reviewed-on: https://chromium-review.googlesource.com/502078
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-09 21:44:03 -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
Vadim Bendebury
bdbb45b14a usb_updater: allow symbolic Board IDs
When specifying board ID to program, it is convenient to be able to
specify the ID as a string, as reported by the RLZ stored in the VPD.

With this patch the first component of the board_id command line
option is considered a string if it is no longer than 4 bytes.

BRANCH=cr50
BUG=b:35587387,b:35587053

TEST=ran the following commands (interleaved with erasing INFO1 on the
     target):

  localhost ~ # usb_updater -s -i
  Board ID space: ffffffff:ffffffff:ffffffff
  localhost ~ # usb_updater -s -i ABCD
  localhost ~ # usb_updater -s -i
  Board ID space: 41424344:bebdbcbb:0000ff00
  localhost ~ # usb_updater -s -i
  Board ID space: ffffffff:ffffffff:ffffffff
  localhost ~ # usb_updater -s -i 0x41424344:0x1234
  localhost ~ # usb_updater -s -i
  Board ID space: 41424344:bebdbcbb:00001234
  localhost ~ # usb_updater -s -i
  Board ID space: ffffffff:ffffffff:ffffffff
  localhost ~ # usb_updater -s -i ABCD:0x1234
  localhost ~ # usb_updater -s -i
  Board ID space: 41424344:bebdbcbb:00001234

Change-Id: Ied8b240d60ea50f6fc8633f919ce4bc81ac17727
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/528440
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-09 13:27:52 -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
Wei-Ning Huang
e237092ee9 ectool: fix command tpframeget return value
ec_command returns the length of response if there is no error. Fix the
return value so tpframeget sub command returns 0 on success.

BRANCH=none
BUG=b:62077098
TEST=`make BOARD=rose -j`

Change-Id: I87288a3efcca75dacebae784e731e314e97017ad
Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/527766
Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2017-06-09 09:16:27 -07:00
Chun-Ta Lin
0b5e3aa642 hammer: initial commit for trackpad firmware updater
Tool to update the trackpad firmware over USB. Primarily borrowed from
extra/usb_console/usb_console.c

BRANCH=none
BUG=b:35587174
TEST=Manually executed with hammer

Change-Id: Icad951d2478a3e231f293e11fb461eaae20e5042
Reviewed-on: https://chromium-review.googlesource.com/525192
Commit-Ready: Chun-ta Lin <itspeter@chromium.org>
Tested-by: Chun-ta Lin <itspeter@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-09 07:10:41 -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
Vadim Bendebury
61b87c56b6 g: do not invoke signer with sudo unless it is necessary
Invoking signer with sudo is required only when signing requires a USB
fob. Let's not use it in unless necessary.

BRANCH=cr50
BUG=chromium:728751
TEST=verified that Cr50 build succeeds when both using and not using
     the signing fob.

Change-Id: I8f40bd52f1752bfd88ec002f298b991faf7a2512
Reviewed-on: https://chromium-review.googlesource.com/528373
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-08 18:52:40 -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
Brian Norris
8bd5696180 flash_ec: add scarlet support
BUG=b:62307687
BRANCH=gru
TEST=`flash_ec --board=scarlet`

Change-Id: Iaee413a3710921c37763ddf620eba558da6e569f
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448760
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/528060
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: 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
CHLin
e806e20c03 npcx: system: fix the incorrect checking of invalid BBRAM(IBBR) bit.
This CL adds:
1. Fixed the incorrect address of BKUP_STS register.
2. Cleared the IBBR bit of BKUP_STS register at initial because
its default value is 1(means the content of BBRAM is invalid) whenever
VBAT is powered up.
3. Add debug msg when IBBR bit is set to indicate the BBRAM's
corruption.
4. Modified the valid BBRAM offset from 1 to 0 and size from 63 to 64.

BRANCH=none
BUG=b:38187362
TEST=No build error for make buildall; Check IBBR is cleared at initial.
Check IBBR is set by changing the VBAT voltage below VBAT MIN.
Test console command "reboot ap-off" on poppy.

Change-Id: I69d98b50d4e0aec17b55a4a9b5e8f1a412a3fe45
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/505861
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-06-08 02:35:38 -07:00
Vadim Bendebury
3639527eb4 bs: add missing codesigner command line argument
The recent change of the code signer is not backwards compatible, a
new command line parameter must be added.

BRANCH=cr50
BUG=none
TEST=verified that

    H1_DEVIDS='xxxx yyyyy' ./util/signer/bs

  succeeds again.

Change-Id: I9a8e03c20aa4b7b689b1f5e4a1f786cf5857483f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/527317
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-07 23:45:41 -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
Aseda Aboagye
27a39b44d1 g: uart_bitbang: Keep debug stuff off by default.
There are some useful UART bitbang commands, statistics, and logs and
such.  These shouldn't be enabled by default, and this commit makes it
so.

BUG=b:35648297
BRANCH=cr50
TEST=Build an image that enables UART bit banging with BITBANG_DEBUG set
to 0.  Verify that the associated debug commands and statistics are not
present.

Change-Id: Ic0348a6fb1620229e2ed601e0ff549596d814e1e
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/527605
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:30 -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
Wei-Ning Huang
5b1d2b878d rose: add touchpad related host commands
Add touchpad related host commands:
1) EC_CMD_TP_SELF_TEST: run open short test.
2) EC_CMD_TP_FRAME_INFO: get number of frame and frame size.
3) EC_CMD_TP_FRAME_SNAPSHOT: make a snapshot of the frame.
4) EC_CMD_TP_FRAME_GET: get frame data.

BRANCH=none
BUG=b:62077098
TEST=`make BOARD=rose -j`
     `ectool --name=cros_tp tpselftest` and
     `ectool --name=cros_tp tpframeget` works

Change-Id: I43db82278e556b1e6f6301fe88233fe7c4a18a14
Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/515282
Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2017-06-07 05:22:56 -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
Vadim Bendebury
25fb7bb3e5 Cr50: usb_updater: add commands to get/set board id
This patch enhances the Cr50 usb_updater to allow to get and set Board
ID value saved in the Cr50's INFO1 space using the earlier introduced
dedicated vendor commands.

Getting or Setting the board ID does not require establishing a
connection with the Cr50, the new option is --board_id/-i. When
specified without a parameter, the new option will cause the Board ID
to be read. When specified with a parameter, the board ID value will
be set. The parameter includes one or two values in a single string,
the values separated by a colon.

The first value is a 4 byte board ID, and the second value is the
flags field. The default flags field is set to 0xff00.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that it is possible to get and set the board ID value
      using usb_updater, both over USB and TPM.

      verified that it is not possible to set a new board ID value is
      the INFO1 space has been already programmed.

      verified that it is not possible to set a board ID value which
      would not allow the currently running image to start (even
      though there is no run time check yet).

Change-Id: Ief175d8b2ef3177db13fa86f831914088d9447b0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525096
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-07 03:02:55 -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
cf5555a9ce stm32mon: Add support for STM32F412
BRANCH=none
BUG=b:38506987
TEST=On eve, where some sectors were locked, was able to unlock them:
- Enter bootloader:
st_flash --board=eve --enter_bootloader=true
- Unlock all pages:
/tmp/stm32mon -a 8 -l 0x8c -u
ChipID 0x441 : STM32F412
Bootloader v1.2, commands : \
00 01 02 11 21 31 44 63 73 82 92 32 45 64 74 83 93 00
Flash write unprotected.

Change-Id: I423e4b7f235ee2c9dddf28f4166fca2a74132733
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/511886
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2017-06-06 17:09:28 -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
Vadim Bendebury
885c02a92d cr50: usb_updater: do not send setup request unless necessary
There are only two usb_updater actions which require establishing a
connection with the Cr50: transferring the firmware image during
update and reporting the version of the running image (because the
version is reported when the connection is established).

This patch refactors usb_updater code to establish the connection only
when necessary.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that 'usb_updater -c' succeeds both issued over USB and
      TPM

Change-Id: I6a0c82eb440c092263d4802f124f458f148a8ab5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525095
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 17:09:28 -07:00
Vadim Bendebury
af92414985 cr50: include more vendor commands into the USB set
The upcoming changes in usb_updater will allow to issue vendor
commands to set and get board ID value. It is also useful to be able
to corrupt the alternative RW header over Suzy-Q when Cr50 is running
a debug image.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=not yet.

Change-Id: I54ac6eb4cebd85f97407211c5212b868d61e560f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524894
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 17:09:27 -07:00
Vadim Bendebury
b06942187e cr50: usb_updater: add proper vendor command processing
So far vendor command processing has been a second class citizen in
the Cr50 usb_updater: return codes were mostly ignored even when using
TPM, when using USB there was no way to communicate return codes at
all.

This patch refactors the source code to use a single function to
process vendor commands over both USB and TPM, adding proper passing
of the result codes back to the caller in both cases, retrieving the
return code from the response header when using TPM and from the first
byte of the response payload when using USB.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that it is possible to update rw13, rw18 and rw20 both
     over TPM and USB, which indicates that vendor commands are
     properly handled.

Change-Id: I837e17b29d3b025fbca5b1ef49463cfb1729fe6c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525094
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 17:09:27 -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
Philip Chen
d8036441ca scarlet: enable mkbp
BUG=chrome-os-partner:62987, b:62307687
CQ-DEPEND=CL:524987, CL:524034, CL:524973
BRANCH=scarlet
TEST=manually push VolUp/VolDown on scarlet

Change-Id: I593bdce6c69856c4099c8c17059f5fd1eb8aae33
Reviewed-on: https://chromium-review.googlesource.com/443746
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/524981
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-06 17:09:27 -07:00
philipchen
f7930038a1 scarlet: Remove one usb type-c port
BUG=chrome-os-partner:62207, b:62307687
CQ-DEPEND=CL:524981, CL:524987, CL:524034
BRANCH=gru
TEST=make BOARD=scarlet
TEST=manually test on gru - only one type-c port works.

Change-Id: I0b1735d3da11ee9432ce97467036e2a6cf2b8dbe
Reviewed-on: https://chromium-review.googlesource.com/431000
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/524973
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-06 17:09:27 -07:00
philipchen
1861f5695a scarlet: initial mainboard
Copied board-related files from
gru folder and updated some minor changes
to make it compilable.
Will do more follow-up modification based on this work.

BUG=chrome-os-partner:62207, b:62307687
CQ-DEPEND=CL:524973, CL:524981, CL:524987
BRANCH=gru
TEST=make BOARD=scarlet

Change-Id: Ib508ef69e448028809276fe010c3f5fbef0500b4
Reviewed-on: https://chromium-review.googlesource.com/430965
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
(cherry picked from commit 63592fef936909fe97af487f4ded44b9daa5847f)
Reviewed-on: https://chromium-review.googlesource.com/524034
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-06 17:09:26 -07:00
Duncan Laurie
9565b8ba06 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>
2017-06-06 14:36:30 -07:00
Vadim Bendebury
51f5875da6 cr50: usb_updater: include return codes into USB response payload
When vendor commands are processed by the TPM device, the result of
the command execution is communicated through the TPM response header.
When vendor commands are sent through USB the command execution result
value is lost, as the USB reply includes only the response payload,
(if any), but not the result value.

With this patch the single byte result value is prepended to the USB
response payload. The recipient will always look for the value in the
first byte of the response to find the vendor command execution
status.

The corresponding change to the Cr50 usb_updater will remove the
response code from the payload before considering the command's return
data.

BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified proper existing extension commands processing (post
     reset, turn update on) by the new version of usb_updater and
     backwards compatibility with earlier Cr50 RW version (down to
     0.0.13).

Change-Id: I5c8b3ea71d3cbbaccc06c909754944b3ab04675d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525093
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 14:36:28 -07:00
Vadim Bendebury
a75f7c8680 cr50: usb_upgrade: allow responses lager than requests
When invoking vendor command handlers in try_vendor_command(), the
buffer containing the command is passed to the handler to communicate
the command contents and to hold the command execution return data. It
was fine when invoking vendor command handlers from the TPM stack, as
the receive buffer is 4K in size and is large enough for any expected
vendor command response.

It is different in case of USB: the command is in the receive buffer
of the USB queue, and the response data could easily exceed the
command size, which would cause corruption of the USB receive queue
contents when the response data is placed into the same buffer where
the command is.

Let's introduce a local storage to pass the command and receive the
response data from the handler. 32 bytes is enough for the foreseeable
future, should a need arise for a larger buffer, testing would result
in an error (a new error type is added to indicate insufficient buffer
space for command processing).

BRANCH=none
BUG=b:35587387,b:35587053
TEST=with the rest of the patches applied verified proper processing
     of the 'Get Board ID' command for which response size exceeds the
     request size.

Change-Id: I2131496f3a99c7f3a1869905120a453d75efbdce
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525092
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-06 14:36:28 -07:00
Nicolas Boichat
6d05a31a44 rollback: Include board-generated entropy when adding entropy
Mix in board-generated entropy with the externally provided one,
which should help make the per-device secret stronger.

BRANCH=none
BUG=b:38486828
TEST=reboot; rollbackaddent Hello => works fine when USB is connected,
     fails otherwise, as board-generated entropy relies on USB timing.

Change-Id: I314f44759c5f8b859913a748db95e9d42b5cdd11
Reviewed-on: https://chromium-review.googlesource.com/518609
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-06 08:52:16 -07:00
Nicolas Boichat
39db721f9a hammer: Add board_get_entropy function (and test)
This function will be used to generate some entropy using the
Clock Recovery System.

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
TEST=Test fails when no USB connection is active
TEST=Test passes when USB connection is active
TEST=Pasting the values into:
     tr ';' '\n' | awk 'BEGIN { e = 0; tot=16384.0 }
                  { p = $1/tot; if (p > 0) { e -= p*log(p)/log(2) } }
                  END { print e }'
     shows an entropy > 4 bits per sample.

Change-Id: I2363c7bce42c72c33ef0bf3f099d709ee9c13d13
Reviewed-on: https://chromium-review.googlesource.com/518608
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-06 08:52:16 -07:00
Harry Pan
2f436f4cc9 isl9238: Enable system power monitor function
The system power monitor function, aka. PSYS, of the ISL9238 chip
is disabled by default, this patch enables PSYS monitor in the
EC driver.

BUG=b:62041842
BRANCH=none
TEST=Able to read non-zero value at the MSR of
MSR_PLATFORM_ENERGY_STATUS (0x64D) by iotools;
Also, kernel powercap driver probes PSYS domain correctly;
Such that the kernel exports the sysfs node of intel-rapl:1

Change-Id: I7a533032815e873ae74dca42ec07041be0d0f975
Signed-off-by: Harry Pan <harry.pan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/520549
Tested-by: Kane Chen <kane.chen@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-06-06 05:15:55 -07:00
Mary Ruthven
4315a010b0 g: add flag to delay int enable until board_init
Cr50 has different gpio configurations for different boards. They cannot
be determined until board_init. We want a way to delay enabling the gpio
interrupts until the board type can be determined.

This change adds a gpio flag, GPIO_INT_DISABLE. When set gpio_pre_init
will setup the interrupt, but not enable it. board_init then enables all
of the interrupts with init_interrupts.

BUG=b:35587228
BRANCH=cr50
TEST=use 'gpiocfg' to verify the setup hasn't changed. Add print
statements to verify that gpio_pre_init skips enabling the interrupt on
any gpio that has GPIO_INT_DISABLE set

Change-Id: I91f73297ab80781b99aa82eda479ae311c13cb77
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/523808
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-05 18:33:57 -07:00