Commit Graph

6302 Commits

Author SHA1 Message Date
Divya Sasidharan
af848fcce3 anx74xx: Fix typo in anx74xx_check_cc_type function
BRANCH=none
BUG=none
TEST=manual, On Reef connected hoho and made sure it is
properly detected instead of as an accessory.

Change-Id: I1c271a8c5c2800dd88bf0e63a7c7aa2e23551510
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/411382
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-14 22:47:43 -08:00
Ryan Zhang
4a1f5b0927 Electro: Support 360 Degree rotation
Follow Cyan's & Glados's setting.

BUG=chrome-os-partner:59536
BRANCH=master
TEST=system can boot up normally.

Change-Id: I6abfcef06e5b46cb974706b7472c73f00a644544
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/408497
Commit-Ready: Ryan Zhang <ryan.zhang.quanta@gmail.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Mohammed Habibulla <moch@google.com>
Reviewed-by: Vincent Wang <vwang@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-14 22:47:31 -08:00
Mary Ruthven
9495ea7564 cr50: Stop disabling the AP/EC uart when ccd is disabled
This change removes the uart disable in rdd_disconnect. It used to be
necessary because we used to disable device state detection in
rdd_disconnect. Without device state detect we had to disable the AP and
EC uart to make sure there were no interrupt storms. Now we keep device
state detection running all the time. It handles enabling/disabling the
AP and EC uart when it senses the RX signals aren't pulled up.

UART is only enabled/disabled when cr50 detects that the AP or EC state
changed from off to on or on to off. If the debug cable is detached and
then reattched the uart will be disabled on detach, but it won't be
reenabled until the AP/EC are rebooted.

BUG=chrome-os-partner:58222
BRANCH=none
TEST=Detach and reattach suzyq without rebooting the AP or EC and make
sure both consoles come back after reattaching the cable.

Change-Id: Id104e12dc533e8d7047f32aebd41abd1c959d267
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410269
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-14 20:00:40 -08:00
Vijay Hiremath
f61da52856 reef: Enable fast charging profile
Enable fast charging profile config (CONFIG_CHARGER_PROFILE_OVERRIDE)
so that the battery desired current & voltage can be selected for given
rated performance values.

BUG=chrome-os-partner:59779
BRANCH=none
TEST=Manually overrode the temperature and voltage. Observed correct
     charge profile config is selected for each tests.

Change-Id: I080a3ace6d2f77bb6b97911b7705a44ec563258b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410824
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-11-14 20:00:09 -08:00
Bruce
3af2f5e0d4 Snappy: enable tcpc-controlled drp toggle
BUG=None
BRANCH=None
TEST=make buildall

Change-Id: Icdeb4c67234c863128d1d3dd9bdecd149ee866ce
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409733
Commit-Ready: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-13 21:58:31 -08:00
Vijay Hiremath
9b47a0812d skylake: Add support to S0iX based on host commands from Kernel
Picked the code from Glados branch.
 Change-Id: I4bf114235c4d542dd7cf0dad6427c771e54d4611
 https://chromium-review.googlesource.com/#/c/331358/

BUG=chrome-os-partner:59742
BRANCH=none
TEST=make buildall -j

Change-Id: Ib79f1209dfd9e6a9de0438cb1866bba2939e5393
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410036
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-11-13 10:58:58 -08:00
Vijay Hiremath
98402bb466 smart_battery: Add console command to read ManufacturerAccess() data
Added console command to read ManufacturerAccess() data on a given
register block.

BUG=chrome-os-partner:59660
BRANCH=none
TEST=Enabled config on Reef.
     Successfully able to read ManufacturerAccess() data

Change-Id: Ic86ae1b44ca8016634c48b54b1130d30fdd2d3fa
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/409638
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-11-12 23:55:08 -08:00
Bruce
4975e8db75 Pyro: Enable BD9995X power save mode when hibernated
Turn off the charger BGATE when the system is hibernated to
save maximum power.

BUG=None
BRANCH=None
TEST=make buildall

