Commit Graph

4058 Commits

Author SHA1 Message Date
Bill Richardson
eded0406a3 Add EC_CMD_BLOB host command to pass opaque data around
This provides a way to experiment with or support random
functionality not specifically related to the normal EC
operation. With this, we can use a standard host command to pass
opaque data blobs between the AP and EC without specifying a
particular meaning to them.

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

Nothing in the normal EC usage sends these messages. I have a
test/example program coming soon.

Change-Id: I77fe434cbd9151e4c2c22bc36d1ed6063d3bf940
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/283070
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-07-06 20:06:55 +00:00
Alec Berg
3196828344 lucid: add support for lucid battery pack board
Add support for lucid battery pack board.

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

Change-Id: I145a1a362503bcd35ee92e6c013af4facd95f443
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/283170
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-06 18:38:33 +00:00
Bill Richardson
662ed79092 cr50: cleanup a few strings & messages
Add a description for the USB HID interface, neaten a bit of
console output. No new functionality.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ie85a0192bc4ab9fa87afb4be41d496545a3b548a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/283051
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-07-01 23:23:35 +00:00
Andrey Petrov
1f941e8674 mec1322: protect spi_transcation() with mutex
Concurrent SPI transactions are not possible, however in case of external SPI
and flashrom update scenario both host command and vhash trigger transactions.
This adds mutex for the SPI transcation

BRANCH=None
BUG=chrome-os-partner:38103
TEST=on Cyan, run hundreds of flashrom cycles to make sure there are no read,
erase or write errors

Change-Id: If346ebe635387d477dcea5f406a5c31579142e2d
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282113
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
2015-07-01 03:49:24 +00:00
Divya Jyothi
ae834fa50a mec1322: correct reset cause state in lfw
Reset cause was recorded / corrected only in RO/RW images.
lfw still has old implementation.This caused sysjump RO/RW to
not jump appropriately.

BRANCH=None
BUG=chrome-os-partner:38103
TEST=on Cyan,sysjump RO and sysjump RW console commands
nd make sure it jumps to the right image.

Change-Id: I37138f552fdd385c98d770d242d896ffc014697c
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282210
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
2015-07-01 03:49:19 +00:00
Dino Li
edb53663dd nds32: remove macro "RO"
"RO" is a workaround for GP base instructions.
And now we have added "-mno-gp-direct" option in the NDS32 toolchain.
So the compiler would not generate GP base instructions directly,
and we can remove this "RO".

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

BRANCH=none
BUG=chrome-os-partner:24378
TEST=console "version" and "gpioget"

Change-Id: I23cb6374fb8eb57081d713bf5c70b80a87dd2fb5
Signed-off-by: Dino Li <dino.li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/281862
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-01 03:49:14 +00:00
Todd Broch
943e9292f1 pd: Change which DP pin config DP source uses for sink capabilities.
DP Alternate mode specification defines two bytes in the DP
capabilities payload with respect to pin configs.  One that governs
the DFP and the other the UFP.  The one that the DP source needs to
examine depends upon whether the UFP is a receptacle or a plug.

Previously we just examined the DFP pin config which was correct for
all UFP plugs but not UFP receptacles.  This change fixes that by
examining bit <6> of capability message to determe plug vs receptacle
and in case of receptacle choosing the UFP ping config instead.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chromium:505652
TEST=manual, hoho & apple (UFP_D plugs) still work.

While I don't have a test for UFP_D receptacle partner device reports
following for its DP caps which should now decode correctly.

  <31:24> 00 Reserved/SBZ
  <23:16> 1C UFP pin config == C, D, E
  <15:08> 00 DFP pin config zero
  <07:00> C5 <6> == 1 == receptacle

Change-Id: Ib9e3a808828ff6b8c062baf0fc3c23b3da33c2c3
Reviewed-on: https://chromium-review.googlesource.com/282621
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-07-01 03:49:10 +00:00
Andrey Petrov
e3c72ce5c1 mec1322: reload watchdog on LFW entry
When RO/RW sysjump is made watchdog is not disabled. Since LFW needs to
load firmware image into SRAM over SPI, there is a certain chance watchdog
counter will fire in the middle of it.

