Commit Graph

2257 Commits

Author SHA1 Message Date
li feng
17276a7a7e reef led: add battery led support
BUG=chrome-os-partner:55492
BRANCH=none
TEST=on Reef proto, verified led behavior on battery charing,
discharging cases

Change-Id: Ibc134b741e5c433697b752f73bd3e29ba5910124
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/364025
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-29 19:21:54 -07:00
Daisuke Nojiri
b517067a41 cts: Add timer test
The timer test checks the accuracy of the internal timer. After sync,
DUT and TH start counting down one second. After one second, DUT raises
GPIO level.  TH determines whether the test passes or not based on how
much more or less time elapsed than one second, assuming its clock is
calibrated.

This test takes advantage of TH running on a bare chip. If the host
were measuring (instead of TH), the timing would be affected by many
software and hardware layers (e.g. UART drivers on DUT and host,
python interpreter, etc.).

BUG=chromium:624520
BRANCH=none
TEST=cts.py --module timer && cts.py --module gpio && make buildall

Change-Id: I535e7772b4d93f1f5d248506f7ea167429a50174
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361384
2016-07-29 15:02:44 -07:00
David Hendricks
1d3e67cc31 reef: Update pins for EVT
Updates for EVT:
- TCPC0 interrupt polarity is now low, define GPIO_INT and set ANX74xx
  internal polarity control based on IS_PROTO.
- Swapped pin assignments for USB_C1_PD_INT_ODL and EN_USB_C1_5V_OUT.
- Rename USB_PD_RST_ODL to USB_C0_PD_RST_L and make it push-pull.
- Add USB_C1_PD_RST_ODL

BUG=chrome-os-partner:54958,chrome-os-partner:54952,chrome-os-partner:55165
BRANCH=none
TEST=needs testing

Change-Id: I075934cced532d656f942841c30e3640a6f42568
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/358944
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2016-07-29 15:01:59 -07:00
David Hendricks
9d2cb33fb1 reef: Check if interrupt is active in tcpc_alert_event
This ensures that we're only checking the reset signal for the
corresponding interrupt. Otherwise we can hit a race condition
when both TCPC chips are taken out of reset.

