chromiumos/platform/ec.git
11 months agoRemove unused test config 42/66742/2 master
Vic Yang [Fri, 23 Aug 2013 00:57:58 +0000 (08:57 +0800)]
Remove unused test config

Test config is now in test/test_config.h. Let's remove the unused config
lines in board/host/board.h.

BUG=chrome-os-partner:19235
TEST=Pass all tests.
BRANCH=None

Change-Id: Ic8f7f4dcf8e0ad5f8800fe8ad2ae89b604a239f4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66742
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agopit: Disable CONFIG_HOST_COMMAND_STATUS 28/66828/2
Andrew Bresticker [Thu, 22 Aug 2013 21:21:29 +0000 (14:21 -0700)]
pit: Disable CONFIG_HOST_COMMAND_STATUS

With CONFIG_HOST_COMMAND_STATUS, the EC can respond to a command
with EC_RES_IN_PROGRESS, indicating to the AP that it should poll
for completion of the command with EC_CMD_GET_COMMS_STATUS.  The
kernel, however, only guarantees the atomicity of single commands.
As a result, i2c passtrough or keyboard commands could be issued
while the AP is polling for completion of a flashrom command. By
disabling CONFIG_HOST_COMMAND_STATUS, we eliminate polling of the
EC status by the AP so that there is no interleaving of commands.

BUG=chrome-os-partner:20978
TEST=flashrom on Pit
BRANCH=pit

Original-Change-Id: I48b29a0dbbcc56fc55f72ca64b8aff51036740e3
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66703
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit 2db4fcfb267b938fcc35af2a0d2e374f99551743)

Change-Id: Iac7c15ec337d618cd6d95439d4b922bf3ec43916
Reviewed-on: https://gerrit.chromium.org/gerrit/66828
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>

11 months agoDon't send IN_PROGRESS response if GET_COMMS_STATUS is unsupported 27/66827/2
Andrew Bresticker [Thu, 22 Aug 2013 21:15:01 +0000 (14:15 -0700)]
Don't send IN_PROGRESS response if GET_COMMS_STATUS is unsupported

If the EC responds to the AP with IN_PROGRESS, the AP will then use
GET_COMMS_STATUS to poll for completion of the previous command.
If the EC doesn't support GET_COMMS_STATUS, it will return an error,
confusing the AP.

BUG=chrome-os-partner:20978
TEST=flashrom on Pit
BRANCH=pit

Original-Change-Id: I7c911ebc047042450b1eefc992ba2250d35fa078
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66702
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit 67efd2c100f9de6fe34d381f6145e2d795d8549f)

Change-Id: If102710d30cbc53670bb5652b473734c7d9251be
Reviewed-on: https://gerrit.chromium.org/gerrit/66827
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>

11 months agobolt: workaround board sequencing deficiencies 21/66821/2
Aaron Durbin [Fri, 23 Aug 2013 15:49:01 +0000 (10:49 -0500)]
bolt: workaround board sequencing deficiencies

The bolt board has the PP1050 regulator's pgood
output connected to VCCST_PWRGD on the chipset. However,
that is inappropriate because VCCST_PWRGD is the signal
used when the 1.05V rail is good when transitioning to
S0. The PP1050 regulator needs to be up while in S5
to supply the 1.05V suspend rail. To work around this
mismatch, the PP1050_PGOOD signal which is routed to
the EC needs to be changed to an open-drain output.
It's driven low until the transition to S0 in order
to properly sequence the chip.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Built and booted on handful of boards.

Change-Id: Ic85eab8f295f6e76d9b33f440e68c82096976683
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66821
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agobolt: add board support to flash_ec 20/66820/2
Aaron Durbin [Fri, 23 Aug 2013 15:43:59 +0000 (10:43 -0500)]
bolt: add board support to flash_ec

The flash_ec utility was not honoring --board=bolt. Therefore,
add it to the known variants of flash_slippy.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=flash_ec --board=bolt dosen't fail

Change-Id: I8f9c1ddcf7d40b8b579cd90af7dd5c4d90537084
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66820
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoFalco: throttle if battery current drain is too high 84/66684/3
Bill Richardson [Thu, 22 Aug 2013 17:18:58 +0000 (10:18 -0700)]
Falco: throttle if battery current drain is too high

I missed this requirement the first time. Now it's here. Also adding a test
for it as well.

BUG=chrome-os-partner:20739
BRANCH=falco
TEST=manual

make BOARD=falco runtests

Change-Id: I88aac8d12d09f7970b04c4aa02b6986b5ea16306
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66684
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
11 months agoCompletely new thermal/fan implementation 88/66688/2
Bill Richardson [Wed, 7 Aug 2013 22:34:04 +0000 (15:34 -0700)]
Completely new thermal/fan implementation

Problems with existing thermal control loop:
* Not multi-board friendly. thermal.c only supports Link and needs
  refactoring. Temp thresholds and fan speeds are hard-coded.
* Only the PECI temp is used to determine the fan speed. Other temp sensors
  are ignored.
* Has confusing data structures. Values in the CPU temp thresholds array mix
  ACPI thresholds with fan step values.

With this change, the thermal task monitors all temp sensors in order to
perform two completely independent functions:

Function one: Determine if the host needs to be throttled by or informed of
              any thermal events.

For thermal events, each temp sensor will have three threshold levels.

TEMP_HOST_WARN
* When any sensor goes above this level, host_throttle_cpu(1) will be called
  to ask the CPU to slow itself down.
* When all sensors drop below this level, host_throttle_cpu(0) will be called.
* Exactly AT this level, nothing happens (this provides hysteresis).

TEMP_HOST_HIGH
* When any sensor goes above this level, chipset_throttle_cpu(1) will be
  called to slow the CPU down whether it wants to or not.
* When all sensors drop below this level, chipset_throttle_cpu(0) will be
  called.
* Exactly AT this level, nothing happens (this provides hysteresis).

TEMP_HOST_SHUTDOWN
* When any sensor is above this level, chipset_force_shutdown() will be
  called to halt the CPU.
* Nothing turns the CPU back on again - the user just has to wait for things
  to cool off. Pressing the power button too soon will just trigger shutdown
  again as soon as the EC can read the host temp.

Function two: Determine the amount of fan cooling needed

For fan cooling, each temp sensor will have two levels.

TEMP_FAN_OFF
* At or below this temperature, no active cooling is needed.

TEMP_FAN_MAX
* At or above this temperature, active cooling should be running at maximum.

The highest level of all temp sensors will be used to request the amount of
active cooling needed. The function pwm_fan_percent_to_rpm() is invoked to
convert the amount of cooling to the target fan RPM.

The default pwm_fan_percent_to_rpm() function converts smoothly between the
configured CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX for percentages
between 1 and 100. 0% means "off".

The default function probably provide the smoothest and quietest behavior,
but individual boards can provide their own pwm_fan_percent_to_rpm() to
implement whatever curves, hysteresis, feedback, or other hackery they wish.

BUG=chrome-os-partner:20805
BRANCH=none
TEST=manual

Compile-time test with

  make BOARD=falco runtests

On the EC console, the existing fan commands should work correctly:

  faninfo       - display the fan state
  fanduty NUM   - force the fan PWM to the specified percentage (0-100)
  fanset RPM    - force the fan to the specified RPM
  fanset NUM%   - force the fan to the specified percentage (0-100) between
                  its configured minimum and maximum speeds from board.h
                  (CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX)
  fanauto       - let the EC control the fan automatically

You can test the default pwm_fan_percent_to_rpm() with

  fanset 1%
  faninfo

The fan should be turning at CONFIG_PWM_FAN_RPM_MIN. Let the EC control it
automatically again with

  fanauto

Also on the EC console, the thermal settings can be examined or changed:

  > temps
  PECI                : 327 K = 54 C
  ECInternal          : 320 K = 47 C
  G781Internal        : 319 K = 46 C
  G781External        : 318 K = 45 C
  >
  > thermalget
  sensor  warn  high  shutdown   fan_off fan_max   name
    0      373   387    383        333     363     PECI
    1        0     0      0          0       0     ECInternal
    2        0     0      0          0       0     G781Internal
    3        0     0      0          0       0     G781External
  >
  > help thermalset
  Usage: thermalset sensor warn [high [shutdown [fan_off [fan_max]]]]
  set thermal parameters (-1 to skip)
  >
  > thermalset 2 -1 -1 999
  sensor  warn  high  shutdown   fan_off fan_max   name
    0      373   387    383        333     363     PECI
    1        0     0      0          0       0     ECInternal
    2        0     0    999          0       0     G781Internal
    3        0     0      0          0       0     G781External
  >

