Commit Graph

815 Commits

Author SHA1 Message Date
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
Simon Glass
b4df203506 snow: Turn on CONFIG_ASSERT_HELP
We want our friendly ASSERT() messages.

BUG=chrome-os-partner:10149
TEST=manual
Enable the option for snow, add a failing ASSERT() to the rw command
and see the a nice message is printed now.

Change-Id: I84587b209dc4a9d72310456ed2aca178256c5811
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25412
2012-06-22 11:12:40 -07:00
Bill Richardson
84d89a5dc3 Reenable EC console 'fanduty' command, for testing.
BUG=chrome-os-partner:10747
TEST=manual

Boot the CPU (the fan is off otherwise). From the EC console run

  faninfo

It should show the fan duty cycle changing to maintain a specific RPM.

Run

  fanduty 50
  faninfo

Now the fan duty cycle should be fixed around 50%.

Change-Id: I13e4b0a7e5b2661769d64bf93342483d0419545d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25900
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-06-22 11:12:39 -07:00
Simon Glass
d47905ce27 Make ASSERT() report assertion failures
Rather than just reset the board, report assertion failures to aid
debugging. To enable this, use CONFIG_ASSERT_HELP.

BUG=chrome-os-partner:10149
TEST=manual
Enable the option for snow, add a failing ASSERT() to the rw command
and see the a nice message is printed now.

ASSERTION FAILURE 'address' in command_read_word() at common/memory_commands.c:00000037

Change-Id: Ice59434c5daf610832dd0e1fcfa5630dc847bb67
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25411
2012-06-22 10:13:36 -07:00
David Hendricks
bf376505e9 snow: change flash size to 128KB
This changes CONFIG_FLASH_SIZE so that a 128KB image is produced.

BUG=chrome-os-partner:10377
TEST=Tested on Snow with 128KB EC flash
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: Ib9dd65839304a55d586648046bdd7f96b02c2688
Reviewed-on: https://gerrit.chromium.org/gerrit/24130
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
2012-06-21 19:58:53 -07:00
Vic Yang
f1cf43fed3 Calibrate TMP006 temperature sensor
Update sensitivity factor of PCH sensor and charger sensor.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:9599
TEST=Check temperature readings are more reasonable.

Change-Id: Id975e977a7d5c9630ceeabf0174eeba7bd49e8a1
Reviewed-on: https://gerrit.chromium.org/gerrit/25821
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-06-21 09:38:40 -07:00
Simon Glass
d5cb026142 Enable checking for divide by 0 and alignment faults
These likely indicate errors, so we shold trap them. Possibly this
should be reconsidered for production.

BUG=chrome-os-partner:10148
TEST=manual:
build on all boards
build and boot on snow with a special rw command containing a division
by 0. See that it is trapped:
> rw 0

=== EXCEPTION: 03 ====== xPSR: 01000000 ===========
r0 :0000000b r1 :08005eba r2 :00000000 r3 :20001048
r4 :00000000 r5 :08004fd4 r6 :08004f8c r7 :200012a8
r8 :08004fd4 r9 :00000002 r10:00000000 r11:00000000
r12:00000000 sp :200009a0 lr :08002861 pc :0800368a
Divide by 0, Forced hard fault, Vector catch
mmfs = 02000000, shcsr = 00000000, hfsr = 40000000, dfsr = 00000008

Turn off the cpu_init() setup, and see that it is ignored.

> rw 0
read 0x0 = 0x00000000
>

Similarly, try an unaligned access with the rw command with this enabled:

> rw 1

=== EXCEPTION: 03 ====== xPSR: 01000000 ===========
r0 :0000000b r1 :00000041 r2 :00000001 r3 :200012ac
r4 :00000000 r5 :08004fd4 r6 :08004f8c r7 :200012a8
r8 :08004fd4 r9 :00000002 r10:00000000 r11:00000000
r12:00000000 sp :200009a0 lr :08002861 pc :08003686
Unaligned, Forced hard fault, Vector catch
mmfs = 01000000, shcsr = 00000000, hfsr = 40000000, dfsr = 00000008

but disabled it works:

> rw 1
read 0x1 = 0x5d200010
>

