Commit Graph

4675 Commits

Author SHA1 Message Date
Bill Richardson
0e6024eb13 cleanup: ignore compiled executable in extra/
This just adds a .gitignore entry so that git doesn't complain
about the executable you may have built in the extra/usb_console/
directory.

BUG=none
BRANCH=none
TEST=make buildall

This has no effect on the EC code at all. The things in the
extra/ directory are optional and unsupported.

Change-Id: Ib4915f712f9d14caf7418ef4b03aa41e8764fd36
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310840
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-11-05 11:10:15 -08:00
li feng
7e31d2650b mec1322: reduce system stack size
Reduce system stack size from 4096 to 1024.
Increase code RAM size to 104K and reduce data RAM size
to 20K.

BUG=chrome-os-partner:45690
BRANCH=None
TEST=Tested on Kunimitsu
     1. Flash EC, boot up, force to S5/G3, back to S0;
     and powerd_dbus_suspend to S3, all work fine.
     2. Use console command to dump system stack memory values,
     the size used is around 350, >600 still available.

Change-Id: Ib004678cc16f10c94c333063b728a2816ed5b3c5
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/310581
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
2015-11-04 07:09:07 -08:00
Shawn Nematbakhsh
1915367112 chell: Fix inverted KSO2 / GPIO101
KSO / GPIO101 is inverted and needs to be driven high on scan, so it
can't be configured as open-drain.

BUG=None
TEST=Verify keys on KSO2 scanline are functional.
BRANCH=None

Change-Id: Ic94b9e09a74d22a6e8e4b45ae03088e9ea5c2295
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310544
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-11-04 07:09:05 -08:00
li feng
0b4674500e led: correct LED blinking interval
LED activity is triggered by HOOK_SECOND. Updated value of led
constants to make sure blinking interval is correct.

BUG=chrome-os-partner:47243
BRANCH=none
TEST=Verified on Kunimitsu battery LED blinks at interval expected.

Change-Id: Ibd1089f3c12b1f449d81aeee9cf430981ae214ea
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/310545
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-04 07:08:55 -08:00
Ben Lok
64a812d4b7 oak: cancel long press timer when lost power_good or entering S3
1. refer to commit 8bd44bf4, oak has similar issue:
   if power good is lost and the power button still press, we need
   cancel the long press timer, otherwise EC will crash.
2. Furthermore, EC will crash too if long press timer is still active
   during entering S3.
3. The debounce of suspend & power_good signal can be removed on rev4
   because rev4 doesn't adopt level shifter.

BRANCH=None
BUG=chrome-os-partner:46857
TEST=Manual
1. press power button during coreboot, and it can shutdown normally, or
2. run test case:
   > test_that -b oak <DUT IP> firmware_FwScreenPressPower

Change-Id: I584d8beeb31b6c01289bfe4790453a4a3bd35b1c
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/309942
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-11-04 07:08:49 -08:00
Vadim Bendebury
d5e49bc23d make: decouple rw and ro object file sets
When building EC image, in the majority of cases the RW and RO images
are built from exactly the same set of object files, and the RO set of
objects is used as a template to derive the RW set of objects.

This is not necessarily correct in all cases, let's just create an
abstract set of object files and use it to derive the sets for RO, RW
and sharedlib as appropriate.

BRANCH=None
BUG=chrome-os-partner:43025
TEST=tested as follows:
  - changed the Makefile to sort all object files in a single list
    (instead of sorting them by directory, with the directory list
    unchanged). Built all targets, saved all .smap files. Then applied
    this change and again built all targets. Compare all smap files,
    there were no differences.
  - modified board/samus/board.h to trigger building sharedlib
    objects, verified that build/samus/sharedlib built fine.

Change-Id: Ie563aca62028cae9e16f067ba20b5e2930355cf5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310389
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-11-04 07:08:45 -08:00
Vadim Bendebury
a25c7025e1 mec1322: killing the white whale (removing temp files left behind)
This has been bothering me literally for years: once in a while there
would be tons of files in /tmp directory named tmpXXXXXX where XXXXXXX
is some random string.

Finally, it became clear that the files are generated when 'make
buildall -j' is called in the ec directory. Next step - it looks like
one of the culprits is building for board named 'chell'. Indeed, this
board uses its own version of cmd_obj_to_bin make function, which,
among other things invokes the pack_ec script to pack the image.

The script was creating temporary files and leaving them behind.