From the host, ectool can be used to get and set these parameters with
nearly identical commands:

  ectool thermalget
  ectool thermalset 2 -1 -1 999

Change-Id: Idb27977278f766826045fb7d41929953ec6b1cca
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66688
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoFix a bug that I2C error may cause incorrect LED color 14/66314/2
Vic Yang [Tue, 20 Aug 2013 06:16:53 +0000 (14:16 +0800)]
Fix a bug that I2C error may cause incorrect LED color

If there is an I2C transaction error while setting LED color, the three
LED color channels might be in an inconsistent state. In this case, we
should explicitly set the LED state to INVALID so as to force the next
LED color update.

BUG=None
TEST=Build success
BRANCH=Spring

Change-Id: I1353044ef782481872d692f15748413ef539cb27
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66314
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 months agoLock BOOTCFG to safe values for all LM4s 38/66538/2
Bill Richardson [Wed, 21 Aug 2013 15:59:53 +0000 (08:59 -0700)]
Lock BOOTCFG to safe values for all LM4s

The BOOTCFG register configures a couple of important things: whether to
allow jumping into the builtin ROM bootloader at reset, and whether or not
to allow JTAG access for programing and debugging.

The default is "no" and "yes". But the BOOTCFG register can be locked so
that it can't be changed again, which means that if the wrong values are put
into it, the system is pretty much bricked.

On Link, we wrote a BOOTCFG value that allowed a GPIO to be used as a bypass
to optionally trigger the ROM bootloader, but on Slippy and its derivatives
that GPIO is not pulled up. If you program the Link values into BOOTCFG on a
Slippy, the system is stuck in the ROM bootloader more or less forever.

This change disables that GPIO, keeps JTAG enabled, and locks those settings
for all LM4 chips (it's a chip config now, not a board config). We've never
actually used the GPIO to invoke the ROM bootloader, but we have managed to
brick a number of systems just by having it enabled, so we're going to lock
it into a safe configuration now.

BUG=chrome-os-partner:19247
BRANCH=falco,peppy
TEST=manual

Reflash, boot, power cycle (actually unplug the EC from AC and battery) a
few times. It should continue to work.

Change-Id: Iaf1a81d6814104421a56425490e3d5164ea9b617
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66538
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoRemove default values for undefined tasks from charge state module 66/66466/2
Dave Parker [Wed, 21 Aug 2013 01:29:34 +0000 (18:29 -0700)]
Remove default values for undefined tasks from charge state module

Due to the order of pre-processing, TASK_ID_CHARGER and
TASK_ID_SWITCH aren't defined even if they are in the ec.tasklist
for a board.

BUG=chrome-os-partner:21565
BRANCH=falco,peppy
TEST=Turn device off, remove AC power. Plug AC power back in.
Charging LED should light in ~1 second.

Change-Id: I20ebbec71ca5e5dc8ab34da946d3dfeb91fc7849
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66466
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agokirby: Add kirby support to util/flash_ec. 05/66005/2
Jeremy Thorpe [Thu, 15 Aug 2013 22:34:51 +0000 (15:34 -0700)]
kirby: Add kirby support to util/flash_ec.

This allows stm32mon built in kirby build directory to be used to flash EC.

BUG=chrome-os-partner:21964
TEST=util/flash_ec --board=kirby --image=build/kirby/ec.bin
BRANCH=None

Change-Id: I38ab6de0e129996010974c8766e1f84f4e8eb3a7
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66005
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 months agoChange peppy battery led error blink timing 91/63891/6
David Huang [Wed, 31 Jul 2013 07:43:43 +0000 (15:43 +0800)]
Change peppy battery led error blink timing
(led turn on 1 sec and turn off 3 sec)

BRANCH=peppy
BUG=none
TEST=manual
  Disconnect internal battery to check battery led blink timing.

Conflicts:

common/led_peppy.c

Change-Id: I1417073448505aa5dca2e0e999185b5a9b53410e
Signed-off-by: David Huang <David.Huang@quantatw.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/63891
Reviewed-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Hsu Henry <Henry.Hsu@quantatw.com>
Tested-by: Dave Parker <dparker@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>

11 months agofalco: delay backlight enable by 420ms 38/66238/4
Aaron Durbin [Mon, 19 Aug 2013 21:50:00 +0000 (16:50 -0500)]
falco: delay backlight enable by 420ms

In order to meet the panel power sequencing requirements the
backlight enable needs to be delayed by 420ms. As the EC has
direct control over the panel backlight, it's difficult to
align with the reset of the panel signals which are controlled
by an LVDS bridge. In order to not affect other boards the
backlight implementation has been moved within falco's
board directory.

BUG=chrome-os-partner:21234
BRANCH=falco
TEST=Built with a printf to verify rough timing transitions.

Change-Id: I5d6cd2989f17cc5c188d307f6ceacb52341a87b4
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66238
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agoAdd test for console command history 37/64837/3
Vic Yang [Tue, 6 Aug 2013 22:06:44 +0000 (06:06 +0800)]
Add test for console command history

This tests that command history is as expected. Also fix a bug that some
checks in console_edit test are skipped.

BUG=chrome-os-partner:19236
TEST=Pass console_edit test.
BRANCH=None

Change-Id: Ifbd3d1690f25b35bf5efe523e656b013aa534d26
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64837

11 months agopit: Only enable FET4 by default at cold reset 27/66127/2
Doug Anderson [Fri, 16 Aug 2013 20:19:23 +0000 (13:19 -0700)]
pit: Only enable FET4 by default at cold reset

Now that U-Boot and kernel can properly talk to the EC in pit, there's
no reason to hack all the FETs on.  We only need to turn on FET4 which
enables SD card booting.

We'll leave the old "all fets on" hack there for "puppy", though.
Apparently that still needs it?

BRANCH=pit
BUG=chrome-os-partner:21975
TEST=Boot up and see LCD turn on.
TEST=Cold reset while holding recovery and can boot from SD card.

Change-Id: Iae96375ac7bd1a9eed8243367332cf003b62c48d
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66127
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
11 months agoPoll and cache g781 temperature values 97/65597/3
Dave Parker [Sun, 11 Aug 2013 17:46:44 +0000 (10:46 -0700)]
Poll and cache g781 temperature values

BUG=chromium:271236
BRANCH=falco,peppy
TEST=Run 'ectool temps all' Verify temp. values are present
for the g781.

Change-Id: I2ea8aff9e256167bf04abc959f971da94fc51e77
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65597
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAdd fan power enable GPIO for Peppy 74/65674/3
Dave Parker [Tue, 13 Aug 2013 02:54:24 +0000 (19:54 -0700)]
Add fan power enable GPIO for Peppy

BUG=chrome-os-partner:21847
BRANCH=peppy
TEST=Manual. Check state of GPIO_P5000_FAN_EN with lid open
and lid closed. Can also check with meter via TP109.

Change-Id: I8a64c14d53dd84a5d586c0abb04ccb71de0e78b3
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65674

11 months agoRemove board 'wolf' from master/ToT branch. 14/65514/2 release-R30-4537.B
Dave Parker [Sat, 10 Aug 2013 19:37:42 +0000 (12:37 -0700)]
Remove board 'wolf' from master/ToT branch.

Firmware development for this board is happening on the
firmware-wolf-4389.24.B branch.

BUG=chrome-os-partner:21815
BRANCH=None
TEST=Run util/make_all.sh. Verify all is made.

Change-Id: I4b58a982a87562231453f3f201024b809c6a24fb
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65514
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAdd abstract "cond_t" type to detect state transitions. 71/65071/5
Bill Richardson [Wed, 7 Aug 2013 22:36:21 +0000 (15:36 -0700)]
Add abstract "cond_t" type to detect state transitions.

We often need to watch for transitions between one state and another, so
that we can issue warnings or take action ONCE. This abstracts that "have I
already reacted to this" stuff into a single set of functions.

For example, this code reads a GPIO every time through the loop, but it only
generates an event when the GPIO value changes from 0 to 1:

    cond_t c;

    cond_init_false(&c);

    while(1) {
        int val = read_some_gpio();
        cond_set(&c, val);

        if (cond_went_true(&c))
            host_event(SOMETHING_HAPPENED);

        sleep(1);
    }

BUG=none
BRANCH=falco,peppy
TEST=manual

make BOARD=falco runtests

Change-Id: I42393fcf3c4eb71b9551118a0f442d55c0691315
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65071

11 months agoHaswell: shutdown directly to G3 without pausing in S5 36/65336/3
Bill Richardson [Fri, 9 Aug 2013 17:59:35 +0000 (10:59 -0700)]
Haswell: shutdown directly to G3 without pausing in S5

We've been pausing in S5 for ten seconds for various arcane reasons related
to clock rates and USB peripherals. We don't need to do that anymore, and
there are other arcane reasons why it's better if we don't.

BUG=chrome-os-partner:21791
BRANCH=falco,peppy
TEST=manual

On the EC console, limit the output to just the chipset channel:

> chan 4

Now boot the AP, then shut down.

Before you'd see a ten-second pause in S5, like this:

  [29.586858 x86 power state 3 = S0, in 0x00df]
  [29.587268 x86 power state 7 = S0->S3, in 0x009f]
  [29.587707 x86 power state 2 = S3, in 0x009f]
  [29.587959 x86 power state 8 = S3->S5, in 0x009f]
  [29.588474 x86 power state 1 = S5, in 0x009c]
  [29.588733 x86 power state 1 = S5, in 0x009c]
  [29.603317 x86 power state 1 = S5, in 0x0094]
  [39.603612 x86 power state 9 = S5->G3, in 0x0094]
  [39.604137 x86 power state 0 = G3, in 0x0000]
  [39.604376 x86 power state 0 = G3, in 0x0000]

With this change the pause is gone:

  [26.764160 x86 power state 3 = S0, in 0x00df]
  [26.764570 x86 power state 7 = S0->S3, in 0x009f]
  [26.765011 x86 power state 2 = S3, in 0x009f]
  [26.765262 x86 power state 8 = S3->S5, in 0x009f]
  [26.765777 x86 power state 9 = S5->G3, in 0x009c]
  [26.766220 x86 power state 0 = G3, in 0x0008]
  [26.766526 x86 power state 0 = G3, in 0x0008]
  [26.770517 x86 power state 0 = G3, in 0x0000]

Change-Id: I05e19ddfe9dfa1bcc2a29103d120910c4371b88e
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65336
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
11 months agoHide battery vendor params override behind config option 57/65257/2
Randall Spangler [Thu, 8 Aug 2013 23:17:49 +0000 (16:17 -0700)]
Hide battery vendor params override behind config option

Only link actually used this function, but all batteries were required
to provide an (empty) implementation.  Use
CONFIG_BATTERY_VENDOR_PARAMS to gate this functionality, so non-link
battery code can be simpler.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms and pass unit tests

Change-Id: Ic2c6dd1163a981e48873d798f77891cc7de1f8cf
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65257
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
11 months agoConsole command for g781 temperature sensor. 34/65234/3
Dave Parker [Thu, 8 Aug 2013 02:47:26 +0000 (19:47 -0700)]
Console command for g781 temperature sensor.

Read status, set temperature alert thresholds, get and set
configuration options. I2c offsets and status/config register
bits are documented in temp_sensor_g781.h

Usage by example:
g781 - Print status info
g781 settemp 0x0e 12 - Set remote low temp alarm to 12C
g781 setbyte 0x09 0x40 - Enable single-shot mode
g781 getbyte 0xfe - Read device ID

BUG=None
BRANCH=falco,peppy
TEST=Manual. Run g781 console command

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: Id051f79ea643255d57c3fc694b7ae685a6611c81
Reviewed-on: https://gerrit.chromium.org/gerrit/65234
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
11 months agoFix leaving keyboard scanning disabled on brief power button press 38/65238/2
Randall Spangler [Thu, 8 Aug 2013 21:38:58 +0000 (14:38 -0700)]
Fix leaving keyboard scanning disabled on brief power button press

If the power button is pressed for a shorter period than the debounce
timeout, then the debounced state never changes.  This was causing the
power button state machine to disable scanning (in the interrupt
handler) but never re-enable it (in the deferred handler).

Easy fix; just re-enable based on whether the current state is
released, not whether the debounced state is transitioning to
released.

BUG=chrome-os-partner:21772
BRANCH=all (falco, pit, etc.)
TEST=type on console.  briefly flick power button.  type more; should work.

Change-Id: I9723a6aa10f122fcee62702b85ce7981b1c8103a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65238
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
11 months agopit: leave 1.35V rail on during warm reboot 27/65227/2
Randall Spangler [Thu, 8 Aug 2013 18:26:49 +0000 (11:26 -0700)]
pit: leave 1.35V rail on during warm reboot

This maintains the contents of AP RAM during the warm reboot.

BUG=chrome-os-partner:21483
BRANCH=pit
TEST=from u-boot prompt,

Peach # mm 41f00000
41f0000000000000 ? 9
41f0000400000000 ? 9
41f0000800000000 ? 9
41f0000c00000000 ? 9
41f0001000000000 ? 9
41f0001400000000 ? 9
41f0001800000000 ? 9
41f0001c00000000 ? 9
41f0002000000000 ? 9
41f0002400000000 ? 9
41f0002800000000 ? 9
41f0002c00000000 ? 9
41f0003000000000 ? 9
41f0003400004000 ? 9
41f0003800000000 ? 9
41f0003c00000000 ? 9
41f0004000000000 ? .
Peach # md 41f00000
41f0000000000009 00000009 00000009 00000009    ................
41f0001000000009 00000009 00000009 00000009    ................
41f0002000000009 00000009 00000009 00000009    ................
41f0003000000009 00000009 00000009 00000009    ................

Then Alt+VolUp+R.  Then repeat md command at u-boot prompt.

Change-Id: I07de4df2fe4c4dd86b88bbd208e1fb87860fa9d5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65227
Reviewed-by: Julius Werner <jwerner@chromium.org>
11 months agoUpdate Wolf from Slippy. 72/63872/7
Hsu Henry [Wed, 31 Jul 2013 03:28:56 +0000 (11:28 +0800)]
Update Wolf from Slippy.

Copy from Slippy and Delete BAT_DETECT_L and related functions.
(create new file battery_wolf.c)

BRANCH=wolf
BUG=none
TEST=manual
 Build it with util/make_all.sh, seems fine.

Change-Id: I672147c45e14d03c7f4cf8ecc6daa3f889f97c05
Signed-off-by: Hsu Henry <Henry.Hsu@quantatw.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/63872
Reviewed-by: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>

11 months agopit: If flash registers are disabled all blocks are protected 80/64980/2
Randall Spangler [Wed, 7 Aug 2013 19:55:44 +0000 (12:55 -0700)]
pit: If flash registers are disabled all blocks are protected

This fixes a confusing indication in flashinfo, where the all_now flag
is set but banks aren't shown as protected now.

BUG=chrome-os-partner:20277
BRANCH=pit
TEST=See bug for full test procedure.  In short:
     1) Enable physical write protect
     2) flashwp enable
     3) flashwp now
     4) flashinfo shows all banks protected now

