Commit Graph

1640 Commits

Author SHA1 Message Date
Gwendal Grignou
4e7e1bb796 motion_sense: Add more complex EC/AP sensor rate support.
Add config settings for ODR and EC rate per requestor and
per power state (1 for the AP, 3 for the EC).
This way we can finely set ec rate and ODR depending on usage.

On chromeos, AP is not setting frequency, so EC sets for different power
state. On some platform, sensors can now be suspended in S3/S5.

Allow EC oversampling when AP is only looking for a few samples.
It is useful for double tap detection where high accelerator ODR is
required.

BRANCH=ryu
TEST=Tested on Ryu
BUG=chromium:513458

Change-Id: Ic3888a749699f07b10c5da3bc07204afd4de70da
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295637
2015-08-29 01:34:14 -07:00
Alec Berg
252dce9bd3 glados: increase voltage hysteresis in fast charging
Increase voltage hysteresis in fast charging to 100mV to avoid
bouncing back and forth between low and high voltage profiles.

BUG=chrome-os-partner:44299
BRANCH=none
TEST=test on glados, charge up from below 8.2V to above 8.3V
with zinger and verify that we switch cleanly from the low
voltage profile to the high voltage profile.

Change-Id: Ia4c03b93da66c4913848ba8eec0e09988c4d71d8
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296024
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-28 19:43:42 -07:00
Vijay Hiremath
5943f49e17 Keyboard: Add a macro to conditionally compile the console commands
Added macros to conditionally compile the keyboard test console commands to
save the memory. These macros can be enabled/disabled in the board specific
files.

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

Change-Id: I3ad190f1f3c9310e4f706b3b23cb8ca8755e49ef
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/295942
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Commit-Ready: Divya Jyothi <divya.jyothi@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-28 18:09:06 -07:00
Dawei Li
97a1d1671b twinkie firmware: add support for vbus voltage and current
The format of an ep packet header (8 bytes) :
Packets for cc1: [sample_tstamp, sample_seq, vbus_voltage, tstamp_offset]
Packets for cc2: [sample_tstamp, sample_seq, vbus_current, tstamp_offset]
Updated: use array to implement a circular queue; when a forming a packet,
remove one element from the queue. In this way, we can capture more samples
of vbus information.
Updated: when sniffer task has not started sending packets, most recent vbus
info is always stored at the first position of the queue, making sure that
the first reported vbus info is the most recent one.

Updated: allow user to compile the original version or the new version of the
source code. In ec/board/twinkie/board.h
Use #define CONFIG_USBC_SNIFFER_HEADER_V1, if you do not want twinkie to
send out vbus info;
Use #define CONFIG_USBC_SNIFFER_HEADER_V2, if you want twinkie to send out
vbus info.

Signed-off-by: Dawei Li <daweili@google.com>

BUG=chrome-os-partner:42703
BRANCH=none
TEST=BEGIN
connect Twinkie to a waveform generator, record data using:
sudo sigrok-cli -d chromium-twinkie --continuous -o test.sr
then check the resulting waveforms on pulseview.
END

Change-Id: Ifdb6402eb7d998ffb25128c510d1780491b11872
Reviewed-on: https://chromium-review.googlesource.com/282388
Commit-Ready: Sheng-liang Song <ssl@chromium.org>
Tested-by: Dawei Li <daweili@google.com>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-28 01:19:33 -07:00
Dawei Li
405ac32148 twinkie_sink: allow twinkie commands in the sink mode twinkie
Previously, the "twinkie" commands are only avaible in sniffer/normal
mode. By allowing the twinkie commands in sink mode. We can
do more testings in the sink mode. The following important commands
are now available in sink mode:
twinkie bufrd, twinkie bufwr, twinkie fsm, twinkie send.
With these commands, we can command sink mode twinkie to send
arbitrary USB PD packets, and see how the target devices respond.

Since sink mode and sniffer mode may have conflicts with each
other, the commands may not behave in the same way as in sniffer
mode. See the #ifdef HAS_TASK_SNIFFER ... #endif blocks for details.

Signed-off-by: Dawei Li <daweili@google.com>

