Commit Graph

321 Commits

Author SHA1 Message Date
Vincent Palatin
15854fa680 Add FMAP even if VBOOT is not activated
This simplifies the re-flashing for stm32 based platforms.

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

BUG=chrome-os-partner:8865
TEST=On Daisy, flashrom -p internal:bus=lpc -w ec.bin

Change-Id: I66860383c34110b1edf852929c244a2b682bc105
2012-05-22 15:04:13 +00:00
Vincent Palatin
16d8f6c8bc Fix regression on linking address
On platform where the flash base address is non null (e.g. stm32), we need to
take it into account.

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

BUG=None
TEST=On Daisy, type "sysjump A" and "version" into the EC console
and observe that the commands succeed.

Change-Id: I95596d45f6970259d19d7063f6794fae0c400ab7
2012-05-22 15:04:13 +00:00
Gerrit
33b7a5c512 Merge "Disable touchscreen when lid is closed and in S3" 2012-05-22 07:41:46 -07:00
Randall Spangler
990c8b39e1 Disable touchscreen when lid is closed and in S3
(Touchscreen was already disabled in S5)

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

BUG=chrome-os-partner:9736
TEST=from console, 'gpioget touchscreen_resetn' in these cases:

1) system is off -> 0
2) system is on with lid open -> 1
3) system is on with lid closed -> 1
4) system is suspended with lid open -> 1
5) system is suspended with lid closed -> 1
6) system is shut back down -> 0
7) suspend system with lid open, THEN close lid -> 0

Change-Id: I5fc80b72ea9dcfbf11f5280d79ae805c2ef1b6df
2012-05-21 16:30:12 -07:00
Bill Richardson
40bb0ad88c Turn on light bar subtly for factory
BUG=chrome-os-partner:9850
TEST=manual

Open the lid. The lightbar should turn on.

Change-Id: I14d1316e6b0cac7a7e2f5b08b7d14b6bbdfa5830
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-21 16:28:55 -07:00
Gerrit
790d3d8721 Merge "Even more debug command cleanup to save space" 2012-05-21 15:24:32 -07:00
Randall Spangler
b2c4ee6cf8 Even more debug command cleanup to save space
BUG=none
TEST=(run the commands)

Change-Id: Ibc414ffd594e06dbdce64c51859b6f247bb10d36
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-05-21 14:57:08 -07:00
Bill Richardson
add419009f Clean up linker scripts; detect out-of-flash problem.
The VMA of the .data segment is in RAM, but we actually put it into FLASH.
The linker doesn't notice if it runs out of flash, so it creates an invalid
image.

This adds an explicit check to be sure it all fits. It also refactors the
region declarations to be more explicit. For vboot-enabled configurations,

  CONFIG_SECTION_*      - describes the extent of flash for one entire image
  CONFIG_FW_*           - the region within the SECTION for the firmware only
  CONFIG_VBLOCK_*       - the region within the RW SECTIONs for the vblocks
  CONFIG_VBOOT_ROOTKEY  - the region within the RO SECTION for the root key

Look at chip/lm4/config.h for the best example.

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

Build it, run it.

Change-Id: I3c652e82d58a5328115cc750c80ecba6a3fd99a3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-21 14:20:02 -07:00
Gerrit
b5ce7f5a20 Merge "More debug command cleanup to save space" 2012-05-21 11:16:06 -07:00
Randall Spangler
eac46a9194 More debug command cleanup to save space
(saves another 1.5KB)

BUG=none
TEST=(run the commands)

Change-Id: Id3ca58528fa68a4cec606edf2b98b9af38ac228f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-05-21 10:21:10 -07:00
Vic Yang
f618a74f7f Add host command to read temperature sensor info
In order to perform testing across all future boards and enable easier
debugging, we need a host command to read temperature sensor name and
sensor type.

BUG=chrome-os-patner:9836
TEST='ectool tempsinfo 0' shows sensor name and its type.

Change-Id: I06d9c6b045902394179c35e2ee8bc8dc551e8e98
2012-05-22 01:00:41 +08:00
Randall Spangler
01e94792e7 Clean up debug commands to use less space
BUG=none
TEST=(run the commands)

Change-Id: I6ed4aee169311825190bcc386b86cdc32ba0866a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-05-21 09:17:51 -07:00
Randall Spangler
b1bb8314bd Add LM4 support for hard reset
(And add STM32 support for disabling interrupts before reset, which
got missed before.)

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