This patch makes the name pattern of the temp files better
recognizable, juts in case, and makes sure that the files are deleted
once they are not needed.

BRANCH=none
BUG=none
TEST=invoking 'make buildall -j' still succeeds but does not result in
     leaving temp files behind.

Change-Id: I50c511773caa87d4e92980c4c9a36768b0c3101f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310586
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-11-04 07:08:40 -08:00
Gabe Noblesmith
e3554f39d7 Initial commit of TCPM driver for FUSB302.
BUG=none
BRANCH=none
TEST=PD contract established with various devices

Change-Id: I4b452befe9ccd9d67bd6ad5c8cf77ae58320f6af
Signed-off-by: Gabe Noblesmith <gabe.noblesmith@fairchildsemi.com>
Reviewed-on: https://chromium-review.googlesource.com/294924
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-04 07:08:36 -08:00
Alec Berg
4f090ad68e oak_pd: change oak_pd to be a sym link to glados_pd
Make oak_pd a sym link to glados_pd. A few small changes
necessary to make this possible:
- glados_pd now sets the VBUS present power status bit as oak_pd
does and as is appropriate for TCPCI spec.
- oak_pd now has watchdog enabled (not sure why it was
previously disabled).
- add a flag in gpio.inc to define EC_INT pin on B5 for oak_pd
and A14 for glaods_pd (and all other boards pointing to
glados_pd). Note: this breaks oak board rev 1, where EC_INT was
on A14.

BUG=none
BRANCH=none
TEST=make -j buildall
Load on glados and make sure zinger works.

Change-Id: I28f4ee106e44e2819919f1826508fc1fc05bb2a1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310193
2015-11-04 07:08:35 -08:00
nagendra modadugu
e8b998f2cc Dropping of DAP permission causes false alert when debugging.
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47239
TEST=ran debugger and checked for absence of bus errors
Signed-off-by: nagendra modadugu <ngm@google.com>

Change-Id: I97f3840000a271ef3402f0f3df88258f7a513d4e
Reviewed-on: https://chromium-review.googlesource.com/310542
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Nagendra Modadugu <ngm@google.com>
Trybot-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
2015-11-04 03:01:50 +00:00
nagendra modadugu
058687e0cc Drop permissions to MEDIUM (APP level).
Drop permissions as soon as initialization
is complete.  APP code is expected to run
at MEDIUM permission level.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=serial shell starts up
Change-Id: I181d55ca96eb5998ad49856af9f82afb67b03024
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/309919
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2015-11-03 18:50:48 +00:00
Shawn Nematbakhsh
792d00184a stm32: i2c: Use correct timingr values based on clock source
Previous change 813e56e10a broke this by interchanging the values.

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