BRANCH=None
BUG=chrome-os-partner:38103
TEST=on Cyan, run hundreds of flashrom cycles and make sure there is no
watchdog reset

Change-Id: Idafcc6a1c9fb35f04be398a68e3ec05bb2b1425d
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282112
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
2015-07-01 03:49:04 +00:00
Divya Jyothi
b4c205bf51 vboot_hash: Abort hash calculation on flash write
If flash is being written, any pending hash calculation is likely to
be invalid.

BRANCH=None
BUG=chrome-os-partner:38103
TEST=on Cyan, run hundreds of flashrom cycles to make sure there are no
read, erase or write errors

Change-Id: I915f8db7998c56fc12e7d85173232882fb7ed80d
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282211
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
2015-07-01 03:49:00 +00:00
Andrey Petrov
d2dabdae5d mec1322: fix flash_physical_read()
flashrom on target issues a salvo of flash read commands with small
buffer size (128 bytes). Since there is no yield this starves other
tasks/events including hooks and as result watchdog is never reloaded.
This change makes read function yield to other tasks. In addition,
spi_enable()/disable chaining leads to situations where a SPI can be
disabled in the middle of transcation. This is addressed by keeping
SPI permanently enabled in LFW entry function, as well as in RW/RO
early init functions.

BRANCH=None
BUG=chrome-os-partner:38103
TEST=manual on Cyan, run flashrom -p ec -w xx in cycles, swaping xx so that
flashrom does flash. Make sure there is no watchdog triggered

Change-Id: Id5c50239a1d5c64054d7c660dd03b2be4678221c
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282111
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
2015-07-01 03:48:55 +00:00
Vincent Palatin
0c331e6fcb pi3usb9281: fix BC1.2 re-detection when using USB device mode
When the USB2.0 port is used in device mode, having the D+/D- lines
connected just before resetting the PI3USB9281 (for the 2nd detection
used a BC1.2 debouncing) triggers a misdetection where DCP chargers are
seen as Apple 2.4A chargers.
To avoid this, disconnect the D+/D- lines and let them relax before
triggering the PI3USB9281 reset.

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

BRANCH=smaug
BUG=chrome-os-partner:42048
TEST=connect and disconnect a DCP charger to the Smaug type-C port
with the AP running, see it constantly detected as DCP and no Pericom
interrupt storm.

Change-Id: I8f6043439c2c6b52f2689b4947baffe51f62eba8
Reviewed-on: https://chromium-review.googlesource.com/282594
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-01 02:15:25 +00:00
Vincent Palatin
cdef497a4e bq2598x: ryu: take into account hardware input current optimizer
Take profit of the hardware input current ramping/back-off integrated
in the BQ2589x charger by setting the current limits higher for BC1.2
USB modes and letting the hardware adjust to the actual charger
limitation depending on the VBUS voltage droop.

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

BRANCH=smaug
BUG=chrome-os-partner:42045
TEST=Connect a Nexus 9 DCP charger to Smaug and see the input current
adjusted to 1650mA without brown-out, read back the value properly from
the AP:
$ ectool usbpdpower
Port 0: SNK Charger DCP 4958mV / 1650mA, max 5000mV / 1650mA / 8250mW

Change-Id: I348e5ee4980a5652f72f279ab4e3a7126583b093
Reviewed-on: https://chromium-review.googlesource.com/282584
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-01 02:15:19 +00:00
Alec Berg
a11ffa6c93 tcpc: use initialization complete alert bit to signal readiness
Use the new TCPC initialization complete bit in alert register to
signal TCPC readiness instead of checking for USB VID to be set.

BUG=none
BRANCH=none
TEST=load on glados, make sure we can boot without battery.

