Commit Graph

594 Commits

Author SHA1 Message Date
Randall Spangler
bebfb9431e 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>
2013-08-01 14:22:44 -07:00
Dave Parker
8e28efa7ac 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>
2013-08-01 11:07:58 -07:00
Bill Richardson
86bef29c3d 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>
2013-07-31 12:33:31 -07:00
Bill Richardson
af77729737 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>
2013-07-31 12:33:31 -07:00
Rong Chang
bf71082456 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>
2013-07-29 11:07:31 -07:00
Bill Richardson
ac78e589af 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>
2013-07-25 19:02:09 -07:00
Bill Richardson
298a7276c2 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>
2013-07-25 15:50:13 -07:00
Randall Spangler
1960b9f957 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>
2013-07-24 19:08:18 -07:00
Randall Spangler
b4d903487e 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>
2013-07-24 18:08:32 -07:00
Randall Spangler
90215a4494 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>
2013-07-24 18:08:31 -07:00
Randall Spangler
ba3733e492 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
2013-07-24 18:08:29 -07:00
Randall Spangler
e6f0c272a0 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
2013-07-24 16:31:14 -07:00
Vic Yang
99e4a97798 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>
2013-07-24 15:50:19 -07:00
Rong Chang
5afcb815d6 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>
2013-07-24 15:50:17 -07:00
Randall Spangler
fe660aa372 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>
2013-07-24 14:05:17 -07:00
Rong Chang
6c280b1b32 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>
2013-07-24 13:07:13 -07:00
Aaron Durbin
18f0bd28e2 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>
2013-07-24 12:09:49 -07:00
Randall Spangler
8cd69cfe53 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>
2013-07-24 12:09:47 -07:00
Randall Spangler
8b81636780 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>
2013-07-23 17:37:54 -07:00
Randall Spangler
cb1f7306b3 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>
2013-07-23 17:37:53 -07:00
Randall Spangler
64e38af781 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>
2013-07-23 11:14:16 -07:00
Randall Spangler
4288e45815 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
2013-07-23 11:14:15 -07:00
Randall Spangler
345c22be08 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
2013-07-23 11:14:14 -07:00
Vic Yang
8218aa1346 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>
2013-07-22 16:09:47 -07:00
Dave Parker
46af344b87 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>
2013-07-22 15:28:58 -07:00
Randall Spangler
fe76b51da0 Truncate version string to 32 characters
The version struct and EC_CMD_GET_VERSION assume 32-character version
strings.  But if the git tree is dirty and the board name is long, the
version string overflows that limit.

This change truncates what's stored in the version string to fit.

The build info still contains the full version string, as it did before.

BUG=chrome-os-partner:21156
BRANCH=none
TEST=build BOARD=mccroskey with a dirty tree; it should build.
     Then cat build/mccroskey/ec_version.h to see CROS_EC_VERSION32 has
     truncated the version string.  Then build a platform of your choice
     and type 'version' to see that the version string and build info is
     still reported correctly.

Change-Id: Ie71b8efd99a83315f8b4d5ad10c51e48781b12f4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62649
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-19 18:01:55 -07:00
Simon Glass
db347953e1 Add an enum for the number of flash regions
Add an enum for the number of flash regions so we can keep track of all
the possible regions.

(This is used in U-Boot which wants to declare an array of all possible
regions.)

BUG=chromium:244019
BRANCH=none
TEST=manual
Build EC for pit.

Change-Id: I494d857f1388dcc5c64b1cd580cf0084bdef0212
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62701
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 18:01:49 -07:00
Dave Parker
c243537dda Constrain charging voltage to values chargers can provide.
BUG=chrome-os-partner:20863
BRANCH=falco,peppy,slippy,wolf
TEST=Manual. On Peppy, there should no longer be "Charging
Voltage" messages every second on the EC console. On other platforms
verify that V_Batt reported by the 'charger' command is divisible
by 16.

