Commit Graph

834 Commits

Author SHA1 Message Date
Randall Spangler
7e50e844a3 Change ec_command() to return negative values for errors
This is more compatible with kernel and u-boot, and will make it
easier to share code between the ec project and those.

BUG=none
TEST=manual:

  ectool version -> should work normally

on ec, do 'hostevent set 0x40000'.  Then at root shell
  ectool queryec
EC returned error result code 19

  ectool flashread 0x100000 16 foo
Reading 16 bytes at offset 1048576...
EC returned error result code 2
Read error at offset 0

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

Change-Id: I5e2a85f96c874d0730c14e1438a533649cd594f8
Reviewed-on: https://gerrit.chromium.org/gerrit/26359
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2012-06-29 10:46:18 -07:00
Randall Spangler
70718f97e3 Add x86shutdown console command
Now that the EC powers on the AP unconditionally on startup, we need a
way to quickly shut the AP down if it's running without a heatsink.

(Also cleaned up comments and line spacing to kernel style)

BUG=none
TEST=boot system; when x86 is booting, type 'x86shutdown'.

Change-Id: I4dd5a2d5d27b624d0d0f9228baac257587b4808a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26274
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-29 10:22:50 -07:00
Randall Spangler
1448b7642e Include board and config headers in common.h
This ensures they get included everywhere, and fixes a common bug
where we forget one of them and then code which is supposed to be

BUG=none
TEST=build the code

Change-Id: Ic9208f946a3aea4b0b08f546f1919602befa76d4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26365
2012-06-29 10:22:49 -07:00
Simon Glass
3d632987cc dma: Deprecate dma_start_tx() in favor of dma_prepare_tx()
This allows us to prepare a dma transaction in advance, and quickly
start it when needed.

BUG=chrome-os-partner:10533
TEST=build and boot on snow

Change-Id: Ib7d843b2d3a5cd94b6025b9741db1794ebbcfda0
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26449
2012-06-29 09:57:08 -07:00
Vic Yang
67c9f4547e Fix a bug in battery temperature cut off
When battery temperature is too low, charging should be paused.

BUG=none
TEST=none

Change-Id: I0de87143f5da810cee70c14ee3c52614b5cf3d3b
Reviewed-on: https://gerrit.chromium.org/gerrit/26380
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-28 23:44:41 -07:00
davidjames
a1cde77c51 Revert "dma: Deprecate dma_start_tx() in favor of dma_prepare_tx()"
This reverts commit 7af4172be4afad9d576549721a82b3a47d701647 / Iac605b879b3556f33af5585b298ada6bc4f52c90.

This change bypassed the commit queue and broke daisy as a result.

BUG=chrome-os-partner:10533
TEST=build and boot on snow

Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I7a05ab42f71a901d167bde977f8a025c7ef62dfc
Reviewed-on: https://gerrit.chromium.org/gerrit/26379
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-06-28 19:57:34 -07:00
Simon Glass
9ae29ecd25 dma: Deprecate dma_start_tx() in favor of dma_prepare_tx()
This allows us to prepare a dma transaction in advance, and quickly
start it when needed.

BUG=chrome-os-partner:10533
TEST=build and boot on snow

Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: Iac605b879b3556f33af5585b298ada6bc4f52c90
Reviewed-on: https://gerrit.chromium.org/gerrit/26166
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Simon Glass <sjg@chromium.org>
2012-06-28 19:02:08 -07:00
Randall Spangler
2e0ae57990 Use __packed instead of __attribute__((packed))
The presubmit script for linux kernel style prefers the former.

BUG=none
TEST=none

Change-Id: I0a0a1eb039f45975ada075c1302d868071a7cfb1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26361
2012-06-28 17:40:39 -07:00
Simon Glass
3db49e8acf dma: Adjust prepare_channel() to use a channel pointer
Rather than a channel number, use a pointer. Also we don't need a
return value, since this function cannot fail.

BUG=chrome-os-partner:10533
TEST=build and boot on snow

Change-Id: I9d7e567a9f3d496184fd28f0820ad798b1c43a28
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26165
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-06-28 17:06:47 -07:00
Simon Glass
a366d64981 dma: Export dma_get_channel()
Access to dma is currently via a channel number. It is more efficient
to export a pointer to the dma channel since it avoids the conversion
on every API call. This helps, because dma is often on the critical
path.

Export the function to provide a pointer to a dma channel given its
number.