Change-Id: Id84f737301e467b3b56a7ac22790e55d672df7d8
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25410
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-06-21 06:01:22 -07:00
Randall Spangler
80fa2da908 Add reboot-at-shutdown flag
Also removes unused recovery request, since AP handles that internally now.

BUG=chrome-os-partner:10685
TEST=manual.  From root shell,

ectool reboot_ec RO                 -> EC reboots to RO, AP stays up
ectool reboot_ec A                  -> EC reboots to A, AP stays up
ectool reboot_ec cold               -> EC reboots, AP shuts down
ectool reboot_ec cold at-shutdown   -> (EC stores request, but doesn't reboot)
shutdown -P now                     -> EC reboots when AP shuts down
ectool reboot_ec cold at-shutdown   -> (EC stores request, but doesn't reboot)
ectool reboot_ec cancel             -> (EC stores cancel-request)
shutdown -P now                     -> AP shuts down, but EC doesn't reboot

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I51bbf997f6b7f94fe61f06a8a1804c3cc5c319b8
Reviewed-on: https://gerrit.chromium.org/gerrit/25791
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-20 23:30:02 -07:00
Simon Glass
50ea753bbb snow: Turn on CONFIG_PANIC_HELP
Add this option to make panics easier to decode.

Also put panics in a new stack for snow.

BUG=chrome-os-partner:10146
TEST=manual:
build for all boards
On snow, cause a panic and see that it is reported correctly.

Change-Id: If0b90ec0cec4ccb10041bd12bc21b342581e7f62
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24506
2012-06-20 14:08:23 -07:00
Rong Chang
024c44cd96 Enable snow I2C host auto detection
This change is picked from daisy change:
  I70f66581d0e921c83bc2051b2a521b332e18aa50

It should be reverted after rework all dev boards to new I2C config.
Issue filed against this hack: http://crosbug.com/p/10622

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:10622
TEST=manual
  Console commands:
    'i2c r 0x90 4' - single byte pmu read
    'battery' - double bytes battery read

Change-Id: I3185d872dc5ef6673fcd7efddf8394fe73f11813
Reviewed-on: https://gerrit.chromium.org/gerrit/25743
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-06-20 07:12:18 -07:00
Rong Chang
bffc0fd3a2 Enable snow battery charging
This change adds battery and PMU driver to snow board configuration.
Charging is enabled in init function. EC I2C host is set to I2C2.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:10608
TEST=manual
  Run uart console command 'i2c r 0x90 4'.

Change-Id: Ie09749c33c6093a46ba0ea44d42910417a67f37a
Reviewed-on: https://gerrit.chromium.org/gerrit/25501
Tested-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Rong Chang <rongchang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-06-20 07:12:17 -07:00
Vic Yang
d93672660a lm4: Stub chip-related functions in keyboard module
This is a prepare work for keyboard scan module unit test. All functions
that directly use LM4 registers are moved to stub or refactored.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:10285
TEST=Build success. Check keyboard still works.

Change-Id: Ic70a6e712c116c1e35f0407b79be2b6e6a31232a
Reviewed-on: https://gerrit.chromium.org/gerrit/25725
Commit-Ready: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-20 06:27:25 -07:00
Rong Chang
b2181b1238 Fix deep discharging poweroff function
Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:10614
TEST=manual
  Boot link with test image. Disconnect AC. Check EC console log.
  When battery charge drop from 3% to 2%. EC will soft reset and
  restart system in S5.

Change-Id: Iff2e67ad689bb2eecaf0f8efa46eb3a5f1f28911
Reviewed-on: https://gerrit.chromium.org/gerrit/25504
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2012-06-20 06:27:25 -07:00
Louis Yung-Chieh Lo
bdf3ea3b09 Support KBC I8042_TEST_KB_PORT (0xab) command.
Lack of this command could make u-boot pc_keyb.c failed to init (see
lines around line 143 of u-boot/files/drivers/input/pc_keyb.c).

  static char * kbd_initialize(void)
  {
        ...
        kbd_write_command_w(KBD_CCMD_KBD_TEST);
        if (kbd_wait_for_input() != 0x00)
                return "Kbd:   interface failed self test";

Change-Id: I0a906e0ee4419be74a79ce983c025ce42f02cb81
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
BUG=chrome-os-partner:10358
TEST=tested on link.
Reviewed-on: https://gerrit.chromium.org/gerrit/25619
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-06-19 21:38:52 -07:00
Simon Glass
004c607a96 Add an option to report panic fault information
The fault status registers sometimes have useful information, so provide
an option to display these.

This adds about 1KB to the code size.

BUG=chrome-os-partner:10146
TEST=manual:
build for all boards
On snow, cause a panic and see that it is reported correctly.

=== EXCEPTION: 03 ====== xPSR: 01000000 ===========
r0 :0000000b r1 :00000047 r2 :60000000 r3 :200013dd
r4 :00000000 r5 :080053f4 r6 :200013d0 r7 :00000002
r8 :00000000 r9 :200013de r10:00000000 r11:00000000
r12:00000000 sp :200009a0 lr :08002b85 pc :08003a8a
Precise data bus error, Forced hard fault, Vector catch, bfar = 60000000
mmfs = 00008200, shcsr = 00000000, hfsr = 40000000, dfsr = 00000008

Change-Id: I1a18c85ee63760502c92b300f5a87e57468469a5
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24505
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-06-19 18:45:27 -07:00
Randall Spangler
ebf79b00a9 Set GPIO_ENTERING_RW before jumping between images.
BUG=chrome-os-partner:10662
TEST=manual

1) Boot system with power+esc+refresh.  gpioget ENTERING_RW --> 0
2) reboot, then gpioget ENTERING_RW --> 1
3) Check EC_IN_RW signal on AP, if possible

