Commit Graph

5341 Commits

Author SHA1 Message Date
Bill Richardson
4bc7964f5b Ignore unused private board directories
If we're not building a board from a private subdirectory,
there's no need to include all the private build.mk files.

BUG=none
BRANCH=none
TEST=make buildall (with private subdirectories)

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I39b61d9b26978702717bf463b47979290cadc8dc
Reviewed-on: https://chromium-review.googlesource.com/344662
Reviewed-by: Dominic Rizzo <domrizzo@google.com>
2016-05-13 16:44:15 +00:00
Wonjoon Lee
849ccf7c91 kevin: Add support bmi160 sensor
BMI168 is twins sensor with BMI160. Adding defines, drv.

BUG=chrome-os-partner:52844
TEST="accelread 0" is working on kevin

Change-Id: I8335ea4a766ae88e049791b9231ab752486be9d4
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341650
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-12 20:13:53 -07:00
Wonjoon Lee
7a12b82541 kevin: add more board id
BUG=None
TEST=cmd 'ver' gets proper version on kevin

Change-Id: I2404c57cf2aa939e5255fb70f0e77299ddf0776e
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/343619
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-12 20:13:53 -07:00
Shawn Nematbakhsh
7a698b2253 npcx: shi: Allow up to 10ms from CS assertion to first data byte
Performance in our baseline 4.4 kernel is much worse than previous test
kernels and CS-to-first-byte delay is frequently > 500us. Allow up to
10ms to receive a data byte after CS to reduce the possibility of failed
host commands.

BUG=chrome-os-partner:53181
TEST=Manual on kevin w/ chromeos-kernel-4_4. Verify that "ERR-GTH" rate
is much reduced while spamming "ectool version".
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I92880ccf83a77ee9bdd3d85813e341105857ca4c
Reviewed-on: https://chromium-review.googlesource.com/344410
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 18:45:40 -07:00
Shawn Nematbakhsh
e41ee0e3eb kevin: Handle WARM_RESET_REQ input
Trigger warm reset on WARM_RESET_REQ assertion.

BUG=chrome-os-partner:51926, chrome-os-partner:51923
BRANCH=None
TEST=Toggle input pins from sysfs (GPIOs 11, 38), verify that ISR is called
and proper action is taken.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Change-Id: I38ef06bd99a7885647a27cef1a8371ad96c3f051
Reviewed-on: https://chromium-review.googlesource.com/338924
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-12 17:15:35 -07:00
Shawn Nematbakhsh
541433abaf cleanup: lars / kunimitsu (and _pd): Remove board-level code
Authoritative firmware for these boards can be found on
firmware-glados-7820.B branch.

BUG=chrome-os-partner:49909
BRANCH=None
TEST=`make buildall -j`

Change-Id: I78dddef7bc36ecceb5cd9f0eb07052e8e16b6c15
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343201
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 13:06:45 -07:00
Donald Huang
f36943f95a flash_ec: Add support for it83xx_evb
Add it83xx_evb support in flash_ec script.

BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run
     "~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin"

/* ==SNAPSHOT START== */
(cr) (flashec) donald@donald-nb ~/trunk/src/platform/ec $ ~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin
INFO: Using ec image : ./build/it8380dev/ec.bin
INFO: Flashing chip it83xx.
Waiting for the EC power-on sequence ...CHIPID 8390, CHIPVER 82, Flash size 256 kB
Done.
CHIPID 8390, CHIPVER 82, Flash size 256 kB
Erasing chip...
/100%
Writing 262144 bytes at 0x00000000
Done.
Verify 262144 bytes at 0x00000000
-100%
Verify Done.
INFO: Flashing done.

/* ==SNAPSHOT END== */

Change-Id: I0a76c0ccfcc3726796372ba3b7915a41c64d5766
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/343985
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 00:56:35 -07:00
Mulin Chao
3ccb91fe10 npcx: Fixed bug that unexpected value of timer which source clock is 32K
In rare case, FW read the unexpected counter value of timer which source
clock is 32K (Watchdog timer and ITIM16/32 which use 32K source clock).
The root cause is the clocks between reading registers and timer's are
asynchronous. It has a chance to get invalid counter value when timer is
under transaction edge. The solution is using two consecutive equal
readings to make sure the counter value is valid.