BUG=chrome-os-parter:10533
TEST=manual: build for all boards

Change-Id: I0318e59dbb1b9077f0445804692ca7ea99cf6581
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26164
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-06-28 17:06:47 -07:00
Simon Glass
6d04819930 Add time_since32() to return microseconds since a start time
It is useful to implement timeouts like this:

start = get_time();
while (time_since32(start) < 1000)
   ...

Add a function to make this easy. Note that for efficiency we only
support a 32-bit return value which limits the timeouts to about an
hour.

BUG=chrome-os-partner:10888
TEST=manual:
build for all boards
boot on snow

Change-Id: I200cb04f5a76b4c76a9bc314d927e4bab1f08a56
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26289
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-06-28 17:06:46 -07:00
Randall Spangler
7957516145 Add flash_link_ro command to openocd
This is ~4x as fast as flashing the entire EC image, and is similar to
the existing flash_link_a command.

BUG=none
TEST=from openocd prompt, flash_link_ro

Change-Id: I04160af3d7d70028f8d2789480094c283a1ce2ab
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26268
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-06-28 16:32:55 -07:00
Simon Glass
9905a80a4b i2c: Tidy up common code for i2c master
At present there is quite a bit of duplicated code. Create a new
i2c_transfer() function to take care of this.

BUG=chrome-os-partner:10888
TEST=manual:
build for all boards
boot on snow (cannot test i2c as it is broken)

Change-Id: I3672cc4ff9de4e2e0deaec2997590ee892ef09aa
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26140
2012-06-28 11:56:39 -07:00
Simon Glass
7d465e6d55 stm32: Use SPI ports for i2c arbitration
We plan to use two of the SPI ports (NSS and MISO) for arbitration
on the i2c host interface. In preparation for this, add the extra
GPIO to the table, and change NSS to a pull-up.

BUG=chrome-os-partner:10888
TEST=manual:
build for all boards
boot on snow

Change-Id: I70962b25f371a4ca54f0ce67dcf0bc33b1cc8c47
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26139
2012-06-28 11:56:30 -07:00
Vic Yang
b38e3405ea Do not trickle charge when battery ask for no current
When battery ask for no current, we should go back to init state to
determine what to do next.

BUG=chrome-os-partner:10946
TEST=none

Change-Id: Idf3ac7554a0774655138c5efe9c5e6de7f6cb7a0
Reviewed-on: https://gerrit.chromium.org/gerrit/26310
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-28 06:39:46 -07:00
Vic Yang
21aaa0b406 Fix a bug of temperature unit mismatch
We set battery temperature limit in deci-Kelvin but use them as Celsius.
Let's fix this so that battery is cut off correctly.

BUG=chrome-os-partner:10942
TEST=none

Change-Id: I2320b5e9f19ccc17f0cec7664133544c25a745f8
Reviewed-on: https://gerrit.chromium.org/gerrit/26302
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-27 23:59:39 -07:00
Vic Yang
a6e24f1672 Add an option flag to intentionally shift binary code
We need a simple way to build an EC image that is binary-wise much
different from the original one, so that we can test EC update as much
thoroughly as possible. By padding useless space, we can have an image
with exactly same functionality but binary-wise different.

BUG=chrome-os-partner:10264
TEST=Build and run without error.

Change-Id: I070bec7cec71db1662238ca6af10e864c82ba428
Reviewed-on: https://gerrit.chromium.org/gerrit/26083
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-27 21:22:17 -07:00
Vic Yang
0e261504aa Stub smart battery read/write functions
For better testability, let's move smart battery read/write functions to
a stub so that we can easily mock them.

BUG=chrome-os-partner:10270
TEST=build success

Change-Id: I416580c6dc7911e376bc232e5f0560117d9353c2
Reviewed-on: https://gerrit.chromium.org/gerrit/26227
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-27 03:22:17 -07:00
Vic Yang
0909a66d90 Add a test of keyboard debouncing
This test checks keyboard debouncing works correctly.

BUG=chrome-os-partner:10284
TEST=Test passed

Change-Id: I0c984ecc9444b149da580ff0775cc81245b21a1e
Reviewed-on: https://gerrit.chromium.org/gerrit/26021
Commit-Ready: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-27 02:51:42 -07:00
Vic Yang
b96e04d2eb Add a test of keyboard typematic
This test checks when holding down a key for different length, typematic
works correctly.

BUG=chrome-os-partner:10287
TEST=Test passed.