Change-Id: I9de43eecf71654bf337d7a0e8b21f0cbcf386cc7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25624
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-06-19 10:48:21 -07:00
Vincent Palatin
661742dea9 stm32: configure OSC pins as GPIO
For Lucas DVT, we are re-using the external oscillator pins as GPIO.
Set the special purpose mux and add them to the GPIO list.

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

BUG=None
TEST=run software on Lucas EVT board

Change-Id: I969c97ba4b56d7cce570f3fe5f17d44687020fe5
Reviewed-on: https://gerrit.chromium.org/gerrit/25393
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-19 10:48:21 -07:00
Rong Chang
e14d961407 Implement x86 force shutdown
Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:8242
TEST=manual
  Switch to dev mode VT2 console. Increase CPU load:
    cat /dev/urandom > /dev/null &
    cat /dev/urandom > /dev/null &
  Check CPU PECI temperature and wait for auto shutdown:
    ectool temps 9

Change-Id: I62ad6efd6621bf5ddcde55424c39ac897271a94a
Reviewed-on: https://gerrit.chromium.org/gerrit/25503
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
2012-06-19 09:53:03 -07:00
Rong Chang
638274bd2c Enable daisy I2C host auto detection
This change is a temperary hack. And it should be reverted after
finalize daisy board design.

The host port on daisy can be configured as I2C1 or I2C2. PMU is
connected directly to the host port, hence the host port can be
detected. This change unifies ec firmware image for different I2C
configurations.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:10612
TEST=manual
  Build daisy ec firmware. Flash it to daisy boards with different
  I2C port config. Check uart console commands:
    'i2c r 0x90 4' - single byte pmu read
    'battery' - double bytes battery read

Change-Id: I70f66581d0e921c83bc2051b2a521b332e18aa50
Reviewed-on: https://gerrit.chromium.org/gerrit/25502
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Mark Hayter <mdhayter@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
2012-06-19 01:26:29 -07:00
Vincent Palatin
0aa39fc1e6 helper script to flash EC on boards
The script ensures that the servo parameters are correct,
and restores original servo parameters afterwards.

Daisy EC flashing works from the build tree :
 ./util/flash_ec --board=daisy --ro

The Link flashing is using the new openOCD 0.5.0 in the chroot.

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

BUG=None
TEST=./util/flash_ec --board=snow --ro
./util/flash_ec --board=link

Change-Id: Ifc87a8d21a5dac6ad8c4a0fb38694aa5f5bbf992
Reviewed-on: https://gerrit.chromium.org/gerrit/21664
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-06-18 18:37:30 -07:00