Change-Id: Idd775a1d8033ff3405d10919e1e15ddddebc6c23
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62699
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 18:01:48 -07:00
Dave Parker
50ebe05652 Peppy: Detect physical presence of battery before waking it
BUG=chrome-os-partner:20889
BRANCH=peppy
TEST=Power device without battery. It should boot with no 30
second delay. The battery LED blinks orange indicating a
battery error.

Change-Id: Iea4f5644ae223b60dc8058dc52e06405e275c001
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61820
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Marc Jones <marc.jones@se-eng.com>
2013-07-19 17:02:18 -07:00
Dave Parker
7f1c49ab4b Add ectool discharge command to Falco and Peppy.
Expands and renames ectool 'chargeforceidle' command to
'chargecontrol'. Board-specific calls are needed to enable and
disable the discharge while on AC power state.

BUG=chrome-os-partner:20506
BRANCH=falco,peppy
TEST=Run ectool chargecontrol command with each option (normal,
 idle, discharge) on Falco and Peppy. Verifiy battery is discharging
 in discharge mode via EC console 'battery' command.

Change-Id: I7ac2b18b4f143bf6abc1e0bb878ad21a99f52100
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60689
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 10:58:18 -07:00
Randall Spangler
5691ac8168 Add EC_CMD_GET_FLASH_INFO version 1
This adds two new fields: the ideal write size for best EC flashing
performance (e.g., page mode instead of word mode), and a flags field
with a flag to indicate whether the EC erases its bits to 0 or 1.

The EC still supports the old version 0 command, since u-boot and
flashrom expect that to work.

BUG=chrome-os-partner:20973
BRANCH=(all haswell); this will speed up flashing and software sync
TEST=ectool flashinfo
     1. old EC, new ectool -> only reports version 0 info
     2. new EC, old ectool -> only reports version 0 info
     3. new EC, new ectool -> reports new fields

Change-Id: I484327fe22a58d2b69d7f6ac767b2d3e81b3e0b7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62378
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2013-07-18 16:47:00 -07:00
Randall Spangler
672057cb7e Split x86 power button logic out of switch.c
Power button logic is common across all platforms and is not
LM4-specific, so move it to its own module.  Switch.c will eventually
be moving to common/ and will common across all platforms (not just
x86), and splitting out the x86 power button logic is needed before
that too.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=manual
     1) power on system with both lid and power button.
     2) power+refresh -> reboots
     3) power+refresh+esc -> recovery mode
     4) power+refresh+downarrow -> reboots, AP stays off
     5) toggling recovery GPIO via servo should generate SW debug output
        showing bit 0x10 toggling

Change-Id: I07714e2c035dceece66f90407983397d2697e7d5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61780
2013-07-17 10:49:48 -07:00
Aaron Durbin
7d6e01d617 lm4: make configure_kblight_gpios() board dependent
The configure_kblight_gpios() funciton was specific to
the link board. Therefore, move the function to be defined
within the board-specific file.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Built. Tested similar change on bolt.

Change-Id: Ib5847130450024c50d6526d2c1a64d67ab501637
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62209
2013-07-16 16:40:38 -07:00
Randall Spangler
0c73fdae77 Make a top-level config.h file to include sub-configs
This file will soon contain the exhaustive list of all CONFIG defines
and their descriptions.

Chip-level configs are renamed to config_chip.h to avoid naming
conflicts.

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

Change-Id: I9e94146f5b4c016894bd3ae3d371c4b9f3f69afe
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62122
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-16 12:06:31 -07:00
Randall Spangler
873e4425c5 Remove unneeded direct includes of board.h and config.h
Both of these are included via common.h, which is in turn included by
most other header files.  Directly including board.h or config.h is
redundant and discouraged.

No code changes, just removing #includes.

This is in preparation for making a top-level config.h file, but that
change will be easier to review if it doesn't touch as many files.

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

Change-Id: I204bcebe5607c6e6808821eb071cfc31d2a93a7c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62121
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-16 12:06:30 -07:00
Randall Spangler
f8955d14b6 Remove unused board_version enums
These were briefly used on link, and are not used by any other
platform.  The values for those platforms are almost certainly wrong,
and incorrect information is worse than no information.