Change-Id: I06d4a7674d9aa897d09d4a2e6f2410f2c84f8f4b
Reviewed-on: https://chromium-review.googlesource.com/294956
Commit-Ready: Sheng-liang Song <ssl@chromium.org>
Tested-by: Dawei Li <daweili@google.com>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-28 01:19:33 -07:00
Vijay Hiremath
eb57628abe Kunimitsu: Buffer AC status to the PCH
Ported the patch from Glados.
 Change-Id: Id7e6ca674e35c98594d09b86ab5bdf518f8b3984
 Reviewed-on: https://chromium-review.googlesource.com/288922

BUG=none
BRANCH=none
TEST=boot on Kunimitsu and verify PCH_ACOK is asserted when the device
     starts to charge and is deasserted when no cable is connected.

Change-Id: I869dab9dacc9c80da1cff79d795f07e16cbd37de
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/295864
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-27 21:27:49 -07:00
Mike M Hsieh
6ced01bb86 kunimitsu: battery led implementation
Implement LED function for battery charging behavior

BUG=none
BRANCH=none
TEST=checked and verified LED behavior while charging and remaining battery
capacity under 3%/10%
Signed-off-by: Mike Hsieh <mike.m.hsieh@intel.com>

Change-Id: Ic340d4ea428f7726611b2ae24a4d18563c63ee80
Reviewed-on: https://chromium-review.googlesource.com/295476
Commit-Ready: Wenkai Du <wenkai.du@intel.com>
Tested-by: Wenkai Du <wenkai.du@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-27 14:39:53 -07:00
Todd Broch
5bc9b32807 ryu: Change charger termination current to 192mA.
Good rule of thumb for charger current is that it should be set
between C/20 & C/50 for the battery of the device.

For ryu its presently set at 64mA which may explain why we see
charger's status as charging even when battery is full.  In any case
its well below recommendation so lets change it to something within
that.

Sampled data (see issue tracker) indicates charging current is ~256mA
when battery reaches 100% charged.  Setting to 192mA (3 * 64) to error
on the side of charging slightly longer.  This number is still within
termination current recommendation:
  C/20 > term_current >= C/50

Note, also changing bq2589x default termination to match its POR value
of 256 as no other board uses this charger presently.

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

BRANCH=smaug
BUG=chrome-os-partner:42848
TEST=manual, read charger IC termination register and see termination
current set to 192mA

Change-Id: I60dbb9326c3abb8091fd9ab18eda08b9eabb197b
Reviewed-on: https://chromium-review.googlesource.com/293096
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-08-27 11:45:57 -07:00
Aaron Durbin
6ebc6c493f glados: implement x86 power cycle on EC reset
On certain glados boards (board id >= 2) there is a
gpio conntected to the LDO_EN pin of the BD99992 pmic.
This is a requirement for pulling power from the x86
side of the system. Add a check at HOOK_INIT time to
check the current system reset flags. If a watchdog,
hard, or soft reboot occurred the LDO_EN is deasserted
to bring down the DSW and primary rails.

BUG=chrome-os-partner:44527
BRANCH=None
TEST='reboot', 'reboot ap-off', host cmd reboot.

Change-Id: I7e971a03c8894e1cbf20aaad67903db2057aad41
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295116
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-26 21:50:29 -07:00
Aaron Durbin
73338cc986 glados: disable console history
We're already too close to limits. Disable console history to
provide more breathin room for features.

BUG=chrome-os-partner:44527
BRANCH=None
TEST=Can build with follow up code that actually links.

Change-Id: I53f9fdace64e01d28081f62fa535bb6efd0f5675
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295114
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-26 20:21:58 -07:00
Aaron Durbin
2fd997c27c glados: enable CONFIG_BOARD_VERSION
Glados has board ids, but the config variable was
never set. Enable the config and also change the name
of the GPIOs to match the expectations of the common
infrastructure.

Prior:
> version
Chip:    smsc mec1322 81
Board:   0
RO:      glados_1.1.9999-f3a5046
RW:      glados_1.1.9999-f3a5046
Build: glados_1.1.9999-f3a5046 2015-08-26 10:42:45 @adurbin-chromium