(This is also how it's done on Amenia)

BUG=none
BRANCH=none
TEST=needs testing

Change-Id: I47513b3b47e947c8b4644f4d837ddc3fb1ee7a30
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361061
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-29 15:01:58 -07:00
David Hendricks
854695981f reef: Initialize TCPC chips in their own function
This makes board_set_tcpc_power_mode() a noop since that's controlled
by anx74xx code and we have another TCPC chip onboard. Instead, we'll
reset the TCPC chips in a hook that will run after board and I2C init.

This is more like what Amenia code does.

BUG=chrome-os-partner:54952
BRANCH=none
TEST=needs testing.

Change-Id: Id3af4af1014432235b699a9568ee19df63601b2c
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361060
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-29 15:01:56 -07:00
Mary Ruthven
12f22933e3 cr50: fix usb spi to disable resets while doing updates
We need to ignore sys_rst_l right now when we use the usb spi endpoint
to update the AP or EC. We hold the EC and AP in reset and this causes
sys_rst_l to be asserted at the start of updating the AP and when the EC
comes out of reset.

Using the USB SPI endpoint may require doing a bunch of transactions
back to back. Cr50 should not reset itself between each one.

This change postpones the reset until we're done using the usb spi
endpoint. Once sys_rst_l just resets the TPM we can remove all of this.

BUG=chrome-os-partner:52366
BUG=chrome-os-partner:54982
BRANCH=none
TEST=manual
	verify 'util/flash_ec --board=kevin --raiden' updates the EC

	'sudo flashrom -p raiden_debug_spi:target=AP -w $IMG' updates
	the AP

	The AP and cr50 reset after usb_spi is disabled.

Change-Id: I68a76012bc7bf6d3abd073a70f0b90e440d72c49
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364051
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-07-28 20:20:51 -07:00
Brian Norris
43b2f5bac6 kevin: invert accelerometer matrix
We have the lid and base sensors correct in relation to each other.
e.g., when at 90 degree lid angle, this reports correctly:

    # ectool motionsense lid_angle
    Lid angle: 90

But it appears that our axes are opposite from (e.g.) what Chrome
expects. With the lid angle at 180 degrees flat on a desk, I see:

    # ectool motionsense
    Motion sensing inactive
    Sensor 0: -571	1018	-16302
    Sensor 1: 0	0	0
    Sensor 2: 896	-3424	-16208

but the Z-axis should be positive. After this patch, I see:

    # ectool motionsense
    Motion sensing inactive
    Sensor 0: 580	-1000	16289
    Sensor 1: 0	0	0
    Sensor 2: -832	16368	1008

Which looks more accurate, and actually gets Chrome to rotate properly.

All tested on kevin rev3.

BRANCH=none
BUG=chrome-os-partner:55717
TEST=`ectool motionsense`, `ectool motionsense lid_angle`; also test
     rotation in Chrome

Change-Id: Ie1bffe27989c893d6037e251499f235ef10d4578
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364161
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-28 20:20:19 -07:00
Mary Ruthven
2f256ad698 cr50: fix wake pin handling when resuming from sleep
Cr50 was not waking up long enough after SPS_CS_L was asserted for the
spi slave transactions to start and disable sleep. It also was not
handling SYS_RST_L properly when it was asleep.

This change sets SPS_CS_L to be an edge triggered wake up source instead
of level triggered, because cr50 should just wake up on the edge and
disable sleep until the spi transaction is done.

It also adds sys_rst_l as a wakeup source. The sys_rst_asserted
interrupt cannot be triggered while cr50 is asleep, so the
pmu_wakeup_interrupt will call sys_rst_asserted if SYS_RST_L is low at
resume. This change relies on the EC extending the delay in
chipset_reset to be long enough for SYS_RST_L to still be asserted when
cr50 resumes.

BUG=chrome-os-partner:54331
BRANCH=none
TEST=manual
	make sure suzyq is disconnected.

	verify ap boots up to the kernel after running
	'gpioset SYS_RST_L 0' then 'gpioset SYS_RST_L 1' on the ec
	console.

	Check that cr50 goes to sleep when the AP is not trying to use
	the TPM.

	When cr50 is asleep pwrbtn + refresh still resets the system.

	Disable SYS_RST_L_IN as a wake source and verify the system
	verification fails and requests a recovery image.

Change-Id: I807b1918842d96c9d2922aa33404d87ab28b9906
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363606
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-07-28 20:19:51 -07:00
Vincent Palatin
2300ecc611 kevin: reef: enable CCD provided by an external chip
The case close debug (CCD) feature is provided by the external security
chip. We add CONFIG_CASE_CLOSED_DEBUG_EXTERNAL to be able to detect debug
accessory with Rd/Rd (by setting Rp/Rp when VBUS is detected without
seeing Rp).

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

BRANCH=none
BUG=chrome-os-partner:55410
TEST=manual:on Kevin, plug a SuzyQ (with Rd/Rd) either in S5 or
transition the device to S5 afterwards and see the debug USB endpoint
works.

Change-Id: Icef4209470463be77d43f4a46e32769ebf58f558
Reviewed-on: https://chromium-review.googlesource.com/363401
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-27 02:03:51 -07:00
Shawn Nematbakhsh
e8a95db059 kevin: battery: Revive batteries in soft-disconnect state
ESC+F3+Power+AC removal puts the battery into a soft-disconnect state
where is stops supplying current. Revive batteries in this state by
supplying a precharge current.

BUG=chrome-os-partner:55617
BRANCH=None
TEST=Manual on kevin. Put battery into soft-disconnect state. Attach
charger and verify EC doesn't lose power and battery again supplies
current.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I8dfcfa90c723d627636d9bebca48429b9f1106f7
Reviewed-on: https://chromium-review.googlesource.com/363004
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-26 23:55:10 -07:00
Shawn Nematbakhsh
93de085455 kevin / gru: Increase size of code RAM
Reduce size of UART Tx buffer to 1024 bytes on all npcx platforms and
increase size of code memory by 6K bytes on Kevin.

BUG=chrome-os-partner:52876
BRANCH=None
TEST=`make buildall -j` with subsequent commit.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib9e52a4406f84cfc434984f8819d7ef02b70beb4
Reviewed-on: https://chromium-review.googlesource.com/363591
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-26 17:32:31 -07:00
Shawn Nematbakhsh
136ca23afe kevin / gru: Add psys console command
Add `psys` console command for system power monitoring. Note that pmon
resistor / cap are not stuffed by default.

BUG=chrome-os-partner:55616
BRANCH=None
TEST=Verify `psys` command on kevin prints a result.

Change-Id: I9ac7b55ad30d0709624f94c27e173eb80f80a1ac
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363061
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-26 12:27:35 -07:00
nagendra modadugu
e819881b8c CR50: add endorsement certificate flow
This change implements logic for installing
endorsement certificates in the RW section.

The endorsement certificates are initially
provisioned in a fixed RO flash region and
are copied in the RW TPM data region (once
this region has been initialized).

Also add code for reading from the info bank,
which is where the endorsement seed is
initially stored.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
BUG=chrome-os-partner:50115
TEST=TCG tests running

Change-Id: Id8c16d399202eee4ac0c4e397bdd29641ff9d2f3
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/362402
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-23 02:18:49 +00:00
Shawn Nematbakhsh
1f99b58bd3 kevin / gru: Warn users when incompatible GPIO config is used
Old kevin / gru boards are no longer supported by our current GPIO
configuration and must revert a CL to boot properly. Detect if old
boards are used with an incompatible config and warn users of this fact
by spamming the EC console and blinking the LED red.

BUG=chrome-os-partner:55561
BRANCH=None
TEST=Boot new kevin, verify no console spam or LED blinkage is seen. Verify
old kevin + old gru spam the console and blink LED.

Change-Id: I6d49720f760a6bef2bb3db6872857a5f61259e06
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362653
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-22 18:40:09 -07:00
Bill Richardson
a865ec4e80 Cr50: Rearrange flash to allow dual RO images
We had been putting the NVMEM flash where the boot rom would
expect to find RO_B, preventing us from ever being able to update
the bootloader.

With this CL, we're rearranging the flash to support both RO_A
and RO_B. The current flash layout now looks like this:

  0x40000 RO_A
  0x44000 RW_A
  0x7c000 TOP_A
  0x80000 RO_B
  0x84000 RW_B
  0xbc000 NVMEM
  0xbffff <end of flash>

BUG=chrome-os-partner:44803
BRANCH=none
TEST=make buildall, also manual tests on Cr50 boards

First, check that our current process still works:

  make BOARD=cr50 CR50_RO_KEY=cr50_rom0-dev-blsign.pem.pub
  spiflash -i -v build/cr50/ec.hex

  Yep, it does, but that only produces RO_A, not RO_B.

To test the dual RO behavior, I used prebuilt RO_A and RO_B blobs
for the bootloaders, signed using Marius' new scheme.

Build the unsigned image, then sign it using Vadim's scripts:

  make BOARD=cr50 -j30
  ~/bin/bs hex

We'll garble various bits of the full image to invalidate each of
the four RO/RW/A/B parts.

Find lines common to both ROs and common to both RWs:

  sort B1*.hex | uniq -c | grep ' 2 ' | \
       awk '{print $2}' | sort > tmp.ro2
  sort build/cr50/RW/ec.RW*.signed.hex | uniq -c | grep ' 2 ' | \
       awk '{print $2}' | sort > tmp.rw2
  ro=$(diff tmp.ro2 tmp.rw2 | grep '<' | head -1 | awk '{print $2}')
  rw=$(diff tmp.ro2 tmp.rw2 | grep '>' | head -1 | awk '{print $2}')

Double-check to be sure we don't have any false matches:

 grep -l $ro build/cr50/RW/ec.RW*.signed.hex B1_*.hex
 grep -l $rw build/cr50/RW/ec.RW*.signed.hex B1_*.hex

The pre-signed RO_A image is older than RO_B, but both have the
same epoch/major/minor, which is all that the bootrom checks for.
It doesn't look at the timestamp.

The RW_A is older than RW_B because of the sequential signing
process. The RO bootloaders will check their timestamp, so RW_B
should be preferred.

RO_A  RO_B  RW_A  RW_B
good  good  good  good

  cat build/cr50/RW/ec.RW*.signed.hex B1_*.hex > foo.hex
  spiflash -v -i foo.hex

    jump @00040400
    jump @00084000

  => boots RO_A -> RW_B

RO_A  RO_B  RW_A  RW_B
good  good  good  bad

  cat build/cr50/RW/ec.RW*.signed.hex B1_*.hex > foo.hex

  ln=$(grep -n $rw foo.hex | awk -F: 'NR==2 {print $1}')
  sed -i "${ln}d" foo.hex

  spiflash -v -i foo.hex

    jump @00040400
    jump @00044000

  => boots RO_A -> RW_A

RO_A  RO_B  RW_A  RW_B
bad   good  good  good

  cat build/cr50/RW/ec.RW*.signed.hex B1_*.hex > foo.hex

  ln=$(grep -n $ro foo.hex | awk -F: 'NR==1 {print $1}')
  sed -i "${ln}d" foo.hex

  spiflash -v -i foo.hex

    jump @00080400
    jump @00084000

  => boots RO_B -> RW_B

RO_A  RO_B  RW_A  RW_B
bad   good  good  bad

  cat build/cr50/RW/ec.RW*.signed.hex B1_*.hex > foo.hex

  ln=$(grep -n $ro foo.hex | awk -F: 'NR==1 {print $1}')
  sed -i "${ln}d" foo.hex

  ln=$(grep -n $rw foo.hex | awk -F: 'NR==2 {print $1}')
  sed -i "${ln}d" foo.hex

  spiflash -v -i foo.hex

    jump @00080400
    jump @00044000

  => boots RO_B -> RW_A

Yay.

Now make sure RW_A and RW_B can be updated using usb_updater.

  \rm -rf build
  make BOARD=cr50 -j30
  ~/bin/bs

  ./extra/usb_updater/usb_updater build/cr50/ec.bin

  I'm running RW_A, it updates and reboots into RW_B. Good.

  reboot 5 times, and it reverts to RW_A.

  Power cycle and it goes to RW_B again.

Update to RW_A.

  \rm -rf build
  make BOARD=cr50 -j30
  ~/bin/bs

  ./extra/usb_updater/usb_updater build/cr50/ec.bin

  I'm running RW_B, it updates and reboots into RW_A. Good.

  reboot 5 times, and it reverts to RW_B.

  Power cycle and it goes to RW_A again.

Cool.

Change-Id: I6c1689920de06c72c69f58ad2ef1059d9ee0d75f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362521
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-22 15:36:14 -07:00
David Hendricks
29ef0536d8 reef: Introduce IS_PROTO hack
This will be used to hack around code that only works on proto.
The earlier method of attempting to use board ID to determine
codepath worked to a limited extent, but fell short due to pin
swappings. So the dream of having a single binary that would work
on multiple board revisions died, and now if someone wants to build
for an old proto board they need to set this #define to 1.

BUG=chrome-os-partner:54947
BRANCH=none
TEST=tested with upcoming patches in this series

Change-Id: I5468c252e5401d69b108c75fa00b3dfbbcf77c22
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360949
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-22 15:36:05 -07:00
Nick Sanders
863708f5ec servo_v4: add USB updater
This adds a Google FW update endpoint to
servo v4.

BUG=chromium:571476
TEST=successfully update servo v4 via usb
BRANCH=None

Change-Id: I79cb46364d416300e430708db25814f861a6d7c9
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361833
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-21 17:33:05 -07:00
Nick Sanders
08aebf624c servo_micro: add USB updater
This adds a Google FW update endpoint to
servo micro in place of a GPIO enpoint.

BUG=chromium:571477
TEST=successfully update servo micro via usb
BRANCH=None

Signed-off-by: Nick Sanders <nsanders@chromium.org>

Change-Id: I3d6c501d515b3f1db6e8259fbb829abe18f72e00
Reviewed-on: https://chromium-review.googlesource.com/361834
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-21 17:33:04 -07:00
Vadim Bendebury
9b752cbcd4 tpm: add manufacturing status check
For now the presence of both RSA and EC certificates at fixed NVRAM
indices is considered evidence of TPM being through manufacturing.

BRANCH=none
BUG=chrome-os-partner:50645
TEST=with the rest of the patches applied TPM manufacturing status is
     properly detected at startup.

Change-Id: Iff3861603272cdfb58ebc523458c114685b2429f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362351
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-07-21 17:32:22 -07:00
nagendra modadugu
68244c3f4e CR50: match private key against certs on endorsement
This change updates the ecc and rsa key generation templates.

Due to crosbug.com/p/55260 in which the TPMT_PUBLIC template is
truncated during personalization, ecc generation requires a
workaround.

For RSA, allow the standard template to be used even on development
builds.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
BUG=chrome-os-partner:50115,chrome-os-partner:55260
TEST=test full personalize + cros_ack verify cert flow

Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/360441
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit db5a1ca8a40be9bf7e741637cd8d7f15f520ab11)
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit b6620239bb7c4f5900051677f40f161c0a853a94)
Change-Id: I1af83f1ec86e7ee4d325a4b7aabe03ce08c4108b
Reviewed-on: https://chromium-review.googlesource.com/362142
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-07-21 17:32:20 -07:00
nagendra modadugu
b1c3aa2080 CR50: fix uninitialized buffer size in _cpri__SignRSA
The TPM2 wrapper library does not initialize the
size of an output buffer length prior to calling
into cr50/tpm2.  This results in arbitrary failures
depending on memory layout.

