Commit Graph

6218 Commits

Author SHA1 Message Date
philipchen
b6937caeeb gru/kevin: turn on flags to save code size
Turn on CONFIG_HOSTCMD_ALIGNED and
CONFIG_COMMON_GPIO_SHORTNAMES to squeeze more
space for the upcoming sensor code.

BUG=chrome-os-partner:59084
BRANCH=gru, kevin
TEST=Check the map to confirm the size reduction

Change-Id: I7a9ca8fccf6d57a797c391dc76cacb0b929e14df
Reviewed-on: https://chromium-review.googlesource.com/403485
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-27 19:28:43 -07:00
Aaron Durbin
52d80971c7 extra/usb_updater: don't use uninitialize variables
The 'transferred_sections' variable wasn't initialized in all paths.
Fix that.

BUG=chrome-os-partner:58794
BRANCH=None
TEST=Built.

Change-Id: If82ef1274d6a931e0cd193f276f34bfcac1fb1c7
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404548
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
2016-10-27 20:16:53 +00:00
Aaron Durbin
97158b6543 usb_updater: report running H1 firmware
Add a command line option which allows to retrieve version currently
running on the cr50 device.

BRANCH=none
BUG=chrome-os-partner:58794
TEST=run the following command:
   $ sudo ./extra/usb_updater/usb_updater -f
   open_device 18d1:5014
   found interface 4 endpoint 5, chunk_len 64
   READY
   -------
   start
   Target running protocol version 5
   Offsets: backup RO at 0, backup RW at 0x4000
   Keyids: RO 0x3716ee6b, RW 0xb93d6539
   Current versions:
   RO 0.0.9
   RW 0.0.8

Change-Id: Ia34f455d3ca826a24992adf123a07865dccb1d57
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400418
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2016-10-27 12:42:37 -07:00
Aseda Aboagye
5b556dbd24 kevin: Add bugs to TODOs.
Found some TODOs and filed bugs for them.

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

Change-Id: I3aa4350383f1fe9954f2dd20811c2256d0940a48
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/404112
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2016-10-27 01:21:54 -07:00
Johnnie Chan
3337c17efd Adding offsetof macro to stddef.h.
This duplicates the macro definition that exists in compile_time_macros.h.
Adding it is okay since they are both guarded by a #ifndef #endif check.
This is needed by code being pulled in from google3 which expects the
macro to be defined in the standard place.

BUG=none
BRANCH=none
TEST=make BOARD=haven_dev

Change-Id: Ibddefcd8bbfe0d121b3ce65950ce979e65778761
Reviewed-on: https://chromium-review.googlesource.com/403573
Commit-Ready: Johnnie Chan <johnniec@google.com>
Tested-by: Johnnie Chan <johnniec@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-26 19:59:17 -07:00
Vadim Bendebury
f2c33b73b2 cr50: provide platform API for fw version capability
The tpm is supposed to report its firmware version when
TPM_PT_FIRMWARE_VERSION_1 and TPM_PT_FIRMWARE_VERSION_2 capabilities
are requested.

This patch retrieves form the build info string SHA1s of the ec and
tpm2 repositories and returns them to the caller.

BRANCH=none
BUG=chrome-os-partner:58177
TEST=with the appropriate tpm2 source tree changes the ec and tpm
      SHA1s are now reported:

    localhost ~ # tpm_version
    TPM 2.0 Version Info:
    Chip Version:        2.0.0.0
    ....
    Firmware Version:    0a92ec7c01b9c924

    (the first half is the zero prepended 7 characters of the ec SHA1,
    and the second half is the zero prepended 7 characters of the tpm2
    SHA1).

Change-Id: I01e4fffdafbbdc4668342ea511ca9c4a555e20a9
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403115
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2016-10-26 19:59:15 -07:00
Duncan Laurie
a5393caeb5 eve: Add new board
Add support for eve P0 board with:

- chip: npcx
- pmic: bd999992GW
- charger: bd99956
- tcpc: 2x anx3429

BUG=chrome-os-partner:58666
BRANCH=none
TEST=build and boot on eve board