Change-Id: Ifd5d50bbdfde1383538e3ce86f002845798940ac
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409853
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:10 -08:00
Bruce
b7c2f5c295 Pyro: enable tcpc-controlled drp toggle
BUG=None
BRANCH=None
TEST=make buildall

Change-Id: I9a37cffc6018a34ba865d718f488206f06d96087
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409895
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:08 -08:00
Bruce
c6273b6145 Pyro: clear hpd bit in board level tcpc init
PD alternate mode is covered in tcpc interface. So tcpci_tcpm_init()
doesn't reset HPD. If keeping HDMI/DP type-C cable connected, doing
sysjump sets HPD signal to high while it's already high(this high comes
from previous state), then OS doesn't output to HDMI/DP monitor.

BUG=None
BRANCH=none
TEST=make buildall

Change-Id: Ic3bc75b1e5579816d8c1b294fe2eb65a20e3eae3
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409751
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:07 -08:00
Vijay Hiremath
3f728b4ca6 bd9995x: Battery charging profile settings
Added battery charging profile settings as given in the datasheet.

BUG=chrome-os-partner:58553
BRANCH=none
TEST=Manually verified on reef. VBAT is equal to battery voltage.
     Previous/current Charge status is equal to the conditions given
     in the datasheet.

Change-Id: Ie04619a122fe52d6768c03ff5156b368e3f2d340
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/398080
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-12 01:50:27 -08:00
Mary Ruthven
732dced60f cr50: request 0mA instead of 500mA for CCD
This changes the usb descriptor to set the MaxPower to 0mA instead of
500mA.

BUG=chrome-os-partner:59564
BRANCH=none
TEST=Verify 'lsusb -vd 18d1:5014 | grep MaxPower' shows the power is 0mA

Change-Id: Ieeb8dec6c205f4fe51392f8106b3a0ed7d3ea0a5
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410288
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2016-11-11 23:12:02 -08:00
Bill Richardson
12da6c23fb Cr50: Add TPM-compliant commands for console lock
This allows custom TPM commands to be declared using the a
DECLARE_VENDOR_COMMAND macro instead of the original (and still
unchanged) DECLARE_EXTENSION_COMMAND macro.

The new commands are nearly identical, but they are encapsulated
using the vendor-specific protocols described in the TPMv2 spec.
Our original extensions use a non-standard command code, and
return a non-standard struct on completion, which can be
confusing to standard TPM drivers and tools.

Demonstrating the use of the new macros, this adds commands to
obtain the state of the Cr50 restricted console lock, or to set
the lock. There is intentionally no command to unlock the
console.

Note that this CL just adds the commands to the Cr50. We still
need to provide a nice userspace utility for the AP to use.

BUG=chrome-os-partner:58230
BUG=chrome-os-partner:57940
BRANCH=none
TEST=make buildall; load, boot, test, and update again on Reef

On Reef, I can use the trunks_send tool to send the raw TPM bytes
to invoke these commands:

Get the lock state:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000D00000000001000

The last byte 00 indicates that the lock is NOT set, so set it:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000C000000000011

Success. On the Cr50 console, I see it take effect:

  [480.080444 The console is locked]

Query the state again:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000D00000000001001

and now the last byte 01 indicates that the console is locked.

And of course the existing extension commands still work as
before. In addition to uploading firmware, I can use the
usb_updater from my build machine to query the running firmware
version:

  $ ./extra/usb_updater/usb_updater -f
  open_device 18d1:5014
  found interface 4 endpoint 5, chunk_len 64
  READY
  -------
  start
  Target running protocol version 5
  Offsets: backup RO at 0x40000, backup RW at 0x4000
  Keyids: RO 0x3716ee6b, RW 0xb93d6539
  Current versions:
  RO 0.0.10
  RW 0.0.9
  $

Change-Id: I7fb1d888bf808c2ef0b2b07c782e926063cc2cc4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409692
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-11 23:11:51 -08:00
Kevin K Wong
7300bc56c0 reef: enable tcpc low power mode
BUG=chrome-os-partner:55158,chrome-os-partner:55889,chrome-os-partner:55890
BRANCH=none
TEST=on reef use ina (pp3300_pd_a_mw) to check tcpc power consumption