Change-Id: I401db73098a98dc3367cedde31f8ec1c5d5f047b
Reviewed-on: https://gerrit.chromium.org/gerrit/26086
Commit-Ready: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-27 01:43:54 -07:00
Vic Yang
8b3634ee1f Add a test of i8042 scancode set
This test check correct scan code is sent when I8042_XLATE is enabled or
disabled.

BUG=chrome-os-partner:10286
TEST=Test passed

Change-Id: I939963cbecddb22506e64cb374667c7c2e5b4f8b
Reviewed-on: https://gerrit.chromium.org/gerrit/26096
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-27 00:55:04 -07:00
Vincent Palatin
240470a54b stm32: fix race condition in I2C response
When we are transmitting a response to the EC, we don't want to race
with the TX empty interrupt handler. So just disable I2C interrupt
during the transmission.

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

BUG=None
TEST=on Lucas DVT, use the keyboard and see we are no longer getting
"bad checksum" in the kernel log.

Change-Id: Ic59532d1ac0a3eabb67ba0d498940986282bd87f
Reviewed-on: https://gerrit.chromium.org/gerrit/26162
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-26 20:52:35 -07:00
Vincent Palatin
cbbaf428a9 stm32: fix I2C waveforms and states
- most events happen in the first 100us, we don't want to sleep to 2ms.
  This introduces big delays. Just poll the 150us, then fall back to
  sleep.
- restore properly the port state after master transfers.

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

BUG=None
TEST=On Lucas DVT, probe I2C signals with logic analyzer and manually
check them. Verify that the keyboard is still working with the charging
code enabled.

Change-Id: Ic0afde081d070ff6720d924469ecc7166bbc9e4c
Reviewed-on: https://gerrit.chromium.org/gerrit/26161
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-26 20:52:33 -07:00
David Hendricks
3a841ae872 stm32mon: set flash_size to 128KB for chip ID 0x420
This updates the flash_size to match 128KB parts. Unfortunately
there does not seem to be an easy way to differentiate between the
64KB and 128KB parts at runtime.

BUG=none
TEST=tested on Snow

Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: Ie1ca6f6d04753e91d937f67dec193fcf5566251e
Reviewed-on: https://gerrit.chromium.org/gerrit/26188
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2012-06-26 19:02:00 -07:00
Vincent Palatin
108aab99d4 tpschrome: skip bad I2C read
When an I2C read fails, we don't want to switch off the system or even
print verbose warnings.
Indeed, we are failing all I2C reads and writes to the charger and
battery when they are on the same bus as the AP and the AP is ON.

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

BUG=chrome-os-partner:9724
TEST=on Lucas DVT, run the system and see we have no spurious switch off
or verbose EC traces.

Change-Id: Ieb2f7836c70a0d2ad2c4a0f775aa190ce81a6932
Reviewed-on: https://gerrit.chromium.org/gerrit/26064
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-26 18:15:37 -07:00
Rong Chang
c56b1a7bdb TPSChrome charging loop
This change contains a basic charging loop that follows Chromium
battery charging flow. The temperature range constants, loop delay
time will be move to battery pack later.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:9724,9757,9759
TEST=manual, uart console
  Plug AC adapter:
    > pmu event: 0000000000001110
    [batt] state discharging -> idle
    [batt] state idle -> charging
    > battery
      I:         0x04fd = 1277 mA(CHG)a

  Unplug AC adapter:
    > pmu event: 0000000000000110
    [batt] state charging -> idle
    [batt] state idle -> discharging
    > battery
      I:         0xffcb = -53 mA(DISCHG)

Change-Id: Ifed594d78c0ed08c5e4821a9c8581c1a87526729
Reviewed-on: https://gerrit.chromium.org/gerrit/25618
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-26 18:15:35 -07:00
Simon Glass
9bee82222e flash-stm32f100: Fix unaligned cast
There isn't a good reason for doing things this way, so tidy up the
code and remove the TODO.

BUG=chrome-os-partner:10533
TEST=manual:
build and boot on snow
Test writing of flash still works using U-Boot command

Change-Id: I66a8f16072dc28f24c493af7674f7be5d838529c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26163
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-26 17:54:56 -07:00
Randall Spangler
55073a0a84 Power on AP every EC reboot.
Needed for EC software sync so the AP can verify the EC's RW code and
tell the EC to jump to RW when necessary.  If the AP then decides it
doesn't need to stay booted, the AP can shut back down.  (The AP
verifying the EC's code and/or shutting back down are NOT part of this
CL...)