Change-Id: I9a66949b66e0d6736c007773740b4f7431faa3cc
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310057
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-03 09:08:28 -08:00
Ben Lok
37ff1d9696 oak: using only one standby mode wakeup source.
Before Oak rev4, it defines 2 wakeup source EC_WAKE(PA0), EC_PWR_BTN_L(PB5).
Due to the wakeup source limitation of STM32F0 (http://goo.gl/VQk9GV),
Oak can only use one wakeup source, because EC_PWR_BTN_L is low-active and
it is kept high always. The HW & SW should be changed after rev4:
Using PA0 as wakeup source only, instead of both (PA0 & PB5).

BRANCH=none
BUG=chrome-os-partner:46670
TEST=Manual on oak rev4 with HW rework.
Detach PD power adapter, run 'hibernate' on EC console, make sure that both
EC and PD go to hibernate, verify the following cases individually:
1. Press power button and verify that both EC and PD wake.
2. Plug PD power adapter and verfy that both EC and PD wake.

Change-Id: Ief37aa1f11a84dd358875f22fa35c484b10bc388
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/309246
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-11-03 09:08:25 -08:00
Shawn Nematbakhsh
2431602575 cleanup: Standardize use of CONFIG_I2C and add MASTER/SLAVE CONFIGs
Some chips previously defined CONFIG_I2C and others didn't. Standardize
the usage by removing CONFIG_I2C from all config_chip files and force it
to be defined at the board level. Also, make boards define
CONFIG_I2C_MASTER and/or CONFIG_I2C_SLAVE based on the I2C interfaces
they will use - this will assist with some later cleanup.

BUG=chromium:550206
TEST=`make buildall -j`
BRANCH=None

Change-Id: I2f0970e494ea49611abc315587c7c9aa0bc2d14a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/310070
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-03 09:08:21 -08:00
Ben Lok
b1a3d8eda5 oak: handle the warm reset key from servo board
Warm reset key from servo board lets the POWER_GOOD signal
deasserted temporarily (about 1~2 seconds) since Oak rev4.
In order to detect this case, check the AP_RESET_L status,
ignore the transient state if reset key is pressing.

BUG=chrome-os-partner:46655
BRANCH=none
TEST=make buildall -j;
Press warm reset key of servo board, AP should reset normally.

Change-Id: Ib9f111d2273cde61354e72367fe74d4ee15d2291
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/307201
Tested-by: Yidi Lin <yidi.lin@mediatek.com>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-11-03 09:08:20 -08:00
Kyoung Kim
80b997dc27 mec1322: fix gpio_disable_interrupt
MEC1322_INT_DISABLE(interrupt enable clear register) is 'Write 1 to Clear'
for each bit. To disable interrupt for specific GPIO pin, only specific
bit should be written with 1.

BUG=NONE
BRANCH=NONE
TEST=NONE

Change-Id: Ibf40a20656c4c99f9625b516cff3e7da9bf2f69d
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/309979
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-03 09:08:07 -08:00
Ben Lok
59fd91317c oak: Adding 2S and 3S battery support
The default battery type of Oak is 3S, in order to compatible to
2S battery, set the minimum voltage of battery to 6V rather than 9V.

BRANCH=none
BUG=chrome-os-partner:46540
TEST=manual
1. connect 2S battery to rev4
2. check the battery info with EC command:
   > battery
3. confirm the voltage of battery is match to setting of battery_info.

Change-Id: Ieb7e39817bb0cefa523f73039b68943adb50f045
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/306381
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-11-03 09:08:00 -08:00
Dino Li
2ea7b194d9 nds32: fix interrupt
1. To enable INT_PRI (hardware interrupt priority level 0~3)
   register, bit0@INT_CTRL = 0.
2. GIE need to be enabled before UART is initialized.
   [symptom]
   To define CONFIG_RWSIG / CONFIG_RSA / CONFIG_SHA256, then power on:
   after RW image is verified, firmware stuck in uart_flush_output().

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

BRANCH=none
BUG=none
TEST=1. bit0@INT_CTRL = 0.
     2. The RW image is verified and jump to image RW.

Change-Id: I393a3d5f87ea257885b872c91bfce43aecbaea8b
Reviewed-on: https://chromium-review.googlesource.com/309400
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-01 19:45:58 -08:00
Dino Li
ba63ef190e it8380dev: fix irq, jtag and system
[irq]
1. The chip_init_irqs() function clears all IERx and EXT_IERx registers.

[jtag]
2. Enable debug mode through SMBus.

[system]
3. remove console_force_enabled functions.
4. implement __no_hibernate, scratchpad and nvcontext functions.

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

BRANCH=none
BUG=chrome-os-partner:23575
TEST=1. IERx and EXT_IERx registers are all cleared after chip_init_irqs().
     2. console command "scratchpad" and "hibernate".
     3. bram bank0 index 0x10 ~ 0x1F (16 bytes) for
        system_get_vbnvcontext() and system_set_vbnvcontext functions.

Change-Id: If044d50c69ae80b013ab646a3a6931cec7560ec4
Reviewed-on: https://chromium-review.googlesource.com/309390
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-01 19:45:57 -08:00
Mulin Chao
aa2db44011 nuc: Add state machines to handle i2c master stall bus and call i2c_xfer again.
Create two state machines SMB_WRITE_SUSPEND and SMB_READ_SUSPEND to handle i2c
master stall bus and call i2c_xfer again. Notice we should disable i2c
interrupt since cannot read/write SDA reg to clear interrupt pending bit.

Modified drivers:
1. i2c.c: Modified to handle calling i2c_xfer twice or more.

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

Change-Id: I781f6f8227867ea9c0e265b3064f48602c0f5f07
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/309381
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-01 10:08:50 -08:00
Shawn Nematbakhsh
9258886bd3 glower: Remove board
Glower is no longer in use or useful, so remove it.

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

Change-Id: I8f9868e37a759fa7c1229d5ad2531bc947108010
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309976
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-30 23:02:23 -07:00
Alec Berg
a023d6b0c1 glados: oak: chell: enable USB PD logging
Enable USB PD logging.

BUG=chrome-os-partner:45933
BRANCH=none
TEST=make -j buildall
make -j BOARD=glados tests
Load on glados and test that PDLOG events show up in dmesg

Change-Id: I61dbc5019ea3228542c2c244228bbb483cf51ead
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309881
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-10-30 17:51:20 -07:00
Shawn Nematbakhsh
813e56e10a stm32f0: i2c: Set timing register values by port clock source
I2C1 may be clocked by HSI or SCLK. I2C2 is always clocked by PCLK.
Therefore, apply different timing register values according to the
selected clock source for a port.

BUG=chrome-os-partner:46188
BRANCH=None
TEST=Manual on glados_pd. Verify slave i2c communication is functional.

Change-Id: Icd2306d25d5863b0fc3379e46885a227efb23cca
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309781
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-10-30 14:33:29 -07:00
Vadim Bendebury
e4d78afafb cr50: upgrade to the latest FPGA image 20151029_41713@78167
This patch updates the EC codebase to match the latest USB build which
now provides ability to programatically tell between different FPGA
flavors. It also changes the polarity of the 'cold bootsrap' pin, so
using the latest spiflash utility is mandatory.

Note that there has been no signer changes.

BRANCH=none
BUG=none
TEST=as follows:

    - programmed the FPGA, it now reports the following when reset:
      FPGA |20151029_041713@78167
    - booted the new image using the latest spiflash version. Note
      that the bootrom now reports the FPGA image it comes from
    - disconnected the FPGA upgrade port, rebooted the device, entered
      on the device console:
       > spstp off
       > spste
     run on the workstation:
       $ examples/spiraw.py -l 10 -f 800000
       FT232H Future Technology Devices International, Ltd initialized at 857142 hertz
     and observe on the DUT console:
       Processed 10 frames
       rx count 11574, tx count 5497, tx_empty 10, max rx batch 11
       >

Change-Id: I66596061731d9abcf41c5f5984ac479bbc1648e8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309963
Commit-Ready: Vadim Bendebury <vbendeb@google.com>
Tested-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-10-30 14:33:28 -07:00
Alec Berg
832b2cc58b samus: increase POWERBTN task stack size
BUG=chromium:547879
BRANCH=samus
TEST=make BOARD=samus

Change-Id: Iba29d53918245714ffcf6c87f42d1fa98be028b8
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309142
Reviewed-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit 12d924b7a05ddcd64a6d845faba5d6dc348c4bbd)
Reviewed-on: https://chromium-review.googlesource.com/309553
2015-10-30 13:09:41 -07:00
Alec Berg
c6b22f0ab7 pd: turn on CONFIG_USB_PD_LOW_POWER by default
Define CONFIG_USB_PD_LOW_POWER by default to save power on both
TCPM and TCPC side by waking PD task less often when possible.

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

