Commit Graph

2965 Commits

Author SHA1 Message Date
Nicolas Boichat
6bbcf5b3f8 hammer: Prefix configuration descriptor with RO/RW section
It is useful for the updater to be able to determine which region
is active without having to use the update interface.

BRANCH=none
BUG=b:35587171
TEST=lsusb -d 18d1:5022 -v -v | grep hammer shows either:
     RO:hammer_v1.1.6441-e58472daf+ or
     RW:hammer_v1.1.6441-e58472daf+
     depending on the image used

Change-Id: I8e1acfbc546330e10ba650b743e3a4c9986b0c30
Reviewed-on: https://chromium-review.googlesource.com/515242
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2017-05-25 18:58:49 -07:00
Nicolas Boichat
95a986ecad hammer: Increase hook stack size
Adding entropy takes up to 1028 bytes of stack, let's increase
the stack size to 1280 bytes.

BRANCH=none
BUG=b:38487027
TEST=Flash hammer. On host, reboot hammer to RO:
     usb_updater2 -r; sleep 0.5; usb_updater2 -s
     usb_updater2 -e (adds entropy)
     EC console: check that rollbackinfo shows secret is updated

Change-Id: I7e2d506e0fcc3152d27ac1796db95df6b1a931d1
Reviewed-on: https://chromium-review.googlesource.com/513808
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-25 18:58:47 -07:00
Duncan Laurie
cb4ff83d5b eve: Implement workaround for broken reset flags
Newer Eve boards will lose VBAT on power cycle and therefore cannot
successfully save the reset flag state.

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

BUG=b:35585876
BRANCH=none
TEST=manual testing on Eve: execute 'reboot ap-off' and ensure that the
AP does not power on.  Also ensure that 'dut-control power_state:rec' works
as expected and does not power off at the recovery screen due to a power
button press.

Change-Id: Ida1563593d802c00280a55a0d24a504c25fab532
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/514504
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-05-25 12:25:20 -07:00
Duncan Laurie
e69058a7a5 eve: Update actual_key_mask for new scancodes
With the updated scancode matrix the keymask needs to be adjusted to
not mask off these particular keys.

BUG=b:36735408
BRANCH=none
TEST=build and boot on Eve
TEST=kbpress 0 3 1; kbpress 0 3 0 reports KEY_LEFTMETA as expected
TEST=kbpress 0 5 1; kbpress 0 5 0 reports MSC_SCAN but no key yet
(as expected because the kernel does not handle it yet)

Change-Id: Iba78741b8a0cd1248a799cf5219cee59ea6630ec
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/514502
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-05-25 12:25:20 -07:00
Nicolas Boichat
4fd6f23101 hammer: Store secret in rollback block
Also, increase console task stack size, as adding entropy
requires 780 bytes of stack.

BRANCH=none
BUG=b:38486828
TEST=Flash hammer
     rollbackinfo => 1 version 0 block, 1 empty block, RW verifies
           correctly.
     rollbackupdate 0; rollbackinfo => No change
     rollbackupdate 1; reboot => RO refuses to jump to RW
     rollbackinfo => Secret is [00..00] on both block (so the data
                     was copied correctly)
     rollbackupdate 2, 3, 4; rollbackinfo => Writes alternate
           between the 2 blocks.
     rollbackupdate 2 => Refuses to downgrade version
TEST=From blank secret [00..00], 'rollbackaddent Hello' updates it
         to [ba..fa], which matches the output of:
         (dd if=/dev/zero bs=1 count=32; echo -n Hello) | sha256sum

Change-Id: If63346dfab0a28aa82a7b4c2e46ca89fde3eb990
Reviewed-on: https://chromium-review.googlesource.com/511986
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-25 04:27:41 -07:00
Nick Sanders
81b2654dc9 mn50: socket controls
Add console and usb_spi commands to enable or disable IOs
to the socket, so that it will not be powered if a chip is inserted,
and control reset and boot_cfg.

BUG=b:36910757
BRANCH=None
TEST=Check no voltage when socket is disabled. Full spiflash compatibility.