Also add a Power+Refresh+DownArrow key combination which causes the EC
to reset WITHOUT powering on the AP; this will be needed for debugging
the AP power-on sequence.

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

1) power+refresh+down -> ec reboots, system stays down
2) power+refresh+esc -> ec reboots, system to recovery
3) power+refresh -> ec reboots, system boots
4) hibernate, then open lid -> ec reboots, system boots
5) hibernate, then power button -> ec reboots, system boots
6) yank battery, then reconnect -> ec reboots, system boots
7) reboot ec -> system boots
8) 'sysjump A' when AP already booted -> system stays on
9) 'sysjump A' when AP shut down -> system boots

Change-Id: I65d2f7d9cca3acb84b76302cdcd8c8a800f03253
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26158
2012-06-26 17:33:53 -07:00
Randall Spangler
b73bfcaa92 Only check for boot key on the first boot after keyboard reset
Don't check if we've jumped to this image (which preserves the reboot reason,
so was causing us to re-check).

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

1) power+refresh; should see EC print [KB boot key 0]
2) sysjump A; should NOT see [KB boot key 0]

Change-Id: I46cc60358e1d1952484f52147787fee06e4ff69f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26155
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-26 17:01:53 -07:00
Randall Spangler
7b155fb8ac Refactor boot key detection
Keyboard scan module now owns the recovery key state on all platforms.

And clean up a few comments to linux kernel style

BUG=chrome-os-partner:10890
TEST=manual
- Power on system.  Should boot normally.
- Power+Refresh+D.  Should turn dev switch on.
- Power+Refresh+F.  Should turn dev switch off.
- Power+Esc.  Should reboot system.  Power button should power on normally.
- Power+Refresh+Esc.  Should power on into recovery mode.
- Then press power to shut system down.
- Power button should power on normally (not back into recovery mode).

Change-Id: I4d16e1e8b039efeacbd41e8acec115844bc8457d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26147
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-26 17:01:52 -07:00
Randall Spangler
fb123b4838 Only one RW image is now the default
And if RW B isn't enabled, it's not even linked.

BUG=chrome-os-partner:10881
TEST=on link, should be no B image, and 'sysjump B' should fail
On BDS, still should be A and B images

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Icb2af07881cc7e28b9b877f45824486a22fde8d7
Reviewed-on: https://gerrit.chromium.org/gerrit/26116
2012-06-26 13:58:54 -07:00
Randall Spangler
90afebac64 Strip out vboot signature code and stay in RO for link
BUG=chrome-os-partner:10880
TEST=boot EC; should stay in RO and not do signature check
(verify via debug console output)

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

Change-Id: I831aa91f8273bc7fb1a624cf36d9f21d52d8f3d8
Reviewed-on: https://gerrit.chromium.org/gerrit/26115
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Randall Spangler <rspangler@chromium.org>
2012-06-26 13:58:53 -07:00
Vincent Palatin
b8d7d8fc44 fix panic serial code
panic_putc was doing an infinite loop on platforms with a UART FIFO.
(e.g. LM4F)

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

BUG=chrome-os-partner:10825
TEST=on Link EVT and Lucas DVT, type "rw 1" in the EC serial console and
see the panic trace.

Change-Id: I47f43183e6e938b88874c80244430ddf88c5a567
Reviewed-on: https://gerrit.chromium.org/gerrit/26052
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-25 17:52:47 -07:00
Randall Spangler
900c0215b4 Add hash support
EC computes a SHA-256 hash of its RW code on boot.  Also adds host and
console commands to tell the EC to recompute the hash, or hash a
different section of flash memory.

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

1) ectool echash -> should match what the EC precomputed
2a) ectool echash recalc 0 0x10000 5
2b) on EC console, 'hash 0 0x10000 5'
2c) results should agree
3a) on ec console, 'hash 0 0x3e000' then quickly 'hash abort'
3b) ectool echash -> status should be unavailable
4) ectool echash start 0 0x3e000 6 && ectool echash && ectool echash abort && sleep 2 && ectool echash
status should be busy, then unavailable

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I6806d7b4d4dca3a74f476092551b4dba875d558e
Reviewed-on: https://gerrit.chromium.org/gerrit/26023
2012-06-25 15:37:42 -07:00
Randall Spangler
aab92d552d Shut off keyboard backlight at chipset shutdown
This ensures the keyboard backlight will go off even if the chipset
shuts down due to overheating (or some other unclean shutdown).