Change-Id: I489e80f63a33c182629d3a04fd0a9dadfb3914ab
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64980
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agoPut knowledge of task-config dependency in config.h 10/65010/3
Randall Spangler [Wed, 7 Aug 2013 22:28:47 +0000 (15:28 -0700)]
Put knowledge of task-config dependency in config.h

Rather than have every board check for tasks before declaring their
config macros, have config.h know what configs are invalid without
their corresponding tasks.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms and pass unit tests

Change-Id: Iecf6eb44782e15565eaaf6d69c6288ee8d2e4c4c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65010
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agodaisy: remove I2C port detection 58/64958/4
Randall Spangler [Wed, 7 Aug 2013 16:53:37 +0000 (09:53 -0700)]
daisy: remove I2C port detection

Daisy systems are few and far between, and not actively used for
development now that we have pit.  Remove the I2C port detection which
was used for early systems, and just hard-code the port value to the
one on my daisy.

BUG=chrome-os-partner:10622
BRANCH=none
TEST=boot daisy

Change-Id: I981a51448899f75437f35dc2aa84a0556c0018eb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64958
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agoconsole_output: Add commands for saving / restoring print mask. 08/65208/2
Shawn Nematbakhsh [Thu, 8 Aug 2013 16:25:58 +0000 (09:25 -0700)]
console_output: Add commands for saving / restoring print mask.

Saving + restoring the channel print mask previously involved running
the 'chan' command with no parameters, then parsing the output. This
parsing is unreliable if other tasks are also writing to the console.
Add commands to save / backup the current channel mask, and later
restoring it. Typical method to limit channel mask will now be:

chan save
chan <mask>
...
chan restore

BUG=chromium:269758.
TEST=Run 'chan save' / 'chan 0' / 'chan restore' on EC console, verify
print mask is restored.
BRANCH=Peppy/Falco.

Change-Id: I725c7fb5e3ac7e55ed5f435446f8fc5c54af165f
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65208
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoUse macros for C <-> K conversions 05/65005/2
Bill Richardson [Wed, 31 Jul 2013 20:08:11 +0000 (13:08 -0700)]
Use macros for C <-> K conversions

This just replaces all the "X - 273", "Y + 273" stuff with a macro.

