Commit Graph

7644 Commits

Author SHA1 Message Date
Randall Spangler
1154a307e1 cr50: Split EC state machine into its own file
The device state machines aren't quite similar enough to use common
code.  Split the EC state machine out, the way we split out BattPrsnt
and CCD_MODE.

BUG=b:35587387
BRANCH=cr50
TEST=manual
	Pull CCD_MODE_L high, so Cr50 detects/enables CCD
	Pull EC_DETECT high.
	reboot -> 'EC RX only', then 'EC on' at 1 second

	Pull EC_DETECT low --> See 'EC off' message
	ccd --> EC UART disabled

	Pull EC_DETECT high --> See 'EC on' message
	ccd --> EC UART RX+TX

	Pull EC_DETECT low for <1 sec then back high
	(don't see EC off/on messages)
	ccd --> EC UART RX+TX

	Reboot with EC_DETECT still low -> EC off at 1 second

	Reboot with EC_DETECT still low and then assert EC_DETECT
	within a second -> EC RX only, then EC connect at 1 second.

Change-Id: I71687e651d625cadd656934f4cb2bbadc0b58816
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/619750
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-25 19:54:11 -07:00
Rachel Nancollas
07d646ced0 zoombini: fixed gpio.inc to make power enables push-pull
Made EN_PP3300_TRACKPAD, EN_PP3300_WLAN, and EN_PP3300_WWAN push-pull
and added USB1_ENABLE.

BUG=None
TEST=Check to make sure power enables are not floating.
BRANCH=None

Change-Id: I5e63b61a83e4c5504cead6d7b28d087fc5538c3b
Signed-off-by: Rachel Nancollas <rachelsn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/630056
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-08-25 14:21:38 -07:00
Caveh Jalali
e4997a631e anx3429: read chip firmware version during init
fetching the chip firmware version toward the end of the chip
anx74xx_tcpm_init() sequence is a good place to do this.  we need this
info in any case and this is a safe place to access device registers
and cache the values.  subsequent chip firmware queries typically
return the cached value.  also, tcpci_tcpm_init() is already
structured this way.

TEST=verified with follow-up CL that firmware update succeeds and new
	version is reported

BRANCH=none
BUG=b:35586895

Change-Id: Ic3fd07bbf8a220bfd506d59d8a1f3ea25b14e94c
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/634513
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-25 12:09:03 -07:00
li feng
dd1f41a03b core/minute-ia: add __image_size
For system using core/minute-ia, build will fail since __image_size is
not defined. If later this variable is used, should adjust its value
properly.

BUG=none
BRANCH=None
TEST=Build passed for Soarka ISH which uses core/minute-ia.

Change-Id: I8e179e0bac551a46d93ca10ba8b61b4ebade74fc
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/595151
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-24 23:06:40 -07:00
Caveh Jalali
68dfee896e anx74xx: enable driver "release".
TEST="make buildall" succeeds, "make runtests" passes for reef.

returning SUCCESS instead of UNIMPLEMENTED from .release() means the
pd_task() is allowed to reinitialize the TCPC when coming out of
PD_STATE_SUSPENDED or similar scenario.

TEST=verified anx3429 firmware update succeeds, USB port still usable
	for charging after update.

BRANCH=none
BUG=b:35586895

Change-Id: I1a624ccf25dfa6468de72f8564f936bc0a35edb1
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/596797
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-24 17:20:42 -07:00
Mary Ruthven
611887143a cr50: add board property functions
Add some board property functions that describe what behavior we are
checking instead of just using board_use_plt_rst. More devices are
getting deep sleep support. This changes some function names to make the
transition easier.

This change adds board_use_deep_sleep and board_detect_ap_with_tpm_rst.
Right now both of these just call board_use_plt_rst. This will
eventually change with the expansion of deep sleep to new devices.

BUG=none
BRANCH=cr50
TEST=run firmware_Cr50DeepSleepStress with 10 suspend/resume cycles

Change-Id: I8d9ef23f686dea788d26ac4973054ad027fdd3a4
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/633891
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-08-24 17:20:42 -07:00
Aseda Aboagye
abd7e7d582 g: Change rdd 0.4V ref to 0.3V.
On some boards, it was seen that SuzyQable wasn't detected by the rdd
block.  The voltage around 0.4V is marginal with a Vbus around 4.75V.
This commit simply adjust the 0.4V comparator reference voltage to 0.3V
in order to make the detection work.

BUG=b:64847312
BRANCH=cr50
TEST=Find a soraka where SuzyQable didn't work.  Verify with this patch,
it does work.  Additionally, verify that servo_v4 continues works.

Change-Id: If54630ec469408031cd84ffb93ef5fea42bdee3b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/633403
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-24 17:20:41 -07:00
Randall Spangler
1029239bc1 g: Move chip pre-init to chip_pre_init()
Currently, chip/g uses jtag_pre_init() to do some chip
pre-initialization that isn't actually related to JTAG.  This has been
harmless, but it's currently the only chip which actually does "JTAG"
pre-init, and we'd like to get rid of that.  So, move that
functionality to a new optional chip_pre_init() function.

BUG=chromium:747629
BRANCH=cr50
TEST=make buildall
     boot cr50
     make all dis; confirm chip_pre_init() is called early in <main>

Change-Id: I3cae0747ab0c3cc974fce9f108947207b38e035f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/629876
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-24 11:29:02 -07:00
Furquan Shaikh
c859c057e1 poppy: Enable base on sysjump
Now that we enable base only on chipset state transition, sysjump
needs to be handled in a special way. On sysjump if chipset is already
in S0, then enable base right away.

BUG=b:64987346
BRANCH=None
TEST=Verified that base is enabled and connected on sysjump. Tablet
mode events work again in evtest.

Change-Id: I917b0ca84d2735a4f2b32ecea3d310eccb7c008c
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/631218
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-24 01:25:52 -07:00
Che-yu Wu
4f21ee309c extra/stack_analyzer: Show indirect calls.
Show the indirect calls found in disassembly.

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         --export_taskinfo=./build/elm/util/export_taskinfo.so \
         --section=RW \
         --annotation=./extra/stack_analyzer/example_annotation.yaml \
         ./build/elm/RW/ec.RW.elf
     make BOARD=elm SECTION=RW \
         ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
         analyzestack

Change-Id: Ib82e68e0bc6c4be56ab679c297f256cbfe94bbb7
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/628048
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-24 01:25:51 -07:00
Ryan Zhang
f9a2ef2347 Coral: Fix FAFT failure for firmware_ECUsbPorts
+ Follow Change#386854
+ Remove gpio41: gpio41 is used for ADC and already exist.

BUG=b:64738358
BRANCH=master
TEST=`make -j BOARD=coral`, `firmware_ECUsbPorts` passed on santa MB
Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>

Change-Id: I1c08c68c5449a94a333aca3384a48244450155ab
Reviewed-on: https://chromium-review.googlesource.com/613061
Commit-Ready: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2017-08-23 23:13:41 -07:00
Che-yu Wu
eeeee803b7 extra/stack_analyzer: Show callsite information.
Show callsite details in the call trace.
Handle another addr2line failure output.

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         --export_taskinfo=./build/elm/util/export_taskinfo.so \
         --section=RW \
         --annotation=./extra/stack_analyzer/example_annotation.yaml \
         ./build/elm/RW/ec.RW.elf
     make BOARD=elm SECTION=RW \
         ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
         analyzestack

Change-Id: I3f36584af85f578f1d298bcd06622ba8e7e5262d
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/628000
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-23 23:13:38 -07:00
CHLin
1f5ea1619b npcx: Don't enable CONFIG_CMD_FLASH_TRISTATE when internal flash is used
The bit controlling the tri-state of FIU pins is reserved when the
internal flash is used and should not be modified. This CL adds a
compiler error to prevent this kind of misuse.

BRANCH=none
BUG=none
TEST=No build errors for "make buildall". "BORAD=npcx7_evb make" with
CONFIG_CMD_FLASH_TRISTATE defined, make sure the error message is
printed.

Change-Id: I020c8ab9e02b9a377879bbd2a337943e77a369d6
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/624828
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 21:17:23 -07:00
Scott Collyer
8eea86766b coral: Enable TCPC init to happen in pd_task init
This CL enables the config option CONFIG_USB_PD_TCPC_BOARD_INIT and
modifies the board level tcpc init function to wait up to 2 seconds
to ensure that the battery is out of its disconnected state.

This change was put into Eve to ensure the PD chips are not reset until
the battery is out of disconnect and delay start of the pd_task
(and PD negotiation) until the battery is out of disconnect state.
This is part of a change was initially done on Eve
https://chromium-review.googlesource.com/c/592716.

For Coral the delay of tcpc init relative to the PD task also
addresses an issue where VBUS would be dropped by the external charger
when attempting to boot with no battery connected. When no battery is
connected there is a timing issue between the Analogix TCPC and the EC
related to when the TCPC sends its auto GOODCRC. This results in a
hard reset which causes the drop of VBUS.

BUG=b:64375688
BRANCH=none
TEST=Tested by Bitland using 500 iterations and showed no occurrence
of the hard reset causing VBUS to drop. Prior to this CL, the failure
rate was 1 out 300 attempts.

Change-Id: I28fe3266eb1c0a2940e1bdacee65cf4e642d3483
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627115
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-23 21:17:23 -07:00
Scott Collyer
0aa4bfe9a3 tcpc: Move board level TCPC init to happen in pd_task init
When the board level TCPC run as an init hook it will frequently
lead to an EC reset when we are trying to recovery a disconnected
battery, potentially even a reboot loop with the most unlucky
timing.

If we instead call it from the pd_task before tcpc_init is called
then the board init hook can stall the pd_task init until the
battery is out of disconnect mode, or giving up after 2 seconds
in case the battery never seems to recover.

This accomplishes two goals: ensure the PD chips are not reset until
the battery is out of disconnect and delay start of the pd_task
(and PD negotiation) until the battery is out of disconnect state.

This change was done in the Eve FW branch. Pulling it into TOT so it
can be used for other boards that have the same
issue. https://chromium-review.googlesource.com/c/592716. The change
to wait for the battery to be out of disconnect mode is in the board
specific board_tcpc_init() function and so will be in subsequent board
specific CLs.

BUG=b:63957122
BRANCH=none
TEST=manual Verify that 'make buildall' is successful.

Change-Id: I14c3dbb89cdc05fa9231fbe9db2e1de19fa941b6
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627114
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-23 21:17:22 -07:00
Scott Collyer
6d286d157c battery: Check physical battery presence before inhibiting power
In order to satisfy factory testing requirements we need to
boot a bare board with just an AC adapter without requiring
a power button.

However we also don't want to always allow booting of the
battery is present but cut-off (which will indicate BP_NO so
we can't use the existing battery_is_present function) or has
critically low level as it may not immediately boot.

To accomplish this add a function that allows the board to
specify a custom "hardware presence" for the battery that is
separate from the battery presence check.

This CL is taking a change done for Eve and pulling into TOT so it can
be used for other projects that have the same
requirements. https://chromium-review.googlesource.com/c/582544

BUG=b:63957122
BRANCH=none
TEST=manual

Change-Id: Ib1dc4f659adbf0eebd3dc8c3c61b39b8fa36cb4a
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627113
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-23 21:17:22 -07:00
Philip Chen
c361021498 scarlet: Enable waking up AP by power button
Meanwhile, we can disable waking up AP by key press,
because there is no keyboard.

BUG=none
BRANCH=none
TEST=when AP is in S3, verify 'powerbtn' command on
ec console can wake up AP

Change-Id: I60c58458cf6f7e1f16b5129c8748b386c9928415
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627675
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 19:04:20 -07:00
Nicolas Boichat
bee02b49b0 usb_updater2: Add support for INJECT_ENTROPY command
Necessary for pairing support. Cleaner implementation to be moved
to hammerd.

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: I7b354c7bb1b6d4260939dc33fe6cb4ab4ecd50e0
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/513809
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
2017-08-23 19:04:17 -07:00
Caveh Jalali
2668e5aeea pd_control: make DISABLE port specific
this makes the PD_CONTROL_DISABLE subcommand of EC_CMD_PD_CONTROL port
specific like all the other subcommands already are.

the only place depthcharge uses PD_CONTROL_DISABLE is in anx7688.c and
that code already passes the correct chip ID along, so this will not
affect the current use case.  ectool already does the right thing as
well.

TEST=used ectool to verify each port can be disabled independently.

BRANCH=none
BUG=b:64956885

Change-Id: I6514eb300793b8958ed78846298ec5b95f78e6dc
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/616259
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 19:04:16 -07:00
Randall Spangler
af85b4f30e cr50: Don't enable GPIO interrupts by default
Each GPIO interrupt should only be enabled after its state machine is
ready to accept interrupts.  Enabling them all by default may cause
undefined behavior if an interrupt occurs before state machine init.

Also, EC_TX_CR50_RX was enabled, and then explicitly disabled in
board_init() because we didn't want it.  Simpler only to enable the
interrupts we do.

BUG=b:35587228
BRANCH=cr50
TEST=boot cr50; manually wiggle platform reset and the detect GPIOs
     and see that interrupts are still generated.

Change-Id: If810eb6fee9945f0c6dfe0d4b592bdc5ff4be6e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/619749
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-23 17:01:21 -07:00
Randall Spangler
b91ff0a480 cr50: Refactor Rdd state machine
The code to mirror Rdd detect into CCD_MODE_L and handle keepalive is
now inside chip/g/rdd.c It uses a HOOK_SECOND state machine similar to
what's coming for EC/AP/Servo.

This also removes the explicit 'ccd enable' / 'ccd disable' commands,
since they'd be overridden by the HOOK_SECOND handler.  If you need to
force CCD enabled, use 'ccd keepalive enable'.

BUG=b:64799106
BRANCH=cr50
TEST=With a CR50_DEV=1 images:
	Disconnect CCD cable (pull RDCC1 and RDCC2 outside 0.2-2.0V)
	gpioget --> CCD_MODE_L = 1
	ccd --> CCD disabled

	Connect CCD cable --> see 'Debug accessory connected'
	gpioget --> CCD_MODE_L = 0
	ccd --> CCD enabled

	Briefly disconnect and reconnect CCD cable --> No debug output
	gpioget --> CCD_MODE_L = 0
	ccd --> CCD enabled

	Disconnect CCD cable and wait a second --> 'disconnected'
	gpioget --> CCD_MODE_L = 1
	ccd --> CCD disabled

	Force CCD_MODE_L = 0 externally, wait a second
	gpioget --> CCD_MODE_L = 0
	ccd --> CCD enabled

	Stop forcing CCD_MODE_L externally, wait a second
	gpioget --> CCD_MODE_L = 1
	ccd --> CCD disabled

	ccd keepalive enable
	gpioget --> CCD_MODE_L = 0
	ccd --> CCD enabled

	ccd keepalive disable
	gpioget --> CCD_MODE_L = 1
	ccd --> CCD disabled

Change-Id: I65110b45e76f60390828e0fbbac8f36fc2cc9b37
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/619393
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-23 17:01:21 -07:00
Scott Collyer
c592ced088 coral: Read SKU ID at initialization time
BUG=b:64705535
BRANCH=none
TEST=Tested two boards with different strapping resistors and verified
that the SKU ID logged in the EC console matches the expected values.

Change-Id: I3534e99856f25dbef810b97a2e4b90c00a65f32e
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627664
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-08-23 12:19:09 -07:00
Jeffy Chen
219a774169 power/rk3399: Fix wrong return state when POWER_S3S0 failed
Currently we are returning POWER_S3S0 when POWER_S3S0 failed, which
would cause dead loop.

Return POWER_S0S3 instead to avoid that.

BUG=b:64886507
TEST=build and boot

Change-Id: Ia6567ee6edd399c0eb39e88006436753fa303507
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/625637
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 12:19:08 -07:00
Philip Chen
13269c2117 scarlet: Enable RTC console/host commands
BUG=b:63908519
BRANCH=none
TEST=on scarlet, manually test 'rtc'/'rtc set' on ec console and
'ectool rtcget/rtcset/rtcgetalarm/rtcsetalarm' on ap console.

Change-Id: Ie7de53895bd0ef88af32b74d8410e2e735d1bda4
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627640
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-08-23 12:19:08 -07:00
Philip Chen
e505cb3662 chip/stm32/clock: Support RTC console/host commands
Add the driver for RTC console/host commands on stm32f0.

BUG=b:63908519
BRANCH=none
TEST=on scarlet, manually test 'rtc'/'rtc set' on ec console and
'ectool rtcget/rtcset/rtcgetalarm/rtcsetalarm' on ap console.

Change-Id: I71035c91ed69fa5f65448618ff8bd1a37427eaad
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/627637
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-08-23 12:19:08 -07:00
Vadim Bendebury
52527acbfb cr50: log I2C slave 'wedged bus recovery' event
We want to be able to collect statistics of the i2c bus problems. This
patch logs an event each time the wedged bus recovery happens.

BRANCH=cr50
BUG=b:63760920
TEST=with the upcoming patches verified that i2c recovery events are
     logged as expected.

Change-Id: I1241b2dece33f89cd724d53a48f94e17f4415c62
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/620114
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 12:19:07 -07:00
Vadim Bendebury
e24bd63fae cr50: log tpm reset event
Use the previously introduced TPM logging framework to log TPM reset
events. The two lowest data field bits are used to communicate the
type of reset passed to tpm_reset_request(),

BRANCH=cr50
BUG=b:63760920
TEST=with the upcoming patches verified that TPM initialization is
     logged as expected

Change-Id: Ic0874723ec6df616a8237b036542398b29fe5ccc
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/620113
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-23 12:19:07 -07:00
Nicolas Boichat
940b88754c chip/stm32/i2c-stm32f0: Further adjust 400kHz setting (48Mhz clock source)
It turns out SCLH = 0x5 is still a little fast (411 kHz on hammer),
let's update it to 0x6.

See 5e6f9a2b38 "chip/stm32/i2c-stm32f0: Adjust 400kHz setting (48Mhz clock source)"
for details.

BRANCH=none
BUG=b:36172041
TEST=Measure I2C speed to be <400 kHz on hammer

Change-Id: I2b5acc532963c407144b8e2a7786d3e2302192d3
Reviewed-on: https://chromium-review.googlesource.com/625507
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Toshak Singhal <toshak@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-23 06:23:26 -07:00
Nicolas Boichat
9ea128966b hammer: Pull down PWM output pin
Some staff boards were accidentally built with both pull-up and
pull-down stuffed, leaving the backlight output always on when
the EC is not driving the pin.

This "fixes" the issue by adding an internal pull-down on the pin,
so that the pin is pulled low whenever the PWM is disabled.

BRANCH=none
BUG=b:64845198
TEST=staff EC console:
     pwm 0 -1 => backlight is off
     pwm 0 0 => backlight still off
     pwm 0 100 => backlight full intensity
TEST=Power consumption with PWM disabled (pwm 0 -1) and always 0
     (pwm 0 0) are comparable.

Change-Id: I32549bfc037a6506470408f8e98cae5ae56006e2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/627345
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-08-23 00:04:09 -07:00
Nicolas Boichat
9c1cf6def5 usb_hid_keyboard: Add support for boot protocol report
In boot protocol mode, we must only send the first 8 bytes of the
report. Also, go back to report mode on USB reset.

When mode is changed, we immediately toggle keyboard endpoint,
to make sure the appropriately sized packet is sent (otherwise,
a longer packet packet will be sent once, which confuses AP
firmware).

BRANCH=none
BUG=b:62004286
BUG=b:64953295
TEST=Flash hammer, check that keyboard works at firmware screen
     and in the OS, and that new key works in OS.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>

Change-Id: If7d6aa6c2dd127b9de34fc93d06bc0dd6e6128a2
Reviewed-on: https://chromium-review.googlesource.com/627344
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-08-23 00:04:07 -07:00
Nick Sanders
493b974124 sweetberry: modify powerlog.py to support multiple devices
powerlog.py can now take -A serialA -B serialB to collect data
from both left and right sweetberries simultaneously.

Also, the Spower class has been modified to allow API usage
rather than console only usage.

BRANCH=None
BUG=chromium:608039
TEST=log from both sweetberries on marlin

Signed-off-by: Nick Sanders <nsanders@chromium.org>
Change-Id: Iaeaddad223f35f0e5cad1549b85fa3f7e4d5e1c7
Reviewed-on: https://chromium-review.googlesource.com/422496
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-08-22 21:34:43 -07:00
Sam Hurst
b59ba48d7e extra: Add Dummy RMA reset auth challenge-response application
Dummy RMA reset application that's used by the RMA Server
Side implementer. Currently everything is hard coded in the app.
This application will be replaced when the actual app is ready.

BUG=b:37952913
BRANCH=none
TEST=make buildall -j
     ./rma_test
     Board Id:
     Z Z C R

     Device Id:
     T H X 01 01 03 08 fe

     Server Key Id:
     10

     Server Private Key:
     47 3b a5 db c4 bb d6 77
     20 bd d8 bd c8 7a bb 07
     03 79 ba 7b 52 8c ec b3
     4d aa 69 f5 65 b4 31 ad

     Server Public Key:
     03 ae 2d 2c 06 23 e0 73
     0d d3 b7 92 ac 54 c5 fd
     7e 9c f0 a8 eb 7e 2a b5
     db f4 79 5f 8a 0f 28 3f

     Challenge:
     CC5QQ LALUS BUPJC TWSYN PAPPN AUEVZ HEMUD GD5DK
     DSM5C VH4SZ LJAZL GDUYM U4JPK FJUCA 2AEAS GCH8W

     Authorization Code:
     P5PSCTS6

     Challenge String:
https://www.google.com/chromeos/partner/console/cr50reset/request?challenge=CC5QQLALUSBUPJCTWSYNPAPPNAUEVZHEMUDGD5DKDSM5CVH4SZLJAZLGDUYMU4JPKFJUCA2AEASGCH8W&hwid=HWIDTEST2082

     Enter Authorization Code: abcd

     Code is invalid

     Enter Authorization Code: P5PSCTS6
     Code Accepted

Change-Id: Id4141861b53745cf7bb67a885fa01dd6f4b4cd04
Signed-off-by: Sam Hurst <shurst@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/622283
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Michael Tang <ntang@chromium.org>
2017-08-22 21:34:42 -07:00
Philip Chen
13f49164ad charger/rt946x: Disable battery thermal protection
We'll handle cell temperature from fuel gauge/battery side.

BUG=b:64806333
BRANCH=none
TEST=monitor charge current through 'battery' console command

Change-Id: I82944de8d1e8834ca1f75c1f616b220e55d94f0e
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/626725
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-08-22 21:34:42 -07:00
Vadim Bendebury
4ec14d890e signer: no need to sign dev images any more.
The chromeos-cr50 ebuild does not install dev images any more, and
chromeos-cr50-scripts do not try updating dev versions of H1 any more.
Let's stop releasing dev Cr50 images.

BRANCH=Cr50
BUG=none

TEST=tried creating a release image in the release branch, got a
     tarball of the desired contents:

   $ tar tf cr50.r0.0.10.w0.0.22_ZZAF_ffffffff_00007f80.tbz2
   cr50.r0.0.10.w0.0.22_ZZAF_ffffffff_00007f80/
   cr50.r0.0.10.w0.0.22_ZZAF_ffffffff_00007f80/cr50.bin.prod

Change-Id: Ib2acaf5f31f7067a98c35c0ec83e730736398a7d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/624193
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-22 16:43:59 -07:00
Furquan Shaikh
844b03dd0e poppy: Enable/disable power to base on chipset startup/shutdown
Instead of always enabling power to base whenever it is connected,
enable/disable power to base depending upon chipset startup/shutdown.

BUG=b:64460667
BRANCH=None
TEST=Verified following:

1. On system startup, base is connected only after chipset startup.
2. On apshutdown, base is disconnected after chipset shutdown.
3. Wake from base still works.
4. Base still works on firmware screen.

Change-Id: I39454701889650964b7c678b275c984772ecd3e7
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/625244
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-22 16:43:58 -07:00
Furquan Shaikh
1fb39a4247 poppy: Return early from base_detect_change if status is unchanged
If current status is the same as requested state, then return early
from base_detect_change without taking any action.

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

Change-Id: I3c403739a2e5c43f31fe77b5633927cf49b974eb
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/625243
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-22 12:38:47 -07:00
Scott Collyer
af6024cc08 coral: Remove volume up/dn button flip in gpio.inc
The Coral schematics are being changed to reflect that volume up is
connected to GPIO83 and volume down to GPIO82. The current EC code
implemented this same assignment, but introduced an intermediate
signal name to match with previous schematics which had the opposite
assignment. With the signal names fixed on the schematic, the
intermediate #defines are no longer needed.

BUG=b:64012307
BRANCH=None
TEST=manual testing on Coral proto. Verified that up button presses
cause the volume bar to go up and volume down button presses cause the
volume bar to go down.

Change-Id: Ib04f8416e8f36271972fc650bf1593a4babaeb82
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/625063
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-08-22 12:38:46 -07:00
Che-yu Wu
00e0222729 extra/stack_analyzer: Fix cbz/cbnz and addr2line parsing.
Fix the cbz/cbnz operands parsing.
Parse the discriminator output of addr2line.

BUG=none
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py

Change-Id: Iade1c14db0dc63fa65ef0f5df778b4f4f1e4f802
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/625498
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-22 05:08:48 -07:00
Che-yu Wu
ef09835e19 ec: Add annotation feature to the stack analyzer.
Get stack analyzer supported to read annotation file and do basic
annotation on the callgraph.

The basic annotation includes:
1. Add missing calls to the callgraph
2. Ignore functions on the callgraph

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         --export_taskinfo=./build/elm/util/export_taskinfo.so \
         --section=RW \
         --annotation=./extra/stack_analyzer/example_annotation.yaml \
         ./build/elm/RW/ec.RW.elf
     make BOARD=elm SECTION=RW \
         ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
         analyzestack

Change-Id: I4cc7c34f422655708a7312db3f6b4416e1af917f
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/614825
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-21 23:48:14 -07:00
Mulin Chao
20c3de1c36 npcx: bypasses for SHM reading fail via eSPI and CSAE impact efficiency
In eSPI systems, when the host performs a data read from the Shared
Memory space, the returned data may be corrupted. This is a result of
the Core-to-Host access enable bit being toggled (by toggling CSAE bit
in SIBCTRL register) during an eSPI transaction. The bypass for this
symptom is to set CSAE bit to 1 during initialization and remove the
toggling of CSAE bit from other EC firmware code.

But keeping the CSAE bit at 1 forever also impacts the eSPI performance
a lots. When the core clock is stalled by sleep, deep sleep or wfi
instruction, the eSPI Peripheral Channel transaction is stalled if this
bit is set. The bypass for this symptom is to wake up the core by eSPI
peripheral channel transaction and let eSPI module handle the remaining
packet.

BRANCH=eve
BUG=b:64730183
TEST=No build errors for make buildall. Flash poppy ec image, make sure
     it can boot to OS. Run "ectool version" over 100000 times, no error
     occurs. Use following script "count=0; while :; do echo "---
     iteration --- $count"; time flashrom -p ec -r ec.bin; sleep 5;
     count=$((${count}+1)); done" to test eSPI performances over 1000
     times. No errors occur and all tests' efficiency are the same as
     removing CSAE bypass.

Change-Id: I1b9051c5a3d368a5917882d9d1c3bb00481a53ad
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/620301
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-21 23:48:13 -07:00
Divya Sasidharan
577a741855 glkrvp: Enable USB MUX PS8743 driver
Add Parade PS8743 USB Type-C Redriving Switch for USB Host /
DisplayPort.

BUG=b:64598680
BRANCH=glkrvp
TEST=On glkrvp,
     Connect Apple dongle and verify mux setting with i2c read.
     1. i2cxfer r 1 0x20 0 -> 0x50 (DP/USB enabled)
     2. flip i2cxfer r 1 0x20 0 -> 0x54 (Flip bit enabled)
     Connect pluggable and verify the same.
     Similar testing was successful on second type-c port.

Change-Id: I96ec380024eb659e071b019dd58b3c640fa1cc03
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/616075
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>
2017-08-21 22:03:53 -07:00
Vijay Hiremath
59ce941927 tcpm: Configure board specific post TCPC init
Some boards have TCPC configurations post TCPC initialization.
Added code to support those configurations.

BUG=b:64531818
BRANCH=glkrvp
TEST=Manually verified on GLKRVP. External GPIOs of PTN5110
     are configured properly.

Change-Id: I3da1c171839f22cf183dacf390cf033becddce0f
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/624557
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>
2017-08-21 22:03:53 -07:00
Vijay Hiremath
309289df45 glkrvp: Enable TCPC using NXP PTN5110 AIC
BUG=b:64531818
BRANCH=glkrvp
TEST=TCPC can negotiate to 20V & 2.25A

Change-Id: I16510a510133bbb1827634303a6b9d02dec4bbc6
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/614311
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>
2017-08-21 22:03:53 -07:00
Stefan Reinauer
e11682bc01 BUILDCC fragments should include core/host
This will prevent userland code to pull in includes
from core/stm32 etc.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
BRANCH=none
BUG=none
TEST=make buildall -j

Change-Id: I450b17baf579cbaee04c253c1e86d998f6e329da
Reviewed-on: https://chromium-review.googlesource.com/618270
Commit-Ready: Stefan Reinauer <reinauer@google.com>
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-21 14:47:27 -07:00
Philip Chen
a438efab9c scarlet: Define BATTERY_DESIRED_CHARGING_CURRENT
BUG=b:64821815
CQ-DEPEND=CL:621776
BRANCH=none
TEST=plug in AC, and check 'charger' command on ec console

Change-Id: I53681d21a5311ea58562acf2fae451ebc7f41d4d
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/621777
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-21 12:52:14 -07:00
Philip Chen
8e7bad0482 battery/max17055: Specify desired charging voltage/current
BUG=b:64821815, b:63870414
CQ-DEPEND=CL:621777
BRANCH=none
TEST=plug in AC, and check 'charger' command on ec console

Change-Id: Ic60bcab7fd0ccc2ea73471ac46e9b0b887f251d9
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/621776
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-21 12:52:13 -07:00
Vadim Bendebury
60f8deccb1 cr50: prepare to release RW 0.0.23
New released images need higher version number.

BRANCH=none
BUG=none
TEST=built and ran an image, verified version number to be right.

Change-Id: I0b5b690d84b2f281752ad01b154efdebeba2e136
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/621296
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-08-18 20:53:06 -07:00
Vincent Palatin
3cbdff8b1b stm32: add embryonic support for STM32F76x
The STM32F76x is really close to the STM32F4 family, so the most concise
implementation is just using CHIP_FAMILY_STM32F4 and adding
CHIP_VARIANT_F76X.

Tune the clock settings to 180 Mhz CPU clock as the goal is performance.
(over-drive is not implemented yet to get to 216 Mhz)

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

BRANCH=none
BUG=none
TEST=ran on nucleo-f767zi board.
'make BOARD=nucleo-f767 flash', the red LED is on and the green LED
turns on/off when pressing the user button, UART console works properly.

Change-Id: I1f67df3aec874c965c81188df46c72de210728d9
Reviewed-on: https://chromium-review.googlesource.com/612750
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-18 16:46:34 -07:00
Vincent Palatin
b6d83d456f stm32: remove stm32f4 dead code in DMA
The STM32F4 family is building a special variant of the dma code
(dma-stm32f4.c), all the conditionals for F4 in stm32/dma.c are just
dead code. remove them.

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

BRANCH=none
BUG=none
TEST=make buildall

Change-Id: Icbf8d08c7e50fe5153a1b3830011bb12afcabaa5
Reviewed-on: https://chromium-review.googlesource.com/621391
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-18 16:46:33 -07:00
Stefan Reinauer
55acd6957e common: Use SVr4/4.3BSD/C89/C99 prototype for strlen
SVr4/4.3BSD/C89/C99 use a return value of size_t. To
make interaction with code running on both userland
and on the EC easier, change our function prototype
to return size_t as well.

Signed-off-by: Stefan Reinauer <reinauer@google.com>
BRANCH=none
BUG=none
TEST=make buildall -j works

Change-Id: I0f097c4d0db4232d888e1d54e6c1d22f4859a112
Reviewed-on: https://chromium-review.googlesource.com/618269
Commit-Ready: Stefan Reinauer <reinauer@google.com>
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-18 14:27:23 -07:00