Change-Id: I4b25c973ece0de6dd3f419c5901cff1d8d05ed95
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282593
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-30 19:02:57 +00:00
Anton Staaf
dd9e4fa427 STM32 PWM: Add error case in conditional compilation
Ensure that a new chip doesn't default to one of the possible
alternate function selection schemes, requiring it to pick one
or implement something new.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

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

Change-Id: I3650fa0c99bbf541039a778f4d6398f0a549f1b2
Reviewed-on: https://chromium-review.googlesource.com/282601
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
2015-06-30 17:19:04 +00:00
Anton Staaf
ebdad6b0f2 STM32F: Remove support for this family
There are no boards left that use this family of STM32 parts.  If we
add one later we can resurect support.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

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

Change-Id: If985a9e9f93c935e98c93f33c075ce00cb9a91ac
Reviewed-on: https://chromium-review.googlesource.com/282532
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
2015-06-30 17:18:59 +00:00
Dino Li
e881d99fde it8380dev: add pin 3.3v/1.8v selection
add GPIO_SEL_1P8V flag for 1.8v/3.3v selection.

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

BRANCH=none
BUG=none
TEST=1. To configure 1.8V/3.3V pin to 1.8V,
        set GPIO_SEL_1P8V flag in gpio.inc.
     2. The corresponding bit will be set as default value if the pin
        is not listed in gpio.inc.

Change-Id: Ica02aabe40b83fcb4d33bd28d717a0633bdef5f3
Reviewed-on: https://chromium-review.googlesource.com/281842
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
2015-06-30 17:18:54 +00:00
Shawn Nematbakhsh
362174b49b glados: Add support for USB-C muxes
Add support for pericom mux (port 0) and parade mux (port 1).

BUG=chrome-os-partner:41696
TEST=Verify set() and get() functions set and return consistent values.
Verify that DP and USB are only activated when proper modes are set.
BRANCH=None

Change-Id: I9d42108688a9070b982ae77f77633654bc6505ed
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282281
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-30 17:18:50 +00:00
Aseda Aboagye
9e73f3e031 presubmit: Add hook to check for config options.
This enables a presubmit hook to check for missing configuration
options. All CONFIG_* options should be defined in include/config.h
along with a brief description of what the config option does.

BUG=chrome-os-partner:26304
BRANCH=none
CQ-DEPEND=CL:281626
TEST=Create a commit modifying a source file with a new CONFIG_* option
and watched the preupload process fail illustrating the error with the
CONFIG_* option.
TEST=make -j buildall tests

Change-Id: I7240b386b4981dcab66811a4829d7d6ebfbf7cb1
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/281826
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
2015-06-30 17:18:45 +00:00
Shawn Nematbakhsh
4a56579f21 usb_mux: Add support for Parade PS8740 chip
Initial support for Parade PS8740 Type-C redriving switch.

BUG=chrome-os-partner:41696
TEST=Manual on Glados in subsequent commit. Verify set() and get()
functions set and return consistent values. Verify that USB SS device
functions when muxes are set to dock or USB.
BRANCH=None

Change-Id: Iedbe53cc76f30ecd969c2ca99a7377ed3b193729
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282280
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-30 17:18:40 +00:00
Shawn Nematbakhsh
1ef8c7dc20 usb_mux: Add driver interface for USB-C muxes
In preparation for adding support for additional USB-C mux chips, add a
new high-level USB-C mux interface usb_mux.c. usb_mux functions are now
called from pd code instead of board-level functions. usb_mux calls down
into a mux chip-specific driver (currently pi3usb30532) or
board-specific drivers which toggle GPIOs (for legacy boards).

BUG=chrome-os-partner:41696
TEST=Manual on Glados in subsequent commit. Verify set() and get()
functions set and return consistent values. Verify that USB SS device
functions when muxes are set to dock or USB. Also, verify that DP
dongle and USB SS device are functional on both PD ports on samus_pd.
BRANCH=None