BUG=none
BRANCH=falco,peppy
TEST=manual

Run the EC console command "temps". It should print human-readable things.

Change-Id: Icc4284c89fdbc0cd3b206a0faacf121973652a63
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65005
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoectool: Return non-success exit code on bad EC status. 86/64686/3
Shawn Nematbakhsh [Mon, 5 Aug 2013 22:08:52 +0000 (15:08 -0700)]
ectool: Return non-success exit code on bad EC status.

When running certain ectool commands, our ioctl may succeed, yet our
command may not be successful for a variety of reasons (see ec_status
enum). In this case, we should return a non-success exit code so that we
can easily detect such failures in scripts.

BUG=chrome-os-partner:21171.
TEST=Pass FAFT suite on Peppy. Pass factory tests on Peppy.
BRANCH=None.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162
Reviewed-on: https://gerrit.chromium.org/gerrit/64686
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 months agoPeppy ectool led command 27/64627/6
Dave Parker [Sat, 3 Aug 2013 01:20:57 +0000 (18:20 -0700)]
Peppy ectool led command

Glue between the existing ectool led command and the
led control logic.

BUG=chrome-os-partner:20776
BRANCH=peppy
TEST=Manual. Run "ectool led" commands:

Should pass:
ectool led power blue|yellow|off|auto|blue=1 yellow=1
ectool led battery blue|yellow|off|auto|blue=1 yellow=1

Should fail:
ectool led adapter <color>
ectool led power|battery red|green|white

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I2540940baa553866760dd9ae62278b6b845793ef
Reviewed-on: https://gerrit.chromium.org/gerrit/64627

11 months agoClean up configuring GPIO alternate functions 00/64400/6
Randall Spangler [Fri, 2 Aug 2013 21:28:43 +0000 (14:28 -0700)]
Clean up configuring GPIO alternate functions

GPIO alternate functions used to be configured throughout the code,
which made it hard to tell which ones you needed to configure yourself
in board.c.  It also sometimes (chip/lm4/i2c.c) led to GPIOs being
configured as alternate functions even if they weren't used on a given
board.

With this change, every board has a table in board.c which lists ALL
GPIOs which have alternate functions.  This is now the only place
where alternate functions are configured.  Each module then calls
gpio_init_module() to set up its GPIOs.

This also fixes a bug where gpio_set_flags() ignored most of the flags
passed to it (only direction and level were actually used).

On stm32f, gpio_set_alternate() does not exist, and pins are
configured via direct register writes from board.c.  Rather than
attempt to change that in the same CL, I've stubbed out
gpio_set_alternate() for stm32f, and will fix the register writes in a
follow-up CL.

BUG=chrome-os-partner:21618
BRANCH=peppy (fixes I2C1 being initialized even though those pins are used
       for other things)
TEST=boot link, falco, pit, spring

Change-Id: I40f47025d8f767e0723c6b40c80413af9ba8deba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64400

11 months agostm32f: Don't glitch signal when setting GPIO_PULL_UP 19/64719/4
Randall Spangler [Tue, 6 Aug 2013 00:01:03 +0000 (17:01 -0700)]
stm32f: Don't glitch signal when setting GPIO_PULL_UP

It looks like a line of code was accidentally left in during
refactoring gpio_set_flags().  That line is equivalent to
gpio_set_level(signal, 0).

It's so far been harmless, because it's immediately followed by
gpio_set_level(signal, 1) - but it does mean the signal may glitch for
a few clocks at this point.

BUG=chrome-os-partner:21678
BRANCH=none (or Spring, but it seems to work fine even with this line)
TEST=boot Spring

Change-Id: Id7a48e2c9bd543f2aa6a0b710faa5dd2b482fd84
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64719

11 months agoMinor fixes for Kirby board.h 11/64811/2 stabilize-4512.B
Vic Yang [Tue, 6 Aug 2013 20:29:43 +0000 (04:29 +0800)]
Minor fixes for Kirby board.h

This includes:
  - Kirby doesn't use TPS65090. Removing TPS65090 config flag.
  - TIM3 is used by charging LED. Move timer to TIM2.

BUG=chrome-os-partner:21607
TEST=Build kirby.
BRANCH=None

Change-Id: I226660cf53371e03730ca41d08f0da2ad5c8ebf7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64811
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
11 months agopit: Don't configure PB3 in alternate function mode 14/64714/2
Randall Spangler [Mon, 5 Aug 2013 23:53:18 +0000 (16:53 -0700)]
pit: Don't configure PB3 in alternate function mode

The power button LED is on PA2, not PB3.  Remove a line of code
accidentally left in from copy-paste at the start of pit bringup.

BUG=chrome-os-partner:21676
BRANCH=pit
TEST=boot pit

Change-Id: Id991b16d69bca0a411efa72211c5dc407923240d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64714
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agosnow: Remove remnants of partial SPI support 12/64712/2
Randall Spangler [Mon, 5 Aug 2013 23:47:25 +0000 (16:47 -0700)]
snow: Remove remnants of partial SPI support

We started SPI development on the Snow platform, but then repurposed
some of the GPIOs to use for I2C arbitration.  Now that we have Pit,
we'll never go back and finish SPI on Snow, so this code can be removed.

Remove the remaining dead code from Snow.  This makes it easier to do the
GPIO alternate function refactoring.

BUG=chrome-os-partner:21618
BRANCH=none
TEST=build snow

Change-Id: I1cebf5097ecfd1dc6b3f55f2bbc47cb6c95cb937
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64712
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agoClean up SPI state machine and add state codes 54/64254/3
Randall Spangler [Thu, 1 Aug 2013 16:36:31 +0000 (09:36 -0700)]
Clean up SPI state machine and add state codes

The old low-level SPI protocol provided no useful information to the
host about whether it was ready to receive or not.  It also could get
stuck waiting to receive data without setting up receive DMA, if the
host did two transactions back-to-back.

Add a real state machine to the SPI module.

Add a range of byte codes the EC can return outside of a response
frame, to indicate its current state.  If the AP receives one of these
codes, it can abort the transaction since it now knows the EC is
unable to determine when it can send a response frame.

This change is backwards-compatible with current AP firmware and
kernel drivers, since those only look for the framing byte and don't
care what other bytes are received in the meantime.

BUG=chrome-os-partner:20257
BRANCH=none
TEST=crosec test; passes at 70us.

Change-Id: Ia06109ead3fbc421848e01050f7baf753cbeb16c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64254
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agoServo V3: Add jtag config for V3 70/64370/3
Simran Basi [Fri, 2 Aug 2013 20:15:14 +0000 (13:15 -0700)]
Servo V3: Add jtag config for V3

Servo V3's VID/PID changed and thus it requires its own cfg to work
with openocd.

BRANCH=None
BUG=None
TEST=ran fw_update locally.
Signed-off-by: Simran Basi <sbasi@chromium.org>
Change-Id: Id17408b17494c32d34f858a3ed5043d70b539004
Reviewed-on: https://gerrit.chromium.org/gerrit/64370
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
11 months agoAdd kirby board 64/64364/2
Vic Yang [Fri, 2 Aug 2013 19:09:57 +0000 (03:09 +0800)]
Add kirby board

GPIO mappings are according to current schematic. Charging and power
sequence code need to be fixed. Charging is disabled now, and some power
sequence code is #ifdef'd out for kirby to compile.

BUG=chrome-os-partner:21607
TEST=Build all boards (including Kirby.)
BRANCH=None

Change-Id: I3a48a7779dab8aad0d086c41e0be19223cd7d6c9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64364
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoRemove proxy config flags for unit tests 67/64367/2
Vic Yang [Fri, 2 Aug 2013 20:01:39 +0000 (04:01 +0800)]
Remove proxy config flags for unit tests

This moves per-test config flags from test_config.mk to test_config.h,
where one can define/undefine config flags for individual test.

BUG=chrome-os-partner:19235
TEST=Pass all tests
BRANCH=None

Change-Id: I096aded2007881433d3b6414d37f8bfdc6a2c45c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64367
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoMove onewire bus support from chip/lm4 to common 76/64376/3
Randall Spangler [Fri, 2 Aug 2013 20:53:20 +0000 (13:53 -0700)]
Move onewire bus support from chip/lm4 to common

No functional changes; just moving file

BUG=chrome-os-partner:21612
BRANCH=none
TEST=onewire red / onewire green / onewire yellow all set the adapter LED
     (tested on link, since I don't have a bolt, but the EC chip and adapter
     are identical)

Change-Id: I005abf871caafa39e82e88875b515c842a12d591
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64376
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agox86: use charge state hook to wake up power button task 66/64366/2
Randall Spangler [Fri, 2 Aug 2013 19:40:30 +0000 (12:40 -0700)]
x86: use charge state hook to wake up power button task

