Commit Graph

192 Commits

Author SHA1 Message Date
Randall Spangler
7209e7c2d0 Clip charging current to valid range
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8662
TEST=manual

Plug in a fully-discharged system.  Run 'charger' and 'battery'
commands to see that it's requesting a really small current.  See that
we're now feeding it a larger current.

Change-Id: I4312e2976b4f39d093deb73f665f8fbaba72d7c8
2012-04-09 14:47:29 -07:00
Louis Yung-Chieh Lo
1a9a415cf6 Support chipinfo command (ectool/host commands)
Add a host command returning chip information. The interface is in common/
while the implementations are in chip-specific code (note: added simple
value for stm).

BUG=chrome-os-partner:8567
TEST=on board
% ectool chipinfo
Chip info:
  vendor:    xx
  name:      yyyy
  revision:  zzzzz

Change-Id: I5030a03a6fcfbfc080d5acd8efb763fde7eefde5
2012-04-09 14:25:30 +08:00
Duncan Laurie
32012be3c0 Export more battery information in LPC map
This data is used to populate the _BIF/_BIX packages in ACPI
but it currently needs an EC command to retrieve that isn't
easy to query in ACPI since it isn't using standard EC RAM.

1) Export these additional fields in init() state:
- Design Capacity of Full
- Design Voltage
- Last Full Charge Capacity
- Cycle Count
- Manufacturer String
- Model String
- Serial Number String

2) Fix an issue where battery current was not reported when
the battery was charging.

3) Remove the command interface so there is no duplication.

BUG=chrome-os-partner:7734
TEST=using (not yet published) coreboot to read battery status
via ACPI and verify that battery removal/insertion events
are properly handled.

Change-Id: If337aad3255e5b1a0f85168838f1dd86a32bbeb3
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
2012-04-06 14:49:30 -07:00
Randall Spangler
a61d8db3d3 Change task messages to events
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7461
TEST=manual

make BOARD={bds,link,daisy}
make tests
flash link system and make sure it boots

Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
2012-04-06 09:06:53 -07:00
Louis Yung-Chieh Lo
0eb9447051 Fix the build error on adv board.
BUG=none
TEST=successfully BOARD=adv make.

Change-Id: I75e0f1e0487f52411c0c50b804e8997065f4e06c
2012-04-06 10:19:10 +08:00
Gerrit
8ea8bbbfd5 Merge "Increase fan speed control to 5 steps." 2012-04-05 17:39:41 -07:00
Vic Yang
94ef5f3ab3 Increase fan speed control to 5 steps.
Factor out fan speed control for easier adjusting fan speed stepping.
Also increase number of fan speed steps from 2 to 5.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8466
TEST=Manual test.

Change-Id: I0ff601c0a4f2ed2a4867bdc6e550eb2827404754
2012-04-05 11:30:16 +08:00
Gerrit
732d256dd9 Merge "First "ectool lightbar" command." 2012-04-04 17:46:50 -07:00
Randall Spangler
bae507a2da Invert write protect signal
Write protect is active-high, not active-low.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8580
TEST=manual

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:on
From console:
  gpioget WRITE_PROTECT
  0  WRITE_PROTECT

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:off
From console:
  gpioget WRITE_PROTECT
  1  WRITE_PROTECT

Change-Id: I81c7858cac43c6c9b8630bf7f5aa0f491e6554ad
2012-04-04 15:26:25 -07:00
Bill Richardson
17fe1ce017 First "ectool lightbar" command.
BUG=chrome-os-partner:8728
TEST=manual

I don't have a system that has both an EC and a lightsaber, so I can't be
certain this works, but I *think* it will.

I do have a Link proto 0.5. With that, you can say

  ectool lightbar test

and the EC console says it's poking at the lightbar, but of course there's
nothing there. If there was, it *should* flash in pretty colors. I have a
lightsaber attached to a BDS, and from the EC console running "lightsaber
test" does make it blink.

Change-Id: Ib6021ad8e53959de52b12efda376254071e5fb4b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-04-04 13:14:04 -07:00
Vic Yang
afe7cda377 Revert "Add back LPC temperature read command as workaround."
This reverts commit dfe22b2b1e.
We seem to have solved I2C block issue. Reverting the workaround LPC
command and ectool command.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8239
TEST=Compilation succeed. Manually tested temperature polling still
works.

Change-Id: I0acb567a138282479c7cc07cbfa723c439d04cd7
2012-04-05 00:06:49 +08:00
Gerrit
8ee84c5db5 Merge "lightbar: add reset GPIO" 2012-04-03 22:37:03 -07:00
Gerrit
84b4dc972d Merge "Remove write protect -> recovery signal hack" 2012-04-03 18:26:01 -07:00
Bill Richardson
e881236a72 lightbar: add reset GPIO
De-assert the lightbar reset GPIO to be able to access its registers.