Beside different source clocks of timer, we also found there's chip's bug
which causes unexpected value of timer. If an interrupt that occurs very
shortly before entering deep idle with instant wakeup, it might result in
disruptive execution (such as skipping some instructions or hard fault)
after "wfi". The workaround is adding the same bypass for idle in deep
idle section.

Modified sources:
1. clock.c: Add bypass for instant wakeup from deep sleep.
2. hwtimer.c: Add consecutive reading function for event timer.
3. watchdog.c: Add consecutive reading function for watchdog timer.

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

Change-Id: I7c9f1fb9618a3c29826d8f4599864a8dac4203bf
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/327356
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-11 21:24:32 -07:00
Shelley Chen
b6b6430daa kevin: Shut down AP at AP_OVERTEMP assertion
coreboot will enable AP_OVERTEMP signal when AP
has surpassed a temperature threshold.  These
changes has the EC do an apshutdown when it
detects this signal going high.

BUG=chrome-os-partner:51926
BRANCH=None
TEST=lower AP_OVERTEMP threshold and make sure
     that AP shutdown occurs.
CQ-DEPEND=CL:342797

Change-Id: Ib9c9d03d2df0d670830c0b4eea3eea3ba5bae0b8
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343060
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-11 18:24:39 -07:00
Shawn Nematbakhsh
9494fc0dd1 pwm: Add generic PWM control host commands
Add generic PWM host commands for setting + getting duty cycle. PWMs can
be controlled through index (board-specific meaning) or by type
(currently KB backlight and display backlight are supported, more can be
added as needed).