Change-Id: I04441fb8339652cf073689177175a98f28807897
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309311
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-30 13:09:32 -07:00
Alec Berg
e080de3c48 pd: add more power improvements to PD task
Added more improvements to power consumption when using
CONFIG_USB_PD_LOW_POWER. On the TCPC, when this option is
defined, then decrease the PD task wake interval when
we are presenting Rd, we don't have a connection, AND we
haven't dual-role toggled recently. This shouldn't affect
connection time because we will get an interrupt when VBUS
is detected.

Note: we can't use the low power task wake interval when
we are connected because we need to monitor CC line for
Rp change and we can't do this when we are presenting Rp
because we need to quickly detect loss of Rd.

BUG=chrome-os-partner:45010
BRANCH=none
TEST=tested on glados. verified we connect to a charger in
S0 and S5. and verified that in S5, we spend >99% of our
time in deepsleep (as measured by idlestats console command).
note, that when testing EC and PD must both define
CONFIG_USB_PD_LOW_POWER to get maximum power improvements.

Change-Id: I661110cc7021f6d17937688787ea4f5f4b82973d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309310
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-30 13:09:32 -07:00
Mary Ruthven
49d4254bd4 Jerry: enable virtual battery
BUG=chromium:484841
BRANCH=none
TEST=check power_supply_info works properly on Jerry