Change-Id: Ib6477f489310f3be1430585ea09fea26f57e3752
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281435
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-30 17:18:37 +00:00
Alec Berg
4114b7f1fe tcpc: update tcpci registers to latest spec
Update TCPCI registers to version 0.62 of PD Interface
specification.

BUG=none
BRANCH=none
TEST=test on glados and samus

Change-Id: I57338b385123371e90f3b79b84e652af15be1bf1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282067
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-30 17:18:31 +00:00
Alec Berg
82ec2510a3 pd: refactor tcpm and move alert function to tcpm driver
Refactor the tcpm/tcpc split such that the tcpm driver implements
the alert functionality since it may be unique for different tcpc
chips.

BUG=chrome-os-partner:41842
BRANCH=none
TEST=make -j buildall. run on samus and glados.

Change-Id: I23f2d7f8627d5337b8d001a09bf27622be24fe33
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281631
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-30 17:18:25 +00:00
Ben Lok
59576398db oak: set a debounce time for suspend signal
The suspend signal from SoC of oak  should be kept at least 50ms.
Add a debounce time for suspend singal detection, to avoid transient
state during SoC boot up.

BUG=chrome-os-partner:42023
BRANCH=none
TEST=plug PD power adaptor to type-c port C1,
     The keyboard should be worked (Ensure EC communication is oaky)

Change-Id: I4a6bb4e8ba9d417fe2a3045846d38b2129516d78
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/282471
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
2015-06-30 12:22:19 +00:00
Kevin K Wong
882da45900 flash_ec: Add support for kunimitsu, kunimitsu_pd, and strago_pd
BUG=none
TEST=Verified EC and PD is able to flash on kunimitsu and strago
BRANCH=none

Change-Id: I31b9ed57d4cd7a1c09cedbf9c873e76770abd3c8
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282000
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-30 12:22:13 +00:00
Dino Li
60e110acd1 it8380dev: add i2c control module
Add i2c control module for emulation board.
To rename CONFIG_ to CONFIG_IT83XX_ for IT83XX series configuration.

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

BRANCH=none
BUG=none
TEST=1. console command "i2cscan" found devices correctly.
     2. console command "i2cxfer".
         2-a. port2 + battery, i2cxfer r, r16, and rlen OK.
         2-b. port1 + slave evb, i2cxfer r, r16, rlen, w, and w16 OK.

Change-Id: I67165f7dcdef538ba6dd03b47f1621a73cc68379
Reviewed-on: https://chromium-review.googlesource.com/263678
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
2015-06-30 12:22:02 +00:00
Kevin K Wong
75b95672ac kunimitsu: Update gpio according to fab3 hardware changes
BUG=none
TEST=Verified system can boot to OS and able to do PD negotiation.
BRANCH=none

Change-Id: Ie232954931984256887f953d387e56baccba2178
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282390
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-30 08:58:35 +00:00
Kevin K Wong
daea221d56 kunimitsu: add initial PD support
This is based off glados commit:
 glados: limit type-C voltage to 5V to increase charging reliability
 Change-Id: I4d67b62a18cf40d645b132081a431f9ce187168b
 Reviewed-on: https://chromium-review.googlesource.com/276366

BUG=none
TEST=Verified PD negotiate on Port 0 on Kunimitsu Fab2.
     Port 1 is also functional after hardware changes.
BRANCH=none

Change-Id: I0cb1edcf1703f55882f81c65e6359a45be4c1629
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/281833
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-30 08:58:31 +00:00
Scott
590c76d910 honeybuns: Update VDM information for DisplayPort
Updated the VDM information to handle properly the DisplayPort alternate
mode.
Switch to 2+2 (DP+USB3.0) if mode D is entered else use 4 lanes of DP
for mode C.
Set the Multi-Function Preferred bit, so laptops select the mode D.

BUG=none
BRANCH=none
TEST=Tested with samus. Verified we get 36W of power + USB2.0 key +
USB3.0 key + external DP display.