With chnage:
> version
Chip:    smsc mec1322 81
Board:   1
RO:      glados_1.1.9999-028832d
RW:      glados_1.1.9999-028832d
Build: glados_1.1.9999-028832d 2015-08-26 11:41:43 @adurbin-chromium

BUG=chrome-os-partner:44527
BRANCH=None
TEST=version command reports board id strapping.

Change-Id: I9b7e41d2f61a91de4648a09ac9da9f101f7bb830
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295113
Reviewed-by: Leroy P Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-27 01:49:43 +00:00
Tom Wai-Hong Tam
38ddecb897 Ryu: Add a console command to control the buttons VolUp and VolDown
(cherry-pick back to ToT)

FAFT needs these buttons (VolUp and VolDown) be controllable
such that it can automate the firmware mode switching flows.
It is done by EC overwriting the GPIO values such that AP can
see the results.

BRANCH=ToT,smaug
BUG=None
TEST=AP boots into the firmware menu screen. Run the following commands
in EC console:
> btnpress voldown 1
> btnpress voldown 0  # See the next option selected, like a real button pressed
> btnpress volup 1
> btnpress volup 0  # Boot in the selected option, like a real button pressed
> btnpress volup
Button volup pressed = 0

Change-Id: I5e0b514d9986b8e5729ffd3560560d650669e0b7
Signed-off-by: Vic Yang <victoryang@google.com>
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294882
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit 77291b156d10f31dd059a4662aa249a8f8ea762e)
Reviewed-on: https://chromium-review.googlesource.com/295162
2015-08-27 01:49:25 +00:00
Gwendal Grignou
456d1baa25 Ryu: increase HOST_CMD stack size
Hit overflow while sending autocalibrate command.

At rest, we were already close to the limit:
   7   HOSTCMD          00000000    0.104035  472/488
Increase to 640 bytes.

BUG=chrome-os-partner:44381
BRANCH=ryu
TEST=Check auto calibrate works.

Change-Id: Ife014baf4316cdca952104c5158f38cd106e023f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295590
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-26 08:28:24 +00:00
Shawn Nematbakhsh
bcab6d22df glados: Increase stack size for powerbtn task
We occasionally see stack overflows in the powerbtn task, so bump the
stack size.

BUG=chrome-os-partner:44202
TEST=Manual on Glados. Disable SLP_S0 GPIO interrupt, run 'reboot' on EC
console, verify that stack overflow is not encountered.
BRANCH=None

Change-Id: I858ad50e86b998e4283a5e11d3a720212150f657
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295571
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-26 05:12:38 +00:00
Rong Chang
f3a5046ed7 glados: oak: Add charger AMONBMON console command
AMONBMON is a charger feature to measure input current and battery output
current. ISL9237 output analog value of voltage diff across sense
resistor to EC's ADC channel. This change also reorders oak's ADC channel
to fix a reading bug.

BRANCH=none
BUG=chrome-os-partner:42270
TEST=manual
  in EC serial console, type command 'adc' and check AMON_BMON value.
  type command 'amonbmon' and check AC current and BAT current.

Change-Id: I9db0a72be7c9a428a16d1609eb8c461c6928e548
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/283665
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-25 13:11:19 +00:00
Shawn Nematbakhsh
1155520c8a glados: Disable keyboard + trackpad in tablet mode
The internal keyboard and trackpad must be disabled in tablet mode to
prevent unwanted input.

BUG=chrome-os-partner:44305,chrome-os-partner:40849
TEST=Manual on Glados. Boot system with lid open, verify that keyboard
is functional and ENABLE_TRACKPAD is high. Swing lid to tablet mode,
verify that keyboard is not functional and ENABLE_TRACKPAD is low.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9f250ae82963c8b497de991b6cce52c86841d08a
Reviewed-on: https://chromium-review.googlesource.com/295206
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-24 20:25:41 +00:00
Anton Staaf
69bd4ce351 USART: Add DMA based receiver
This DMA receiver uses a separate small circular buffer to DMA into.
This allows the DMA transaction to be made circular, and thus it does
not require the interrupt latency to be low enough to setup the next
transfer before the next character comes in.

Additional diagnostics output have been added to the usart_info console
command to facilitate tuning of the FIFO size.

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