Change-Id: I69ff246e9f8197d5d50241e6a8fa4796f4c9bfda
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400638
2016-10-26 14:22:54 -07:00
Scott
450b944ca9 Cr50: i2cs: Re-enable sleep after every interrupt
Previously, sleep was being reenabled only after tpm fifo reads as
that would typcially be near the end of a host driven TPM
command. However, in the case the host reads or writes to the STS
register, then sleep would not be re-enabled. Moved the re-enable
point to at the end of every i2cs interrupt. Since sleep is delayed by
1 second prior to being reenabled then Cr50 will not go to sleep in
the middle of TPM command since the host is either writing or reading
STS at a much faster rate when a TPM command is being executed.

BRANCH=none
BUG=chrome-os-partner:40397
TEST=manual
Added a debug counter in idle.c and shortened sleep delays from 3
minutes to 5 seconds. Unplugged suzyq and verified that when
reconnected, the counter was incrementing to verify that Reef would
go to sleep. Also verified that TPM worked successfully and kernel
was launched.

Change-Id: I03ad33ed3591bbba24b5c56445c06d0e11368019
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/401808
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-10-26 01:45:29 -07:00
Shawn Nematbakhsh
907c09ee38 task: Don't propagate TASK_EVENT_TIMER between between waits
In __wait_evt(), if a timer expiration occurs after we read event
status, before the timer is canceled, then TASK_EVENT_TIMER will be
propagated to the next task wait, likely leading to premature timeout.
Prevent this by clearing TASK_EVENT_TIMER after canceling our timer.

BUG=chrome-os-partner:58658
BRANCH=gru
TEST=Manual on gru, run 'pd # hard' for 12 hours with charger attached,
verify no TCPC I2C read errors occur.

Change-Id: Iac2f05a768b4ef29f82e7c3eb899f4c7dd5c3744
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400968
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-26 01:45:25 -07:00
Vincent Palatin
fffea303b4 pd: fix contract negotiation with dynamic PDOs
When the board is using dynamic source PDOs, we need to ensure that we
are checking the incoming sink power request against the right set of
PDOs else we might reject a valid request (e.g. with high-power source,
we need to check against the 3.0A limit if we only have one port
connected).

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

BRANCH=gru
BUG=chrome-os-partner:56110
TEST=Connect Kevin to Caroline, ask Caroline to charge from the other
side and see it negotiating successfully a 5V/3A contract.

Change-Id: Ie1aa5746776be5946422bf07c08ae0f22faddd8c
Reviewed-on: https://chromium-review.googlesource.com/403088
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:45:17 -07:00
Mary Ruthven
6e82ee4729 cr50: enable write protect
Enable write protect based on the type of image being built. Write
protect will be enabled on production images and disabled on dev images.

BUG=chrome-os-partner:49959
BUG=chrome-os-partner:55604
BUG=chrome-os-partner:58961
BRANCH=none
TEST=verify wp is enabled unless the image is built with CR50_DEV=1

Change-Id: Ibcd7f35fb4b33142c94e59e8c103624fce4e0b10
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403308
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-26 01:45:10 -07:00
Bruce
d73f705442 Snappy: Fix multi-func mode for USB PD
Without this change the Alternate mode adapter with
multi-function capablity would only be configured as
DP instead of (DP + USB).

BUG=None
BRANCH=master
TEST=make buildall

Change-Id: I44d2b0ff56a8851b8104c4305b8f5826dcbe2107
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401266
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:45:02 -07:00
Bruce
53556b96d7 Snappy: Enable low power idle mode
BUG=None
BRANCH=none
TEST=make buildall

Change-Id: I8c71f6916b17d36026d9f96c91391f397bbaef43
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401245
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:44:38 -07:00
CHLin
8d1a958263 npcx: espi: Fix SMI/SCI virtual wire handling
When GPIOC6/GPIO76 are not selected as SMI/SCI function(ie. selected
as GPIO), the reading of SMIB/SCIB will be a fixed value. This means
it cannot reflect the actul SMI/SCI status. As a reault, use SET_BIT/
CLEAR_BIT macro to toggle SMIB/SCIB is not feasible. Firmware should
read the SMI/SCI status from VWEVSM(2) register before setting it.
This CL defines some macros to achieve it.