Change-Id: Ie4ce0613a868030833abfdccd827acce2753dc6f
Reviewed-on: https://chromium-review.googlesource.com/509072
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-05-25 00:14:07 -07:00
Daisuke Nojiri
c78562ff60 Fizz: Power on ethernet port
This patch sets GPIO_LAN_PWR_EN to output/high to power on
the ethernet port at start.

BUG=b:37646105
BRANCH=none
TEST=Measured V3P3A_LAN is 3.3V.

Change-Id: I9629a72d1ffefd1ca2aeb8d2d1f5d74a953d7e58
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/514622
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-05-24 22:07:15 -07:00
Daisuke Nojiri
8e60deda9d Fizz: Prevent active charge port from being reset
Fizz needs to set available power on type-c/pd before PD task starts.
PD task tries to reset available power at start-up. This patch prevents
those reset attempts from disabling already initialized power sources.

BUG=b:37316498
BRANCH=none
TEST=Boot Fizz on barrel jack and type-c adapters

Change-Id: I807f9d5ae4b4530fa80479b4e1a669569be841c1
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/513582
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-24 22:07:15 -07:00
Furquan Shaikh
9a4f6e8e2e poppy: Fix tcpc power mode handling for ANX
ANX has specific sequencing requirements for PWR_EN and RESETN when
entering active and standby modes. The order in which the two GPIOs
were set did not match the spec. Update board_set_tcpc_power_mode to
ensure correct ordering for both the modes.

BUG=b:62043928
BRANCH=None
TEST=make -j buildall

Change-Id: Ifc2991da87c7b7facd3384f752792371efb9fe1e
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/513477
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-05-24 16:16:05 -07:00
Nicolas Boichat
e58472daf8 hammer: Better RO/RB/RW split: 44/4/80 kB
Let's future proof hammer a bit: current flash usage, after
applying uncommmited patches, is about 36/50 kB for RO/RW respectively.

Let's change the RO/RB/RW layout from 64/4/60 kB to 44/4/80 kB.

BRANCH=none
BUG=b:38489464
TEST=Enable CONFIG_CMD_FLASH and force WP_L low.
TEST=flashwrite 0xa000 0x100 => ok
     flashwp true; reboot
     flashinfo => ro_at_boot ro_now
     YYYYYYYY YYY..... ........ ........
     flashread 0xa000 0x100 => Incrementing numbers 0->255
     flasherase 0xa000 0x800 => error
     flashread 0xa000 0x800 => Incrementing numbers 0->255
TEST=(rollback)
     rollbackupdate 2 => works, rollbackinfo is correct
     flashwp rb; reboot
     flashread 0xb000 0x100 => Rollback info followed by 0xff
     flasherase 0xb000 0x800 => error
     flashread 0xb000 0x800 => Unchanged
     rollbackupdate 3 => fails
TEST=(rw)
     flashwp rw; reboot
     flashinfo => all_at_boot all_now
     flashread 0x0c000 0x100
     flasherase 0x0c000 0x800 => Access denied
     flashread 0x0c000 0x100
     flashread 0x1f800 0x100 => 0xff
     flashwrite 0x1f800 0x100 => Access denied
     flashread 0x1f800 0x100
TEST=(norw)
     flashwp norw; reboot
     flasherase 0x0c000 0x800 => ok
     flashread 0x0c000 0x100 => 0xff
     flashwrite 0x0c000 0x100
     flashread 0x0c000 0x100 => Incrementing numbers 0->255
     reboot => RW does not verify anymore
TEST=(norb)
     flashwp norb
     flasherase 0xb000 0x800
     flashwrite 0xb000 0x100
     rollbackinfo => block 0 shows incorrect values.

Change-Id: I915ffe3032e6a70f761c5f7ea2940feaae58366b
Reviewed-on: https://chromium-review.googlesource.com/510413
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-23 21:59:45 -07:00
Vincent Palatin
563456c658 eve_fp: add more fingerprint host commands
Move the existing fingerprint host command in the driver and
add more of them to prepare the new fingerprint architecture.
The commands are mostly stubbed for now.

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

CQ-DEPEND=*364728
BRANCH=none
BUG=b:35648259
TEST=make BOARD=eve_fp (with and without a private repository)
do a fingerprint image capture with 'fptest'.