Change-Id: I5a2904f4e549b7da22242848bb3b1887331ecadd
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/399882
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-11 23:11:43 -08:00
Kevin K Wong
3de9c1dcd0 reef/ps8751: Add force wake for PS8751.
If PS8751 goes into low power mode during sysjump, then tcpm_init will
fail since PS8751 is not accessible via I2C, so force it to wake up
during hook_init.

BUG=chrome-os-partner:59693
BRANCH=none
TEST=Verified PS8751 port on reef is functional after sysjump.

Change-Id: I2aa5a80b2ea9c17a01e4cba04493f83cb0a39955
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410132
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-11 23:11:41 -08:00
Nick Sanders
bb3ab2fbc4 sweetberry: add usb power logging interface
This allows logging of power data over sweetberry

BUG=chromium:608039
TEST=log power data
BRANCH=None

Change-Id: I6f642384cbf223959294c7bd99bca0f9206775b8
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/385540
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-11-11 17:20:19 -08:00
nagendra modadugu
d7222a4956 CR50: add a constant time buffer equals implementation
Various cryptographic operations leak timing
information if comparisons are not executed
in constant time.  This change adds DCRYPTO_equals(),
a constant runtime comparator.

Also replace crypto related callsites that used
memcmp() as a binary comparator.

BUG=none
BRANCH=none
TEST=tcg tests pass

Change-Id: I3d3da3c0524c3a349d60675902d1f2d338ad455f
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/410163
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-11 14:27:23 -08:00
Nicolas Boichat
d558d2bee1 hammer: Switch to exponent 3 RSA keys
BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j && bash flash_hammer

Change-Id: I686dbcfa3ad75ce83a997b20a06c22d8a005fccc
Reviewed-on: https://chromium-review.googlesource.com/410580
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-11 05:40:22 -08:00
Kyoung Kim
fa1cec0b60 ISH: fix UART reference clock
UART reference clock is 100KHz for ISH4 and 120MHz for ISH3

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

Change-Id: Ie33e0bd33e0a0c8e56a58fcf4a48677d38c9d61e
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/409594
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-11 00:12:33 -08:00
Wai-Hong Tam
31df657df8 flash_ec: Only check the board in the raiden list if the board not empty
The firmware provision job running in the lab calls the flash_ec
script with the --chip parameter, instead of the --board parameter.
So only check if the board name is in the raiden list if it is a
non-empty board.

BRANCH=none
BUG=chrome-os-partner:58039
TEST=Manually triggered the flash_ec command:
$ flash_ec --chip=npcx_spi --image=${IMAGE} --port=9999 --raiden

Change-Id: I25fef906d93803a94c544f7699ce494a84c46bd8
Reviewed-on: https://chromium-review.googlesource.com/410162
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-11-10 21:28:57 -08:00
Daisuke Nojiri
2ae311c901 eCTS: Test task priority
CTS task wakes up A and C then goes to sleep:

  CTS -> A, C -> A -> B -> C

Since C has a higher priority, C should run first. This should result
in C running one more time than A (or B).

BUG=chromium:663873
BRANCH=none
TEST=cts.py -m task

Change-Id: I89c733ba3aab09b293edf8583d6ed73791531e59
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409535
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-10 21:28:33 -08:00
Daisuke Nojiri
0874f1a197 eCTS: Add task suite
Task A wakes up B and goes to sleep. Task B wakes up C then goes to
sleep. Task C wakes up A then goes to sleep. This is repeated
repeat_count times:

  A -> B -> C -> A -> ...

It's expected all tasks to run exactly repeat_count times. Tick task
runs to inject some irregularity.

BUG=chromium:663873
BRANCH=none
TEST=cts.py -m task

Change-Id: Ib7227f05f09b7a49f8528aff6e6e8d3e6df93ba7
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409534
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-10 21:28:31 -08:00
Nicolas Boichat
d7178e9b5f test/rsa: Add test for RSA with public exponent 3
This tests RSA 2048 with public exponent 3.

BRANCH=none
BUG=chromium:663631
TEST=make run-rsa3