This is cleaner than having the charge state machine explicitly know
about the power button task.

BUG=chrome-os-partner:21610
BRANCH=none
TEST=reboot EC; see that power button task does not leave init-on state until
     just after the charge state initializes:

     [0.022646 Charge state init -> idle0 after 0.005908 sec]
     [0.022956 PB task 8 = init-on]
     [0.023147 PB PCH pwrbtn=LOW]
     [0.023303 PB task 6 = released, wait 199996]

Change-Id: I11d70103e3ee545512efe621f53d999680a7ad56
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64366
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agoChange one-wire bus to use normal gpio interface 75/64375/3
Randall Spangler [Fri, 2 Aug 2013 20:45:21 +0000 (13:45 -0700)]
Change one-wire bus to use normal gpio interface

There's no need for it to directly access the GPIO registers.  That
was only necessary at the beginning of link, when gpio_set_flags()
didn't exist.

BUG=chrome-os-partner:21612
BRANCH=none
TEST=onewire red / onewire green / onewire yellow all set the adapter LED
     (tested on link, since I don't have a bolt, but the EC chip and adapter
     are identical)

Change-Id: I2386962ff039bb2251be38eaadcaeae8ffd1ea7b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64375
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agoMove input character processing from UART interrupt to console task 63/64363/2
Randall Spangler [Thu, 1 Aug 2013 21:36:43 +0000 (14:36 -0700)]
Move input character processing from UART interrupt to console task

Previously, processing of arrow keys and control characters was done
in the interrupt handler itself.  This increased the impact of UART
input on other interrupts and high-priority tasks.  It also makes it
harder to implement DMA-based UART input on STM32L (in an imminent
CL), since the processing affected the circular UART input buffer
in-place.

This change turns uart_buffering.c back into a dumb I/O buffering
module, and puts all the command line editing and history support into
console.c.

Console history is done via a simple array of input lines instead of a
packed circular buffer of characters.  This is a little less
RAM-efficient, but is easier to implement and read.  History depth is
controlled via CONFIG_CONSOLE_HISTORY, and is 3 for STM32F and 8 for
other platforms.  If we really need a greater history depth, we can
look into implementing a packed circular buffer again, but this time
at task time in console.c.  Also added a 'history' command to print
the current console history.

BUG=chrome-os-partner:20485
BRANCH=none
TEST=console_edit unit test passes; 'history' command prints the last commands

Change-Id: I142a0be0d67718c58341e4569f4e2908f191d8b0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64363
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agoRemove unneeded includes of registers.h 82/64382/2
Randall Spangler [Fri, 2 Aug 2013 21:05:39 +0000 (14:05 -0700)]
Remove unneeded includes of registers.h

The registers.h file should only be included by code in the chip/ and
board/ directories.  Code outside those directories should not access
chip-specific registers.

(This change doesn't completely fix that, because
common/extpower_usb.c uses STM32-specific regs, but we'll fix that in
a separate CL.)

BUG=chrome-os-partner:18343
BRANCH=none
TEST=compile all platforms

Change-Id: Ic499f56690c38663083423b0593800161a68e6e9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64382
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agoHost commands don't set the response pointer 36/64236/3
Randall Spangler [Thu, 1 Aug 2013 16:55:58 +0000 (09:55 -0700)]
Host commands don't set the response pointer

Remove support for allowing host command handlers to set the response
pointer.  This is just one more thing that can break (and did, on SPI
protocol V2).  No commands other than the trivial read-memory-map
command in host_command.c and flash read made use of this capability,
and the savings in performance was negligible.

BUG=chrome-os-partner:21576
BRANCH=none
TEST=boot pit; still boots

Change-Id: I0a9bcf57dbea7155318fc389d7b47d3742a1a00a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64236

11 months agoFalco: Stop charging after a timeout of 10 hours 09/64309/3
Dave Parker [Fri, 2 Aug 2013 03:30:31 +0000 (20:30 -0700)]
Falco: Stop charging after a timeout of 10 hours

BUG=chrome-os-partner:20145
BRANCH=falco
TEST=Hack it. Add (uint64_t)599 * MINUTE to ctx->curr.ts.val
in the timeout comparison. This makes the 10 hour timeout only
take 1 minute. Testing this directly is tricky as a healthy battery
will charge quickly. If you force it to trickle charge it will
give up before 10 hours pass.

Change-Id: I69094a07e58c2d65e322ddc6a1b2ced828da0e26
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64309

11 months agoTrack the duration of each charge/discharge state. 80/64280/4
Dave Parker [Thu, 1 Aug 2013 21:57:09 +0000 (14:57 -0700)]
Track the duration of each charge/discharge state.

BUG=chromium:267146
BRANCH=falco,peppy
TEST=Manual. Observe charge state messages on the ec console.

Change-Id: I25f04db56bf62394b5bb2e0d56edbda3a0bb5e25
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64280

11 months agoPass command line arguments to make from make_all.sh 68/64268/4
Vic Yang [Thu, 1 Aug 2013 21:16:25 +0000 (05:16 +0800)]
Pass command line arguments to make from make_all.sh

This would allow us to do something like:
  util/make_all.sh -j32
  util/make_all.sh V=1

BUG=None
TEST=util/make_all.sh -j
TEST=util/make_all.sh V=1
BRANCH=None

Change-Id: Ifed0baf6c94fbe8b0296cbdc70ba84f92f04b75b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64268
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 months agoFix documentation for lid change and power button hooks 58/64258/2
Randall Spangler [Thu, 1 Aug 2013 20:03:48 +0000 (13:03 -0700)]
Fix documentation for lid change and power button hooks

They're now called from a deferred function call, which is done in the
hook task and not the chipset task.

No code changes.

BUG=none
BRANCH=none
TEST=compile code

Change-Id: I115b6b254bd2b0ddd9688df603621e7ce0c12e1e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64258
Reviewed-by: Vic Yang <victoryang@chromium.org>
11 months agospring: Shorten delay for charger redetect 77/64277/2
Vic Yang [Tue, 30 Jul 2013 23:36:17 +0000 (16:36 -0700)]
spring: Shorten delay for charger redetect

It takes ~250ms for TSU6721 to recognize a CDP charger. Let's shorten
the redetecting delay from 4 seconds to 600ms so that:
  1. A CDP charger is recognized faster
  2. We can properly detect overcurrent for CDP charger

BUG=chrome-os-partner:21388
TEST=Plug in a CDP charger and see it recognized after 600ms.
BRANCH=Spring

Change-Id: Id5020132686f8cfabb126e2fb57e7e75e3868775
Original-Change-Id: Iafbc677fbcdd4eb9e6cf276cc0219b965eb35ef5
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63814
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64277

11 months agospring: Allow a minimum 100mA current input 76/64276/2
Vic Yang [Tue, 30 Jul 2013 23:23:10 +0000 (16:23 -0700)]
spring: Allow a minimum 100mA current input

With this, we are able to boot with a super dead battery even with a bad
charger. This however breaks support for chargers that cannot even
supply 100mA, but that's very unlikely to happen.

BUG=chrome-os-partner:21107
TEST=Charge a dead battery with a bad charger and a super long cable.
BRANCH=Spring

Change-Id: I3c532523456185223420a4381f56365ad3afb2ec
Original-Change-Id: I6b7b0df0ae7bdf863420755ea92e09d87f6866c3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63804
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64276

11 months agospring: Always pull 500mA before charger type is determined 75/64275/2
Vic Yang [Mon, 29 Jul 2013 21:06:49 +0000 (05:06 +0800)]
spring: Always pull 500mA before charger type is determined

To prevent the EC browning out when the battery is too low, let's always
pull 500mA before we can determine the charger type. The correct current
limit can then be set after we know the charger type.

Also, even if the battery is not present, keep the PWM tweaking loop
going.

BUG=chrome-os-partner:21107
TEST=Plug in charger to a device with a dead battery and see it charge.
BRANCH=Spring

Change-Id: Iad5599b60d20fb405d78d30b2be74bcc98958dd5
Original-Change-Id: Iec2ec96e3c2c341f14888aa50bd84f72af75c073
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63626
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64275

11 months agospring: Show yellow LED for battery not fully charged in idle state 74/64274/2
Vic Yang [Fri, 26 Jul 2013 05:23:57 +0000 (22:23 -0700)]
spring: Show yellow LED for battery not fully charged in idle state

Even if the charge state machine is in idle mode, we should still show
yellow LED if the battery is not fully charged. This prevents the case
where the LED is green when the battery just comes back from cut-off
mode.

BUG=None
TEST=Cut off the battery. Plug in the charger and doesn't see green LED.
BRANCH=Spring