Force the buffer length unseen, though this should
be fixed in the TPM2 library.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
BUG=chrome-os-partner:50115,chrome-os-partner:55260
TEST=test full personalize + cros_ack verify cert flow
TEST=CPCTPM_TC2_2_20_02_03 passes, which was consistently failing

Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/360908
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit 635cb7ada25e76e504087916364e2db08a2133ab)
Change-Id: I90e9b4d76986ffa27acc944e48afc2efaadad7cd
Reviewed-on: https://chromium-review.googlesource.com/362116
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-21 17:32:19 -07:00
nagendra modadugu
5de5f2fded CR50: rename struct BIGNUM -> struct LITE_BIGNUM
The name BIGNUM collides with a namesake struct
in openssl.  It would be convenient to write
test code that compares results between openssl
and dcrypto, hence this rename.

Also rename some #defines that conflict with
openssl names.

CQ-DEPEND=CL:*270476
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524,chrome-os-partner:50115
TEST=build succeeds

Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/360346
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit a15b495497728a6b212bd87e92f6ba5ba463f985)
Change-Id: Ic53ce805cfcc591c68fbc1ef90ff2f92cec973a6
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362112
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-07-21 17:32:14 -07:00
Aaron Durbin
1ea4042f57 board/reef: enable CONFIG_CHIPSET_RESET_HOOK
In order for the vstore to be unlocked one needs to enable
the CHIPSET_RESET_HOOK. Do that for reef.