Change-Id: I979ad4a23de6baba63aba037d2713b74fed4737f
Reviewed-on: https://chromium-review.googlesource.com/408130
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-10 21:28:29 -08:00
Nicolas Boichat
ef0f355e47 common/rsa: Add support for exponent 3 RSA keys
These keys are much quicker to verify (259ms to 51ms on a -M0 at
48 Mhz), so they can be used when timing is critical and
verification needs to be performed on the board.

BRANCH=none
BUG=chromium:663631
TEST=make buildall -j && make run-rsa
TEST=make run-rsa3 (next commit)

Change-Id: I0da4b3e21543bb6f7b18e8b6ddc5e153046a61b8
Reviewed-on: https://chromium-review.googlesource.com/408006
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-10 21:28:28 -08:00
Mary Ruthven
5edf3f5a8c cr50: disable sleep
When bus obfuscation is enabled we have the chance of doing a security
reset when resuming from sleep. Since we cannot disable bus obfuscation
on current boards, we need to disable sleep.

BUG=chrome-os-partner:57994
BRANCH=none
TEST=make buildall

Change-Id: I6f49278a9b41c1d15c646838044e34f03b979479
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409576
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-10 18:34:21 -08:00
Jeffy Chen
30f2aced12 charge_manager: send EC_HOST_EVENT_PD_MCU at the end of refresh
When kernel get EC_HOST_EVENT_PD_MCU event and query power state, we may
not done refresh here. Delay EC_HOST_EVENT_PD_MCU event to avoid this
race.

BUG=chrome-os-partner:59499
BRANCH=gru
TEST=Manual on kevin, check power state correct after unplug charger

Change-Id: Ib88acf5a39c2780c6e40144ccebfba17cf84f77c
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/408131
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-10 12:25:35 -08:00
Daisuke Nojiri
5488976a20 eCTS: Add nested interrupt test (High->Low)
Add a nested interrupt test to eCTS. Higher priority IRQ is fired,
followed by lower priority IRQ. Handlers should be executed
sequentially.

P1               *-----*
                /       \
P2             /         *-----*
              /                 \
task_cts ----*                   *----
                 B     C A     D

BUG=chromium:653195
BRANCH=none
TEST=cts.py -m interrupt; make buildall

Change-Id: Ia9f1bf4205cefe8bdc11cc0aa3ad2057359b73ef
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409611
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-09 23:26:31 -08:00
Daisuke Nojiri
b2f14a26b9 eCTS: Add nested interrupt test (Low->High)
Add a nested interrupt test to eCTS. Lower priority IRQ is fired,
followed by higher priority IRQ. Handler executions should be nested.

P1                    *-----*
                     /       \
P2             *----*         *----*
              /                     \
task_cts ----*                       *----
               A      B     C      D

BUG=chromium:653195
BRANCH=none
TEST=cts.py -m gpio, interrupt, timer; make buildall

Change-Id: I34dc7b4e819051b9070a11e69d13d6be704f2e5f
Reviewed-on: https://chromium-review.googlesource.com/408797
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-09 23:26:30 -08:00
Daisuke Nojiri
d57ca41577 eCTS: Pause a few seconds before flushing tty
After a board is reset for setting up a tty port, the host should
wait for a few seconds before flushing the port as the board may
still be booting. This should prevent output from the previous boot
from creeping into a test run.

BUG=none
BRANCH=none
TEST=cts.py -m gpio, interrupt, timer

Change-Id: I1fb567a3a8ddcfff61865b6db3866c56be386c4a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/408759
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-09 23:26:28 -08:00
Nicolas Boichat
f44bc36982 test/rsa: Add test for RSA signature checking
This tests RSA 2048 with public exponent F4 (65537).

BRANCH=none
BUG=chromium:663631
TEST=make run-rsa3