Change-Id: I166fd4fc876b2d71f82e8fc7b33e4268a30be567
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309264
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-29 10:31:40 -07:00
Ben Lok
b347f36b10 oak: ensure PMIC power button is released after SYSJUMP.
There is a race condition between SYSJUMP and function
release_pmic_pwron_deferred().
Process of EC SW Sync will delay the execution time of
release_pmic_pwron_deferred(). PMIC will shutdown the power, if
PMIC power button can not be released within 8 seconds (depends
on PMIC spec). In order to ensure PMIC power button will be
released in time, just release it after SYSJUMP.

BUG=chrome-os-partner:46392
BUG=chrome-os-partner:46656
BRANCH=none
TEST=make buildall -j;
Enable EC SW sync and normal mode in coreboot,
Kernel should bootup successfully.

Change-Id: I45d4aa0f0d4280e68282ea11ccfda05201f88aae
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/307220
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-10-28 11:45:08 -07:00
Ryan Zhang
b86e256fb7 Lars: enable USB-A port power control
Lars: enable USB-A port power control

dumb mode is used since lars ec only have control over
the two usb-a ports' power enable/disable functionality.

BUG=none
BRANCH=lars
TEST=Run "make -j BOARD=lars", "make -j BOARD=lars_pd" and
 "make buildall -j" to build code and ec.bin can be generated.

Change-Id: I0231b36e3875b56bc822dbae1de37da2182e5736
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/309005
Commit-Ready: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-10-28 00:23:51 -07:00
Gwendal Grignou
21c46e7b13 motion: Remove duplicate shutdown code
Call shutdown() entry point at init() and remove duplicate code.
shutdown would init the sensor so they would be ready if needed.
Set S5 flag to include G3 (hard off) state, not only S5 (soft off).

BUG=chrome-os-partner:45722
BRANCH=smaug
TEST=When doing a RO->RW transition while AP is in G3, check the sensors
are initialized properly. This issue was found while testng the magic
sequence code.

Change-Id: I647f83580240bf5ba0c340fca3184220abe4c12e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308561
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-28 00:23:48 -07:00
Gwendal Grignou
7253e57b3c driver: si114x: Fail init of proximity sensor if light sensor fails.
If init of the light sensor fails (for instance, the chip is not present
on the i2c bus), we need to fail the init of the proximity sensor.
Otherwise, the EC will report an unexistent sensor to the AP.

BRANCH=smaug
BUG=chrome-os-partner:46638
TEST=check the proximity sensor is not reported if sensor is disconnected from the
main board.

Change-Id: Ie6b1d74eaac4d6c38d52641626966b5d3ce63bd3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308560
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-28 00:23:48 -07:00
Gwendal Grignou
8238dfa27d driver: bmi160: Add magic sequence to unlock
If init() is interrupted while we are setting the link to the compass,
the BMI160 may be in paging mode and will only answer to registers 7Eh
and 7Fh. Other registers access will return 00h.
To get out of this state, run the sequence to move back from the paging
mode in the error handler. If successful, a subsequent call to init()
will work.

BRANCH=smaug
BUG=chrome-os-partner:45722
TEST=use a special firmware that exists in the middle of the compass
init sequence. Check that the FIFO and all other registers return 0.
Issue 'accelinit 1' (to reset the Gyro): the command succeeds and the
accelerometer is operational again (double tap works).
Check the sequence can be issued after sysjump to RW/RO.

Change-Id: I3455a8cbdcf1c88699ae90f7c09e4438e1268d47
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308184
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-27 16:29:33 -07:00
Bernie Thompson
df038776b4 Remove cyan ec configuration
We no longer need to build cyan on ToT, so we can remove it.

BUG=chrome-os-partner:44576
TEST=None
BRANCH=None

Change-Id: Ifaad4570cb8e1c427e0c341073e4bacd29462974
Signed-off-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309000
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-10-27 13:19:52 -07:00
Shawn Nematbakhsh
2bd7dce32e charger: Add LIMIT_POWER charger param for low bat + weak charger
Add support for two new configs to specify critical energy battery
percentage and critical external charger power. When we are under both
thresholds, set the LIMIT_POWER charger parameter to inform the AP that it
should conserve power to avoid brownout, and consider jumping to EC RW
to negotiate PD.

In addition, modify the existing CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
to allow power-up regardless of power level if a 15W+ charger is
attached, since there is a reasonable chance it may speak PD and provide
sufficient power to boot the AP.