This does not remove reading the stuffing resistors - it just removes
the assumption that they map to PROTO1 and EVT.

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

Change-Id: I2ba19fd52660559bfd1d8e3b8a9949e9b8abbddf
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61929
2013-07-16 12:06:30 -07:00
Vic Yang
a8cda83a27 spring: lower LED brightness to save power
Lower LED brightness:
  - Green:  0x80 -> 0x10
  - Yellow: 0x80 -> 0x40 (looks equivalently bright to green @ 0x10)
  - Red:    Not changed since it's an error condition

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

Original-Change-Id: Ib80b4f5c746163d98a09e21246ea97a6aeb2c054
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61672
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 1f6e5f8a1e074bd91acd3fc0b3de268495199c10)

Change-Id: I8f37cfa79d9fd30f503318e0913f4c12c1737219
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61852
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-15 14:11:13 -07:00
Randall Spangler
20e3309579 Remove fancy trickle charging logic
We implemented a fancy state machine for link to try and feed
almost-dead batteries smaller amounts of current than the charger
could normally supply, by dithering down the voltage to less than was
requested.  It's a lot simpler just to give the battery the smallest
non-zero amount of current we can give it at the voltage it asks for.

Remove the precharge code, since we won't use it on any future
platform and link has already branched.

BUG=chrome-os-partner:20881
BRANCH=none
TEST=find a really dead batery and try to charge it, or do what I did
     and just hack the battery module to lie about the requested values,
     and see that it always gets the minimum current step at the requested
     voltage.

Change-Id: I30bcb62bbe215abafb3a98c52e2afed3b74ead1a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61789
2013-07-15 14:10:45 -07:00
Dave Parker
92b62d1cd9 x86: Enable all wireless switches when going into S0
BUG=None
BRANCH=slippy,peppy,falco,wolf
TEST=Boot device and verify WLAN and WWAN enable GPIOs are active.

Change-Id: I1b488bc26ddbe50c570aefd8fcd3cdcb4d5b38d4
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61653
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-12 16:49:14 -07:00
Dave Parker
b2bc8aaa20 Basic G781 temp sensor support for Falco and Peppy.
This lets us read the internal and external temp values.
More functionality to come once we figure out what is
needed.

BUG=chrome-os-partner:20432
BRANCH=falco,peppy
TEST=run ec 'temps' command on Falco and Peppy.
Signed-off-by: Dave Parker <dparker@chromium.org>

Change-Id: I4f452f438e0a158dc8b34901e3faad3ce36d28b2
Reviewed-on: https://gerrit.chromium.org/gerrit/60145
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
2013-07-11 22:32:52 -07:00
Randall Spangler
eb8920c939 Split wireless power/radio control out of switch.c
Chipset control of wireless power uses the new API instead of overriding
the wireless power itself.

Refactor board-specific support for it to just a few config #defines
instead of board-specific functions.  This makes some assumptions
about the polarity of the enable signals.  Not making those
assumptions would require defining an array of structs or some other
heavier-weight board-specific info.  Since the assumptions hold for
all current boards, let's make them now because this is a step in the
right direction, and reserve doing something more general until we
actually have a use case for it (so we build in just the flexibility
we need).

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; see that link wifi turns on at boot and off at
     shutdown (verify via 'gpioget' from EC console)

Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61608
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-11 16:51:40 -07:00
Randall Spangler
6696843708 Move x86 backlight-enable passthru code to its own module
This code is not LM4-specific, it's x86-specific.  So it doesn't
belong in chip/lm4.  Put it in its own module rather than leaving it
in switch.c, since some x86 systems may need the power button state
machine but not the backlight-enable passthru.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=Quickly run a magnet over the lid switch; the backlight goes off and then
     back on.

Change-Id: I72f7139b73f91539dcfbe6b5cb6d56587ab66fde
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61595
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-11 16:51:39 -07:00
Vic Yang
4d270c1507 Add thermal host and console command test
This checks the functionality of thermal engine related host and
console commands.

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