Change-Id: I079bcc19fcfff98a498cd9e3d2f99f0566b15fe4
Original-Change-Id: I14e6b3d32e04992bd8291da4b8b95e8e23a3acf0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63459
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64274

11 months agospring: Increase CABLE_DET voltage threshold 73/64273/2
Vic Yang [Thu, 25 Jul 2013 00:30:18 +0000 (08:30 +0800)]
spring: Increase CABLE_DET voltage threshold

With this, we can more precisely distinguish a video dongle and an USB
host. The downside is that old boards with ID_OUT connected instead of
CABLE_DET will lose the ability to use a video dongle.

BUG=chrome-os-partner:21310
TEST=Plug in USB host in S5 and see it's detected correctly.
BRANCH=Spring

Change-Id: I26856593a9fc1ef99c60b27aef3a53538e96f482
Original-Change-Id: I1116ac447bbc0b491f88fa38c16ff57501fe0288
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63297
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64273

11 months agospring: Ignore battery assist mode when deciding LED color 72/64272/2
Vic Yang [Thu, 18 Jul 2013 16:49:28 +0000 (00:49 +0800)]
spring: Ignore battery assist mode when deciding LED color

Now we decide LED color only based on battery charge level. Remove the
logic of checking battery assist mode.

BUG=chrome-os-partner:20017
TEST=Build success
BRANCH=Spring

Change-Id: I9fc38f57c931d4a678154e097776d284eb39f6c1
Original-Change-Id: Ide770e96ead05ae96db54290627853132f7edcb3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62487
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64272
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
11 months agoRevert "spring: always enable the PP3300_WWAN rail" 71/64271/2
Vincent Palatin [Fri, 7 Jun 2013 19:05:28 +0000 (12:05 -0700)]
Revert "spring: always enable the PP3300_WWAN rail"

This reverts commit 154c73f32d2625d2cfbe2fa9be4e15b4f382a917.

The kernel driver to control TPS65090 FETs is now submitted in our tree,
and turning on the FET3 connected the 3G modem by default.
So let's remove the hardcoded to allow better power management policy on
the CPU side.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=spring
BUG=chrome-os-partner:17790
TEST=on Spring, boot and dump the TPS65090 configuration from the EC
command line by using "pmu" command.
See 0x1f in the register 0x11 for FET3.

Change-Id: Ie699fef0348138a7483f0e8e7bcaebc37810eba8
Original-Change-Id: I9de0f92a561397ceb81a67b8291d1e8bf04ade38
Reviewed-on: https://gerrit.chromium.org/gerrit/57978
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64271
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>

11 months agoWord-align the host memory map 33/64233/2
Randall Spangler [Thu, 1 Aug 2013 17:27:33 +0000 (10:27 -0700)]
Word-align the host memory map

This fixes unaligned access exceptions when totally-unrelated code
changes happen to move around host_command.c's global variables.

BUG=chrome-os-partner:21578
BRANCH=none
TEST=add a ccprintf() call to host_command.c; no longer causes an exception

Change-Id: I5407e5631a08ea647dc40e5bd9c7bd101868ced0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64233
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
11 months agoAdd hook for changes in the charge state machine 37/63537/3
Dave Parker [Fri, 26 Jul 2013 05:39:13 +0000 (22:39 -0700)]
Add hook for changes in the charge state machine

BUG=chrome-os-partner:20145
BRANCH=falco,peppy
TEST=Manual. Tested with charging timeout logic.

Change-Id: Iab1c9746dcab5820fcdeb3e0d94bfcb0c47e57f2
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63537
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agobolt: force SYS_PWROK and PP3300_DSW_GATED_EN to 0 in forcing G3 path 45/63845/2
Aaron Durbin [Wed, 31 Jul 2013 02:06:48 +0000 (21:06 -0500)]
bolt: force SYS_PWROK and PP3300_DSW_GATED_EN to 0 in forcing G3 path

The following signals were not being initialized properly in the
forcing G3 path:
- GPIO_SYS_PWROK
- GPIO_PP3300_DSW_GATED_EN
This lead to the EC RW sysjump, but the boards wouldn't reboot
on the x86 side. Sadly, without this change, the board I have
works. However, those signals need to be driven low.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Willis tested on boards that previously didn't work.

Change-Id: I1771881485bc5be73ed2b08da91fddff9ab09167
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63845
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAbstract polite AP throttling into a function 09/63909/2
Bill Richardson [Wed, 31 Jul 2013 16:37:58 +0000 (09:37 -0700)]
Abstract polite AP throttling into a function

This wraps the EC_HOST_EVENT_THROTTLE_START/STOP host events in a new
function called host_throttle_cpu(), similar to chipset_throttle_cpu().

That function requests the AP to throttle itself, which is less drastic than
just smacking it down from the EC.

BUG=chrome-os-partner:20805
BRANCH=falco,peppy
TEST=manual

This is a refactoring change only. All boards should still build, all tests
should still pass.

Change-Id: I871cce8f0e13230cb52eeb5e16955266f8461374
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63909
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAdd build-time checks on board-specific array sizes. 33/63833/3
Bill Richardson [Wed, 31 Jul 2013 00:26:20 +0000 (17:26 -0700)]
Add build-time checks on board-specific array sizes.

We've been declaring a bunch of statically-sized arrays:

  extern struct foo_t foo[FOO_COUNT];

And then initializing them like so:

  struct foo_t foo[FOO_COUNT] = {
    /* blah */
  };

That only catches cases where we initialize with too many entries. It
doesn't catch cases where we haven't initialized enough. This change tests
for both cases like so:

  extern struct foo_t foo[];

  struct foo_t foo[] = {
    /* blah */
  };
  BUILD_ASSERT(ARRAY_SIZE(foo) == FOO_COUNT);

The affected arrays are:

  adc_channels[ADC_CH_COUNT]
  gpio_list[GPIO_COUNT]
  temp_sensors[TEMP_SENSOR_COUNT]
  x86_signal_list[X86_SIGNAL_COUNT]
  i2c_ports[I2C_PORTS_USED]

BUG=chrome-os-partner:18343
BRANCH=falco,peppy
TEST=build all platforms

All platforms should still build, all tests should still pass.

Change-Id: Ibb16dc3201f32df7cdc875648e89ba4ffb09f733
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63833
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAdd led_slippy build rule back to common/build.mk 86/63886/2
Dave Parker [Wed, 31 Jul 2013 06:12:09 +0000 (23:12 -0700)]
Add led_slippy build rule back to common/build.mk

This got dropped during some of the recent clean up.

BUG=None
BRANCH=slippy
TEST=Manual. Check that the LED on slippy is working.

Change-Id: I80505c5df72410c9f25521d0c116fc59da5cb1db
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63886
Reviewed-by: Randall Spangler <rspangler@chromium.org>
11 months agoAdd PMU powerinfo host command and console command 50/63350/6
Rong Chang [Thu, 25 Jul 2013 16:44:46 +0000 (09:44 -0700)]
Add PMU powerinfo host command and console command

Before this change, powerinfo host command supports only one target
with USB charging. This change adds a common powerinfo host command
and console command for TPSChrome based targets.

BRANCH=None
BUG=chrome-os-partner:20326
TEST=manual
  build and flash pit target, check console command 'powerinfo'.
  check ectool powerinfo with and without AC adapter.

Change-Id: I2cfd8dfa011e23f819c6bae19cf22b4a7343f044
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63350
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agoectool: fix console command 45/63445/4 factory-pit-4471.B
Aaron Durbin [Fri, 26 Jul 2013 02:17:13 +0000 (21:17 -0500)]
ectool: fix console command

There are a few issues with console output:

1. The EC was returning more bytes than the message's insize. The
   reason stems from a refacotring that the set the global
   ec_max_insize  variables to 'EC_PROTO2_MAX_PARAM_SIZE - 8'.
   It really should be EC_PROTO2_MAX_PARAM_SIZE to cover the
   maximum packet size returned from the EC.

2. A change was made to handle EAGAIN returning from the EC kernel
   driver's ioctl() interface. That change prevented 0 bytes received
   from being returned properly.

The first issue occurs because the EC console is always larger than
what the original ec_max_insize was set to. This caused no console
messages to be displayed. The second issue causes the console command
to potentially loop forever because the drain of the EC console is
never indicated because 0 could never be returned.

BUG=chrome-os-partner:21165
BRANCH=falco,peppy
TEST=Built and can now read 'ectool console' output as well
     as not including gargabe.