BUG=chrome-os-partner:55471
BRANCH=None
TEST=Able to boot and reboot without getting vboot hash saving
errors. Also am able to see the assertion/deassertion messages
on the console.

Change-Id: I94a41a08ad8649423988372607835da01ec12b8b
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362001
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-21 11:22:27 -07:00
David Hendricks
4fe82acac2 tcpm: anx74xx: Add alert polarity member to tcpc_config_t
This allows us to specify the polarity of the alert signal for
each TCPC chip onboard, even if we have multiple instances of
the same chip.

BUG=none
BRANCH=none
TEST=built and booted on reef

Change-Id: I06a58c4e26892843243e8e98f2c86c6d3a696eb1
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360948
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-21 00:48:05 -07:00
Nick Sanders
3c44198c33 servo_micro: support servo micro v2, console gpio
* Remove GPIO USB endpoint to make room for update endpoint.
* Change GPIO mapping slightly to support servo micro v2.

BUG=chromium:571477
BRANCH=None
TEST=run servod, see new controls.

Change-Id: Id3b85b4c77b8f21afd9636b2ee459ace6f42f68e
Reviewed-on: https://chromium-review.googlesource.com/361383
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-07-20 22:22:32 -07:00
Shawn Nematbakhsh
b1aecf2c5d kevin / gru: Enable low-power idle
BUG=chrome-os-partner:54343
BRANCH=None
TEST=Verify system continues to function as normal in S0 and S5.