BUG=chrome-os-partner:52002
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty kb 100` - Verify KB backlight goes to 100%
`ectool pwmgetduty kb` - Prints 100
`ectool pwmgetduty 0` - Prints 100
`ectool pwmsetduty 0 0` - Verify KB backlight goes to 0%
`ectool pwmgetduty kb` - Prints 0
`ectool pwmgetduty disp` - Error res 3 (unsupported PWM type)
`ectool pwmsetduty 1` - Error res 3 (non-existent PWM index)

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I607c92a291e6c2e3af8238eaf22ad2bb81ffc805
Reviewed-on: https://chromium-review.googlesource.com/344012
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-11 18:24:30 -07:00
Vincent Palatin
3e9490031b twinkie: disable tracing when injecting packets
The tracing runs a higher priority task (SNIFFER) than the packet
injection (on CONSOLE task) and both RX and TX are using the same buffer,
so when we are sending a packet, we are getting immediately preempted by
the tracer and bad stuffs happen.

Now, we can manually inject packets and get the text trace of the
response.

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

BRANCH=none
BUG=none
TEST=with the SOP' experimental patch, plug a full-featured cable into
Samus with Twinkie as an interposer, then do the following sequence:
Pretend there is a device
> tw resistor rd 0
Enable the text tracing
> tw trace on
Send discover identity to the cable (and get the descriptors)
> tw sendprime 1 0x104f ff008001
Sent CC1 104f + 1 = 381
165.939687 SRC/0 [0141]GOODCRC
165.942520 SRC/0 [514f]VDM Vff00:DISCID,ACK:ff008041 1c00050d 00000000 030a0000 11082032

Change-Id: Ie0ad57341c6476e983229b532716986dffefa8a1
Reviewed-on: https://chromium-review.googlesource.com/342512
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2016-05-11 18:24:29 -07:00
Wonjoon Lee
61a0b59cac kevin: reduce program size
Reduce size to port motion sensor

BUG=chrome-os-partner:52876
TEST=Can get build image with sensor job

Change-Id: I7ea0248d0067d25c644eb148c50e36514f9b2598
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/342586
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-11 05:40:36 -07:00
Stefan Reinauer
a0e40c7515 mec1322: Don't try to inline pwm_get_keep_awake_mask()
The function is defined in pwm.c but only used outside of
pwm.c, so inlining the function won't work anyways.

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

Change-Id: Ibeea86dd504092f962f24ab1ec4df55088a23290
Reviewed-on: https://chromium-review.googlesource.com/343283
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-05-10 19:42:10 -07:00
Shawn Nematbakhsh
ed91068917 npcx: shi: Fixes for REBOOT_EC host command handling
- For REBOOT_EC and several other host commands, send_response may be
  called multiple times (once for early success notification, one for
  actual notification, if the handler exits cleanly). Ignore calls after
  the first.
- During reboot / sysjump, we're not equipped to handle host commands, so
  disable the SHI interface altogether.

BUG=chrome-os-partner:52878
TEST=Manual on kevin. Verify "ectool reboot_ec RO" (RO to RO = NOP)
succeeds without error messages on EC console. Verify "ectool reboot_ec
RW" causes sysjump without AP going down.
BRANCH=None

Change-Id: Iae83084e4f8d5218600be2a9da7f71dd7872d569
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342622
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-05-10 19:42:06 -07:00
Wonjoon Lee
0f6dce9fe4 driver: bmi160: Add support bmi168
BMI168 is twins sensor with BMI160. Adding chip ID.

BUG=chrome-os-partner:52844
TEST="accelread 0" is working on kevin

Change-Id: Iadb5aeb9bc7be7fb2c6bc23e48ea2510b4bf84df
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341578
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-10 09:34:54 -07:00
Shawn Nematbakhsh
b8154d0246 kevin: Move RAM from data section to code
Kevin is code space constrained, so use RAM normally used for data
instead for code.

BUG=chrome-os-partner:52876
BRANCH=None
TEST=Verify free code RAM becomes 5732 bytes (was 1636) and free data
RAM becomes 3072 bytes (was 7168 bytes) (measured with pending changes
to add sensor task). Also, verify kevin continues to boot + power sequence.

Change-Id: Ia6470a76f95e87d6cda1bf7273deaab6344f8ee9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343191
Commit-Ready: Wonjoon Lee <woojoo.lee@samsung.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-10 09:34:45 -07:00
Stefan Reinauer
65bca9b9fd kionix: Initialize rv in all cases
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
BRANCH=none
BUG=none
TEST=compile tested for Samus

Change-Id: Ib7a0a75a2d63cf8f55d0b59f4a3225da2cb4e70b
Reviewed-on: https://chromium-review.googlesource.com/343282
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-05-09 09:59:42 -07:00
Dino Li
26afde3331 keyboard: it83xx: add COL02 inverted feature
The other chips support this feature so we implement it too.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=The behavior of kso2 is inverted
     if define 'CONFIG_KEYBOARD_COL2_INVERTED'.

Change-Id: I70d1694ca7d3d10278a484a632e88dc204b71b23
Reviewed-on: https://chromium-review.googlesource.com/342488
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-06 18:58:21 -07:00
Mulin Chao
3391ef950a npcx: shi: Improve reliability of SPI host command interface
- Fix output buffer filling races
- Limit response size to 256 bytes to work-around forced low bit on
  257th byte
- Modify CS glitch to handle CS-to-clock delay
- Make CS GPIO interrupt pri 0 to ensure SHI interrupts aren't serviced
  first

TEST=`while true; do ectool version; done > /usr/local/log` on kevin,
verify failure occurs about every ~72000 commands (~360000 host commands)
BRANCH=None
BUG=chrome-os-partner:52372

Change-Id: I5c3d90bf510ed782973b57c2b7497441434c1708
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341492
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-06 18:58:20 -07:00
Bill Richardson
b13f300ca3 Allow TEST_LIST_HOST= to override test targets
When developing or tweaking tests, we almost always need to hack
the Makefiles so that "make runtests" doesn't run *EVERY* test
each time, but only the one we're playing with.

This CL just allows you to override the default test_list_host
values from the commandline. Of course, you shouldn't do this
except when testing the tests themselves.

BUG=none
BRANCH=none
TEST=manual

  # build all boards and run all tests
  make buildall -j14
  # run all tests
  make runtests
  # run only the two specified tests
  TEST_LIST_HOST="lightbar hooks" make runtests

Change-Id: Icd82c2c781a71a461a7d75bc4bd54944b0eaeed6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343003
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-07 00:16:29 +00:00
james_chao
1d8ff93a49 driver/accelgyro_bmi160.c: fix the error handle in read()
The function raw_read_n() return the status, and then check it
it should be saved to the variable ret.

BUG=none
BRANCH=tot
TEST=make buildall -j
Signed-off-by: james_chao <james_chao@asus.com>

Change-Id: I4d2bd200fc49892ae95c63aaeca3af75f7338bec
Reviewed-on: https://chromium-review.googlesource.com/342809
Commit-Ready: BoChao Jhan <james_chao@asus.com>
Tested-by: BoChao Jhan <james_chao@asus.com>
Reviewed-by: BoChao Jhan <james_chao@asus.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2016-05-06 15:01:44 -07:00
Wonjoon Lee
cd2ef5a5fa kevin: Add support for SPI_MASTER on kevin
Enabling SPI_MASTER on SPIP port in npcx

BUG=chrome-os-partner:52844
TEST=spixfer rlen 0 0 1 shows 0xd2 on kevin
BRANCH=None

Change-Id: I3fe333a7d69fe16c2c630c3c2487320a0d1c020b
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341577
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-06 00:25:15 -07:00
Wonjoon Lee
be930e3425 npcx: spi: disable all port from board struct
We have two port(as is FALSH_, ACCEL_) on SPI defines
Let's prevent build error so that We can use particular
enable/disable port

BUG=None
TEST=Buildall is OK

Change-Id: Ib6fe14c4edd91947bde0a2da1c889da31db291a4
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341576
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-06 00:25:15 -07:00
Shawn Nematbakhsh
2c162ddade test: host: Fix sbc_charging_v2 test failure
sb_i2c_xfer() assumes 'out' is a valid pointer, which is only true if
out_size is non-zero.

BUG=chrome-os-partner:51207
BRANCH=glados
TEST=`make buildall -j` w/
https://chromium-review.googlesource.com/#/c/342630/

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia22dcca2b5318b4d69c7afa49f5c8891ab329bd1
Reviewed-on: https://chromium-review.googlesource.com/342635
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2016-05-05 19:16:57 -07:00
Stefan Reinauer
8321eed87b common: Drop unused data structure
SHA256_digestinfo[] is never used but declared static and const.

Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
BRANCH=none
BUG=none
TEST=compile tested
Change-Id: I0bcf419bf63fac3e6eadd9efad10fc05b7be9158
Reviewed-on: https://chromium-review.googlesource.com/342484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-05-05 19:16:50 -07:00
Bill Richardson
9b815745fa Cr50: Lower all runlevel permissions to medium
Two permission registers are already lowered. This adds the
remaining two.

BUG=chrome-os-partner:52994
BRANCH=none
TEST=make buildall; run on Cr50

USB works, SPI works, sleep and deep sleep work, tpmtest.py works.

Change-Id: Ifb27d5be81f10537114f4702addb58c6d7e1630c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342455
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-05 15:10:24 -07:00
Shawn Nematbakhsh
b803590c27 hooks: Add relative HOOK_INIT priority for peripherals
Using HOOK_PRIO_DEFAULT for peripheral initialization necessitates using
HOOK_PRIO_DEFAULT+1 for board-level code. Instead, use a
higher-than-default relative priority for peripheral initialization
outside of board.

BUG=None
TEST=Verify PWM and ADC are functional on kevin.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia8e90a7a866bdb0a661099dd458e3dfcaaa3f6bb
Reviewed-on: https://chromium-review.googlesource.com/342171
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-05 01:12:25 -07:00
Wonjoon Lee
d6546857da charge_manager: Always set active charge port on first pass
Always call board_set_active_charge_port() on the first pass through
charge_manager_refresh(), in case actions must be taken once the
CHARGE_PORT_NONE selection is confirmed.

BUG=None
BRANCH=None
TEST=Attach unpowered peripheral without AC and powerbtn, make sure ap boot-up

Change-Id: I4bcf1d548d7a8c80f4395fc90ff499fce33c8373
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341076
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-05 01:12:24 -07:00
Bill Richardson
3ef613fa44 Cr50: Enable the USB SOF clock auto-calibration
The timer clock nominally requires no firmware settings. It is
tuned in manufacturing to be centered around 24MHz. However, it
will potentially migrate away from 24MHz based upon variations in
temperature and voltage. The variation is approximately
0.1-0.5MHz, based upon functional simulations, and backed up with
observations in the lab. This CL enables a hardware feature to
dynamically tune the timer clock if the device has an active USB
port, by monitoring the SOF (start of frame) USB packets that are
sent by the USB host every milllsecond with 500ppm accuracy.

BUG=chrome-os-partner:50800
BRANCH=none
TEST=make buildall; run on Cr50 hardware

Verified that deep sleep, USB suspend/resume, etc continue to
work with this enabled. Not too surprising, since I've never
encountered a problem without it.

In addition, I monitored XO_CLK_TIMER_CURRENT to see that the
timer adjustments are being made while connecting and
disconnecting from USB, entering andleaving sleep and deep sleep,
etc. They are.

Change-Id: I328b6416bc40ef8718815c5e09cf91ec1c6646f0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342145
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-04 16:15:02 -07:00
Shawn Nematbakhsh
bdbf0810d0 gru: Initial mainboard commit
Clone of kevin w/ minor GPIO / LED changes.

BUG=chrome-os-partner:52736
BRANCH=None
TEST=Verify image boots + sequences on kevin p1.

Change-Id: I7d3f3ce97a8b080516b635a3d2b7bc3c6515c6d9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340542
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-04 16:15:02 -07:00
Shawn Nematbakhsh
15ac27daa1 rk3399: Set power state based on input signals
Use input signals to verify power state and determine power state after
sysjump.

BUG=chrome-os-partner:52878
BRANCH=None
TEST=Manual on kevin.
- Verify AP powers up on 'powerbtn'.
- AP shuts down on 'apshutdown'.
- AP re-powers / resets on 'powerbtn' + 'apreset'.
- AP doesn't shutdown on 'sysjump rw' while in S0.

Change-Id: Id24feb0f8490aa7cb73c46178085ff2e46f8d0a6
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341704
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-04 16:15:02 -07:00
Kevin K Wong
25a4f355e8 npcx: add device id for npcx586g/npcx576g
BUG=none
BRANCH=none
TEST=version command shows the correct chip device id

Change-Id: I312b343f97a99b3ff5ae7d6ec3606cff291b2b55
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/342130
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-05-04 02:42:21 -07:00
Dino Li
32bf8ecb77 board: rename it8380dev to it83xx_evb
Unified board name for IT83-series.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST="make BOARD=it83xx_evb -j" and "make buildall -j"

Change-Id: Ic96d0132fb31fcc8715d0dd810f8bd340035a640
Reviewed-on: https://chromium-review.googlesource.com/341843
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-03 22:00:49 -07:00
Kevin K Wong
e83c06bf90 apollolake: ignore PLTRST# from SOC unless RSMRST# is deasserted
add optional chipset specific function to check if PLTRST# is valid

BUG=chrome-os-partner:52656
BRANCH=none
TEST=make buildall, able to boot to OS on amenia

Change-Id: I7a2747c4f77f50393c3250c2ab0e1625e64e5a41
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/341732
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-03 15:40:46 -07:00
Bill Richardson
b6ad3710c4 Cr50: Enable jittery clock
BUG=chrome-os-partner:52576
BRANCH=none
TEST=make buildall; try on Cr50

I manually tested both highsec and highperf variants, as well as
forcing the bootrom init to run. All the bank registers were
loaded with meaningful values, and none of the SPI or USB
functionality showed any problems.

Change-Id: Ia91ba98ef4c667aec74195c4a7bbf72a5d1c8b2d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342030
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 15:40:44 -07:00
nagendra modadugu
97ba687605 CR50: fix issue in ecc parameter endian conversion
Only convert parameters that aren't NULL.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests in test/tpm_test/tpmtest.py pass & CPCTPM_TC2_2_20_04_05

Change-Id: I7d8133a0068ba50dc47ead7b4ce002d96d868dbe
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/341846
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 15:40:43 -07:00
Nicolas Boichat
427b8f9cd9 elm: Set USB_DP_HPD as input
This makes all board_typec_*dp* functions irrelevant: remove them.

BRANCH=none
BUG=chrome-os-partner:52352
TEST=USB_DP_HPD_C from AP side indicates which output is currently
     in use (native HDMI or ANX7688)

Change-Id: Id60ab97ee9ce987ec4e36e5fd9be9a20908edbfe
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/338868
Commit-Ready: Koro Chen <koro.chen@mediatek.com>
Tested-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-05-03 05:03:08 -07:00
nagendra modadugu
3d030e6409 CR50: remove checks on RSA key buffer size
Remove buffer size checks in _cpri__GenerateKeyRSA().

The TPM stack passes in TPM2B buffers that
may have the size field uninitialized.
Callees are expected to assume that the
buffer size is sufficient for the requested
operation.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=TCG test CPCTPM_TC2_2_20_03_02 reliably passes

Change-Id: I3d9bc2475b82dfaa9ed1d2617b1c333ff4df409d
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340883
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 01:42:52 -07:00
David Schneider
45d9f6afeb Add the lock key to the keyboard mask on kevin
TEST=confirm lock key scancode shows up in matrix
BUG=none
BRANCH=none

Change-Id: I51ef44017ea57abd3cbbc69c55f3d9da7afff42b
Signed-off-by: David Schneider <dnschneid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341469
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-02 21:30:13 -07:00
Shawn Nematbakhsh
8aa04ea278 npcx: Reduce system stack size
Reduce system stack size to 1K to match other recent chips.

BUG=None
TEST=Build + boot on kevin.
BRANCH=None

Change-Id: I0be6e865ca03f4eef2ee7a99856df8257d7269d9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341850
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-05-02 21:30:13 -07:00
Bruce
d539c79960 sb_firmware_update: Set ac flag at fw update mode
Some reason cause the power off during battery fw update process.
Then execute the process again, tool can't detect AC because EC
can't read data from battery. So set AC_PRESS flag after check
battery is in battery fw update mode.

BUG=None
BRANCH=None
TEST=check the battery can execute fw update in this case.

Change-Id: Iafe501eb1719a12425d5cac42d27c897e078acc1
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/341044
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-02 21:30:13 -07:00
Vadim Bendebury
3b1c3ba36f usb_updater: retransmit upgrade blocks if target does not reply
When the target is running upgrade protocol version 2, it is capable
of processing multiple transfer attempts of the same block.

This patch allows timeouts when expecting the target acknowledges. If
the acknowledge does not arrive in time, the host reports the timeout
on the console and retransmits the same block to the target.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=it is now possible to successfully upgrade cr50 on Kevin in one go:
      $  ./extra/usb_updater/usb_updater build/cr50/ec.bin
      read 0x80000 bytes from build/cr50/ec.bin
      open_device 18d1:5014
      found interface 4 endpoint 5, chunk_len 64
      READY
      -------
      erase
      Target running protocol version 2
      Updating at offset 0x00004000
      sending 0x29620/0x3c000 bytes
      Timeout!
      Timeout!
      Timeout!
      Timeout!
      -------
      update complete
      reboot
      bye

Change-Id: Ib1c3179cb3a02c0ae6e5e949476553ae28b6a295
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341583
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
acaec88101 g: enhance upgrade protocol to allow upgrade block restarts
With this new protocol version the target watches the size of the
received messages while reassembling an upgrade block.

If a message of the header size arrives and it is not the last message
of the block, the target considers it a re-start of the block transfer
by the host (presumably because a chunk was lost and the host did not
receive a confirmation of the block transfer in the preceding block
transfer attempt.)

BRANCH=none
BUG=chrome-os-partner:52586
TEST=the upgrade command on the host reports target running protocol
     version 2, upgrades on B1 board still run smoothly.

Change-Id: I2e16c1be5135c0b5a4f09ea293f09ecabf59ecb3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341630
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
de3a96c471 g: verify that first message of each upgrade block is right
When a new upgrade block starts, the host sends first a 12 byte
message including the block size and header.

The target must verify that the message is of the proper size and the
contents make sense (the header is not all zeros). It also should
drain the USB queue completely in case it holds a message of a
different size.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=upgrade still works fine on B1

Change-Id: I80538a3a1a5d507a84bd21b868a3db626bc6a4b0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341619
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
2b326b4461 g: upgrade - improve verification of the first upgrade message
When an upgrade transfer starts, the target expects to receive a 12
byte transfer start message from the host, carrying an empty payload
of all zeros.

The target and host can be out of sync for whatever reason, so when
the target is expecting a transfer start message, the host can be
sending a chunk of a code block instead. In this case the target pulls
just 12 bytes off the receive queue, leaving the rest of the chunk
there, which even more complicates error recovery.

This patch makes sure that when expecting the upgrade transfer start
message the target extracts all receive data from the queue, no matter
how many bytes have been received, and then verifies that the size
matches the expected size, and that the payload is all zeros, to
confirm that the message is indeed the transfer start message.

BRANCH=none
BUG=chrome-os-partner:52586
TEST=cr50 firmware upgrade still works fine on B1

Change-Id: If5ec86d0385f97f0f361635b3903cea3a962b707
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341618
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
b81afce806 g: introduce versioning and backwards compatibility of usb_upgrade
The original version of usb_upgrade does not provide for any error
recovery and also does not support any protocol version notion.

Real life experience has shown that error recovery is essential, it
needs to be introduced as a protocol enhancement. We want to stay
backwards compatible though, so there is a need for protocol
versioning.

In the original version of the protocol target response is always the
same: a 4 byte number which is the error code (and zero means no
error). This patch modifies response to the very first packet from the
host, the startup packet. The startup response is 8 bytes long. The
first 4 bytes is still the same as before, the second 4 bytes carry
the protocol version supported by the target, an integer in network
byte order.

Thus, receiving a 4 byte reply to the startup message tells the host
that the target is running protocol version zero, 8 byte reply carries
the actual version number in the last 4 bytes.

The USB transfer function on the host is enhanced to accept responses
shorter then expected, when allowed.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=usb_updater can successfully update both old and new cr50 images,
     properly reporting protocol version as 0 or 1 respectively.

Change-Id: I9920d2708b21f29615282161fc0eb027018f9378
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341617
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
65118b7f7a g: drop: always start with USB facing external port
We want to be able to communicate with the chip no matter what the
hardware conditions are, otherwise it is easy to lose the ability to
re-program it from the external connector.

With this patch the chip always comes up with the USB interface
exposed and will stay in this mode until debug cable is pulled out.
After that it will honor subsequent cable plug ins/pull out events as
designed.

BRANCH=none
BUG=chrome-os-partner:52281,chrome-os-partner:50700
TEST=Suzy-q reliably creates serial interfaces when the chip is
     programmed with the code including this patch.

Change-Id: I608fb1912f1b2e88f7a207cbfff145760da1a4e4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341580
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
d37d508325 usb_updater: shut down on errors more gracefully and simplify APIs
It might not matter much, but it is a good practice to explicitly
release USB resources when terminating the app which used them.

Also, make function signatures around the file simpler by introducing
a structure to carry common USB endpoint properties: device handle,
endpoint number and chunk size.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=no change in functionality, upgrades on B1 still work fine,
     upgrades on Kevin still very unreliable

Change-Id: I9157774a2f5591c70701ba822f20db6ba02e7029
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341616
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
455767f08f g: fix debug messages not to include two newlines
The CPRITS() macro adds newline to all strings, there is no need to
explicitly add newlines.

BRANCH=none
BUG=none
TEST=usb upgrade debug messages do not span two lines any more

Change-Id: I1991214ddaa5945bedba861d67b392973f6a3d0f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341615
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
42662f2214 g: recover from usb_upgrade interruptions
The usb upgrade protocol is very fragile, any error while transferring
data causes the state machine on the target to lock up, and the only
way to resume the upgrade is to power cycle the device.

With this patch USB callbacks which happen more than 5 seconds since
the previous callback would be considered a start of new transfer,
thus allowing to attempt a new upgrade without the power cycle.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=the following script allows to upgrade successfully:
    $ while not  ./extra/usb_updater/usb_updater build/cr50/ec.bin; do sleep 6; done

Change-Id: Ibe1078cf62073ce89a31416522b0d6917bc923b9
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341572
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:44 -07:00