Change-Id: Ie17a5fde2d6470c6272e8059bddc845cea07aff2
Reviewed-on: https://chromium-review.googlesource.com/491071
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-23 05:57:13 -07:00
Nicolas Boichat
0ce33d0e87 hammer: Do not define CONFIG_ROLLBACK_UPDATE for RW section
BRANCH=none
BUG=b:35586219
TEST=make newsizes saves ~420 bytes on hammer and staff.

Change-Id: I69a757cc8eb0545cfbb73df04ac36ea6e68ae933
Reviewed-on: https://chromium-review.googlesource.com/511984
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-23 05:57:13 -07:00
Nick Vaccaro
9a0d0aa70d common: sensors: add extra sensor attributes
Adds min_frequency and max_frequency to struct motion_sensor_t.

New attributes min_frequency and max_frequency are now returned in
ectool's MOTIONSENSE_CMD_INFO response.

Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3.

Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's
header file.

BRANCH=none
BUG=chromium:615059
TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin,
make buildall -j passes.

Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/482703
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-05-18 21:05:23 -07:00
Nick Vaccaro
d7eefeffb9 gru: disable CONFIG_CMD_ALS to reduce bin size
Gru ran out of room with upcoming change, disabled CONFIG_CMD_ALS
to free up the needed space and keep build from breaking.

BRANCH=none
BUG=chromium:615059
TEST=verified gru target build doesn't run out of flash space using
"make buildall -j"

Change-Id: Ifb76ad0fe4693dfa4415370354c6d5af2bd4cc11
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/490846
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-05-18 21:05:22 -07:00
Scott Collyer
56dc7a3ef6 servo_v4: Added support for HW board ID and limit on VBUS voltage
The first two versions of servo_v4 (red and blue) have the TPD2E001
ESD between VBUS and CC1/CC2. This part has a breakdown min voltage of
11V. Therefore for these versions of servo_v4, need to limit VBUS to
less than the default 20V value.

This CL adds support to read two board ID gpios attached to the gpio
expansion part. The max VBUS voltage is limited to 9V for red/blue and
allowed to be 20V for black.

BUG=b:38351574
BRANCH=servo_v4
TEST=Manual
Modified a servo_v4 to add the 2 new pullup resistors. Tested with
this unit and with a unit that does not have the pullups. Verified
that without the pullups the version ID reads a 0 and the max VBUS
voltage that will be requested by the CHG port is 9V. Wih the modified
servo_v4, verified that the version reads 3 and the CHG port will
request up to 20V.

Change-Id: Ic41fcbe3a5c000282552c7322b5ab18ebb203cd2
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/507027
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2017-05-18 18:08:04 -07:00
Daisuke Nojiri
30f6c60bcb power_button: Allow PB to be idle at power-on
This change adds CONFIG_POWER_BUTTON_INIT_IDLE. When it's set,
the system starts with the power button state idle. It means
when the board boots from power-off, it stays at G3.

BUG=b:37536389
BRANCH=none
TEST=Power on Fizz. Verify it stays at G3. Verify it boots
by pressing power button.

Change-Id: I09a62a69d9f201b2dc261838cc9b4425fe3a8dc1
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/486945
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-05-18 18:08:01 -07:00
Dino Li
432f3f4686 it83xx: ec2i: move 'ec2i_setting' to header file of chip
This enum can be included in common.

BUG=none
BRANCH=none
TEST=build boards: it83xx_evb and reef_it8320
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>

Change-Id: Id7014b7de170cb3324c45d43fbf04ebe48a69f5e
Reviewed-on: https://chromium-review.googlesource.com/505864
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-05-18 18:07:53 -07:00
Duncan Laurie
a457573b0c eve: Shut down PMIC in hibernate
Instead of using EC hibernate shut down the PMIC over I2C.

This will turn off the DSW rail and the EC completely.  The existing
wake sources are still able to wake the system.

BUG=b:35647896
BRANCH=none
TEST=manual testing on Eve board to ensure that wake sources that
are expected to wake from G3 are still functional.  (AC, power, lid)

Change-Id: I91b14ec360190176dba0a8e7c458b2b0ab5b6dcd
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/506719
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-18 18:07:29 -07:00
Duncan Laurie
a082274af6 eve: Enable mutable scancode for EVT boards
Enable the mutable scancode sets for EVT boards and reassign the
existing F13 scancode to instead send the new 0[e0 58] 1[e0 07]
scancode instead.