In the previous CL, SMI/SCI negative polarity is conditionally
disabled. However, the negative polarity is not used in current
firmware design. Set the SMI/SCI polarity as postive unconditionly by
default.

Modified drivers:
1. lpc.c: use macro NPCX_VW_SMI/NPCX_VW_SCI to generate Virtual wire.
          use SMI/SCI postive polarity uncontionally by default.
2. register.h : define macro to handle SMI/SCI virtual wire.

BUG=chrome-os-partner:34346
BRANCH=none
TEST=make buildall; try hostevent on Wheatley and check virtual wire
signal is correct on logical analyzer.

Change-Id: Id4a7748addeaa3b35f280ff29f6fcd8a08b9894b
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/400161
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Tested-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2016-10-26 01:44:21 -07:00
Duncan Laurie
5cfa02b03c lpc: Add function for host reset without RCIN GPIO
Prior x86 boards have had GPIO for toggling RCIN directly on the PCH,
although many likely had HW-assisted methods as well.

With eve we need to generate an eSPI Virtual Wire for RCIN, but in reality
software control over RCIN Virtual Wire is not available with the npcx EC,
so the legacy LPC interface for pulsing KBRST must be used instead as this
is the only way to generate RCIN.

This method will likely vary on different EC chips, but for skylake it
can just be abstracted into the LPC module.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=successful 'apreset warm' on eve EC console

Change-Id: I7f9e7544a72877f75d05593b5e41f2f09a50e1c9
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400037
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:44:08 -07:00
Duncan Laurie
b142b05465 power: Add board callback before RSMRST# state change
This board function allows workarounds to be applied to a board after all
power rails are up but before the AP is out of reset.

Most workarounds for power sequencing can go in board init hooks, but for
devices where the power sequencing is driven by external PMIC the EC may
not get interrupts in time to handle workarounds.

For x86 platforms and boards which support RSMRST# passthrough this board
callback will allow workarounds to be applied despite the PMIC sequencing
by ensuring that the function is executed before RSMRST# deassertion.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=test IMVP8 workaround on multiple eve boards

Change-Id: I0569494084000a4b1738ee18aafce5c96900dc4b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/402591
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:44:06 -07:00
Andrey Petrov
b1ac9d3c6e amenia: remove mainboard
Amenia is EOL. Remove mainboard.

BUG=chrome-os-partner:57490
BRANCH=none
TEST=none

Change-Id: Idd453299df866c8ea6e4a4903d94bc26ff9150c6
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/392231
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-25 17:33:50 -07:00
Vijay Hiremath
e46d67518e reef/pyro/elm/amenia/snappy: Remove false battery critical message
Till the charger task is initialized port is not set for the BD9995X
users and a false battery critical message is printed. Removed the
false message printed for BD9995X users to avoid confusion.

BUG=chrome-os-partner:58972
BRANCH=none
TEST=Manually tested on Reef.
     False battery critical message is not printed on the EC console.

Change-Id: Iec8d0f354c4f6dc17efa9da8db38b125e57addab
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/402668
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:48 -07:00
Duncan Laurie
a15ac8e733 npcx: espi: Fix pltrst handler for chipset reset hook
Enable the chipset_reset_hook by adding interrupt trigger on
pltrst assertion and fix the compilation when built with
CONFIG_CHIPSET_RESET_HOOK enabled.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=build with CONFIG_ESPI and CONFIG_CHIPSET_RESET_HOOK

Change-Id: I64eb7a1acc58c07beba0d28f94d95ef33d7220fb
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400035
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:46 -07:00
Duncan Laurie
e99b53ceb8 npcx: lpc: Fix DP80CTL setting for eSPI
The datasheet says DP80CTL[1] should be set when using eSPI.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=boot with espi and see port80 values