BRANCH=None
BUG=None
TEST=make buildall -j
     Verify DMA works by cross connecting two discovery boards

Change-Id: Idcdf95a47fadf21ec2154f0c9128cd3586e568ec
Reviewed-on: https://chromium-review.googlesource.com/292870
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
2015-08-24 19:08:35 +00:00
Anton Staaf
16f63703c9 USART: Add usart_info command
This optional console command is enabled with CONFIG_USART_INFO_COMMAND.
It will display and clear dropped character and overrun counts for all
configured USARTs.

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

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

Change-Id: Icf6061aaab2cda71e9d317455c897828b9daf844
Reviewed-on: https://chromium-review.googlesource.com/292770
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-08-24 19:08:30 +00:00
Ben Lok
0b79533f88 oak: add battery setting for rev3 & rev4
The battery type of rev3 is changed to 3S, add this setting to battery_info.
But in order to compatible to 2S battery, set the minimum voltage of
battery to 6V rather than 9V.
For rev4, it should always connect to 3S battery and doesn't necessary to
support 2S battery.

BRANCH=none
BUG=chrome-os-partner:44428
TEST=manual
1. connect 2S battery to rev3.
2. check the battery info with EC command:
   > battery
3. confirm the voltage of battery is match to setting of battery_info.
4. connect 3S battery to rev3, and repeat step 2&3.

Change-Id: I626ed150d76a1dfba7d1caf08c4f19882e9cb089
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/295024
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-08-24 11:43:29 +00:00
Gwendal Grignou
da4239f64b ryu: add si1141 support
Add si1141 to the list of motion sensors.
Setup IRQ line and other constants.

BRANCH=smaug
TEST=Check sensor is working
BUG=chrome-os-partner:32829

Change-Id: Ic05bc24164d067a1dee6a6241681420348d7a843
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291336
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-22 09:31:57 +00:00
Gwendal Grignou
f59ab4c5f3 cyan: fix sensors matrices
Matches definitons set in
chromium/chromeos/accelerometer/accelerometer_types.h.

Using that standard, the coordinate frames of the lid and base DO NOT
line up perfectly when the lid is fully closed or fully open.

Therefore, rotate the lid vector 180 along the X axis before
calculating the lid angle.

BRANCH=cyan
BUG=chrome-os-partner:40177
TEST=When the device is open 180 degrees, check the sensors
agree with each other:
Flat on the back (Z pointing to the sky):
localhost devices # cat */*raw
-1008 [keyboard : X]
-112  [keyboard : Y]
16544 [kyeboard : Z]
-256  [lid : X ]
2000  [lid : Y ]
16336 [lid : Z ]
On the right side (X pointing to the ground)
localhost devices # cat */*raw
-16928
-48
-1040
-16176
432
80
On the bottom edge (Y pointing to the sky)
localhost devices # cat */*raw
-192
15872
1648
496
15936
752
Check the angle as calculated by the EC is correct using accelinfo.

Change-Id: Ib8ee42da8cf818213f892b1f024253f37a4da488
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294716
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
2015-08-22 01:37:55 +00:00
Shawn Nematbakhsh
ad8ce3f806 usb_pd: Add host command to limit external charger voltage / current
PD charger voltage + current can now be limited with
EC_CMD_EXTERNAL_POWER_LIMIT. The limit is automatically cleared when the
AP transitions out of S0 into S3 / suspend.

BUG=chrome-os-partner:43285
TEST=Manual on Samus w/ zinger.
- Plug zinger, verify charging at 20V/3A.
- `ectool extpwrlimit 3000 12000 --dev=1`, verify charging at 12V/3A
- `ectool extpwrlimit 1000 5000 --dev=1`, verify charging at 5V/1A
- Plug zinger into other port, verify still charging at 5V/1A
- `powerd_dbus_suspend`, verify charging at 20V/3A
- `chglim 2000 12000`, verify charging at 12V/2A
- `ectool extpwrlimit 0xffff 0xffff --dev=1`, verify charging at 20V/3A
- `chglim 1000 20000`, verify charging at 20V/1A
- `chglim`, verify charging at 20V/3A
BRANCH=ryu

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6cd5377be91b3df75f99cb414fd3fa5a463b56cb
Reviewed-on: https://chromium-review.googlesource.com/293954
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-08-22 01:37:38 +00:00
Bill Richardson
65d683a7e5 Cr50: Build external libs remotely, but put objects here
When building components from external libraries, instead of
rsyncing the library into our build directory and building there,
just build in the library directory and have it put its generated
objects into our build tree. That will keep any build artifacts
in the library directory from polluting our builds unexpectedly.

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