BUG=b:36735408
BRANCH=none
TEST=manual testing on Eve EVT to ensure that the key that used
to send F13 now sends the new scancode.  Also test on P1 to ensure
that the key still sends F13.

Change-Id: Ia134db7b069d5bf10c931ee7ce66dd1ea85d3544
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/506718
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-18 18:07:29 -07:00
Nicolas Boichat
11237d5e91 hammer: Make keyboard work at firmware screen
First, libpayload expects the keyboard interface index to be 0.

Then, hid_iface_request needs to reply to USB_HID_DT_HID request
with the content of struct usb_hid_descriptor. With current code,
the variable name is generated (and therefore hard to guess), so
we create a new set of macros so that we can use a specific
variable name.

Also, add support for HID Get_Protocol and Set_Protocol, as they
are compulsory for devices supporting boot protocol, even though
those are mostly no-op for now.

Finally, add a note regarding USB HID keyboard boot protocol, to
make sure that we do not accidentally change the report format.

BRANCH=none
BUG=b:36538963
TEST=Keyboard works in FW screen, both trackpad and keyboard
     still work when AP has booted.
TEST=hammer/staff can still be updated (both RO from RW, and RW
     from RO)

Change-Id: Ibea4888385909c9ce3b430464e5805c039d4b9ed
Reviewed-on: https://chromium-review.googlesource.com/505796
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-18 06:03:52 -07:00
Nicolas Boichat
0b077ad671 poppy/soraka: Basic LED support
This applies the simple rule: Charging port led is on, other
is off. When charging, LED is amber, otherwise it's white.

Open questions:
 - Do we want blinking on low battery? On which side(s)? In
   which AP states?
 - No blinking in S3? That's ok?
 - Need to add led blinking support for special debug mode
 - Recovery mode blinking does not work as LED is powered from
   a rail that is not on when AP is in S5.

BRANCH=none
BUG=b:37970194
TEST=Charge from one side, led is first amber, then white when
     battery is full. Switch side, led behaves the same way.

Change-Id: I0531d72cd621148c0d0cce57a32b7310792d9936
Reviewed-on: https://chromium-review.googlesource.com/497372
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-18 06:03:52 -07:00
Mulin Chao
6959f42da6 npcx7_evb: Add initial board driver of npcx7 ec evb.
Add the evaluation board driver of npcx7 series ec for testing. If you
received the evb which ec is 128-pins package, please notice it has
the following limitations.

a. No GPIOD7/E0 pins.
b. No I2C4_0, I2C4_1, I2C5_1 and I2C6_1 ports.
c. No ADC7, ADC8 and ADC9 channels.
d. No JTAG port 1.
e. Do not enable CONFIG_HIBERNATE_PSL since no PSL circuit on evb.

This CL also includes:
1. Modified reset config from srst to sysresetreq in openocd/npcx.cfg.
   Make sure openocd driver can reset ec by using NVIC_SYSRESETREQ.
2. Add flash utilities for npcx7 ec in openocd/npcx_cmds.tcl.
3. Add npcx7_evb support in flash_ec.

BRANCH=none
BUG=none
TEST=Passed all npcx7 drivers verification on the evb no matter which
     ec's package is 128 or 144 pins package.

Change-Id: I8224d97cd66ce483d70816f47b2e124308f1b69c
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/505832
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-18 06:03:51 -07:00
Dino Li
59c04665c6 reef_it8320: initial reef_it8320 board
This change is based on reef's board code and modified for it8320.

BUG=none
BRANCH=none
TEST=Run the entire faft_ec suite and passed.

Change-Id: I8977d7431eb0a97ceb4ee1dfd11a2c4433687db0
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/487792
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-05-18 02:26:10 -07:00
Nicolas Boichat
9774484d29 poppy: ACCELGYRO3_INT_L is always on gpio 36
dabc580d7e "poppy: Add ARC++ sensor support." accidentally moved pin
from gpio 36 to 30. When updating gpio.inc for rev1, I accidentally
thought the pinout had been changed. Let's fix this.

BRANCH=none
BUG=none
TEST=Boot on poppy and soraka