BUG=chrome-os-partner:7470
TEST=from console, "reboot", then "reboot hard"

Change-Id: Ib98792abc0c91a01e2230b419fc876052380655a
2012-05-21 09:17:43 -07:00
Gerrit
8407b93f6d Merge "Fix a bug that 'ectool thermalget' silently fails" 2012-05-21 09:11:01 -07:00
Gerrit
9e2c9b332d Merge "Use common host command processing for Daisy I2C" 2012-05-21 09:10:59 -07:00
Vic Yang
bc021ce9c7 Fix a bug that 'ectool thermalget' silently fails
'ectool thermalget' should return error if sensor ID or threshold ID is
out of range. This CL fixes a bug that error codes mismatch.

BUG=chrome-os-partner:9840
TEST='ectool thermalget 0 10' gives error.

Change-Id: I74d0c66044cd31743c4fac0a8dc0431db6259e71
2012-05-21 16:46:59 +08:00
Vincent Palatin
36107b54d4 Fix flash base in full image ELF
When the flash base address is non null (e.g. stm32), it's nice to have
the full ELF image (including the 3 copies) at the right address.

This doesn't change anything to the final .bin image but allow to load
directly the .obj with tools which handle ELF format.

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

BUG=None
TEST=Flash ec.obj on a Snow board using the ST-Link JTAG over GDB.

Change-Id: I51a6d9c00b359c6204bd51b30ee7a4fec362d88e
2012-05-19 00:19:51 +00:00
Vincent Palatin
a043accacd stm32: keep power across sysjump
Ensure we can jump between EC images without powering down the GAIA AP :
- preserve GPIO state
- go back to "power-on" state if needed in GAIA state machine.

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

BUG=chrome-os-partner:8865
TEST=On Daisy, boot Linux, then type "sysjump B" and observed we can
still interact with Linux without any AP reboot.

Change-Id: Ia2bd0f65ea348813b120bcc3a3f3bdfa96a9877a
2012-05-18 20:02:19 +00:00
Vincent Palatin
1b104fb7d9 Fix partition address when flash base is not zero
On chips where CONFIG_FLASH_BASE is not 0 (e.g. stm32), the reset vector
address check in system_run_image_copy would fail because we are
comparing an absolute address against a flash offset.

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

BUG=chrome-os-partner:8865
TEST=on Daisy, type "sysjump B" in EC console.

Change-Id: Ib79677fb926a37fcf32f4aac013dc36b086f4464
2012-05-18 18:56:52 +00:00
Vincent Palatin
4c5f1365b5 Use common host command processing for Daisy I2C
This also updates the communication protocol between the EC and the AP in a
non backward compatible way.

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

BUG=chrome-os-partner:9614
TEST=on Daisy with updated kernel driver, use the keyboard in ChromeOS

Change-Id: I5a50e9a74b9891153a37ea79318c8a66a1b0c5ca
2012-05-18 17:57:51 +00:00
Gerrit
86a36e5bcc Merge "Preserve USB port state when jumping" 2012-05-17 21:43:56 -07:00
Randall Spangler
103e055dda Disable unused BDS functionality
This was used on the hybrid Badger-Lumpy systems for one-off testing.
It wouldn't necessarily work on a bare Badger board, and maintaining
it resulted in frequent build breaks.

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

BUG=none
TEST=build link, bds, daisy; boot link and bds

Change-Id: Ib64ccad9f38d76832ab57f7254dbf32f3d5e4a5e
2012-05-17 10:50:54 -07:00
Randall Spangler
5907675a47 Add AC state change hook
And start wiring to x86_power so it can detect AC state changes
(needed to enable/disable turbo).

*YES*, this compiles for BDS/Daisy now...

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

BUG=chrome-os-partner:9069
TEST=plug/unplug AC power and look for "x86 AC on" / "x86 AC off" in debug log

Change-Id: I8399fab9637d6635a1c615f07448fd45b86bc25f
2012-05-17 09:30:38 -07:00
Louis Yung-Chieh Lo
1cb328dc0c Fix some behaviors of keyboard command handlers.
The phenomenon is that there is a char on-hold in port 0x60 and the kernel
never picks it up. Hence the keyboard cannnot be recognized after resume.
It comes from multiple reasons:

1. The command I8042_CMD_RESET_BAT(0xff) and I8042_CMD_ENABLE(0xf4) didn't
   clean the buffer.