Change-Id: I1b46c47a074a308f2e316e93813559d170bfe5ee
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/355161
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-07-20 22:22:14 -07:00
Mary Ruthven
dea7a16a9b g: add an option to disable uart0 rx no matter what
Having uart0 RX enabled can cause serious issues. This change adds a
config option to disable uart0 rx no matter what.

BUG=none
BRANCH=none
TEST=On B2 check that the ultradebug console is now read only

Change-Id: Icaec6954ffd3cbf0fda3f53581f6e4020d555267
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361976
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-20 22:22:09 -07:00
Shawn Nematbakhsh
1e53ce006c kevin: Add CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
The battery on kevin apparently requests 0A / 0V when extremely low, so
ignore this request and apply the pre-charge current.

BUG=chrome-os-partner:55416
BRANCH=None
TEST=Verify Kevin powers on with dead battery and battery charges as
expected.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I224f8ccd4f1d70d3a0f6f6e940fa6cbd80997fef
Reviewed-on: https://chromium-review.googlesource.com/361994
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-20 22:21:46 -07:00
Myles Watson
6361eba4ea hadoken: Add Bluetooth defines to board.h
BUG=None
BRANCH=None
TEST=make BOARD=hadoken

CONFIG_BLUETOOTH_LE
CONFIG_BLUETOOTH_LE_STACK
CONFIG_BLUETOOTH_LE_RADIO_TEST