Change-Id: I6f44acdcfa7bc8f21144b26887eda503a350a6b0
Reviewed-on: https://chromium-review.googlesource.com/497232
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-18 02:26:10 -07:00
Nicolas Boichat
12a8ab8a5c usb_hid_touchpad: Add config options to set dimensions
In principle, trackpad dimensions (logical and physical), can be
probed from the trackpad at runtime, but this would slow down setup
time, as we need to wait for the trackpad to be initialized to read
those. Also, we do not have a framework to generate HID report
at runtime, and a new base with new trackpad would probably require
a new overlay anyway.

Also, set appropriate (temporary) values for both hammer and staff.

BRANCH=none
BUG=b:38277869
TEST=Connect hammer/staff to host, correct logical dimensions are
     shown in evtest, and resolution is always 32.

Change-Id: I39b84274d71ca2f4e285f3324c0841331aae9bc1
Reviewed-on: https://chromium-review.googlesource.com/505856
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-18 02:26:08 -07:00
Daisuke Nojiri
760c89fe37 Fizz: Set up charge suppliers at boot
Fizz has two power sources: barrel jack and type-c port. It
selects a power source at boot and does not dynamicall switch
to the other ports after that.

Fizz initializes all power suppliers of all ports to zero then
initialize the source supplier (barrel jack or type-c port).

When both sources are provided, it prefers a barrel jack. This
detection is done by reading the voltage on PPVAR_PWR_IN.

If barrel jack is detected as a sink, type-c port works as a
source only. If type-c port is detected as a sink, type-c
port works as a sink only.

Fizz does not have a battery. So, battery module is removed.

BUG=b:37573548,b:37316498
BRANCH=none
TEST=Boot on both type-c & barrel jack.

Change-Id: If4f5ff0c6019d06ac9dacb5dd365f5aa96bffef3
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/499547
2017-05-17 19:06:31 -07:00
Dino Li
120ce3eaa0 board: reef_it8320: copy board/reef
copy board/reef and modified for 'pre-upload.py'.

BRANCH=none
BUG=none
TEST=build all.

Change-Id: I76618610f443c7d4bb1b7b507c71f3d74d639667
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/501607
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-05-17 19:06:25 -07:00
Mary Ruthven
2c33693bb3 cr50: remove code that was used to work around sys_rst issues
Cr50 holds the EC in reset when it wants to flash the EC or AP. This
will trigger a pulse on the tpm reset signal. In early Cr50 versions
when the tpm was reset we would reboot cr50, so we added some code to
prevent cr50 from resetting itself when the update was going on.
sys_rst_asserted would check if there was an update going on and ignore
the signal if update in progress was true. At the end of the update the
deferred function was used to reset Cr50 after the update was complete.

None of this is needed anymore. We can just release the EC from reset at
the end of the update. This change removes usb_spi_update_in_progress
and the deferred update_finished.

BUG=b:35571516
BRANCH=none
TEST=flash the bob ec and ap using ccd.

Change-Id: I79416dba178c06bbc7289ad96968ee4e61947c4c
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/506571
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-05-16 20:55:50 -07:00
YH Lin
9fd645a005 ec: add initial coral related files
For now use the files from reef. To be changed later on.

BRANCH=none
BUG=b:38271615
TEST=emerge-coral chromeos-ec

Change-Id: Iff0a7b21b575d6394c27ff9959010496801fd056
Reviewed-on: https://chromium-review.googlesource.com/506117
Commit-Ready: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-05-16 20:55:50 -07:00
Vadim Bendebury
7456475f99 cr50: drop obsolete/addressed TODOs
There many TODOs sprinkled in the code, some of them have been
addressed or do not apply any mode. This patch removes them.

BRANCH=cr50
BUG=none
TEST=built and ran cr50 on reef

Change-Id: Ica6edb204e5cc0cc9dc7f0d43fd39e7ddaf56809
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/506496
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-16 13:37:03 -07:00
Nicolas Boichat
cb9bd66ec6 hammer: Add staff board
hammer corresponds to poppy, and staff corresponds to soraka.