Change-Id: I95e3b3640fd5952faeb24312e387468aed6266c7
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/267688
Reviewed-by: Todd Broch <tbroch@chromium.org>
2015-06-30 08:58:23 +00:00
Aseda Aboagye
0ec956ea9d util: Add config option checker.
There are several cases in the EC code base where a CONFIG_* option is
used somewhere, but not defined within the include/config.h file.  This
script aims to fix that.  Eventually, it will become a presubmit hook to
actively prevent future offenses.

BUG=chrome-os-partner:26304
BRANCH=none
TEST=cros lint --debug util/config_option_check.py
TEST=Ran script and found offending config options.
TEST=make -j buildall tests

Change-Id: I999d32ebacc636b3fff9e857f3cc46feee475e80
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/281626
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
2015-06-27 19:29:29 +00:00
Vic Yang
ed3f712101 tegra: enable EC sleep in S3
In S3, the EC isn't expecting AP host commands, so it's safe to enable
sleep.

BRANCH=Ryu
BUG=chrome-os-partner:36918
TEST=Check sleep mask in S0 and S3.
Also check sleep mask after sysjump with AP on and with AP off.

Change-Id: I67f0634631f62ee571e18d2870cd4a6926d4e090
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/251750
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-26 20:17:45 +00:00
Vincent Palatin
5c1bb2174c honeybuns: manage USB and DP hardware
Get the USB hub out of reset only when there is a USB host,
same thing for the DisplayPort hardware.

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

BRANCH=none
BUG=chrome-os-partner:37078
TEST=Plug and un-plug Honeybuns to Samus. See both the USB devices
connected and the external display.

Change-Id: Iabbeb0650d18c4c0c3324f47d99f9aaa35601c16
Reviewed-on: https://chromium-review.googlesource.com/281927
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-06-26 18:57:40 +00:00
Ian Chao
957638c78c nuc: Add SHI driver for arm-based platform in chip folder.
Add npcx_evb_arm board-level driver for arm-based platform.
Add header.c: for booting from NPCX5M5G A3 Booter.
Remove lfw folder due to those functionalitie have been replaced with Booter

Modified drivers for
Patch Set 1:
1. flash.c: Implement UMA lock, tri-state and selection register lock functionalities
2. hwtimer.c: Add ITIM32 for hwtimer
3. lpc.c: Add checking for LRESET
4. system.c: Modified CODERAM_ARCH functions for NPCX5M5G A3 Booter.
5. uart.c: Add support for module 2
Patch Set 2:
6. lpc.c: Modified lpc_get_pltrst_asserted() func
Patch Set 3:
7. minimize the changes for CONFIG_CODERAM_ARCH in common layer
8. comments of Patch Set1/2
Patch Set 4:
9. Modified CONFIG_RO_MEM_OFF point to ro image and keep header as a part of ec.RO.flat.
10. Fixed RO_FRID and RW_FRID issues which caused by CONFIG_CODERAM_ARCH.
Patch Set 5:
11. Modified system.c in common folder for supporting *_STORAGE_OFF.
12. Use *_STORAGE_OFF in firmware_image.lds.S to indicate flat file layout in flash.
Patch Set 6:
13. rebase to newest version
14. system.c: Modified for the newest include/system.h
Patch Set 7:
15. Merge from version 0625

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

Change-Id: Ifd7c10b81b5781ccd75bb2558dc236486976e8ed
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/272034
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
2015-06-26 18:57:32 +00:00
Kevin K Wong
ccb6b15d51 kunimitsu: Code clean up.
This allows cleaner code diff from glados.
No new functional change is added.

BUG=none
TEST=Able to boot kunimitsu to OS.
BRANCH=none

Change-Id: I0ff7a097a617907a44c78d5e0f01dc409eb047ec
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/281832
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-26 18:57:25 +00:00
Vincent Palatin
7067007b21 honeybuns: transform into a real multi-voltage PD source
Switch it to a source-only PD device (as it is)
and add the voltage selection code.

For now, output 12V only for 20V request as the 5V->20V transition is
not monotonic, triggering disconnection detection.

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