Change-Id: I195a349bb9a862606971054adc9ac3b56a817fe7
Reviewed-on: https://chromium-review.googlesource.com/408129
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2016-11-09 21:14:17 -08:00
Shawn Nematbakhsh
92d91adbdb npcx: hwtimer: Fix 'slow' timer count just before overflow
If our 32-bit usec timer is close to overflow, we may deep sleep several
times in succession without making any adjustment to our count, causing
deadlines on the other side (eg. HOOK_TICK expiration) to be reached much
slower than expected. Avoid this by not entering deep sleep if our timer
is about to overflow. This will result in a <= HOOK_TICK_INTERVAL (200ms
interval) period of not entering deep sleep, every ~4300 seconds.

BUG=chrome-os-partner:59240
BRANCH=gru
TEST=Verify 3x kevin units survive 16 hours in S3 without EC watchdog.

Change-Id: I2126458be8820f78212e19c2bb79242ff1194f6f
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409673
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-09 21:14:09 -08:00
Shawn Nematbakhsh
ebdb6a62aa npcx: Fix hwtimers
- Wait for ITEN bit to be set / cleared, since writing this bit just
  sets a 'request'.
- Ensure ITIM_EVENT_NO reg is set with minimum value 1, per the
  datasheet.
- Don't dsleep if our wake event is in the past (eg. wake event will
  occur any time now)

BUG=chrome-os-partner:59240
BRANCH=gru
TEST=Manual on kevin, verify that dsleep period never exceeds expected
wait period. Also verify that EC watchdog doesn't occur after 5 hours in
S3.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Iedb2723c3f12b74dea66082b1d8b8ce1b6e7d945
Reviewed-on: https://chromium-review.googlesource.com/409672
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-09 21:14:08 -08:00
Daisuke Nojiri
5e8a2255ab stm32f0: Allow change of external int priorities
This change allows each board to customize external interrupt
priorities.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I5941f368ea70a069b34ce1d98508a1fad1ac22da
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/408796
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-09 18:40:00 -08:00
Nicolas Boichat
3857a34873 hammer: Add elan trackpad support
BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j && bash flash_hammer

Change-Id: I8b0e2f3e33f48622097ce698c9548d3e96ac75f1
Reviewed-on: https://chromium-review.googlesource.com/407741
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2016-11-09 04:41:10 -08:00
Nicolas Boichat
de0f53afef driver/touchpad_elan: Basic elan touchpad driver
BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j && bash flash_hammer

Change-Id: I0ff4f48ff1399e054f745ac13ffacf81dffedeab
Reviewed-on: https://chromium-review.googlesource.com/407740
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-08 23:24:52 -08:00
Nicolas Boichat
840ba2b6e4 hammer: Initial checkout
BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j && bash flash_hammer

Change-Id: I8cc11408d28677a800af58e738f47d5dcadea3e6
Reviewed-on: https://chromium-review.googlesource.com/407739
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-08 23:24:50 -08:00
Furquan Shaikh
e3298150ea ec_commands: Add a new host event for extended events
Since we are out of host event bits, add a bit to indicate extended host
event exists. This is put in as a placeholder for now so that we don't
lose out the last available hostevent bit.

BUG=chrome-os-partner:59352
BRANCH=None
TEST=Compiles successfully

Change-Id: If35a246f3da511fde9f8c0bba419afb76a1a9827
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407804
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-08 20:30:09 -08:00
Furquan Shaikh
2fc7ba9df1 common: Add new recovery mode button combination
This adds new key combination (Left_Shift+Esc+Refresh+Power) that triggers
recovery mode by setting a new host event
EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT. This host event can be used
whenever user wants to request entry into recovery mode by
reinitializing all the hardware state (e.g. memory retraining).

BUG=chrome-os-partner:56643,chrome-os-partner:59352
BRANCH=None
TEST=Verified that device retrains memory in recovery mode
with (Left_Shift+Esc+Refresh+Power) on reef.

Change-Id: I2e08997acfd9e22270b8ce7a5b589cd5630645f8
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407827
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-08 20:30:07 -08:00
Gwendal Grignou
bf4e1db093 driver: sensor: Remove set_interrupt
Remove set_interrupt(), was always a noop.
Unused, interrupt is done inside the init routine.

BUG=none
BRANCH=none
TEST=buildall