Current differences (hammer/staff):
 - USB id (5022/502b)
 - PWM frequency (10kHz/100Hz):
   - On staff, driving PWM at 10kHz leads to an actual duty cycle
     around 30-40%, with a PWM output at 1% (long rise/fall time).
     100Hz looks better, we get ~1.45% duty with 1% PWM output.

BRANCH=none
BUG=b:38277869
TEST=Flash staff, boots fine.
TEST=pwm 0 1 shows quite dim backlight on staff.

Change-Id: I66ba2adf89fbee8578ee473afb28e3e242b4d111
Reviewed-on: https://chromium-review.googlesource.com/505855
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-16 07:47:05 -07:00
nagendra modadugu
ed1532bf81 CR50: replace dcrypto_memset with always_memset
always_memset() implements a version of memset
that survives compiler optimization.  This change
replaces instances of the (placeholder) call
dcrypto_memset() with always_memset().

Also add a couple of missing memsets and
fix related TODOs by replacing memset()
with always_memset().

BRANCH=none
BUG=none
TEST=TCG tests pass

Change-Id: I742393852ed5be9f74048eea7244af7be027dd0e
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/501368
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2017-05-15 17:34:30 -07:00
Nicolas Boichat
f660c8e5b0 hammer: Add pull-up on write protect pin
We don't have an external pull-up on WP_L, so let's use an internal
one instead.

BRANCH=none
BUG=b:35582031
TEST=gpioget WP_L shows 1 as default value, servo can control
     value, and when servo is not driving the pin, value goes back
     to 1.

Change-Id: I75148cde9ab89c1dfb05f3182608894a3e1390fa
Reviewed-on: https://chromium-review.googlesource.com/502849
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-15 03:56:41 -07:00
Marius Schilder
a30bb73e78 cr50: add LONG_LIFE bit to suppress RO uart.
BRANCH=None
BUG=None
Change-Id: Icfb20bff28a593c9058d67ad09f188c567b7401c
Reviewed-on: https://chromium-review.googlesource.com/454240
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-05-12 20:58:06 -07:00
Daisuke Nojiri
c2f640c159 Fizz: Add LED control
This patch adds code to control the power LED.

BUG=b:37646390
BRANCH=none
TEST=Verify LED turns green, red, amber, off. Verify LED turns green
or off when chipset is on or off, respectively.

Change-Id: I1d7940d9bb4414d97c541ead802efeb8f279533e
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/486947
2017-05-12 20:58:01 -07:00
Daisuke Nojiri
05a8637ca0 Fizz: Add recovery button
Cr50 masks the recovery button signal on a proto board when the
power button is being pressed (b:37682117). This bug has to be
fixed for the recovery button to work.

BUG=b:37274183
BRANCH=none
TEST=make buildall

Change-Id: Ia413ffce84d67b6f24f983ccce8ae8277452ac2c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/494069
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-12 18:46:14 -07:00
Nick Sanders
8df3b161e9 mn50: initial checkin
This firmware supports a board used to initialize firmware on new cr50
parts.

BUG=b:36910757
BRANCH=None
TEST=boots on scribe board, spi/usb/uart/i2c functionality works.
TEST=cr50 boots on reef, CCD EC+AP SPI/UARTS work

Change-Id: I48818225393a6fc0db0c30bc79ad9787de608361
Reviewed-on: https://chromium-review.googlesource.com/437627
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-05-12 03:25:39 -07:00
Daisuke Nojiri
44b9f9df83 Fizz: Enable/disable USB Type-A ports
This change makes Fizz enable USB type-A ports on resume and disable
them on shutdown.

BUG=b:38226666
BRANCH=none
TEST=Boot Fizz off of USB flash drive on a USB-A port.

Change-Id: I7f22438271ffc080e950f5f300937d89706e08a4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/481078
2017-05-11 20:01:33 -07:00
Daisuke Nojiri
bb1b65a177 charger: Add dedicated (non-type-c) charger
This patch adds a dedicated charge port. The number of such ports
is specified by CONFIG_DEDICATED_CHARGE_PORT_COUNT. It works as a
sink only. The total number of charge ports is represented by
CHARGE_PORT_COUNT.

BUG=chromium:721383
BRANCH=none
TEST=make buildall. Boot Fizz off of barrel jack.