Change-Id: I604ed3bfed3549b2573fac65da83450acd3f2797
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60964
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-11 04:26:14 -07:00
Vic Yang
b3f1d0d059 Add function to inject console input from test
This can be used to test console command.

BUG=chrome-os-partner:19236
TEST=Build success
BRANCH=None

Change-Id: I7ce002f9e66fd7786492bacb453f126b9766d741
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60978
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-11 04:26:09 -07:00
Randall Spangler
6b46a0cfc5 Refactor x86 chipset code
This moves most of the code into a common module, leaving only the
board-specific GPIOs (now listed in a struct in board.c) and the
chipset-specific state machine with multiple copies.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=boot link; verify suspend and resume work; shut back down and see
     it go to G3 after 10 sec.

Change-Id: Iafa8ba55a4870bb0119ff4161a1a9054fcc7955f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60949
2013-07-10 11:16:43 -07:00
Vic Yang
56bd316488 spring: Drop support for VFET2 video poewr output
VFET2 is only used by early stage boards. Let's drop it now.

Also, disable power output when power good for VFET is not set. This
essentially adds retry for video power output.

BUG=chrome-os-partner:18186
TEST=Boot and test video output.
BRANCH=Spring

Original-Change-Id: I1937522a6a523a4f5dbeb9882518ca6e37655bea
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60852
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit e82589e073c5a863797fa87ecaa1dfafb1a9228d)

Change-Id: Ib043f952e699eb99b373da205379f56230887f6a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61396
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-10 11:16:36 -07:00
Vic Yang
01ed345ebd Uprev panic data struct version
The struct was changed in commit 74c34bbad, but the struct version was
left as 1. We need to uprev this so the data returned by host command is
useful.

BUG=chrome-os-partner:16901 chrome-os-partner:20548
TEST='ectool panicinfo' with new and old struct. Compare output with
output from console command 'panicinfo'.
BRANCH=None

Change-Id: I4df3142497dc5ee21d100c4cb8118fb7a0ce7a7e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60314
Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
2013-07-10 11:16:18 -07:00
Randall Spangler
5f30f40cb5 Move protocol v2 constants to ec_commands.h
These constants are scattered around the various interface
implementations and should be in one place.  This will also clean up
the u-boot side when ec_commands.h is copied there.

BUG=chrome-os-partner:20257
BRANCH=none
TEST=build link, spring, pit; test 'ectool hello'

Change-Id: Ib1425db00ec8220538d8c5c65107ac9548009516
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60810
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-07-03 18:23:09 -07:00
Aaron Durbin
1b9a0ade16 charger: add support for TI BQ24715
Add support for the TI BQ24715 smart battery charger.
It provides the system power while limiting the battery
charge limit based system power needs.

This code is based off of the bq24725 code, however there
is one change (aside from the min/max) to fit into the
current charging state machine. The charging voltage
setting is cached to provide the illusion of it being 0V
which the hardware does not allow.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Used on a board containing this charger.

Change-Id: I59af88fba6bf740e7caff72c9ed27eaf721758c4
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60804
2013-07-03 16:02:24 -07:00
Randall Spangler
0ee2689ee9 Add get-protocol-information command
This is necessary to support larger packet sizes for host protocol
ver.3.  The host previously didn't have any way to know how big a
packet the EC could accept / respond with (except on LPC, where the
size is determined by the I/O window).

BUG=chrome-os-partner:20257
BRANCH=none
TEST='ectool protoinfo' returns good info; on link,

  Protocol info:
    protocol versions: 2 3
    max request:   256 bytes
    max response:  256 bytes
    flags: 0x00000000

and on pit,

  Protocol info:
    protocol versions: 2 3
    max request:   544 bytes
    max response:  544 bytes
    flags: 0x00000001

Change-Id: Ic1e3831d9b4a96ffbf365c0d09b6023472de39a9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60703
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-02 09:32:52 -07:00