Change-Id: I0ff4843212ea8140be41dcd17af130991117e3da
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407968
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 17:12:18 -08:00
Gwendal Grignou
9b67ffcd52 common: Add tablet_mode API
Simple API to set/get the tablet mode. It can be set via lid angle
calculation or if a board has a dedicated HAL sensor/GPIO.

Merged from glados branch, add MKBP switch support.

BUG=chromium:606718
BRANCH=gru
TEST=Check with Cave that both mode works.

Reviewed-on: https://chromium-review.googlesource.com/402089
Reviewed-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit c940f36ceabcf2425284001298f03ebdb4c3079e)
Change-Id: I2ee5130f3e0a1307ec3ea543f7a32d66bc32b31d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404915
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 17:11:28 -08:00
Nick Sanders
8bb2d9fbf0 usb_serial: add python console
console.py can access a Google USB serial endpoint
specified by vid:pid and serial number

BUG=chromium:608039
TEST=open console to send and receive text.
BRANCH=None

Change-Id: I735692b7031d73506be2745a2cd5225bfcefd396
Reviewed-on: https://chromium-review.googlesource.com/405030
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
2016-11-08 17:11:15 -08:00
Wonjoon Lee
b044fba33c bd9995*: maintain VBAT voltage as battery maximum
BUG=chrome-os-partner:54248
BRANCH=gru
TEST=Manual on kevin, high temperature chamber(60C),
battery will require 0 voltage because of high temp,
then check 'chgstate' vbat maintained at 8688 mV.

Change-Id: I3b5835701c42a0cd861400ba921b3d3797152bbd
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/400088
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 02:53:54 -08:00
Bill Richardson
c335895df7 Cr50: Let NVMEM take more time and memory
We were getting occasional stack overflow and watchdog timeouts
when clearing NVMEM. Bump up the stack size a bit in the HOOKS
task, and pet the watchdog before invoking the tpm2 init
functions.

BUG=chrome-os-partner:59419
BRANCH=none
TEST=make buildall, manual

Lock the console, then unlock it. This will reboot the EC & AP,
but should never reboot the Cr50.

Before this CL, it did about half the time.
After, it doesn't.

Change-Id: I33adfeb7360bf7d146a55ef16c923a1a0416393d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407847
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-05 21:03:06 -07:00
Vijay Hiremath
cc944ac92a reef: Update battery structure info as in the spec
BUG=chrome-os-partner:59285
    chrome-os-partner:55861
BRANCH=none
TEST=make buildall -j

Change-Id: I2a22f5ef0072793701f4899cd6e669b8cccca78b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/406682
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-11-05 17:41:04 -07:00
Shawn Nematbakhsh
ddc3b3429f elm / kevin / oak: Don't wake from S3 on lid close
BUG=chrome-os-partner:59256
BRANCH=gru
TEST=None

Change-Id: I8e41dc131343e7639850364db27a3ff926164fba
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407078
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-05 14:40:15 -07:00
Scott
4555fe63f5 anx74xx: Modifed tcpm_get_cc function to fix check for 3.0 A type
When attaching a dump (not PD protocol) TypeC charger, the incorrect
charger type was being selected and therefore it was not enabling 3A
charging. I tracked this issue down to the anx74xx_tcpm_get_cc()
function returning a incorrect value. The expected value was
TYPEC_CC_VOLT_SNK_3_0, but instead it was returning
TYPEC_CC_VOLT_SNK_DEF.

The reason the incorrect cc type was being returned is because the if,
else if, construct didn't work properly for the 3A case where the
upper 2 bits are set. Modified this routine to use a case statement
and consolidated the checks for both cc1 and cc2 into one helper
function.

BRANCH=none
BUG=chrome-os-partner:58738
TEST=manual
Connected zinger and guppy chargers and verified correct cc type was
being returned. In addition tested hoho/dingdong adapters as well as
suzyq. Tested both cable orientations to verify that cc1 and cc2
returned the correct values.

With guppy connected, now see this output on ec console:
C0 HARD RST TX
C0 st5
C0 st36
C0 st37
C0 HARD RST TX
C0 st5
[1921.980074 AC on]
[1922.008140 charge_request(8688mV, 9280mA)]
C0 st6
[1922.910539 Ramp p0 st5 3000mA 3000mA]