Change-Id: I0a4bbc20e512c2a2ca02f3690e92e9cec92d3a0e
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361535
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Levi Oliver <levio@google.com>
2016-07-20 20:06:10 -07:00
Vincent Palatin
dbc2e3e909 cr50: add INA 3V3 load switch GPIO
Add a GPIO to control the INA 3.3V power rail load switch on Reef.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: I2be33ebff376b50f9cc2962db5fc3fa11f4bb107
Reviewed-on: https://chromium-review.googlesource.com/361692
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
2016-07-20 21:03:13 +00:00
Divya Sasidharan
27f6bf2762 reef: reject charge port on init till battery is initialized
Ported from patch below:
      Change-Id: If8fd84f82f5a7fb7ca3736031a161d90e5e77c12
      Reviewed-on: https://chromium-review.googlesource.com/349853

Also added CUSTOM_BATTERY_PRESENT check for battery not initialized

BUG=chrome-os-partner:55255
BRANCH=master
TEST="batterycutoff" command successful and boots fine
after plugging in AC to exit ship mode;make buildall -j

Change-Id: I928e17b7ae186d9be695f45540fd79b844f8e3ac
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/360217
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-19 18:33:50 -07:00
Mary Ruthven
c0f6ac5e02 g: disable usb wakeup when debug accessory is disconnected
USB is only used for CCD. USB should not be enabled as a wakeup source
unless a debug accessory is detected, because that is the only USB
traffic we care about. The rest may be from other sources like the HID
interface or something else using those signals. This change disables
the utmi wake source when the debug accessory is attached and enables it
when it is connected.

BUG=chrome-os-partner:54796
BRANCH=none
TEST=manual
	The SPI_CS_L pin still gets triggered and will wake up cr50
	before usb so disable wake up pins as a wakeup source.

	Verify Cr50 goes to sleep and plugging in a SuzyQ will wake it
	up and after removing it Cr50 will go back to sleep.

Change-Id: Ib97244016b0af244c340259915def9f4d8f97569
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360693
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-07-19 16:32:10 -07:00
Myles Watson
858cba298c hadoken: Remove I2C and add ADC
As of EVT2, remove I2C (TWI).
Use the pins for analog sensing of the battery level.

BUG=None
BRANCH=None
TEST=Sense the battery level and use the serial port.

Change-Id: I3d5d2401e61e6e7d203e933d2566f6f3cd65c054
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361546
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Levi Oliver <levio@google.com>
2016-07-19 16:31:59 -07:00
Aseda Aboagye
4cf11cb152 big: Enable link-time optimizations.
big is running out of space in ToT.  Grab some space by enabling LTO.

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

Change-Id: I54bc4b368e863f65c76c2b77fa06e3123cff766f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/361549
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-19 16:31:58 -07:00
Nick Sanders
acdba71b73 servo v4: Add new GPIO mappings for rev2
Servo V4 rev2 has slightly different gpio mappings.
Note that this change will cause rev1 to not work.

Allow uservo routing before servod init. Further
work is needed on uservo port preinit as servod will
reset the port on startup, disconnecting uservo.

BRANCH=none
BUG=chromium:571476
TEST=Boot, use dut-control, see uservo.

Change-Id: I6436eed030cfdd329c5bd0cbca49038b268c2b71
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359620
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-19 00:06:02 -07:00
Vijay Hiremath
3f9ee35859 BD99955: System VR in battery LEARN, Cut-off & No-battery condition
Regulate the system voltage by setting the charging voltage to battery
maximum in case of battery LEARN, Cut-off & No-battery conditions.