Change-Id: I3114594f0020a5198532aa78ce126f4da6caf09a
Reviewed-on: https://gerrit.chromium.org/gerrit/63445
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
12 months agoAdd new hostevents to ask the AP to throttle itself 79/63379/3
Bill Richardson [Fri, 19 Jul 2013 21:00:51 +0000 (14:00 -0700)]
Add new hostevents to ask the AP to throttle itself

Occasionally the EC wants to ask the AP to throttle itself. Currently, the
only thing that the EC can do (at least on x86) is to assert the PROCHOT#
signal, which is a fairly intrusive operation and one that Intel suggests we
save for emergencies.

This CL adds a new pair of host events to ask the BIOS to throttle the AP
politely, or stop doing so. The turbo charger code will send these events to
the AP if they become necessary.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

Tests should still pass, everything else is unchanged.

  make BOARD=${BOARD} runtests

Currently, there's nothing on the BIOS/OS side that would respond to these
events, so they're just ignored. You can test that, even without this CL, by
running

  hostevent set 0x40000
  hostevent set 0x80000

Change-Id: I4a7a1b6eb87e42df94ddd09f4c6abee6ebcbd485
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63379
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
12 months agoPulse EC_ENTERING_RW instead of just leaving it high 33/62133/2
Randall Spangler [Tue, 16 Jul 2013 17:23:25 +0000 (10:23 -0700)]
Pulse EC_ENTERING_RW instead of just leaving it high

The Silego chip has a 50k pulldown which will leak power if we leave
EC_ENTERING_RW high.  We don't need to leave it high, because once the
latch in the Silego gets set it ignores this signal.  This is ~100uA,
so it only really matters in S5 on pit (since x86 boards and spring
both hibernate in S5).

BUG=chrome-os-partner:20757
BRANCH=none
TEST=probe ec_in_rw signal before/after sysjump

Change-Id: Ib6b09cfc7718b35e4e93c952c3098c08d53572e2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62133
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
12 months agoAdd turbo mode charger support, and tests for it. 72/63372/3
Bill Richardson [Thu, 25 Jul 2013 18:00:03 +0000 (11:00 -0700)]
Add turbo mode charger support, and tests for it.

Some chargers can run in a "turbo" mode, which lets it draw from the battery
to provide extra power to the AP in short bursts. In order for this to work
properly, the EC has to watch the current closely to make sure specific
limits are observed. It also has to recognize specific adapters, since those
limits vary depending on the rated power that the adapter can provide.

This adds the basic functionality, plus a test for it.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

  make BOARD=${BOARD} runtests

On Falco, you can also use the "adapter" EC command to see what's going on.
Try replacing the adapters and running that command to be sure they're
correctly identified, too:

  > adapter
  Adapter 65W (590mv), turbo 1, AP_throttled 0
  >

We currently support 45W, 65W, and 90W adapters. Unknown adapters are
treated as 65W, but don't enable turbo mode.

Change-Id: I7e5407db825ce7e596cb495fb8cb4d1dd1ff639c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63372
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoChange macro names used for test configurations 71/63371/2
Bill Richardson [Thu, 25 Jul 2013 18:21:30 +0000 (11:21 -0700)]
Change macro names used for test configurations

We can't change CONFIG_ options from the gcc commandline, because
include/configs.h explicitly undefs them again. So for some tests, we add a
-DFOO to the command line and then put this in the source:

This change just uses TEST_FOO instead of FOO, so it's more obvious what's
happening.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

No functional change, just renaming. Run

  make BOARD=${BOARD} runtests

Everything should still pass.

Change-Id: I17e10180f8d779dff0961cf411f5b61cfc70c316
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63371
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoAdd descriptions for lots of config options 81/63281/2
Randall Spangler [Wed, 24 Jul 2013 23:53:12 +0000 (16:53 -0700)]
Add descriptions for lots of config options

No functional changes, no renaming options, just adding comments.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I7218f8a4465e3e27b33a1d1a5313da83e474d633
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63281
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
12 months agoClean up onewire config options 73/63273/2
Randall Spangler [Wed, 24 Jul 2013 22:59:44 +0000 (15:59 -0700)]
Clean up onewire config options

Rename onewire_led to led_driver_ds2413, since we may have other LED
drivers hanging off a one-wire bus in the future.

No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I1d70b1c5778da94bda4ebef3b57f7c39bfba2322
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63273
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
12 months agoClean up more config options - FMAP, etc. 71/63271/2
Randall Spangler [Wed, 24 Jul 2013 19:03:40 +0000 (12:03 -0700)]
Clean up more config options - FMAP, etc.

CONFIG_FMAP is now defined by default, because all platforms other
than the host unit tests use it.

No functional changes, just renaming config options and removing dead code.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie6496310c822491068e2fa6976933486f26badb0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63271
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
12 months agoClean up more config options 48/63248/3
Randall Spangler [Wed, 24 Jul 2013 18:49:23 +0000 (11:49 -0700)]
Clean up more config options

No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I65b310b670e61bcb3531c581dfc57625df064df2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63248

12 months agoClean up and document UART config options 44/63244/3
Randall Spangler [Wed, 24 Jul 2013 01:13:15 +0000 (18:13 -0700)]
Clean up and document UART config options

No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I91584cb1f8990dd0f980abd32c04465a66243e71
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63244

12 months agoSupport emulator hibernate 70/62970/2
Vic Yang [Tue, 23 Jul 2013 04:29:58 +0000 (12:29 +0800)]
Support emulator hibernate

If we are hibernating indefinitely, just exit with hibernate exit code.
If hibernating with a delay, delay for that amount of time and then
reboot.

BUG=chrome-os-partner:19235
TEST='hibernate 1' and see emulator reboot after a second with reset
flag 'hibernate'
BRANCH=None

Change-Id: If25bf2eefbcf275f2592b92a997a9d7e1ff2384d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62970
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
12 months agoReboot emulator with execv() 69/62969/2
Vic Yang [Tue, 23 Jul 2013 04:13:42 +0000 (12:13 +0800)]
Reboot emulator with execv()

With this, the emulator is able to reboot itself without the help of
run_host_test script. This makes it easier for development and also
speeds up the test.

BUG=chrome-os-partner:19235
TEST=Pass all tests
BRANCH=None

Change-Id: Ifa510442de19256c671ab91b6bc75fe9e8b9dc7b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62969
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
12 months agoCollect board X specific files into build.mk common-$(BOARD_X) 11/63211/4
Rong Chang [Wed, 24 Jul 2013 16:34:03 +0000 (09:34 -0700)]
Collect board X specific files into build.mk common-$(BOARD_X)

This change removes all CONFIG_module_FOO from board/foo/board.h .

BRANCH=None
BUG=chrome-os-partner:21302
TEST=util/ecmakeall.sh

Change-Id: If36c792d7a8587a186287eee5fa31b4c4cf1c006
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63211
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoStandardize concatenation macros 31/63231/3
Randall Spangler [Wed, 24 Jul 2013 18:19:10 +0000 (11:19 -0700)]
Standardize concatenation macros