BRANCH=samus
BUG=chrome-os-partner:37078 chrome-os-partner:41860
TEST=connect to Samus and see it negotiate 5V then 20V,
then manually switch to 12V.

Change-Id: I4fc198245999ff9ce8fec929f305681043d72965
Reviewed-on: https://chromium-review.googlesource.com/259113
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-06-26 01:46:55 +00:00
Chiranjeevi Rapolu
ddf77bbe78 Fix assertion crash in __wait_evt()
mutex_lock() is called from MEC1322_IRQ_ACPIEC0_IBF
interrupt context, causing deadlock and assertion
in __wait_evt().
In the interrupt context it now checks for mutex lock first.
If the mutex is already locked,, it will disable ACPI
interrupts and defer the memmap mutex lock.
Added LPC interrupt disable/enable functions as needed.
Increased deferred function count where needed.

BRANCH=None
BUG=chrome-os-partner:40820
TEST=Test for suspend-resume, cold, warm reboots and
other general stability.

Change-Id: I3dda0d4635a6b6281faf200c8c7b6fcba8877254
Signed-off-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/280418
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
2015-06-25 17:21:50 +00:00
YH Huang
331db691c4 oak: enable tmp432 thermal sensor
This change enables tmp432 thermal sensor. Enter "tmp432"
or "temps" in ec console and get temperature information.

BRANCH=none
BUG=none
TEST=manual
  Enter "tmp432" to get temperature information.
  Connect the battery and enter "temps" to get temperature
  information.

Change-Id: Ie7a9fb4541c5cb3cfa6a26e95f99fe4aacb3a3d3
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/280956
Reviewed-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-25 13:14:45 +00:00
YH Huang
8099b7b384 oak: power: add the console command "power on/off"
Add the console command "power on/off" for AP power on/off.

BRANCH=none
BUG=none
TEST=manual
  enter "power on/off" in the ec console to turn AP power on/off.

Change-Id: I16d2af72bc1bf045e7672acd9471dff0a672aff5
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/280957
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-25 10:51:19 +00:00
Dino Li
d5c43a880c it8380dev: add fan control module
1. pwm, add frequency select function for pwm channels.
2. timer, add external timer 3~8 apis.
3. add fan control module for emulation board.

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

BRANCH=none
BUG=none
TEST=console command "faninfo, fanset, fanduty, and fanauto"
     fanset 3333
     Setting fan 0 rpm target to 3333

     faninfo
     Actual: 3390 rpm
     Target: 3333 rpm
     Duty:   35%
     Status: 1 (changing)
     Mode:   rpm
     Auto:   no
     Enable: yes

     faninfo
     Actual: 3301 rpm
     Target: 3333 rpm
     Duty:   34%
     Status: 2 (locked)
     Mode:   rpm
     Auto:   no
     Enable: yes

     fanduty 80
     Setting fan 0 duty cycle to 80%

     faninfo
     Actual: 5952 rpm
     Target: 3333 rpm
     Duty:   80%
     Status: 2 (locked)
     Mode:   duty
     Auto:   no
     Enable: yes

     faninfo
     Actual: 5971 rpm
     Target: 3333 rpm
     Duty:   80%
     Status: 2 (locked)
     Mode:   duty
     Auto:   no
     Enable: yes

     fanauto

     faninfo
     Actual: 3330 rpm
     Target: 3333 rpm
     Duty:   36%
     Status: 2 (locked)
     Mode:   rpm
     Auto:   yes
     Enable: yes

     fanset 8000
     Setting fan 0 rpm target to 8000

     faninfo
     Actual: 6793 rpm
     Target: 8000 rpm
     Duty:   100%
     Status: 3 (frustrated)
     Mode:   rpm
     Auto:   no
     Enable: yes

     fanset 3456
     Setting fan 0 rpm target to 3456

     faninfo
     Actual: 5053 rpm
     Target: 3456 rpm
     Duty:   56%
     Status: 1 (changing)
     Mode:   rpm
     Auto:   no
     Enable: yes

     faninfo
     Actual: 3440 rpm
     Target: 3456 rpm
     Duty:   34%
     Status: 2 (locked)
     Mode:   rpm
     Auto:   no
     Enable: yes

     /* force stop the fan */
     [87.035136 Fan 0 stalled!]
     [87.035520 event set 0x00000400]
     [88.035712 Fan 0 stalled!]
     [89.036288 Fan 0 stalled!]
     [90.036864 Fan 0 stalled!]
     [91.037440 Fan 0 stalled!]
     [92.038016 Fan 0 stalled!]
     [93.038592 Fan 0 stalled!]
     [94.039168 Fan 0 stalled!]
     /* release */

     faninfo
     Actual: 3427 rpm
     Target: 3456 rpm
     Duty:   35%
     Status: 2 (locked)
     Mode:   rpm
     Auto:   no
     Enable: yes