BUG=chrome-os-partner:55292, chrome-os-partner:55255
BRANCH=none
TEST=Manually tested on Amenia using console command charger.
     Charging voltage is set to battery max in LEARN, Cut-off &
     No-battery conditions.

Change-Id: I74bbab8174fd63b5f8439b8b35098db4a506d72d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/360681
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-18 13:33:04 -07:00
Aseda Aboagye
06ca7d4d91 rk3399: kevin: Inhibit booting w/ insufficient pwr
Before, as soon as the EC started booting, it would unconditionally boot
the AP (unless explicitly told not to. ie: "reboot ap-off").  However,
we weren't waiting for our power to settle which was causing some
brownouts.  This would happen when trying to boot without the battery.

This commit causes the EC to inhibit powering on the AP until we have
sufficient power.

BUG=chrome-os-partner:55289
BRANCH=None
TEST=Flash EVT2; verify can boot normally.
TEST=Remove battery and insert charger.  Verify that DUT can boot up.
TEST=Insert drained battery. Verify power on is inhbited.  Plug in
charger and verify that DUT can power on.

Change-Id: Ifb40766fcc1d330674ec39de6d81174f92b6d658
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/361005
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-18 11:36:36 -07:00
Ryan Zhang
c9f150c368 Elm: Allow rejected 'Dont charge' request on init
If our battery isn't able to provide enough power to the EC on boot, we
should not cut off our input power, regardless of dual role
determination or other charging policy.

BUG=chrome-os-partner:54944
BRANCH=master
TEST=Manual on Elm. Drain battery completely, attach USB-C charger,
verify that "Battery critical, don't disable charging" is seen on the
console and the EC doesn't brown out.

Change-Id: I7782d333da89b872e33ea31304f878ca490329cf
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/360781
Reviewed-by: YH Huang <yh.huang@mediatek.com>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-07-17 21:23:55 -07:00
Chris Chen
846741eddb cts: Added GPIO test suite
Contains code for all the gpio tests so far. Code in
cts_task for th and dut is for testing purposes and
test result reporting will be updated in the next
patch.

BRANCH=None
BUG=None
TEST=Manual
- Connect handshake and gpio test lines between th and dut
- Build tests
- run 'cat /dev/ttyACM0' in one terminal
- run 'cat /def/ttyACM1' in another
- Flash boards
- All test results should print either passed or unknown

Change-Id: I7142fb87a6ce0a20c571cde608fbbe60e35898ea
Reviewed-on: https://chromium-review.googlesource.com/359935
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-07-15 21:39:16 -07:00
Inno Park
db1b3b34c2 kevin: change coordinates axis for sensors
BUG=chrome-os-partner:52844
BRANCH=none
TEST=check x-y-z value from base/lid accelerometer with ec console
command 'accelread'

Change-Id: I38a83f13e415504600cc6c566cf8586e1309a270
Signed-off-by: Inno Park <ih.yoo.park@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/354321
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-15 19:23:33 -07:00
Mary Ruthven
41f872ed53 g: tristate spi master pins
Having DIO A4, A8, and A14 connected to the spi master output pads
prevents reef from booting. We need to tristate those pins when spi ccd
is not in use.

This change disconnects those pins from the spi peripheral when spi is
disabled and reconnects them when spi is enabled.

BUG=chrome-os-partner:53582
BRANCH=none
TEST=manual
	use 'pinmux' to verify DIOA4, DIOA8, and DIOA14 are set have
	GPIO 7, 8, and 9 as their output sources when not using the usb
	spi interface.

	Check the usb spi interface still works.

	Enable usb spi then disable ccd and check that the pins are
	connected back to the non-peripheral gpios.

	Verify the AP on kevin and reef can be flashed using servo.

	Verify the AP boots successfully on both.

Change-Id: I85d70422a30da445076432d2bfc81960aeba8578
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/357883
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-14 23:34:38 -07:00
Vijay Hiremath
b1462bf1f3 charger: BD99955: Get the VBUS level from the charger
Added code to get the VBUS level by reading the charger registers.

BUG=chrome-os-partner:55117
BRANCH=none
TEST=Manually tested on Amenia, VBUS_VAL (5Ch) & VCC_VAL (5Eh)
     registers are updated with the correct VBUS value on the
     respective ports.

Change-Id: I3b019b2d87e4c347f12596df387a2a659092ae25
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/359416
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-13 19:09:39 -07:00
Mary Ruthven
cd6328496f kevin: enable virtual battery
Enable using the virtual battery on Kevin.