BUG=chromium:537269
TEST=Manual on Glados. Set CHG_MW thresh to 20000, BAT_PCT to 50. Verify
that LIMIT_POWER charger param is set until Zinger negotiates to 20V. Also
veify that system can boot with Donette.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic963c82fea4ad10e8a5d7e476c5ce3e5ae525dad
Reviewed-on: https://chromium-review.googlesource.com/306774
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-27 13:19:51 -07:00
Mary Ruthven
cb4a76e802 i2c: get battery information from charge state
ARM systems currently use SBS kernel driver which talks to the battery
through I2C passthu in the EC. Instead when asking for battery
information try getting it from the charge state machine first, and
then try the battery if charge state does not have the information.
This reduces latency by cutting out the battery response time.

BUG=chromium:484841
BRANCH=none
TEST=check that power_supply_info works properly on Jerry

Change-Id: If4da15ccabe412adc31fc94b189089ebb3e9265c
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/307905
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-27 11:52:34 -07:00
Duncan Laurie
95e8bc2e0b chell: Set SPI flash chip to W25X40
Chell was still set to use W25Q64 instead of the W25X40 that is
actually on the board.

BUG=chrome-os-partner:46289
BRANCH=none
TEST=successfully run "flash_ec --board=chell"

Change-Id: If21e5f9a00600c97d81d2bb2a8700801ae5c2fd6
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308727
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-10-27 01:22:57 -07:00
Duncan Laurie
1361a78311 flash_ec: Add support for flashing chell PD
Add chell_pd to the STM32 list and the USBPD override list.

BUG=chrome-os-partner:46289
BRANCH=none
TEST=successfully run "flash_ec --board=chell_pd"

Change-Id: Ic4ddbe51a0586c563211fd76f20a85428e565546
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308726
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-10-27 01:22:57 -07:00
Dino Li
2fa6f3e590 it8380dev: gpio - remove comment about E4
E4 pin has two output options, INTC WKO25 and WKO114. We can use
any of them. So we enable E4's output to INTC WKO114.

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

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

Change-Id: I1c24d3f5aa7c5ca0fc90fcafc3f0a5edc237ce53
Reviewed-on: https://chromium-review.googlesource.com/307215
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-25 09:17:44 -07:00
Dino Li
ad1d33778f it8380dev: Increase DLM size
1. Total DLM size is 48KB.

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

BRANCH=none
BUG=none
TEST=DLM 0x84000 ~ 0x8BFFF read/write OK.

Change-Id: I2340aeefca60ad59062254ddd363c703c30cfd24
Reviewed-on: https://chromium-review.googlesource.com/307006
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-25 07:40:31 -07:00
Dino Li
19c1e9905d it8380dev: fix clock module
1. Implement deep doze mode for CONFIG_LOW_POWER_IDLE.

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

BRANCH=none
BUG=none
TEST=test the following items in deep doze mode.
     1. WUI interrupts wake-up OK. (For example, power button, lid,
        uart rx, keyboard ksi, and so on)
     2. LPC access interrupt wake-up OK.
     3. Enabled Hook debug, no warning message received (48hrs).

Change-Id: I8702a112632cb6c1c0fa75d682badf272130a7d4
Reviewed-on: https://chromium-review.googlesource.com/307060
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-25 04:34:36 -07:00
Alec Berg
9acd84460e glados: oak: reboot EC if PD MCU crashes
If PD MCU crashes, it will go back to RO code and stay there
until the next AP boot. So, if EC detects PD has crashed, then
EC should panic reboot with debug message that it detected
a PD crash.

PD MCU crash is detected by EC by seeing the PD MCU transition
from RW to RO, without it setting the flag that it got there
from a sysjump.

This CL also makes minor changes to oak_pd and glados_pd board.c
files to make them identical, other than the few minor real
differences between them.

BUG=none
BRANCH=none
TEST=tested on glados using pdcmd console command on EC to test
sysjumps and reboots:

sysjump to RW: pdcmd 0xd2 0 2 0
sysjump to RO: pdcmd 0xd2 0 1 0
cold reboot:   pdcmd 0xd2 0 4 0

Verified that PD can jump back and forth between RO and RW
without EC panicing. Verified that if PD MCU is in RW and
reboots, then the EC will panic and print 'PD crash'. Verify
if PD MCU reboots while in RO, without ever going to RW first,
then EC does not panic.

Change-Id: Id3191f4005e70a6c61a9322bf535b4374e85eb9a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308586
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-23 22:49:29 -07:00
Alec Berg
71e12124e5 pd: remove unnecessary delay in phy init
Remove unnecessary 250ms delay in USB PD phy init