Change-Id: I2f07a2b49d1a0ba9fd9fff0822551486be820b70
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295044
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-08-22 01:37:25 +00:00
Rong Chang
c2ebc9e477 oak: use EXTRA_CLFAGS instead of CONFIG_BOARD_OAK_REV
Oak board revisions are not global configs. Move them out of
include/config.h . This change also makes it easier to build EC
and PD image for different board revisions.

BRANCH=none
BUG=none
TEST=manual
  build for board revision n and load on oak:
    make BOARD=oak clean
    make BOARD=oak_pd claen
    make EXTRA_CFLAGS=-DBOARD_REV=n BOARD=oak -j
    make EXTRA_CFLAGS=-DBOARD_REV=n BOARD=oak_pd -j

Change-Id: I331b4c5a1af94b179d7c6f7878a9c3939ea6025a
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294441
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-21 08:10:23 +00:00
Rong Chang
9f146c7b8a oak: enable oak TCPM power status
Oak doesn't have enough interrupt pins to detect VBUS change. This CL
enables oak TCPM power status alert.

BRANCH=none
BUG=chrome-os-partner:41226
BUG=chrome-os-partner:42610
TEST=manual
  load on oak rev2. plug in normal type-c charger or legacy type-c
  chargers and check charging status.

Change-Id: I9659e749b515f999fe9e81373567f52ec3fe956a
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291161
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-08-21 08:10:16 +00:00
Alec Berg
16cbaf1cd1 oak: add usb charger tasks
Add USB charger tasks to oak to detect legacy charger type.

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

Change-Id: Idb8061c39b0bb8b42f47cbe3ff213b04f14c889a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290420
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Queue: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
2015-08-21 08:10:11 +00:00
Vijay Hiremath
646760bb20 Skylake: Add low power Pseudo G3 support
BUG=none
TEST=Used "shutdown -h now" Kernel console command to test on Kunimitsu.
     With only battery after 1 hour, device enters to Pseudo G3 and the
     V3p3A is off. With AC connected, device is in G3.
BRANCH=none

Change-Id: I955662eb69ac608e9b2d12bdcfbc1258ca83f3a5
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/292976
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-21 03:46:19 +00:00
Wenkai Du
60ddfc8310 kunimitsu: Enable CONFIG_VBOOT_HASH
Port Shawn's patch for glados to kunimitsu:

Enable CONFIG_VBOOT_HASH to support image hash related host commands.
Originally-reviewed-on: https://chromium-review.googlesource.com/294567

Removed temperature sensor test command to save space.

BUG=chrome-os-partner:44214
TEST=Verify `ectool echash` prints a hash
BRANCH=None
Change-Id: I72312cd4d3ae116073e15bb07ca3256c82efe3dd
Signed-off-by: Wenkai Du <wenkai.du@intel.com>
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/294735
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-08-21 00:49:17 +00:00
Shawn Nematbakhsh
3449026b47 glados: Enable CONFIG_VBOOT_HASH
Enable CONFIG_VBOOT_HASH to support image hash related host commands.

BUG=chrome-os-partner:44214
TEST=Verify `ectool echash` prints a hash
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ida17b6cbd03ba0a136df1306bf277dc548a5d9ef
Reviewed-on: https://chromium-review.googlesource.com/294567
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-20 03:12:12 +00:00
Shawn Nematbakhsh
43b3f5bc88 glados: Remove console commands to reduce image size
Remove 'i2cscan' and 'hash' (not yet present, but would be added with
subsequent commit) to reduce image size.

BUG=chrome-os-partner:44214
TEST=`make buildall -j` with subsequent commit
BRANCH=None