BUG=chrome-os-partner:53322
BRANCH=none
TEST=Verify 'power_supply_info' still works.

Change-Id: I5a732d4cdd0f764d8bae086ef23b2690522a038e
Reviewed-on: https://chromium-review.googlesource.com/360186
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-13 19:09:34 -07:00
Koro Chen
5c0ec1cab8 elm: Add sensor power control
PD11 is added in PVT to control power of sensors

BRANCH=none
BUG=chrome-os-partner:54129
TEST=verify sensor power can be controlled on a reworked elm

Change-Id: Ib7457c9c21a26ec853b00f3709922aab70c9d514
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/359153
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-07-13 08:04:08 -07:00
Wonjoon Lee
321130438e kevin: change pwm frequency to reduce EE noise
Currently we have EEnoise(Decap Switching Noise) from LCD PWM
Kevin use LCD Backlight Driver IC and PWM Frequency from EC
Current 10kHz frequency can make switching Noise easily.

BUG=chrome-os-partner:55169
BRANCH=None
TEST=measuring noise reduced, verifying there was no influence
to LCD/digitizer/tsp

Change-Id: I1e65e56a19177dadba0110de5678669288a8555a
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/360003
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-13 02:59:51 -07:00
Wonjoon Lee
92fa2d6de2 kevin: add more waking up signal from hibernating
BUG=None
BRANCH=None
TEST=type "hibernate" in console, and wake up using power button,
lid open, insert power supplier

Change-Id: Ide28974145602db550079c21e76169fbb358c847
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/360041
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-13 02:59:50 -07:00
Mary Ruthven
49312e06cd cr50: disable device monitoring when not in ccd
When cr50 is not trying to do ccd, we dont need to monitor the devices.
Disable device state detection interrupts and the AP and EC UARTs.

BUG=none
BRANCH=none
TEST=gru and kevin monitor devices correctly when ccd is enabled, and
dont monitor anything when it is disabled.

Change-Id: Ic3f5974320486ff6dd0147c490a1c294cc2f6a76
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/356770
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-07-12 22:34:56 -07:00
Aseda Aboagye
9146e44c7d big: Remove battfake command.
big is running out of space due to some incoming changes.  Remove the
battfake command.

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

Change-Id: Ib8ee7d52a2a9dd3a473508648583b303079e67b8
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/359616
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-12 15:36:53 -07:00
Chris Chen
1b8fa6dbe4 cts: Added sync() function
sync() involves 2 gpios on each board, each labeled
GPIO_HANDSHAKE_OUTPUT and GPIO_HANDSHAKE_INPUT on
their respective boards. They both start low,
then the th wiggles his line up and down, waiting
for the dut to mimic it.

BRANCH=None
BUG=None
TEST=manual
- Connect handshake lines to appropriate
  pins on each board (pins found
  in board's gpio.inc)
- Build tests
- Flash boards
- run 'cat /dev/ttyACM0' in one terminal
- run 'cat /dev/ttyACM1' in another
- They should each have printed
  'successful sync'

Change-Id: I61233bca9605ba89c3628c2a65ca9013c56365ea
Reviewed-on: https://chromium-review.googlesource.com/359355
Commit-Ready: Chris Chen <twothreecc@google.com>
Tested-by: Chris Chen <twothreecc@google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-07-12 11:04:41 -07:00
Mary Ruthven
c88d4e965b cr50: do a soft reset instead of hard when responding to sys_rst_l
Soft reset will not power down Cr50, so it wont assert EC_RST_L when it
reboots. This is a short term solution that fixes the cold vs warm reset
issue, but it does not fix the problem with all of all of the other Cr50
functions disappearing during warm reset. We will need to just reset the
TPM functionality on Cr50 to fix those issues.

BUG=chrome-os-partner:52366
BRANCH=none
TEST=Check asserting SYS_RST_L resets Cr50 and the AP and doesn't reset
the EC. Disable the Cr50 reset when SYS_RST_L is asserted, and verify
that the AP doesn't boot after the first reboot. Enable soft reset when
SYS_RST_L is asserted and verify the AP can successfully reboot many
times.

Change-Id: I7c0d0712ee6df59cfadd3975caf3503d44f3eff2
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359342
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-11 21:28:17 -07:00