According to the HW guys, it will consume less power in standby than in
reset due the pull-up on the reset line.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>

BUG=None
TEST=manual

On Link proto-1, type "lightbar test" in the EC console and see it blink.

On BDS, just build it. Nothing actually changes for BDS.

Change-Id: I9ec612c80f48d41ccf779f0962fc047966d4b7ba
2012-04-03 17:57:05 -07:00
Gerrit
e215358e8f Merge "Don't wait for CPU_CORE and VGFX_CORE good before asserting PWROK" 2012-04-03 16:19:26 -07:00
Randall Spangler
cb214ee8d8 Remove write protect -> recovery signal hack
Servo2 can set the write protect signal

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8580
TEST=manual

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:on

Then from EC console:
  gpioget WRITE_PROTECTn
  0  WRITE_PROTECTn

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:off

Then from EC console:
  gpioget WRITE_PROTECTn
  1* WRITE_PROTECTn

Change-Id: I9976cd6f114c8dae75434adf99d9409107b6ada0
2012-04-03 15:58:11 -07:00
Randall Spangler
3d2c4f758f Don't wait for CPU_CORE and VGFX_CORE good before asserting PWROK
In addition, it's not necessary for VGFX_CORE to be enabled for the
system to be in S0; just CPU_CORE is sufficient.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8725
TEST=boot system via power button; should boot normally

Change-Id: Iea32837b698845355f7fa6bd2eaca9fd95f6726b
2012-04-03 15:24:22 -07:00
Gerrit
422f8ea6ba Merge "Add %T format code to print current timestamp." 2012-04-03 13:58:05 -07:00
Randall Spangler
95462ad4fe Add %T format code to print current timestamp.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8724
TEST=if timestamps show up in the debug output, it works

Change-Id: I5264a3a40a07a824cc15b39a7bd81f2db02a3c13
2012-04-03 11:35:47 -07:00
Gerrit
d1f2890982 Merge "Preserve reset cause when jumping between EC images" 2012-04-03 10:03:40 -07:00
Randall Spangler
ed33516e2e Preserve reset cause when jumping between EC images
BUG=chrome-os-partner:8718
TEST=manual

1) Use 'reboot' command from console to boot image.  Should end up in
image A, with last reset reason soft cold.  'sysinfo' should show we
jumped to this image.

2) sysjump RO.  Should end up in RO; otherwise same as 1)

3) reboot using Power+Esc+Reload.  Should end up in image RO, with last
reset reason reset pin.  'sysinfo' should show we did not jump to this
image.

4) sysjump A.  Should end up in A with reset reason reset pin.
'sysinfo' should show we jumped here.

Change-Id: I2dd5595eab4ba2c91bfe8b2b2e9677d7732aca63
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-04-03 09:26:25 -07:00
Louis Yung-Chieh Lo
0ece3ef0dc Fix the SETREP and EX_SETLED state machine (keyboard module).
Original code doesn't handle those 2 commands well. SETREP needs a new
state for incoming data byte. EX_SETLED expects 2-byte parameter instead
of 1-byte.

Also enclose all asynchronous debug output in [] for servo-based testing.

BUG=chrome-os-partner:8674
TEST=on the target board. No "Unsupported data 0x00" message is seen.

Change-Id: Icb8e592fe54620677878ee15ef8a781c8906063e
2012-04-03 11:26:06 +08:00
Randall Spangler
b70183a9bd Implement persistent flash write protect settings
This uses the last bank of flash to hold persistent settings, and
looks at the write protect GPIO to decide whether to protect the chip
at boot (chrome-os-partner:7453).

For ease of debugging, I've temporarily hacked this so flash uses the
RECOVERYn signal (dut-control goog_rec_mode:on) to enable WP instead
of the write protect signal; this works around chrome-os-partner:8580.

Also note that if you write protect any blocks even temporarily,
you'll need to do a power-on reset to clear them before you can
reprogram the flash.  See chrome-os-partner:8632.  At the EC console,
"hibernate 1" will do that, or you can just yank the power.

This also fixes a bug in the flash write and erase commands, where
they weren't properly detecting failure if you attempted to modify a
protected block (missed an interrupt reason...)

New "flashwp" console commands work.  LPC commands need reworking.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8448
TEST=manual

Change-Id: I49c38cc25c793094ae3331a4586fda0761b4bac6
2012-04-02 10:57:03 -07:00
Louis Yung-Chieh Lo
8d6725baf3 Remove the un-necessary TODO comments in i8042 module.
See issue tracker for more information.