Change-Id: I3831ff8565291a992b14a28d5c3a14a74828a57a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294566
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-20 03:12:07 +00:00
Mulin Chao
8c633e5af6 nuc:
Modified i2c driver into controllers and ports to support I2C0 port 0/1 at
the same time.

Modified drivers:
1. i2c.c: Support i2c controller mechanism and fixed bug for i2c_raw functions
used by i2c_wedge and i2c_unwedge.
2. gpio.c: Fixed bug for gpio_alt_sel since wrong type of func.
3. lpc.c: Fixed bug for port80. Since disabling SUPPORT_P80_SEG, we should
replace GLUE_SDP0/1 with DP80BUF.

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

Change-Id: I9919269e4f5e795d9ceb8a4cd2c39abbd7bb6b1a
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/294015
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-08-19 08:10:27 +00:00
Aaron Durbin
7ad94648a5 glados: make BATLOW_L open drain and default high
The BATLOW_L signal is externally pulled up to PP3300_DSW.
Therefore, there's no need to pull this up internally to
the EC's rail. Additionally, allow BATLOW_L to be high
by default as a forthcoming power sequencing change doesn't
utilize the BATLOW_L signal.

BUG=chrome-os-partner:44081
BUG=chrome-os-partner:44082
BUG=chrome-os-partner:43475
BRANCH=None
TEST=Built and booted glados.

Change-Id: I175408d64b728cacc3f6a305680962fe0320eeb9
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/293843
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-08-19 08:10:16 +00:00
Aaron Durbin
eb1327ea0c glados: don't pull up SLP_S0_L
The SLP_S0_L signal lives in the primary power well of skylake
while the EC's VCC is on the DSW rail. If SLP_S0_L is pulled up
then there is leakage into the primary well when it's not on.

BUG=chrome-os-partner:44098
BRANCH=None
TEST=Built and booted glados. Default powerindebug state shows SLP_S0_L
     low when in deep sleep states.

Change-Id: If9c7972fb6a8b8f90738c1c0f7eea6cf2373d64b
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/293842
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-08-19 08:10:09 +00:00
Shawn Nematbakhsh
4e355700aa glados: Switch to V2 board
Switch to V2 glados as the default, and remove support for V1.

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

Change-Id: I58f33225177d259916e8877084c2c431922e7bc5
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/293303
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-08-14 21:04:48 +00:00
Vadim Bendebury
571b7bb640 cr50: tpm2: pull in the tpm2 library sources
This patch syncs up TPM2 sources into the build area when building
cr50 image. This relies on a specific directory layout so that the ec
makefile has access to the tpm2 source tree.

The sources are copied using rsync, the tpm2 library is a dependency
for the RO/RW elf images, and is declared to be a phony make target,
which guarantees that the tpm2 make is always run when cr50 image is
built.

Include files in board/cr50/tpm2 are necessary to be able to build
tpm2 code using the bare metal toolchain used for building ec code.
memory.h is in fact empty, it is easier to add it here than to wrap it
in conditional compilation at the source.

Make variables CROSS_COMPILE and CFLAGS are exported for the benefit
of the tpm2 makefile. ROOTDIR indicates where tpm2 library should look
for .h files not available from the toolchain.

CQ-DEPEND=CL:292946
BRANCH=none
BUG=chrome-os-partner:43025
TEST=make buildall -j succeeds;
     when linked with the latest tpm2 source, the combined image
     starts the tmp task and reacts to the host sending the startup
     command (failing due to unplugged stubs).

Change-Id: Ia3fd260588558c2bacd724df9583052fa4660ca3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/292975
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-08-14 21:04:43 +00:00
Vadim Bendebury
6386c37379 cr50: introduce tpm task skeleton
TPM command processing should not be happening on the interrupt
context.

This patch adds a skeleton of the task which handles TPM functions. It
initializes the TPM and then enters endless loop waiting for an event
trigger from interrupt, which happens when a valid FIFO message is
received.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=none yet

Change-Id: I63dce2762cc07370a05bf00bdf144c5d9eb6019b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289332
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-08-14 21:04:38 +00:00
Dawei Li
68088eb93f twinkie: bug fix for injector.c:cmd_bufrd
bug: when typing
> tw bufrd 3 2
in twinkie console, the command will output 3 elements
However, the third argument(3) is where it starts output
the elements; and the fourth argument(2) is the number
of elements to be printed.