2. clean_underlying_buffer() has clean the queue, but forgot to clean the
   TOH (TO Host). Add keyboard_clean_buffer() to clean the TOH (To Host).

3. When KB interrupt is just enabled, the IRQ didn't sent if there is
   a char queued in buffer already. keyboard_resume_interrupt() solves
   this.

4. Not all keyboard reset should reset the buffer. Only the enable/disble
   of controller RAM  should NOT reset buffer. Other enable/disable
   should clean the buffer.

5. i8042 commands (those commands to port 0x64) should NOT return ACK
   even the parameter byte(s) goes to port 0x60.

6. Keyboard was disabled by kernel, but key stroke still sent to host
   (this needs the BIOS to fix).

Also fix the minor issues:

1. I8042_CMD_RESEND should not return I8042_RET_ACK.

2. I8042_DIS_KB/I8042_ENA_KB should effect the controller RAM content.

3. only send out the scan code when keyboard is enabled.

4. add kblog command for future debug (disabled by default because it
neeeds 1KB of memory).

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

BUG=chrome-os-partner:9525
TEST=tested on link. Start from S0.
1. Run powerd_suspend.
2. Expect system is in S3.
3. Press any key to wake up system.
4. Expect system is up and keyboard is working.
5. repeat for 20+ times.

Change-Id: I1c48822687d7c1f7ef0e8d8bca54bf9b05fd785f
2012-05-17 10:26:16 +08:00
Vic Yang
b49353d4de Preserve USB port state when jumping
USB ports are disabled after jumping between firmware copies.
We need to record USB port state and restore them after jumping.

BUG=chrome-os-partner:9692
TEST=Manual

Change-Id: Ic5cb83bdd8e49017457f732d317a1b59ced59ead
2012-05-17 10:12:22 +08:00
Vincent Palatin
b74cbd8a74 de-LPCify the EC host interface
Preparatory work to use common host command code between ARM and x86.

Just rename constants, do not change the binary API.

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

BUG=chrome-os-partner:9614
TEST=make BOARD=link

Change-Id: I534d427c9b50103273835a6f32a0ddb622c762b3
2012-05-15 18:34:50 -07:00
Bill Richardson
c0539d443c Enable vboot for BDS too.
The recovery switch is the DOWN button.

BUG=none
TEST=manual

Install on BDS, open console.
Press the reset button, it should boot to firmware A.
Hold the DOWN button, press the reset button. It should stay in RO.

Change-Id: I82f72a56df463c7cc67bde7e09f3be1545c76129
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-15 15:18:49 -07:00
Vincent Palatin
33b03d5a39 Sort console commands at build time
Use the linker to sort console commands by name,
this saves execution time and memory.

BUG=none
TEST=generate several images with 5N, 5N+1, 5N-1 commands and check the
output of the "help" command.

Change-Id: Ib5d8f3bca726621c68ab152f4fa662cee355abb1
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
2012-05-15 01:32:44 +00:00
Gerrit
35b1b7bf90 Merge "Arrange help output to sort 'column first'" 2012-05-14 18:23:22 -07:00
Vadim Bendebury
336944e951 Arrange help output to sort 'column first'
Sort the command name index, and then print them in file columns (as
before), but ordering columns first. This makes it much easier to
examine the 'help' command output.

BUG=none
TEST=manual
  . program the new image
  . execute the 'help' command
  . observe output printed sorted 'columns first'

Change-Id: I7b15cef09a61fe20eb4ba5ee274ba1d72063f1c0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
2012-05-14 17:44:45 -07:00
Gerrit
dc703b5ae4 Merge "Slightly update the host commands API" 2012-05-14 17:27:49 -07:00
Gerrit
e00c460c93 Merge "Change polarity of PROCHOT signal to match EVT" 2012-05-14 16:39:20 -07:00
Vincent Palatin
87d3707f62 Slightly update the host commands API
Preparatory work to use common host command code between ARM and x86.

Every command sends back explicitly the size of the response payload.
The size of the response defaults to 0 ond can be updated.

Add a protocol version number returned as command 0x00 to help with
backward compatibility.

move a couple of function from lpc specific header to host commands to
be able to implement them for the I2C link.

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

BUG=chrome-os-partner:9614
TEST=make BOARD=link