BUG=chrome-os-partner:8493
TEST=compile okay

Change-Id: I910aebec7d2a505a02b1bbd5d985a540b94be5c2
2012-03-28 16:51:40 +08:00
Louis Yung-Chieh Lo
b71837716d flash write and erase commands protect the active image.
Comapre the range to be write (erase) with the range of active image.
If overlap, return error to indicate the access denied.

Note that we actually protect only runtime code and ro data.
FMAP is intentional unprotected so that flashrom can update to new map
before jumping. Since the vector table and init code are in the same
erase page, they are unprotected as well.

BUG=chrome-os-partner:7478
TEST=

Change-Id: Icb5cc89836432a11cef80e18eb66bb39a6c9b1d9
2012-03-27 14:36:45 +08:00
Randall Spangler
43686b0588 Fix sysjump to RO
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8613
TEST=sysjump A, then sysjump RO

Change-Id: Id9b3c867fa01893542812373f4469534b4be9918
2012-03-23 09:13:40 -07:00
Bill Richardson
e4e7f5bdf7 Rename led.c to lightbar.c, improve command interface.
BUG=chrome-os-partner:7839
TEST=none

Signed-off-by: Bill Richardson <wfrichar@google.com>

Only tested on BDS at the moment, because that's all I have.

Change-Id: I30c7202856a272953bf7170c6786999378984329
2012-03-20 15:55:58 -07:00
Randall Spangler
41e3b58258 Remove old scratchpad-based reboot-to-image interface
Now that we can jump directly to other images, we don't need this.

We jump to image A by default, unless the recovery button or signal is asserted.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8562
TEST=manual

Reboot -> runs image A
Reboot with reload (F3) held down -> runs RO
Reboot with 'dut-control goog_rec_mode:on' -> runs RO

Change-Id: I8259fe0d738ce0ca897d2f4427d8cf61858b8901
2012-03-20 09:43:46 -07:00
Gerrit
61748b4f04 Merge "Keyboard wakeup." 2012-03-20 09:26:18 -07:00
Gerrit
dfa34083c5 Merge "Support warm reboot from one EC image to another." 2012-03-20 09:26:16 -07:00
Gerrit
7cf6983eb5 Merge "Set power adapter LED based on charge state" 2012-03-20 01:11:50 -07:00
Rong Chang
13ad11292e Set power adapter LED based on charge state
Power adapter LED:
  GREEN = charge done
  YELLOW = charging
  RED = error

Signed-off-by: Rong Chang <rongchang@chromium.org>

BUG=chrome-os-partner:8536
TEST=manual

Change-Id: I5580763a4136e1de7f5eae4e3dda8e169309d902
2012-03-20 14:33:09 +08:00
Louis Yung-Chieh Lo
f8f802cbb8 Keyboard wakeup.
The final piece links the keyboard press and x86_power module.

BUG=chrome-os-partner:8523
TEST=on the link board.
wait for 15 minutes to make host suspend. touch any key to wake up host.

Change-Id: Ie6ae840ae546731daea48ab457fdc056feb5a685
2012-03-20 11:07:19 +08:00
Randall Spangler
b2ac77b37b Support warm reboot from one EC image to another.
This is necessary at init-time for verified boot to jump from RO to
one of the RW images.

It's also used by factory EC update to update one image and then jump
to the updated image to finish the update.  In this case, the x86 does
NOT reboot.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8449
TEST=manual

1) power on x86 and log in
2) sysjump a  --> system is in a; x86 has not rebooted
3) sysjump ro --> system is back in RO; x86 has not rebooted
4) reboot -> system is in RO; x86 HAS rebooted

Change-Id: I9dbadcf9775e146a0718abfd4ee0758b65350a87
2012-03-19 15:41:14 -07:00
Randall Spangler
9ff6f390b9 Remove code for skipping duplicate port 80 writes
The kernel no longer uses port 80 as a delay mechanism, so we don't
need to detect the no-longer-present spammy writes.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7972
TEST=port80 scroll, then boot the system.  see a few repeated bytes,
but not piles of 00 and ff's.

Change-Id: Id14dc43ab4e1b15c6bab99a17c062f295a59e7e6
2012-03-19 09:05:07 -07:00
Randall Spangler
2a9f80d2d9 More cleanup of board/chip configs and initialization
More modules can be disabled individually through CONFIG_ defines.

Reordered early module pre-init and init, and added comments to
explain why things are ordered in main() the way they are.

Fixed a few assorted init-related bugs along the way, like st32m
keyboard scan double-initializing.

BUG=none
TEST=build link, bds, daisy

Signed-off-by: Randall Spangler <rspangler@chromium.org>