Change-Id: Ie46feacc50dc78b1f0bf5e4e131198708cd6ec89
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400034
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:45 -07:00
Duncan Laurie
a45ba126d6 npcx: lpc: Fix SMI generation
The check for whether or not to send an SMI needs to check the
same status bit that it is using to indicate that it is going
to send an SMI.  The SMIE bit is enabled in lpc_init() so it is
always set.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=shutdown with lid close event at developer screen

Change-Id: I9a0f34025c4fa11175fca7be34224ec680bffbef
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400033
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:43 -07:00
Duncan Laurie
b8050224e5 include: Add default state for ESPI and VW_SIGNALS
Add the default undefined state for CONFIG_ESPI and rename
CONFIG_VW_SIGNALS to CONFIG_ESPI_VW_SIGNALS.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=pass presubmit checks

Change-Id: I45242d545915c16bb46f751532a01ab937cee5f0
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400032
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:42 -07:00
nagendra modadugu
e6549481c7 CR50: introduce a fixed endorsement seed & certs
This change introduces a 'fixed' endorsement seed,
and corresponding certificates.  This fixed seed
is used in the endorsement process when a production
mode chip is running dev-signed firmware (or vice-versa).

The fixed certificates are untrusted by production
services, and are suitable for use in a development
environment.

BRANCH=none
BUG=none
TEST=build succeeds

Change-Id: Ifad0b361413a10f88c4977b03033a30a750cd536
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/401634
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-25 14:47:09 -07:00
Martin Roth
53b80c8a08 chip/g/flash: Return error if flash command isn't recognized
This fixes a build failure using gcc 5.3 where opcode and max_attempts
are used before being initialized.

BUG=None
BRANCH=None
TEST=Build all boards successfully.

Change-Id: Ia7c4273f8812cca9f127fcd71101ce3a4e4ad4c7
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/370662
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-10-25 14:47:07 -07:00
Bruce
f140370353 Pyro: Fix multi-func mode for USB PD
Without this change the Alternate mode adapter with
multi-function capablity would only be configured as
DP instead of (DP + USB).

BUG=None
BRANCH=master
TEST=make buildall

Change-Id: I85c8b52469dec6fc347c5cfe6a3b208bc765069e
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401074
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-24 13:49:03 -07:00
Bruce
1f533bd6eb Pyro: Enable low power idle mode
BUG=None
BRANCH=none
TEST=make buildall

Change-Id: If3ba1f57989d9c0f1027e8281a4ff6bddaac7dec
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/402108
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-24 13:48:50 -07:00
Bruce
0ef87a741c Pyro: Fix sensors order for devices with BM160 and LPC mode.
When the kernel reads sensor data via LPC, it expects the order to be:
- ACCEL
- ACCEL
- GYRO
(other sensors data are read through EC commands)
BMI160 expects ACCEL, GYRO and MAG to be next to each other.
Reorganize motion_sensor array to fit these 2 requirements:
If BMI160 in the lid:
- BASE_ACCEL
- LID_ACCEL
- LID_GYRO
...
If BMI160 in the base:
- LID_ACCEL
- BASE_ACCEL
- BASE_GRYO
...

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: If89cf29d28b70e9a46dde8a3301a1942b3a1dd8b
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401206
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-23 01:00:03 -07:00
Bruce
a0e1cd054a Pyro: remove obsolete code for proto
BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Idfa57dc6f06e0b3a42eca3f77279c60e615b6ae5
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401222
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-23 01:00:02 -07:00
Bruce
bbdc57361a Pyro: Enable CONFIG_CMD_ACCEL_INFO
Enable this EC console command for testing

BUG=None
BRANCH=master
TEST=make buildall

Change-Id: I95e3926bcc30f91ebb5174a055db98469b5a8b76
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/400983
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-23 01:00:00 -07:00
Bruce
d295d36520 Pyro: Enable Host command that enables/disables Display Backlight
This command will be used to perform power validation.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I993438162871ceba3e45635db31e3b1bd5aae643
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401084
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-23 00:59:58 -07:00
Brian Norris
5ab2ffdbe9 stm32: make usb_iface_request extern
This isn't supposed to be static. And with CL:401421, we noticed that
clang doesn't like this form. So fix this one too.