To create a token by concatenating already-defined macros and new
text, it's necessary to use multiple levels of macro.  We'd already
done that in several places in the code such as STM32_CAT; this now
standardizes it into a single place.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=Build all platforms; examine ec.RO.map to see that irq_*_handler and prio_* symbols
     evaluated the same as before.  (Other macro evaluations would simply fail to compile
     if they were incorrect, since the concatenated tokens wouldn't fully expand.)

Change-Id: Ic9bf11d27881a84507fe7b6096dab6217c6c6dc7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63231
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
12 months agoAdd a script to build all platforms and run host-based unit tests 30/63230/2
Randall Spangler [Wed, 24 Jul 2013 19:13:24 +0000 (12:13 -0700)]
Add a script to build all platforms and run host-based unit tests

As the number of boards grows, it's handy to have a script which
builds them all and runs host-based unit tests, to make sure that
changes are at least somewhat sane before submitting them to the
commit queue.

BUG=none
BRANCH=none
TEST=util/make_all.sh

Change-Id: Ie3fcb062caedaf36b3e350c3d9be34a9b080c76d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63230
Reviewed-by: Rong Chang <rongchang@chromium.org>
12 months agoMove TPSChrome charging temperature range to battery pack 78/62978/7
Rong Chang [Wed, 24 Jul 2013 15:22:48 +0000 (08:22 -0700)]
Move TPSChrome charging temperature range to battery pack

This change moves vendor specific temperature ranges to battery pack
files or board setup files. And added a host test case to verify that
does not change x86 smart battery charging state machine behavior.

BUG=chrome-os-partner:21181
BRANCH=None
TEST=manual
  build test: util/ecmakeall.sh
  hosttests: make hosttests && make runtests

Change-Id: I48e76826b5555f64b78e3c063ce5f02416c72aa2
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62978
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agobolt: add prelimnary support 10/62210/4
Aaron Durbin [Tue, 16 Jul 2013 19:45:08 +0000 (14:45 -0500)]
bolt: add prelimnary support

The preliminary bolt support allows the board to boot
with all the necessary peripherals working except for the
following things:
- Not all board temp sensors are added.
- WLAN is not powered on because of inrush issues.
- USB power chargers are fixed to normal mode for now.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Built and booted

Change-Id: Iea7a39e812bb396e5731f212630b7fe97c164bf2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62210
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agox86: build chipset_x86_common.o conditionally 08/63208/2
Aaron Durbin [Wed, 24 Jul 2013 15:43:36 +0000 (10:43 -0500)]
x86: build chipset_x86_common.o conditionally

Add a CONFIG_CHIPSET_X86 option that determines if
chipset_x86_common.o is built.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=built bolt and link. All other boards should be covered.

Change-Id: I980a8fc68a31162b920429e695631909c5f6a4db
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63208
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoClean up and document more config options 45/63145/2
Randall Spangler [Tue, 23 Jul 2013 23:32:18 +0000 (16:32 -0700)]
Clean up and document more config options

No functional changes, just renaming config options.

Remove README, now that all options described in it have been moved to
config.h, and the remaining information is out of date.  (Yes, we
should have a README which describes the organization of the EC
repository, but that's a matter for another CL; this one's about
cleaning up config options.)

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Iafefbe94369f1217c698f11d358bc0ecac2bdfde
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63145
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agoLessen timing constraints in hooks test 44/63144/2
Vic Yang [Tue, 23 Jul 2013 23:21:58 +0000 (07:21 +0800)]
Lessen timing constraints in hooks test

HOOK_TICK and HOOK_SECOND aren't firing with precise interval. Let's
lessen the timing constraints.

BUG=chromium:263288
TEST=Pass all tests
BRANCH=None

Change-Id: Ic093c2a27ed1b8621469a4097e567b80d1eeb50d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63144
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoClean up and document keyboard config options 09/63109/2
Randall Spangler [Tue, 23 Jul 2013 21:03:44 +0000 (14:03 -0700)]
Clean up and document keyboard config options

No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie811066a26eeaf2a5b2002b934e25b660d29058d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63109
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agoClean up debug config options 02/63102/2
Randall Spangler [Tue, 23 Jul 2013 20:05:45 +0000 (13:05 -0700)]
Clean up debug config options

All of these were defined on all but a few platforms, and those
explicitly #undef them.  So define them as enabled by default in
config.h so the board.h files are cleaner.

No functional changes; just rearranging/renaming config constants.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; FEATURES=test emerge-falco chromeos-ec

Change-Id: I1201a1472ae29641e9e219c2a0347691ca64cd28
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63102
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agoFixed two i8042 bugs. 86/62986/2
Louis Yung-Chieh Lo [Tue, 23 Jul 2013 10:02:46 +0000 (18:02 +0800)]
Fixed two i8042 bugs.

1. The buffer for host i8042 command is too small so that a command
   is dropped (buffer full) in some cases. Enlarging it can solve bug.
2. The keystrokes are queued in buffer so that kernel driver cannot
   get stable CTR value. We workaround this by disabling the keystroke
   and clearing buffer when keyboard is disabled.

BUG=chrome-os-partner:20758
BRANCH=falco,link
TEST=Verified on link. Repeatedly press Ctrl + U during booting.
The keyboard is working after boot.

Change-Id: I7d8daef8d815b8e4d08df6f6a26ab2a471e5b150
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62986
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
Tested-by: Duncan Laurie <dlaurie@chromium.org>
12 months agoFix reset flags and sysjump time for emulator 58/62958/3
Vic Yang [Tue, 23 Jul 2013 03:50:59 +0000 (11:50 +0800)]
Fix reset flags and sysjump time for emulator

Reset flags should be set properly according to reset type. Also, on
system jump, current time should be preserved.

BUG=chrome-os-partner:19235
TEST='sysjump rw' and check time is the same.
TEST='reboot hard' and see '[Reset cause: hard]'
BRANCH=None

Change-Id: I00fd2c652d10c237f23cc6a33e0b667422bc625d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62958
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoTest power button in kb_8042 test 55/62955/2
Vic Yang [Tue, 23 Jul 2013 03:10:02 +0000 (11:10 +0800)]
Test power button in kb_8042 test

This checks keycodes are sent correctly when power button is pressed.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ibaa4ffce749167be5b8376aada0786f9760e7707
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62955
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoTest sysjump tag in kb_8042 test 08/62908/4
Vic Yang [Mon, 22 Jul 2013 22:52:18 +0000 (06:52 +0800)]
Test sysjump tag in kb_8042 test

This checks that keyboard state is preserved across system jump.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: I53c5bb68246fd117b351d89c3907daf028bc4ef3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62908
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoClean up and document PMU config options 06/62906/3
Randall Spangler [Fri, 19 Jul 2013 23:26:36 +0000 (16:26 -0700)]
Clean up and document PMU config options

No functional changes, just documenting and renaming.

All boards which use the PMU must provide pmu_board_init().  This was
already true - except that Daisy's pmu_board_init() was implemented as
part of pmu_init() instead of its code living in board.c; I've moved
the code there now.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I85ad06dc3b6287ad917fe13acf83182f24a8f23d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62906
Reviewed-by: Vic Yang <victoryang@chromium.org>
12 months agoClean up and document battery config options 73/62673/5
Randall Spangler [Fri, 19 Jul 2013 16:46:48 +0000 (09:46 -0700)]
Clean up and document battery config options

No functional changes, just documenting and renaming.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I0b0d3cdce535d90ce437e82e96346fc3ca9be7b0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62673

12 months agoClean up charger config options 40/62540/6
Randall Spangler [Thu, 18 Jul 2013 20:43:34 +0000 (13:43 -0700)]
Clean up charger config options

These are now described in config.h.  The various BQ chargers now also
use a consistent naming for their sense resistor options.

No functional changes, just renaming, and removal of obsolete
never-defined configs.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie274546fe45f5ffc6fd0f26096c4622805baf8a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62540

12 months agoAdd ectool chargecontrol discharge command for Slippy 51/62851/3 stabilize-4443.B
Dave Parker [Sat, 20 Jul 2013 06:43:28 +0000 (23:43 -0700)]
Add ectool chargecontrol discharge command for Slippy

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Run ectool chargecontrol command with each option (normal,
idle, discharge) on Slippy. Verifiy battery is discharging
in discharge mode via EC console 'battery' command.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I0461b20fc15c99380327b9a282efff7f1ed93baf
Reviewed-on: https://gerrit.chromium.org/gerrit/62851

12 months agoAdd system_common unit test 55/62855/2
Vic Yang [Mon, 22 Jul 2013 17:58:49 +0000 (01:58 +0800)]
Add system_common unit test

This tests reboot-on-ap-shutdown.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ic1a07670f82646e85d014d52a2aba0835319c212
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62855
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
12 months agoSlippy: Detect physical presence of battery before waking it 50/62850/2
Dave Parker [Sat, 20 Jul 2013 06:10:17 +0000 (23:10 -0700)]
Slippy: Detect physical presence of battery before waking it

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Power device without battery. It should boot with no 30
second delay. The battery LED blinks orange indicating a
battery error.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: Icabc450cd44748aed694e4ed8cb81eee152cf456
Reviewed-on: https://gerrit.chromium.org/gerrit/62850
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>

12 months agoSet Slippy write protect to active low 49/62849/2
Dave Parker [Sat, 20 Jul 2013 16:11:35 +0000 (09:11 -0700)]
Set Slippy write protect to active low

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Verify correct WP value using crossystem wp_cur.

Change-Id: I1eb30584a744df7c695a06544d46b729cd4a689f
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62849
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoBasic G781 temp sensor support for Slippy 47/62847/2
Dave Parker [Sat, 20 Jul 2013 07:07:27 +0000 (00:07 -0700)]
Basic G781 temp sensor support for Slippy

This lets us read the internal and external values on the
G781 temp sensor.

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=run ec 'temps' command on Slippy.

Change-Id: Ib3a2a89efd4cfbc4a49696c79daa37bc1880a3ef
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62847
Reviewed-by: Randall Spangler <rspangler@chromium.org>
12 months agoBattery LED control for Slippy 48/62848/2
Dave Parker [Sat, 20 Jul 2013 02:45:06 +0000 (19:45 -0700)]
Battery LED control for Slippy

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Manual. Verify LED is amber while charging, blue when
charged, and off when external power disconnected.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: If80bb9b0c70951d257621a2fe3ef20cd8749a033
Reviewed-on: https://gerrit.chromium.org/gerrit/62848
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>