Change-Id: Icbe1917902d033a8be42b8d834ffc6045d08b985
Reviewed-on: https://chromium-review.googlesource.com/266625
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
2015-06-25 05:32:30 +00:00
Aseda Aboagye
52ee6aa131 config: Add missing config options to config.h
There were many CONFIG_* options that were not defined in
include/config.h.  This commit fixes that by adding those config options
that were missing with a brief description of each.

BUG=chromium:496893
BRANCH=none
TEST=Verified that every mention of CONFIG_* is in include/config.h.
TEST=make -j buildall tests

Change-Id: Ie60756a8dd48d12b3e9b775639f409455dc5656f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/281785
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
2015-06-25 03:49:40 +00:00
Vincent Palatin
4fd15f8d91 power: ryu: ignore lid open events
Do not start the AP on lid open events,
in order to avoid spurious startup due to magnet magic.

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

BRANCH=smaug
BUG=chrome-os-partner:41601
TEST=Play with 2 Ryu EVT2 stacked one on top of the other.

Change-Id: I530d54f61d0674caddf20d1b17268c971f639f2f
Reviewed-on: https://chromium-review.googlesource.com/281667
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-25 02:11:56 +00:00
Alec Berg
cbb79c2558 pd: create driver/tcpm/ to hold TCPM drivers
Create driver/tcpm/ folder to hold TCPM drivers. Currently the
two drivers are a stub driver which is used when TCPM and TCPC
are on the same MCU and can make direct calls between the two
and the TCPCI driver which implements the standard TCPCI protocol.

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

Change-Id: Ie4d9b36eb33155254f8b87b83861f98a7a80693a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281630
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-24 23:13:28 +00:00
Vincent Palatin
564256d2ee bq2589x: ryu: enable IR compensation
Set the resistance compensation for the charger IC according to the EE
team measurements :
- Resistance compensation = 60 mOhm
- Voltage clamping = 160 mV
- Thermal regulation = 120C

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

BRANCH=smaug
BUG=chrome-os-partner:38603
TEST=dump the BQ25892 registers by using the "bq25" command and see that
REG08 contains 0x77.

Change-Id: I90e9ea4569d77fd90ed0290ec78e66810d744648
Reviewed-on: https://chromium-review.googlesource.com/281660
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-06-24 23:13:23 +00:00
Vincent Palatin
68198a2446 ryu: add missing PD power events
Send PD_EVENT_POWER_CHANGE events for all changes in the type-C/PD
configuration to ensure we are not missing any transition from the AP.

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

BRANCH=smaug
BUG=chrome-os-partner:41676
TEST=On Ryu, plug and unplug type-C chargers, C-to-A receptacle
adapters and A-to-C cables and see the proper "extcon" traces in the
kernel log.

Change-Id: I918b9c42867f069852a2222b0f47ef0df8d124aa
Reviewed-on: https://chromium-review.googlesource.com/280870
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-06-24 23:13:16 +00:00
Dino Li
c650a7391c it8380dev: add peci control module
Add peci control module for emulation board.

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