BRANCH=none
BUG=chromium:658436
TEST=build

Change-Id: Ibd0c5724d5178c5ce8fc8c1b74382aeddd8f744d
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/402068
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-21 21:20:49 -07:00
Brian Norris
c4e1a40e35 Fixup usb_updater for reef/clang
clang doesn't like the array here:

ec-utils-0.0.1-r3361: x86_64-cros-linux-gnu-clang -std=gnu99 -g -Wall -Werror -Wpointer-arith -Wcast-align -Wcast-qual -Wundef -Wsign-compare -Wredundant-decls -Wmissing-declarations -O0 -I/build/reef/usr/include/libusb-1.0  -I../../include -I../../board/cr50 -I ../../chip/g -I../../util usb_updater.c   -lusb-1.0 -lcrypto  -o usb_updater
ec-utils-0.0.1-r3361: In file included from usb_updater.c:32:
ec-utils-0.0.1-r3361: In file included from ../../include/usb_descriptor.h:14:
ec-utils-0.0.1-r3361: ../../chip/g/usb_hw.h:29:14: error: tentative array definition assumed to have
ec-utils-0.0.1-r3361:       one element [-Werror]
ec-utils-0.0.1-r3361: static int (*usb_iface_request[]) (struct usb_setup_packet *req);
ec-utils-0.0.1-r3361:              ^
ec-utils-0.0.1-r3361: 1 error generated.

But it's willing to forgive if this is extern. It should be extern
anyway.

BRANCH=none
BUG=chromium:658436
TEST=reef pre-cq passes (building ec-utils)

Change-Id: I5b5f8eb8dcdc3340487b118b30469c8cee73e182
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/401421
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-22 00:01:02 +00:00
Vijay Hiremath
a4da57e0f3 reef: Enable low power idle mode
BUG=chrome-os-partner:56183
BRANCH=none
TEST=Used dut-control command 'dut-control pp3300_ec_mw -r <n>'
     to measure the pp3300 rail and power in S3 dropped from
     ~9mW to ~5mW.

Change-Id: I64b463351a6f191a94a41a31de9ee51ae6d9b7b4
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/400948
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-10-20 23:23:55 -07:00
Bruce
dc6cff16ee Snappy: Create initial board
Create initial snappy EC code, by copy from reef

BUG=chrome-os-partner:58233
BRANCH=None
TEST=make buildall

Change-Id: Ie13491c07165988047d131404a0e759c0d40562a
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/401221
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-20 23:22:37 -07:00
Nicolas Boichat
588a45687d host_command_pd: pd_exchange_status: Fix first_exchange logic
The code clearly indends to sleep on the second time the loop
is taken, but the variable first_exchange is reset to 1 inside
the loop. If, for whatever reason, PD alert status cannot be
cleared, the code will then loop forever, and lead to a watchdog
reset.

BRANCH=none
BUG=chrome-os-partner:58750
TEST=Flash EC RO using ec_util
     Run fwupdatetest with charger unplugged for 10 iterations.

Change-Id: I9e13f2523111853fdc5c45e75886c11f1c8006eb
Reviewed-on: https://chromium-review.googlesource.com/401238
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-20 04:42:37 -07:00
David Hendricks
fb0d464fbd spi_flash_reg: Correct lengths for W25Q40/GD25LQ40
The lengths were previously specified as end offsets and were
thus off by 1.

Fortunately it seems these chips were never used with an EC where we
actually utilize this table. Still, it would be nice if we actually
tested this on real hardware to check that there aren't any other
silly errors.

BUG=none
BRANCH=none
TEST=needs testing

Signed off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I0a5315808c756797940436a10cd4f6df7313ab8c
Reviewed-on: https://chromium-review.googlesource.com/400642
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-20 01:55:59 -07:00
Randall Spangler
5e1c63f6eb Support alignment for EC host command structures
The host command parameter and response buffers should be explicitly
aligned by the LPC/SPI/I2C drivers.  But the host command handlers don't
know that, and the structs are all __packed, so the compiler generates
horribly inefficient ARM Cortex-M code to cope with unaligned accesses.