BUG=none
BRANCH=none
TEST=test on glados and samus. verify we negotiate with
zinger after EC or PD reboots.

Change-Id: I561e41fb0b8bbfeacdd7d6a9ceaf67a1606f65e5
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308535
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-23 19:29:27 -07:00
Vincent Palatin
3f567a9869 ryu: fix lid close detection
Now we are using LID_OPEN *and* BASE_PRES_L for lid close detection,
we need an interrupt on both to debounce arbitrarily long delay between
the transitions of the 2 GPIOs.

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

BRANCH=smaug
BUG=chrome-os-partner:46189
TEST=manual: activate manually LID_OPEN and BASE_PRES_L hall sensors in
very slow sequences and see the proper "lid close"/"lid open" traces,
whatever sequence I do.

Reviewed-on: https://chromium-review.googlesource.com/308513
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>
(cherry picked from commit 659d826b4efcd391eced3d4dda319d502d028457)

Change-Id: I2ee91370205a4bfc0f4b4d224cb55207f745af25
Reviewed-on: https://chromium-review.googlesource.com/308515
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-23 19:29:26 -07:00
Vincent Palatin
b3911e8eef ryu: do not pull EN_PP3300
Modify the former workaround for board revisions missing an external
pull-up to 1.8V on EN_PP3300 :
the 100kOhm resistor between GPE13 and EN_PP3300 is still stuffed even
on boards which don't need the workaround, so tri-state the pin to avoid
driving the net.

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

BRANCH=smaug
BUG=chrome-os-partner:46799
TEST=probed EN_3300 voltage level.

Change-Id: I48f2b2fa9a716cdbe07fbc8a006ba4d3fcfaa63d
Reviewed-on: https://chromium-review.googlesource.com/307868
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 53e49d6d6541183349bb7267fa5ec2b1db250d99)
Reviewed-on: https://chromium-review.googlesource.com/308514
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-10-23 18:03:13 -07:00
Gwendal Grignou
81d269dc00 common: lightbar: Add histeresis to prevent flickering
When ALS is enabled, if light is around one threshold (say 40 lux),
the lightbar will flicker between readings.
Add a histeresis to prevent the flickering.
The current setting is:

setting    ^
(dim)    2 | ------+---->---+
         1 |       +----<---+--->---+
(bright) 0 |                +---<---+---------
           +-------+--------+-------+--------> lux
               20       40      60

BRANCH=smaug
BUG=chrome-os-partner:44400
TEST=check in a dark room (30~40 lux) there is no flickering.
Add unit test.

Change-Id: I4018e2c2ed764abf9c9ed28e2d50a3e94a7d5f75
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308205
2015-10-23 18:03:12 -07:00
Gwendal Grignou
3fc374b7fd board: ryu: Compass and Gyro stays up in S5
Gyro and compass is suspended but still powered on.
Therefore they don't need to be reinitialized.
Note that their init() does not do much, most is done when
initializing the accelerometer part of the BMI160.

BRANCH=smaug
BUG=none
TEST=Check that Gyro: MS Done Init... message are not present
when powering up the system in a loop.

Change-Id: If92727830c32407df49213db46b1d5f1cb0369af
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308204
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-23 16:32:45 -07:00
Aseda Aboagye
daca039e2a mec1322: Remove CONFIG_PORT80_TASK_EN from boards.
There is no port 80 task for the MEC1322 anymore,  therefore no board
should be using this define.  I forgot to remove these at the time.

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

CQ-DEPEND=CL:308450

Change-Id: Ie44474470edb40bc94ec95be9663b509e0ba299a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/308451
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-10-23 14:46:03 -07:00
Alec Berg
94ed0b2cfa lars: remove port80 task
The port80 task has been removed recently and replaced with a timer
interrupt (CL:305591). Fix lars to match the new scheme.

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

Change-Id: I602ef1306b9889732e77cbb32753ca0286123e2b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308450
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-10-23 13:19:01 -07:00
Alec Berg
776bedc3f8 glados: chell: add VCONN swap ability
Add VCONN swap ability and accept VCONN_SWAP requests as long
as we have the ability to provide VCONN.

BUG=none
BRANCH=none
TEST=test on glados. ask for vconn swap and make sure vconn swap
is successful.

Change-Id: I7340e6253dcde4cdbe333a9622d7826e7ccbe6b4
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308238
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-23 13:18:58 -07:00