Original code uses: "cnt = strtoi(argv[0], &e, 10);" to
get the count.
It should use "cnt = strtoi(argv[1], &e, 10);" instead.

Signed-off-by: Dawei Li <daweili@google.com>

Change-Id: I04cf041e47cdf72c5189e4b8446c8f8e4cc5e2e5
Reviewed-on: https://chromium-review.googlesource.com/293561
Tested-by: Dawei Li <daweili@google.com>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Commit-Queue: Sheng-liang Song <ssl@chromium.org>
2015-08-14 02:25:55 +00:00
Aseda Aboagye
5044ff7cd3 twinkie_sink: Fix makefile for variant.
With the recent changes to the build system, RW objects are located in
the RW/ subdirectory of the output build directory.  This commit fixes
the build for the variant.

BRANCH=None
BUG=chrome-os-partner:43965
TEST=./board/twinkie/build_rw_variant; build is successful.

Change-Id: Ifab1994e6e368cc61784df7358c59b7ebd87e67c
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/293344
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Dawei Li <daweili@google.com>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-13 21:41:24 +00:00
Shawn Nematbakhsh
fe150a64e9 glados: Revise PMIC initialization
- PMIC init can be called from HOOK_INIT now that this happens after the
  scheduler has started.
- There's no need to re-initialize the PMIC on sysjump

BUG=None
TEST=Verify glados boots to S0
BRANCH=None

Change-Id: I1839e1bd357759ae2800d812b27bf4e0cd7772b4
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/293012
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-12 21:56:54 +00:00
Wenkai Du
5b4fd77df3 kunimitsu_pd: enable kunimitsu PD build
Symbolic link kunimitsu_pd to glados_pd folder. Disable PD test
build until issue is fixed.

BUG=chrome-os-partner:43142
TEST=emerge-kunimitsu chromeos-ec and check EC and PD binaries

Change-Id: Ic0f1d73246333d8ec7752bb4c42b1c0ac220b5c3
Signed-off-by: Wenkai Du <wenkai.du@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/292841
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-12 04:25:20 +00:00
Shawn Nematbakhsh
c41174c5e5 glados: Enable tests build
`tests` build was previously disabled for glados due to errors building
power/skylake.c. Properly undef the chipset config to make `tests` work
for all skylake platforms.

BUG=None
TEST=`make BOARD=glados tests`
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I7a730cdd5e30a932ff0cd1f3beef77873b9e0630
Reviewed-on: https://chromium-review.googlesource.com/292910
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-12 04:25:14 +00:00
Shawn Nematbakhsh
ccb0c13931 glados: Turn off LEDs in hibernate
Use new board-level hibernate GPIO state function to turn off LEDs in
hibernate.

BUG=chrome-os-partner:43807
TEST=Manual on Glados with subsequent commit. Run 'hibernate' on console,
verify that LED remains off. Press power button, verify that board wakes.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Id695df9b5e75514f8f807a894b63f71676b66f92
Reviewed-on: https://chromium-review.googlesource.com/292317
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-08-11 21:21:34 +00:00
Kumar, Gomathi
722dd54e0a strago: Increase chipset stack size.
Chipset task is overflowing and causing runtime crash.
Increasing the chipset task stack size by 128 bytes.

BUG=chrome-os-partner:43329
BRANCH=none
TEST=Build/flash EC and boot the platform to OS.

Change-Id: I57dfa23080d11e6e86a6ba5917bf28d05239bc0d
Signed-off-by: Kumar, Gomathi <gomathi.kumar@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/291393
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Divagar Mohandass <divagar.mohandass@intel.com>
Tested-by: Divagar Mohandass <divagar.mohandass@intel.com>
(cherry picked from commit bd478accd09fa488cd7c9c73e5714ff02dd0a89b)
Reviewed-on: https://chromium-review.googlesource.com/292321
2015-08-11 02:58:54 +00:00
Vadim Bendebury
1b53f74664 cr50: code modifications to support FPGA B1
The new FPGA version adds a lot of few features, while temporarily
cutting off some existing capabilities like clocking configuration
(hardwared clocks used instead), pinmux assignment for SPS interface
(hardwared connections used), etc.