(Also fixes inter-function line spacing to linux kernel coding style
and reformats a few comments.)

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

1. power on system
2. turn on keyboard backlight (kblight 100 at EC console)
3. power off system (for example, via power button)
4. keyboard backlight should turn off

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I5bbcd1681ae9c972c9875e9c720617bdf51e3d64
Reviewed-on: https://gerrit.chromium.org/gerrit/26039
2012-06-25 15:37:42 -07:00
Randall Spangler
24395bcc87 Remove proto1 workarounds
At this point, EC code requires EVT.  If you still have a proto1,
here's what'll break:
  1) Keyboard recovery mode checks refresh key, and may read unreliably due
     to proto1 silego reset circuit.
  2) Lightbar may not start in the correct state.
  3) EC 'hibernate' command will not work.
  4) Board version may read incorrectly.

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

1) powerbtn -> system powers on, lightbar displays proper sequence
2) version -> board version 1 (EVT)
3) power+refresh+esc -> system boots into recovery mode
4) power+refresh, then power button -> system reboots, then boots normally

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I699946e365d15ae38622b69da1a0241e72d05f61
Reviewed-on: https://gerrit.chromium.org/gerrit/26053
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-06-25 15:37:41 -07:00
Vincent Palatin
faff1c6da6 Align .data section in flash
When copying .data section from flash to internal RAM at startup, we
assume the content of the section is aligned on a word size in flash.
Force the alignment in the linker file.

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

BUG=chrome-os-partner:10823
TEST=on Link EVT, type "sysjump RO" in EC console and see you are
jumping to RO partition and not getting a watchdog reset.

Change-Id: I1a1387ef8bff01d287d85ee2a660811c9e4620c6
Reviewed-on: https://gerrit.chromium.org/gerrit/26032
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-25 14:15:49 -07:00
Vic Yang
1105a28a8c Add a test of checking keyboard de-ghosting
This test check when a ghost key appears, it is correctly ignored.

BUG=chrome-os-partner:10285
TEST=Test passed.

Change-Id: Ic5a6a9b5c78a969899df7c7a82f1c9d0c01b1325
Reviewed-on: https://gerrit.chromium.org/gerrit/25831
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-25 08:39:13 -07:00
Vic Yang
fb3e3283c4 Fix unit test compilation error
A host command to set fan duty cycle is recently added and mock PWM
module doesn't provide the implementation. This breaks our unit test.
Let's fix this.

BUG=chrome-os-partner:10820
TEST='thermal' unit test passed.

Change-Id: I8644742cfec7d2112d7ff1e266b5ac3429c46945
Reviewed-on: https://gerrit.chromium.org/gerrit/26019
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-25 08:18:36 -07:00
Vic Yang
7eabcb4e69 Add a test of checking power button handling
This test checks power button is correctly debounced, and also check
power button press of different length are handled correctly.

BUG=chrome-os-partner:10273
TEST=Test passed

Change-Id: I18595c60896255d36326731d28bab55e64c6bca2
Reviewed-on: https://gerrit.chromium.org/gerrit/25505
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-25 07:15:52 -07:00
Vic Yang
7ae80c0552 Thermal engine unit test
This test checks for the functionality of thermal engine.

BUG=chrome-os-partner:10241
TEST=Test passed
     Disable thermal engine overheating warning and test failed

Change-Id: Ideb0ff9ee4bd1617b11c56dfa2578a3f406381ff
Reviewed-on: https://gerrit.chromium.org/gerrit/25370
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-25 07:15:50 -07:00
Bill Richardson
80c635ecab Add 'fanduty' command both EC console and ectool.
This forces the fan PWM duty cycle to a fixed percentage (0-100). It's only
used for airflow testing.

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

Using this ectool, try

  ectool fanduty 0
  ectool pwmgetfanrpm
  ectool fanduty 50
  ectool pwmgetfanrpm
  ectool fanduty 100
  ectool pwmgetfanrpm

You should see (and hear) the fan speed up.  If you have an EC console, you
can run

  faninfo

and it should show that the 'Target:' is unrelated to the 'Actual:' value.