Change-Id: I8b31c7ce366f383dfcc2f6e850b76a83340a02a1
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406642
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-04 18:31:56 -07:00
Kevin K Wong
72d72ea008 host_command_pd: reduce to 5msec delay in between PD interrupt handling
Since PD task are highest priority, the 50msec delay between was intended
allow other tasks to execute if PD has continuous interrupt. With two
separate TCPC handled by host_command_pd task, interrupt from one TCPC will
block the interrupt handling of another TCPC by this 50msec and cause
error in the PD negotiation.

Reduced to 5msec to ensure TCPC interrupt is handled as soon as possible
while allow other tasks to execute if needed.

BUG=chrome-os-partner:59061
BRANCH=none
TEST=Verify zinger can negotiate to 20V, hoho can get display. Also tested
with faking PD interrupt always asserted to check for watchdog reset.

Change-Id: I9b71277a3d65923f1f5bbfd744b3399e34fd0e6c
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/407542
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2016-11-04 18:31:49 -07:00
Scott
3405c79584 Cr50: I2CS TPM: Ensure HW read fifo is empty for register reads
This change is a safegaurd to ensure that TPM register data is always
placed in the correct location in the HW read I2CS fifo. It is only
checked for 1 or 4 byte regsiter reads. Because of the way in which a
TPM command is sent and the response is read, there are multiple reads
of the STS register prior to reading the TPM fifo register. Therefore
ensuring the fifo has zero depth when 1 or 4 byte regsiter reads,
improves the robustness of the design.

Added a counter to track the number of times the fifo is adjusted and
a new console command 'i2cs disp|rst' to display the count and reset
it to 0 if desired.

Removed section in code for TPM fifo register reads intended to handle
the case where there was a mismatch between how many bytes were copied
into the fifo and the number read by the host. Since the burstcount
field in the status register always contains a valid amount of data
that can be read by the host, there should not be cases where the
host reads less data than was copied from the TPM fifo register. In
the unexpected cases where the host may not drain all of the I2CS read
fifo data during a TPM register read, the I2CS fifo depth will be
corrected the next time that it reads either the access or STS
register which happens prior to the start of any TPM transaction.

BRANCH=none
BUG=chrome-os-partner:57338,chrome-os-partner:59191
TEST=manual
Booted Reef and verfied that TPM functionality is working.

Change-Id: I065a55e64bbcc0cb3357a2bd83447a05400b8899
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382689
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-04 18:31:46 -07:00
Mary Ruthven
f16d6e43d3 g: add permission level checks
The jittery clock and trng security features require high permissions to
be initialized. In the future these initializations and the permission
level drop may be moved to RO.

This change adds permission level checks before trying to access any
registers that require high permission, so when we update RO to change
the permission RW can still function fine.

BUG=chrome-os-partner:59107
BRANCH=none
TEST=Move the permission drop to the beginning of main and verify the
system still boots.

Change-Id: I5b7cb856decd0640288ad3476f875ec9edc42635
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405840
2016-11-04 18:31:44 -07:00
Shawn Nematbakhsh
1f6600fd34 mkbp_event: Properly queue events during host sleep
Don't queue non-wake events, and ensure wake events (and all subsequent
events) always get queued.

BUG=chrome-os-partner:59248, chrome-os-partner:59336
BRANCH=gru
TEST=Manual on kevin, go to suspend, press volume keys dozens of times,
press 'shift', verify device wakes. Place cursor on URL bar, go to
suspend, type "google" quickly, verify device wakes and "google" appears
on URL bar. Go to suspend, press 'VolUp' key 5 times, press keyboard,
verify device wakes and no volume meter is seen on display.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ibe761187fbcefd686776a512786550970a6fc067
Reviewed-on: https://chromium-review.googlesource.com/405717
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit aa2f01566314604404e104d7975c6c755c22a601)
Reviewed-on: https://chromium-review.googlesource.com/407958
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2016-11-04 18:31:37 -07:00