This patch removes some now unused code, modifies some configuration
items and adds TODO_FGPA comment blocks highlighting code which needs
to be reviews next time FPGA version changes).

The new register definitions file is derived from hardware
description.

BRANCH=none
BUG=chrome-os-partner:43791
TEST=with these changes in place the B1 board boots to the console
     prompt.

Change-Id: I78ec6b2831a44cbfd40ee726a5d3c2cc11bf2cfa
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291855
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-08-11 02:58:45 +00:00
Vadim Bendebury
bdc1f4c1dc cr50: control adding USB specific code using proper config
CONFIG_USB is a better indicator that USB related code needs to be
included.

BRANCH=none
BUG=none

TEST=none - this patch helped compartmentnalize the code when
     debugging bringup on a new platform.

Change-Id: I12ef77325591853d73e2e09f7c491954e272bde9
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291854
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-08-11 01:36:10 +00:00
li feng
2911e38022 Cyan: Added Clamshell/Tablet mode support
Enabled lid angle calculation. Clamshell/Tablet mode is decided by lid angle.
Accelerometers are set to be active in S3 also.
Trackpad is enabled/disabled by GPIO TP_INT_DISABLE.
Keyboard scan and trackpad are enabled in clamshell mode and disabled in
tablet mode.
Removed enable_keyboard() since keyboard is enabled in clamshell S0 and
S3.

BUG=chrome-os-partner:41353
TEST=Verify in clamshell mode, system can be waken up from S3 by keyboard/trackpad;
And not tablet mode.
BRANCH=None

Change-Id: Ic5fb5a562e8426288eae2fb9815a213fe5033955
Signed-off-by: li feng <li1.feng@intel.com>
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287341
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-10 20:42:18 +00:00
Anton Staaf
68b2809ee8 Discovery: Configure USART2 as a loopback device
This gives a test case for the USART driver on an STM32L.  Eventually
this will be a good place to test that even in a downclocked configuration
the STM32L USART driver can handle 115200 without dropping characters.
This also gives a convenient build test for the STM32L version of the
USART driver.

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

BRANCH=None
BUG=None
TEST=make buildall -j
     Cross connect a Discovery and a Discovery-stm32f072

Change-Id: Ifb8dfc1179e8a0be84390d36e0bc3ff15f4f4685
Reviewed-on: https://chromium-review.googlesource.com/288979
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-08-10 17:54:22 +00:00
Mike Hsieh
77f68f204f glados: Implement LED functionality on EC
Implement LED control for glados for both red and green LED.

BUG=chrome-os-partner:40848
BRANCH=none
TEST=Manually tested on glados with following commands:
     ectool led battery red
     ectool led battery green
     ectool led battery off

Change-Id: I1b4f8c8c8f26779a11185ea8bbc6536d1d7f97b1
Signed-off-by: Mike Hsieh <mike.m.hsieh@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/289439
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-08 04:26:46 +00:00
Aseda Aboagye
c124e8cbc7 stm32: Deprecate SPI protocol version 2.
Now that v3 support is in the cros_ec kernel driver and depthcharge,
deprecate support for the old v2 protocol.  At some point in the future,
support for the v2 protocol will dropped entirely.

Boards that require support for the V2 protocol should enable the
following config option.

    #define CONFIG_SPI_PROTOCOL_V2

BUG=chrome-os-partner:20533
BRANCH=None
TEST=make -j buildall tests
TEST=Flash jerry, AP & EC boot successful.
TEST=`ectool protoinfo` shows only version 3 supported on jerry.
TEST=Flashrom still works on jerry.

Change-Id: I72d3aee00879314b936cc0b1002c9883550b1f1a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/291411
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2015-08-08 04:26:33 +00:00
Shawn Nematbakhsh
a7bf7b9564 mediatek: Fix llama build
The llama AP_RESET GPIO differs in polarity from oak.

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

Change-Id: Id06bf39e758b528d154936a3e8561704fdf4cce9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290950
Commit-Queue: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
2015-08-06 18:48:14 +00:00