Change-Id: Iac332fb3ba63f96726cf7f64061b3ce22d2e76fd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25965
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-06-22 15:56:57 -07:00
Vincent Palatin
e61af38f55 link: update VR settings
Update a couple of IR3571 settings :
- remove the PS override bit which is a leftover from the debug session.
- modify VR_READY and CODE REV

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

BUG=chrome-os-partner:10171
TEST=run several Link EVT with this EC and check we have no kernel
warnings.

Change-Id: I873dc23ddb3ff8ac9fcdf24cd769414cb12689e5
Reviewed-on: https://gerrit.chromium.org/gerrit/25967
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-22 15:35:41 -07:00
Vincent Palatin
ee4ec72613 stm32: don't try to use the AP I2C connection when the CPU is running
If the EC shares the I2C-2 bus with the battery and the charger, we
don't want to be a master on that bus when the AP is ON and can send us
I2C messages.

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

BUG=none
TEST=on Lucas DVT, check we can read battery info when AP is OFF and we
cannot when AP is ON.

Change-Id: I920a10ae9eff31bd00e4d3a5aec19d6f03b65a33
Reviewed-on: https://gerrit.chromium.org/gerrit/25959
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-22 15:14:07 -07:00
Vincent Palatin
bc672dd30c IR357x core/gfx regulator support
add function read/write the IR3570/71 voltage regulator settings.

This includes new settings for the IR3571 to avoid the freeze observed
on new Link boards.
Currently, these settings are not flashed permanently inside the IR3571,
they are just applied at CPU startup (when the VR powered).

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

BUG=chrome-os-partner:10171
TEST=on Link EVT, check in the kernel log that we are longer seeing the
warnings from the GPU driver and the jankyness.
on Link proto-1, check the IR chip version detection.

Change-Id: I0781f5285aac7a9f03c7c4eb953bf97273c6d404
Reviewed-on: https://gerrit.chromium.org/gerrit/24674
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-22 11:34:19 -07:00
Vincent Palatin
b84ef3b1f2 stm32: drive the keyboard power LED
Put the power LED in the right state (off, on, breathing) depending on
the AP state (off, running, suspending).

The power LED is connected to GPIO B3.
The AP suspend detection is done through GPIO A7.
(so we no longer configure it as SPI alternate function)

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

BUG=chrome-os-partner:10647
TEST=on Lucas DVT, boot/stop the board and see the LED on and off.

Change-Id: I42121aacab35e9da7a751dc9f56bcc5af7850783
Reviewed-on: https://gerrit.chromium.org/gerrit/25880
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-06-22 11:34:17 -07:00
Randall Spangler
232363bac2 Revise EEPROM init and write routines
They now more closely resemble TI's recommended flow.

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

eewrite 1 12 0x1000
eeread 1 12  --> should be 0x1000
eewrite 1 12 0
eewrite 1 12 1
...
eewrite 1 12 100
eewrite 1 12 0xabcd
eeread 1 12 --> should be 0xabcd

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I309caea2774615518e68a0d01d33b052d6945c0f
Reviewed-on: https://gerrit.chromium.org/gerrit/25941
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-06-22 11:34:16 -07:00
Vic Yang
23d9defb2b Disable thermal thresholds for TMP006 sensor near CPU
This sensor doesn't provide accurate case temperature. Let's
disable thermal thresholds for the object tempearture reading from this
sensor.

BUG=chrome-os-partner:9599
TEST=Build success. System works fine.

Change-Id: I9408de59a3349f944c5e215085da93f23965ebc9
Reviewed-on: https://gerrit.chromium.org/gerrit/25824
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-22 11:12:43 -07:00
Simon Glass
475808f5c2 snow: Enable command help and task profiling
These options are useful for devs, so enable them.

BUG=none
TEST=manual:
build and boot on snow; See that the taskinfo command now shows non-zero
data. Type help and see command help.

Change-Id: I6bba1cc22498924ea6f151f2fe7e819ae7560e3c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25414
2012-06-22 11:12:40 -07:00
Simon Glass
3977403642 Add a dedicated panic() function
In addition to ASSERT(), it might be useful to panic() sometimes, so add
a tidy way of doing it which will print a message and reset.

BUG=chrome-os-partner:10149
TEST=manual
Build a special version for snow where the 'rw' command calls panic()
See that a message is produced:
> rw 0
read 0x0 = 0x20001048

** PANIC: Address is 0

Change-Id: I4512c0193f4c1d52d0c256b2deefacf551056fd9
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25413
2012-06-22 11:12:40 -07:00