BRANCH=none
BUG=none
TEST=1. console command "pecitemp" get CPU temperature normally.
     2. console command "peci" manual test peci commands.
        (GetDIB, GetTemp, RdPkgConfig, and WrPkgConfig)

Change-Id: I48b63a391adf04f159adca401acb369a6acc3799
Reviewed-on: https://chromium-review.googlesource.com/265171
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
2015-06-24 04:19:42 +00:00
Aseda Aboagye
cdcd824fa6 glados: Add battery temp to temp_sensors list.
BUG=chrome-os-partner:15461
BUG=chrome-os-partner:40599
BRANCH=none
TEST=Flashed EC image on glados and verified "temps" command on EC
console displayed battery temperature.
TEST=make -j buildall tests

Change-Id: I1df6aab054aee0b5658a90ad736af7dc9a9679e3
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/281213
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
2015-06-24 01:47:05 +00:00
Divya Jyothi
4fcc233c0f mec1322: Correctly get reset cause
Since the reset cause was not recorded correctly
recovery mode(Esc+Refresh+Power) was not working.
With this change power-on reset state and VCC1_RST# only state
are distinguinshed.

BUG=chrome-os-partner:41479
BRANCH=none
TEST=Esc+Refresh+Power boots to recovery screen
     Refresh+Power reboots the system

Change-Id: I63eff488c970302e7afe8a677a57ad27d4d9918e
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Signed-off-by: Freddy Paul <freddy.paul@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/280782
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-24 00:04:48 +00:00
Vincent Palatin
5aadcd90d8 Add board for USB PD chip evaluation
Base board configuration to evaluate USB PD interface chip by
connecting them a STM32F072 Discovery board.

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

BRANCH=none
BUG=chrome-os-partner:41497
TEST=Flash the STM32F072 discovery using the following command:
make flash BOARD=pdeval-stm32f072
then connect to the EC console through the USB port.

Change-Id: Ie3f5dcd04c077be49fbacc020f7af4f298039e8a
Reviewed-on: https://chromium-review.googlesource.com/277713
Tested-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
2015-06-24 00:04:42 +00:00
Alec Berg
43db841066 pd: allow pdcmd task to check TCPC alert status w/o sending HC
Modify PDCMD task to allow for TCPCs that do not support host
commands.

CONFIG_HOSTCMD_PD is a new config option to be used by TCPCs
that implement our host command protocol such as the PD MCU on
glados and oak. Otherwise, the PDCMD task will not send host
commands and will be used simply to check TCPC interrupt status.

BUG=none
BRANCH=none
TEST=test on glados and samus and make sure we can send host
commands from the EC to the PD and that we can negotiate a PD
contract.

Change-Id: I618badb5db3f9e490ae4eedfdb2a0c54513496ff
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/278215
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-23 20:41:03 +00:00
YH Huang
0c46bcc3e7 oak: power off ap if reboot ap-off
When ec gets the console command "reboot ap-off", turn off ap.

BRANCH=none
BUG=none
TEST=manual
  Enter "reboot ap-off" in ec console and then ap is off.

Change-Id: Iba2c3743ae37ee9ceaadba58752d2129fb00d3a8
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/277976
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Queue: Rong Chang <rongchang@chromium.org>
2015-06-23 20:40:58 +00:00
Scott
99e964c018 pd: Add support for TCPC Alert and Alert_Mask registers
Changed the alert function to hold the ec_int line until
all of the alert bits are cleared. Added support for the
alert_mask register. In addition, created ec_int_status
variable to distinguish which of 3 ec_int sources is
driving the pd_mcu_int line.

BUG=none
BRANCH=tot
TEST=Tested Zinger to Glados and Zinger to Samus and verified
that it established a power contract in both cases. Did not
test Oak, but put exact same changes in board.c as in glados.

Change-Id: I372e75b8fd5d66a0c01db18b46100b86fd9ac064
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/278256
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-23 19:18:44 +00:00