Change-Id: I6a28edf02996ddf6b7f32a3831d07d5f0271848f
2012-05-14 23:33:21 +00:00
Randall Spangler
a59178373a Change polarity of PROCHOT signal to match EVT
This would throttle proto1 systems, if it weren't for a HW bug which
means we don't have prochot control over proto1 systems at all.

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

BUG=chrome-os-partner:8982
TEST=system still boots

Change-Id: Ie42c034141f24795ec2bfee592e194001d3cd174
2012-05-14 16:07:17 -07:00
Randall Spangler
08e7b3a516 Fix charging task running too frequently
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=taskinfo; note that number of IRQ8 (I2C0) exceptions goes up more slowly

Change-Id: Ib93aaab80fdd19b7a35aec43903393baf506f2e8
2012-05-14 15:32:13 -07:00
Gerrit
d296c0d246 Merge "Allow console commands abbreviation" 2012-05-14 14:40:44 -07:00
Vadim Bendebury
6a324c1de5 Allow console commands abbreviation
The EC console input handling code is being enhanced to accept
abbreviated command names.

If the abbreviation is unique, the appropriate command is used, if the
abbreviation is ambiguous, the command is handled as nonexistent. The
error message is being modified to mention that the command either
does not exist or is ambiguous.

This change also makes it impossible to have command names matching
the beginning of other command names. Two such cases are being fixed
(`ch' renamed to `chan' and `thermal' renamed to 'thermalconf').

BUG=none
TEST=manual
 . program the new EC image. Try entering at the console:
  > h
  Command 'h' either not found or ambiguous.
  Command returned error 1
  > he
  Known commands:
    adc            autofan        battery        ch             charger
  ...
  > help
  Known commands:
    adc            autofan        battery        ch             charger
  ...

Change-Id: Iaa3e91e1504e42daefb02d561e00c39003548197
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
2012-05-14 13:35:03 -07:00
Simon Glass
f783aee46f daisy: Refactor the power task
Add a set of functions to deal with power on/power off, and checking
the power button. Then use these functions in a new top-level power
control loop.

This implements the following features:

- Cold reset powers off the AP

When powered off:
- Press pwron turns on the AP
- Hold pwron turns on the AP, and then 16s later turns it off and leaves
it off until pwron is released and pressed again

When powered on:
- The PMIC PWRON signal is released one second after the power button is
released (we expect that U-Boot as asserted XPSHOLD by then)
- Holding pwron for 8s powers off the AP
- Pressing and releasing pwron within that 8s is ignored
- If XPSHOLD is dropped by the AP, then we power the AP off

BUG=chrome-os-partner:9424
TEST=very ad-hoc:
1. build and boot on daisy, flash U-Boot with USB using
'cros_bundle_firmware -w usb', inserting daisy
USB cable when it says 'Reseting board via servo...'
2. Press cold reset, then power on, see that it powers on
3. Then hold power-on for 8 seconds and see that it power off
4. XPSHOLD function not tested yet (this should work in Daisy 2)

Change-Id: Ie471af0b4e690de7d6340e47e148c8ce3cda94f3
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-14 09:12:50 -07:00
Simon Glass
55898c8b4b daisy: Deal with no-timeout explicity in wait_in_signal()
This function accepts a timeout value of -1, so add a comment to that
effect. Also make it deal with this explicitly since the current function
seems to return prematurely in that case.

BUG=chrome-os-partner:9424
TEST=very ad-hoc:
1. build and boot on daisy, flash U-Boot with USB using
'cros_bundle_firmware -w usb', inserting daisy
USB cable when it says 'Reseting board via servo...'
2. Press cold reset, then power on, see that it powers on
3. Then hold power-on for 8 seconds and see that it power off
4. XPSHOLD function not tested yet

Change-Id: I01bd81997836333ca33e61d48823e8ff41034d5f
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-14 09:12:50 -07:00
Randall Spangler
27e8bdb7c0 Maintain timer value across sysjumps and clean up init debug output
This helps us keep track of how long vboot is taking on the EC.

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

BUG=chrome-os-partner:9651
TEST=reboot system and look at debug log.  time shouldn't start over after it jumps to image A.

Change-Id: Iad86e90d42dabf1c67b2c2be80dda1151cf9a288
2012-05-11 13:36:34 -07:00
Randall Spangler
2f2a5d9022 Call timer_init() before other interrupts are initialized
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:9647
TEST=hack code to put a uart_puts() immediately following uart_init()
It shouldn't crash.