Change-Id: I04a7fa51d743adfab4be4bdddaeef68943b96dec
2012-03-19 09:04:56 -07:00
Gerrit
eb3920ec7a Merge "Add battery SMI events and refactor charging state" 2012-03-19 01:54:54 -07:00
Rong Chang
e8afc9946a Add battery SMI events and refactor charging state
This CL adds battery SMI events. And refactors the charging state
machine by adding share state context for all handlers.

Power events are moved to common handler. Minor clean up on console
output messages.

Signed-off-by: Rong Chang <rongchang@chromium.org>

BUG=chrome-os-partner:7526,7937,8450
TEST=manual:
  Watch console message when connecting/disconnecting AC adapter and
  battery. Check the state transition.

Change-Id: I42eec4f87a9d49bd193cb9dde9080e3dfccbb77c
2012-03-19 16:08:40 +08:00
Randall Spangler
e68844824b Clean up chip/board configs for LM4
Board-specific features like lightbar should be config'd at the board
level, not at the chip level.

BUG=none
TEST=build link, bds, daisy

Change-Id: If1df2ca0422f7b8bdc172d0df7bd9f6a1af6a9d2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-03-16 14:02:59 -07:00
Randall Spangler
a9f4794edb Add support for 1-wire protocol and power adapter LEDs
BUG=chrome-os-partner:7498
TEST=powerled {off, red, yellow, green}

Signed-off-by: Randall Spangler <rspangler@chromium.org>

Change-Id: I48beaad94d75c0ec30a969ea4b0e35f54e052085
2012-03-16 11:03:13 -07:00
Gerrit
2743514996 Merge "Fix test build" 2012-03-15 20:43:56 -07:00
Vic Yang
9f8e8dc6a3 Temperature sensor grouping.
Group temperature sensors into different types so we only have to set
temperature threshold for each type instead of each sensor.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8466
TEST=Fan control still works.

Change-Id: I7acc714c32f282cec490b9e02d402ab91a53becf
2012-03-16 10:40:52 +08:00
Gerrit
7d1884ee06 Merge "Prevent fan from keep turning on and off." 2012-03-15 17:59:33 -07:00
Vic Yang
826e811493 Prevent fan from keep turning on and off.
Modify thermal engine to treat temperature threshold as a 3-degree range
instead of a certain value. This way the fan do not keep turning on and
off, while the temperature floating around the threshold value.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8466
TEST=Set threshold to current temperature. The fan turns on and does not
immediately turns off.

Change-Id: Iad1de05a409dbbc573a8ffd0ece0dc7961b20806
2012-03-16 07:25:37 +08:00
Vincent Palatin
e456584ce1 Fix test build
Allow to build without the power button task.

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

BUG=None
TEST=make qemu-tests

Change-Id: Ibc757a6641f195f0d10e6a673792b996694f8cec
2012-03-15 21:25:48 +00:00
Randall Spangler
c72f66c050 Add wake signal to PCH
This works similar to SCI/SMI events, but triggers a separate
level-sensitive signal to the PCH instead.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8514
TEST=manual

From EC console:
gpioget PCH_WAKEn --> should be 1
hostevent wake 0x1
close lid switch (with magnet)
hostevent -> should show wake mask 0x1, raw events 0x1
gpioget PCH_WAKEn --> should be 0
hostevent clear 0x1
hostevent -> should show raw events 0
gpioget PCH_WAKEn --> should be 1

Change-Id: I29832c1dc30239a98987578f07dfeb25791dde11
2012-03-15 12:42:11 -07:00
Randall Spangler
38d1b2e8ba Add ability to trigger both warm and cold resets.
Keyboard reset now triggers a cold reset.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8397
TEST=power system on, then do 'x86reset cold' for a cold reset or
'x86reset warm' for a warm reset.  Check x86 debug console to see that
coreboot detects the warm (soft) reset.

Change-Id: I00930d9f5df98365277cd5c7f2eb8f135c4e4398
2012-03-15 09:27:45 -07:00
Gerrit
5f83ab456c Merge "Add back LPC temperature read command as workaround." 2012-03-14 07:06:07 -07:00
Vic Yang
dfe22b2b1e Add back LPC temperature read command as workaround.
Until we solve the I2C hanging issue, we need a reliable way to read
temperature. Add back LPC temperature read command that actually trigger
a I2C read.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8452,chrome-os-partner:8495
TEST=none

Change-Id: Icddd1fe3c1f09889bca633af19041a8aca582de9
2012-03-14 20:53:42 +08:00
Gerrit
6f0512752f Merge "Debug command to simulate keystroke" 2012-03-14 01:41:56 -07:00