Change-Id: Ibbb11f3e1c66e35b5abe190e49161eeaa2009994
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/501468
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-11 17:15:47 -07:00
Nicolas Boichat
1c929523a2 poppy: source 3A on one port
Add a new source policy to provide 3A if there is only one port used
as a source.

Also ensure that the load switch on VBUS when sourcing power is properly
configured to limit the current to 1.5A or 3.0A depending on the case.

BRANCH=none
BUG=b:35585396
BUG=b:35577509
TEST=On soraka (rev1), connect any USB device on port 0. On port 1
     attach C-C cable to MacBook Pro. MacBook Pro charges at ~1.5A.
     Disconnect USB device on port 0, MacBook Pro charges at 3A.
TEST=On soraka (rev1), connect USB key on port 0, see it enumerating,
     plug another USB key on port 1, it enumerates too, and the device
     on port 0 does NOT disconnect/re-enumerate.
TEST=Repeat 2 tests above, but starting with port 1.

Change-Id: I48e744c8edec89bc0a53b54c47f666ad53e47551
Reviewed-on: https://chromium-review.googlesource.com/481563
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-11 09:40:31 -07:00
Daisuke Nojiri
5b7e50ba20 Fizz: Initialize board directory
Noteworthy changes:
* Remove motion sensors
* Remove MKBP keyboard
* Temp sensor (TMP432)
* Remove BC1.2
* One TCPC port (PS8751)
* Remove lid switch
* Remove backlight
* Switch PMIC to TPS650830

BUG=b:37271713
BRANCH=none
TEST=Boot Fizz off of barrel jack.

Change-Id: Id3b1ab1d10ad52786d75dc04bc3115c80ea31ee4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/459114
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-10 14:24:37 -07:00
Nicolas Boichat
57bcc097f1 poppy: Update detection values for rev1
rev1 uses 604K pull-up on lid, 30.1K pull-down, 1% tolerance, so
we can just reuse rev0 detection interval. We can consider narrowing
the interval as rev1 should have tighter tolerance.

BRANCH=none
BUG=b:35582031
TEST=make BOARD=poppy; make BOARD=soraka
TEST=Soraka (rev1): Base is detected.

Change-Id: I7c3950a0b4c0bd0e1140e4a51447a3483cccc603
Reviewed-on: https://chromium-review.googlesource.com/500014
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-10 07:08:28 -07:00
Nicolas Boichat
80d50a5919 soraka: Add battery information
BRANCH=none
BUG=b:35585396
TEST=soraka EC boots and charges battery

Change-Id: I06e0ce7cb143ee039fecada0b4e15a64bcf5968b
Reviewed-on: https://chromium-review.googlesource.com/497530
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-10 07:08:28 -07:00
Daisuke Nojiri
9c48895225 button: Allow board to define recovery buttons
This patch declares recovery_buttons array, where each board
lists recovery buttons. Pressing those while the board reboots
makes the system enter recovery mode.

BUG=none
BRANCH=none
TEST=buildall

Change-Id: I1f204156efbd6d2a507d67ba90f75ce857b03559
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/486944
2017-05-09 23:20:08 -07:00
Daisuke Nojiri
e8982ea3cd Allow lid-less configuration
power_button_x86.c and switch.c assume there is a lid switch. This
patch separate them so that a board with power button but with no
lid can be configured properly.

This patch also moves backlight control to the board directory
so that only the boards with a backlight turn it on/off when power
state changes.

BUG=none
BRANCH=none
TEST=boot fizz. make buildall.

Change-Id: If4070cdc4b1221fae68b35ec3497335d81f192fd
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/489602
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-05-09 23:20:07 -07:00
Vincent Palatin
600df851c5 Eve,Gru,Poppy,Reef: forbid DR_SWAP in RO firmware.
Currently, when we jump from RO to RW, we forget our USB PD state.
To recover from this, we send a SOFT_RESET (resetting the counters...),
then either the USB PD partner is happy about it and we can continue,
or it will issue a HARD_RESET to recover from our mismatched vision of
the current connection (e.g wrong role) resulting in a reset of VBUS.