Change-Id: Ia1867a631934dbd457a23183010fdf9f5c284873
2012-05-11 12:29:59 -07:00
Bill Richardson
8101b71316 Enable verified boot for EC firmware
BUG=chrome-os-partner:7459
TEST=manual

In the chroot:

  cd src/platform/ec
  make BOARD=link

The firmware image (build/link/ec.bin) is signed with dev-keys. Reflash the
EC and try it, and it should verify and reboot into RW A.

Additional tests (setting USE_RO_NORMAL, poking random values into VBLOCK_A
or FW_MAIN_A to force RW B to run, etc.) are left as an exercise for the
reader. I've done them and they work, though.

Change-Id: I29a23ea69aef02a11aebd4af3b043f6864723523
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-10 17:27:36 -07:00
Randall Spangler
f28f2b2e51 Use open drain reset signals, and clean up signals to 5VALW-powered devices
Open drain cleanup minimizes leakage and signal glitching on shared
reset/signal lines, and is tidier than explicitly switching the
signals between inputs/outputs.

Touchscreen and lightbar are powered by +5VALW so their signals need
to be dropped when +5VALW is off to avoid leakage, and so they see a
clean reset signal when they're powered up.

Moved +5VALW power-on to S5-S3 transition, to minimize power draw in
S5.  This also ensures that 5VALW-powered devices get reset when the
device bounces through S5.  (No effect on proto1, where 5VALW is not
under EC control.)

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

BUG=chrome-os-partner:9172
TEST=boot and shutdown system; still works.

Change-Id: Ia4bf0703292a189c324ce283d1e79a33776ee40f
2012-05-10 15:17:01 -07:00
Simon Glass
f8f5599178 Allow boards to set the default console mask
Some boards don't like to have every keyboard scan printed, but some
devs find this info comforting. Add a way for boards to select the
require console mask.

BUG=none
TEST=manual:
build and boot on daisy, see that key scan messages are suppressed.
build on all platforms

Change-Id: I8e6e640eaabc0a08e5427cd97f7089dda1238025
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-10 14:16:07 -07:00
Randall Spangler
013a930082 Fix truncated output from 'ch' command
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST='ch' - prints all the channels now

Change-Id: I38ebc3eed2476c44c26fc00d6ea79800ae427722
2012-05-10 12:41:50 -07:00
Vic Yang
85e734d1b4 Adjust fan speed control thresholds
This CL set higher temperature thresholds for CPU temperature to reduce
fan noise. Also set temperature thresholds for case temperature so that
we can adjust fan speed according to them.

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

BUG=chrome-os-partner:8982
TEST=Manual

Change-Id: I16a74e10af4583a59065c09e8d9538232b0fb157
2012-05-10 15:25:36 +08:00
Randall Spangler
30a33e6b04 Drop DPWROK when system is off for more than 10 sec
This saves ~70mw of power.

To make this work, I also had to stretch the power button signal to
give the system a chance to come back up when the user taps the power
button.

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

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

For each of the following tests, wait ~15 sec after the system is
powered off to give it a chance to drop DPWROK.

1) tap power button -> system turns on
2) hold power button 1 sec -> system turns on
3) open lid -> system turns on
4) silego reset (power+refresh, or power+esc on proto1) -> system stays off
5) silego recovery (power+esc+refresh) -> system turns on
6) hold down power button and type 'reboot' on EC console -> system turns on
7) type 'powerbtn' on EC console -> system turns on

Change-Id: I781cf3e665104192521b7fb9ff75a3c3e7f43464
2012-05-09 16:54:17 -07:00
Randall Spangler
1655c8727a Add hooks for chipset power transitions
This is cleaner than having x86_power explicitly know about everything
else in the system that cares about power transitions.

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

BUG=none
TEST=boot and shutdown system; still works.  Mouse powered to system is off in S5.

Change-Id: Ib673ca2d9edd5473334e7604e98b99b02b768419
2012-05-09 16:09:10 -07:00
Randall Spangler
33422ee341 Fix polarity of radio-disable GPIOs
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

1) gpioget with system off -> ENABLE_WLAN = 0, RADIO_ENABLE_* = 0
2) gpioget with system on -> ENABLE_WLAN = 1, RADIO_ENABLE_* = 1

Change-Id: I397a195b4539083c622b85d63703c334cae931fb
2012-05-09 16:07:26 -07:00
Gerrit
9b169ce929 Merge "stm32: add flash programming support" 2012-05-09 11:41:04 -07:00