Add __ec_align{1,2,4} to force the param / response structs to be
aligned.  Use it in a few structs now which were straightforward to
test.  It should be added to more structs as space is needed, but that
would make this change unwieldy to review and test.

Add CONFIG_HOSTCMD_ALIGNED to enable the additional alignment.
Currently, this is enabled only for LM4 and samus_pd, so that EC code
can be tested without affecting other non-samus ToT development (none of
which uses LM4).

Fix the two handlers that weren't actually aligned (despite one of
them having comments to the contrary).

Also, add a CHROMIUM_EC define that can be used to determine if a file
is being compiled for an EC target.  We need that so that we only force
structure alignment for EC binaries.  On the AP side, buffers may not be
aligned, so we should not force alignment.

BUG=chromium:647727
BRANCH=none
TEST=Flash samus and samus_pd.  Boot samus and run a bunch of ectool
     commands (with and without --dev=1, so it tests both EC and PD).
     System boots and all commands return expected results.

Change-Id: I4537d61a75cf087647e24281288392eb85f22eba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/387126
2016-10-19 20:07:09 -07:00
Kevin K Wong
09ad7536ce pd_task: print pd state name
Shifted pd_task debug level by 1 so that debug level 1 will
enable printing the pd state name.

Added a CONFIG flag to remove ability to change debug_level
during runtime and debug print level will be fixed.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I545813bafa8084355cedc2d8334c3aec5a2b6739
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/339935
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-19 02:45:36 -07:00
Divya Sasidharan
ff9b1d158e reef: usb_pd_policy: Fix multi-func mode for USB PD
Without this change the Alternate mode adapter with
multi-function capablity would only be configured as
DP instead of (DP + USB).

BUG=chrome-os-partner:58670
BRANCH=master
TEST=On Reef, with Dell dongle verified on both ports
 that USB 3.0 device and ethernet is working.

Change-Id: I7a15a281306e29f589de2ef59da9c424f3f6710d
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/400080
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-19 02:45:34 -07:00
Nick Sanders
6e03484c01 polyberry: add initial board build
This supports gpio initialization only.

BUG=None
TEST=Successfully checked console and available GPIO on sweetberry
BRANCH=None

Change-Id: Id50f66652b05c25a8c79ce2938fa161a944d93b8
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/399643
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-10-18 22:15:52 -07:00
Todd Broch
35e580b7a9 Re-enable Google USBC peripheral FW updates.
Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=glados,gru,oak
BUG=chrome-os-partner:57458
TEST=usbpd_GFU

Change-Id: I5a6bfde742a5c698680f99f342b1696084fd002a
Reviewed-on: https://chromium-review.googlesource.com/397862
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Benson Leung <bleung@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-18 19:11:55 -07:00
Carl Hamilton
066d1b6a5f Added "stdbool.h" and definition of uint_least8_t to "stdint.h".
The two types added, bool and uint_least8_t, are needed by the nanopb
common header file "pb.h".

The file added and the file modified are EC versions of files that are
normally provided by the compiler. This change follows the approach
already take to provide our own, mimimalist versions of these files.

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

Change-Id: I892e25b14f7cbe3ecca6f60d6a2955d4d628e3a9
Reviewed-on: https://chromium-review.googlesource.com/398921
Commit-Ready: Carl Hamilton <carlh@chromium.org>
Tested-by: Carl Hamilton <carlh@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-17 17:41:06 -07:00
Shawn Nematbakhsh
38cf4fccfb npcx: i2c: Remove needless controller state pre-check
We're now locking i2c at the controller (not port) level, so it's not
necessary to check if a given controller is busy before doing an i2c
transaction.