The following use-case is still problematic:
if the system is not write-protected (ie it does USB PD negotiation in
RO EC) and we have no battery (or fully drained-one) as buffer, when we
are connected to a PD power supply, if it issues the HARD_RESET
mentioned above, we are going to brown-out.
It's happening with power-supplies supporting DR_SWAP, the RO EC will
negotiate a power-contract (as a sink), then try to reverse data role
(from UFP to DFP) to identify the power-supply. We end-up being
Sink/DFP, then when we sysjump to RW, we reset roles and send the
SOFT_RESET as Sink/DFP, the power-supply identifies the incorrect data
role and issues the HARD_RESET browning us out.
As a workaround, now we never ask for the DR_SWAP in RO firmware and
stays Sink/UFP.
This is not affecting regular write-protected machines (which are not
doing USB PD in RO EC). For developers, we are no longer doing the
DR_SWAP in RO mode, this is mostly innocuous for a regular power-supply,
but this would break the docking use-case. Normally, we will do it as
soon as we have jumped to RW, so the dock should still work unless the
developer is using the machine with RO EC (eg EC development with
soft-sync disabled).

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

BRANCH=reef
BUG=b:35648282
TEST=Boot Snappy without battery. Verify RO image doesn't swap
data roles and soft reset issued by RW image as SNK/UFP is
accepted by the HP adapter.

Change-Id: Id184f0d24a006cd46212d04ceae02f640f5bda65
Reviewed-on: https://chromium-review.googlesource.com/461142
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
2017-05-09 20:36:42 -07:00
Nicolas Boichat
8c980fc5af hammer: Disable boot keys and runtime keys
Those keys aren't very useful on hammer.

BRANCH=none
BUG=b:37422577
TEST=Flash hammer
TEST=make newsizes shows 280 bytes size decrease on hammer/RW.

Change-Id: I859c999ce796af53b9290cc5215f9b28a815b638
Reviewed-on: https://chromium-review.googlesource.com/495969
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-08 07:04:07 -07:00
Nicolas Boichat
3f89130c34 poppy: Improve debounce logic and handle side-band wake signal
First, improve debounce logic to only notify AP on base detection
change.

Then, handle side-band signals. For that purpose, base EC pulses
detection pin for 100 us to signal out of band USB wake (that
can be used to wake system from deep S3). We filter these, and
only consider a single ~100us during a debounce interval to be
a valid out-of-band signal.

BRANCH=none
BUG=b:35775062
TEST=Flash hammer and poppy, connect them together. Put poppy in
     deep S3 (powerd_dbus_suspend), hammer can wake poppy on
     key press.
TEST=Change hammer's board_usb_wake to send invalid pulses (too long,
     too short, multiple pulses within 5ms), and see that all those
     pulses are ignored.
TEST=Check that PP3300_DX_BASE is 0 when base is not connected,
     and 1 when it is connected.

Change-Id: I20bf4151134099f52fe8fe0332524aa1ca5f7d63
Reviewed-on: https://chromium-review.googlesource.com/490130
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-05 03:10:59 -07:00
Nicolas Boichat
db7b881214 poppy: Add new set of detection values for rev1
rev1 uses 600K pull-up on lid, 10K pull-down, 1% tolerance, let's
adjust the detection interval accordingly.

Let's also widen rev0 detection interval upper bound, based on
experimental values.

BRANCH=none
BUG=b:35582031
TEST=make BOARD=poppy; make BOARD=soraka
TEST=Poppy: Base is detected, despite the fact that ADC shows 187.

Change-Id: Ic2122f0b480414a0ec8fa351fbaa5aa79e90eb65
Reviewed-on: https://chromium-review.googlesource.com/495926
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-05 03:10:58 -07:00
Scott Collyer
2cd098a60b eve: Enable TCPC low power mode
This mode had to be disabled for P1 because of leakages on PP3300_A
that affected the voltage levels on the CC lines. With EVT the leakage
issues have been resolved and now this feature can be enabled.

BUG=b:35648532
BRANCH=none
TEST=With lidopen attached sink only adapter to port 1. Then executed
'lidclose' via the EC console and verified that the port went into low
power mode as expected. In addition, without adapter connected,
verified that when in low power mode the EC console was not flooded
with low power messages.

Change-Id: I281497cc6fe251d48c4ea737c7b4242200d39421
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/496947
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-05-04 21:38:50 -07:00