BUG=None
TEST=Manual on kevin, verify i2c is still functional.
BRANCH=gru

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic0cda34f9a58c76083699990a0dc3e761bcdec4f
Reviewed-on: https://chromium-review.googlesource.com/393107
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
(cherry picked from commit 7d2e2f565b79a035a270ca083af97c6a14983739)
Reviewed-on: https://chromium-review.googlesource.com/396138
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-17 17:40:52 -07:00
Shawn Nematbakhsh
d9b7d25b86 power: rk3399: Debounce PGOOD_SYS signal
PGOOD_SYS may glitch for a period not to exceed 1ms. When PGOOD_SYS or
PGOOD_AP are deasserted, wait for up to 100ms for both signals return
before transitioning out of S0.

BUG=chrome-os-partner:56822
BRANCH=gru
TEST=Manual on kevin, boot device and verify it remains in S0 without
spurious transitions to S3.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I95ccae54fc5939c835f00dc9b7cf88b9d0553c11
Reviewed-on: https://chromium-review.googlesource.com/393148
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit b867d3fc9dea04ac65f5288fb99d3ed65c127644)
Reviewed-on: https://chromium-review.googlesource.com/396139
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-17 17:40:47 -07:00
Shawn Nematbakhsh
aec1eb35e7 lucid: Remove console history to save flash space
BUG=None
TEST=`make BOARD=lucid`
BRANCH=None

Change-Id: If90479817fcb5a5c0027718395aaf318dd7b4fcb
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/399769
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2016-10-17 19:53:25 +00:00
Shawn Nematbakhsh
08498eab99 pd: Initialize pd comms and dual role state from PD task
Don't call into tcpm_*() functions from HOOKs since these functions may
manipulate common sets of TCPC registers.

BUG=chrome-os-partner:57691
BRANCH=gru
TEST=On kevin, boot to S0, verify 5V is sourced to legacy peripheral.
Drop to G3, verify role is back to sink and charging is functional. Back
to S0, verify 5V is sourced.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9ade9de068589dce6995cda6b106217aa85aa793
Reviewed-on: https://chromium-review.googlesource.com/394809
(cherry picked from commit 18e9e3870722d57efd232bd7f0a0300003b46ad6)
Reviewed-on: https://chromium-review.googlesource.com/396137
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-14 18:49:38 -07:00
Vijay Hiremath
6f5489e18e cleanup: Rename charge_temp_sensor_get_val() to charge_get_battery_temp()
charge_temp_sensor_get_val() is used to get the battery temperature value
hence renamed it to charge_get_battery_temp().

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

Change-Id: I2b52cac57dcde12a6b7405e7d712240e278954e2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/397962
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-10-14 18:49:36 -07:00
Nick Sanders
26cacee37f servo_v4: support autodetect of CCD
This allows a servo_v4 to export case closed debugging
automatically, if it detects that it's been plugged into
a ccd device.

BUG=chromium:571476
TEST=Connect to reef in both orientations.
BRANCH=None

Change-Id: I8e2781056b22e834132bc4bb839ef2763fa0b4b8
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/375359
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-10-14 16:05:54 -07:00
Daisuke Nojiri
c926d7dc7c cts: Fix back-to-back build
Currently eCTS suites share the same directory (e.g. build/stm32l476g
-eval) to put build artifacts even though some files (e.g. board.c)
compile differently suite to suite. So, if cts-i2c-stm32l476g-eval is
built, followed by cts-gpio-stm32l476g-eval, build fails or produces
incorrect binary.

This patch makes eCTS create different directories for each suite.
As a bonus, we can now builds eCTS suites in parallel.

BUG=chromium:654549
BRANCH=none
TEST=make buildall -j (with uncommitted change)

Change-Id: I4abedc917787be5f79b97e0e50d0d08e01bd5f9d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/398281
2016-10-14 16:05:49 -07:00
Daisuke Nojiri
ce3e350ade getversion: Fix lucid failing because of version strings
make build=lucid fails if there is an uncommitted change in the tree
because '-dirty' is appended to version strings, which causes the image
to exceed the flash size limit.

BUG=chromium:654549
BRANCH=none
TEST=make buildall -j

Change-Id: Ie4a7b4c7dc70846108aed953215f79dc30a10fca
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/396617
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-10-14 16:05:47 -07:00