Commit Graph

584 Commits

Author SHA1 Message Date
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
David Hendricks
fb0d6f078d stm32: add missing init hook
This adds a missing init hook

BUG=none
TEST=Tested on Snow

Change-Id: I4571d5bddf415b06e27e5e9eaadbb6017bde4bbe
Signed-off-by: David Hendricks <dhendrix@chromium.org>
2012-05-11 17:22:58 -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
4df4b8938e Add LICENSE file to project
It's the standard Chromium OS BSD-style license. I just copied it from
vboot_reference.

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

Change-Id: Ib8b77e9544d199fa809caaae0be9c0903c169fd5
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-11 09:11:52 -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
Gerrit
058079977e Merge "Use open drain reset signals, and clean up signals to 5VALW-powered devices" 2012-05-10 16:25:39 -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
9a5b4927c9 stm32: Add a generic gpio library
Much of the code in gpio-stmxxx.c is duplicated. Also the gpio_get_name()
function is not present in the new file.

Create a common gpio.c file to hold this function, and hopefully other
code in the future.

BUG=none
TEST=build on all platforms, boot on daisy

Change-Id: I4ab33e0e5c52843b770fabc777c917493abccffe
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-10 14:16:07 -07:00
Simon Glass
8d48971e91 daisy: Disable keyscan messages
These messages are unnecessary and seem to hang the EC for a while.
Punt them for now.

BUG=none
TEST=build and boot on daisy; see that keyboard still works, and messages
do not appear

Change-Id: I62963b62eb3e7cee86162784f364d7b1da37f631
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-10 14:16:07 -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
Gerrit
ee12df8c28 Merge "Fix truncated output from 'ch' command" 2012-05-10 13:44:28 -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
Simon Glass
906411de93 daisy: Remove start-up message from keyboard scan
Remove the start-up debug message which otherwise ends up being the
first thing displayed on boot, ahead of the banner.

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: I4f057ad32c3a857851d02935286683ea87dc7cd1
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-10 12:37:42 -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
David Hendricks
d8872b6cb7 stm32: set default i2c mode to noop
This CL initializes the default transmit mode for I2C to CMDC_NOP.

When we introduced the protocol, we changed the default mode to send
message protocol version. This didn't take into account that U-Boot's
probe command (and probably other userspace commands) do a single-byte
read to probe. So when the probe was asking for a single byte, by
default we were sending multiple bytes for the version message.

This CL also makes the EC reset the mode to noop after each EC-to-AP
transmission. This will help ensure that the EC ends up in a known
state e.g. if the system is reset. That will require the AP to set the
mode before requesting any real data, but that's how we do things now
anyway.

BUG=chrome-os-partner:9556
TEST=Tested on Daisy.

Tested by running "i2c dev 4; i2c probe" at U-Boot prompt, booting
system, and typing on keyboard. Everything seems to work okay.

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

Change-Id: I0849c94588a9a60ade657af8f941f7267553e316
2012-05-09 13:29:13 -07:00
Gerrit
9b169ce929 Merge "stm32: add flash programming support" 2012-05-09 11:41:04 -07:00
Randall Spangler
8403121f21 Make CPU_PROCHOTn high-Z (input) unless we're driving it low.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

Measure +3VALW power before and after change with system in S5.  Should drop by ~50mW.

Change-Id: I264694a80b2e558e46708de6ab1bfb146f79eb68
2012-05-08 21:07:33 -07:00
Randall Spangler
3919472023 Change recovery key to ESC on EVT systems
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

1) Boot system.  No recovery.
2) Boot system holding down Refresh+Esc.  No recovery.
3) Hold down Power+Esc.  System reboots and stays shut down.
4) Hold down Power+Esc+Refresh.  System reboots into recovery mode.

Change-Id: I53db224b6d2a03406244e79fb64fb67851919857
2012-05-08 21:07:09 -07:00
Randall Spangler
8ea7983c29 Add gpio_set_flags() and system_get_board_version()
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:9117
TEST=version; board version should be 0 on proto1 and 1 on EVT

Change-Id: Ic64ad0d009151fbda09f5c1605ef50ae708cb6ae
2012-05-08 21:00:38 -07:00
Gerrit
2615d8cdae Merge "Automatically switch USB charging mode" 2012-05-08 20:27:50 -07:00
Vic Yang
527eddedaa Automatically switch USB charging mode
Disable USB ports when system is down and set USB ports to standard
downstream mode when system is up or sleeping.

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

BUG=chrome-os-partner:9249
TEST=Plug in a phone and see it charge when system is on.
Turn off the system and see it stop charging.

Change-Id: I02850dee7051ed6589e0f176a933069203f0efdf
2012-05-09 10:15:03 +08:00
Vincent Palatin
71c86b38c3 stm32: add flash programming support
Implements the on-chip flash erasing and writing functions.

The actual writing is done from a routine in internal RAM (using the
special .iram.text section) with interrupt disabled as we cannot read
flash during the writing process.

The write-protect feature is only lightly tested.

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

BUG=chrome-os-partner:8865
TEST=run on Daisy, from the EC console, use flasherase and flashwrite
commands and observe the results using rw command.

Change-Id: I4c64cf28b23df52b18500b42a32a7d3668d45ba6
2012-05-09 01:13:26 +00:00
David Hendricks
a2efa4472a stm32: Fix an off-by-one error in select_column()
This fixes an off-by-one error that was preventing two keys
(left and right arrow) on output 12 from being driven properly,
and causing some other weird ghosting effects.

BUG=chrome-os-partner:9516
TEST=Tested on Daisy

Pressing the right arrow shows this at the EC console:
[1 keys pressed:  -- -- -- -- -- -- -- -- -- -- -- -- 40]
and pressing the left arrow shows this at the EC console:
[1 keys pressed:  -- -- -- -- -- -- -- -- -- -- -- -- 80]

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: Ib7af21444c2d03a0787fb1a28b520a779013774d
2012-05-08 17:06:17 -07:00
Gerrit
87b4278299 Merge "Move gpio list into gpio.h header file" 2012-05-08 14:39:37 -07:00
Bill Richardson
468bc6171c Add LPC lightbar command to get the current sequence.
Instead of making the STOP command synchronous, we can just have the
host-side app tell the EC to stop, then poll until it has.

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

"make BOARD=link", then
copy build/link/util/lbplay to the host and run it.

Change-Id: I846924ae7994a498e0089197785cf239898fe2a3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-08 12:03:49 -07:00
Simon Glass
42842e4378 Move gpio list into gpio.h header file
This is referenced by various files, so should be in the gpio.h header.

BUG=none
TEST=manual:
build and boot on daisy, see that USB download still works
build on all platforms

Change-Id: If579c975ef6c82988b9e411eeaa97c950d9efce4
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-08 11:31:52 -07:00
Bill Richardson
4679f8f194 Mark end of each RW firmware image so we can find it.
This just adds a single byte to the end of the RW firmware, so that we can
scan backwards from the end of the reserved block, skipping 0xff until we
find the actual firmware size. We need this so we can resign existing
firmware images without either signing a bunch of padding or forgetting to
sign a trailing 0xff that might be important.

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

Change-Id: If5cadb4d58c1bce39f66815c328ffd18cc3d444b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-08 08:49:52 -07:00
Louis Yung-Chieh Lo
468e34d51d Add EC_RO/EC_RW and WP_RO FMAP area for fw_updater and factory.
EC_RO and WP_RO area are identical and should cover whole range needed to
be write-protected. While EC_RO is for legacy firmware updater, the WP_RO
is for future factory finalize test.

EC_RW is for fw_updater to update both A/B at once.

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

BUG=chrome-os-partner:9536
TEST=build in chroot and dump_fmap build/link/ec.bin
opened build/link/ec.bin
hit at 0x00013800
fmap_signature   __FMAP__
fmap_version:    1.0
fmap_base:       0x0
fmap_size:       0x0003f800 (260096)
fmap_name:       EC_FMAP
fmap_nareas:     16
area:            1
area_offset:     0x00000000
area_size:       0x00014000 (81920)
area_name:       RO_SECTION
area:            2
area_offset:     0x00000000
area_size:       0x00013000 (77824)
area_name:       BOOT_STUB
area:            5
area_offset:     0x00013800
area_size:       0x00000302 (770)
area_name:       FMAP
area:            7                    <----
area_offset:     0x00000000           <----
area_size:       0x00014000 (81920)   <----
area_name:       EC_RO                <----
area:            8                    <----
area_offset:     0x00014000           <----
area_size:       0x00028000 (163840)  <----
area_name:       EC_RW                <----
area:            9                    <----
area_offset:     0x00000000           <----
area_size:       0x00014000 (81920)   <----
area_name:       WP_RO                <----
area:            10
area_offset:     0x00014000
area_size:       0x00014000 (81920)
area_name:       RW_SECTION_A
area:            14
area_offset:     0x00028000
area_size:       0x00014000 (81920)
area_name:       RW_SECTION_B

Change-Id: I11b9450f87e26ef1cd0ac65ecd059e13d8489e26
2012-05-08 14:51:34 +08:00
Randall Spangler
07e199e234 Add GPIO for PCH SRTCRST#
In case ctl decides to put it on a separate GPIO, he'll use PC7.  If
he doesn't, we can reclaim this GPIO.

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

BUG=chrome-os-partner:7576
TEST=gpioget; signals should be present.  PCH_SRTCRSTn should be 1.

Change-Id: I4ca4437515d62c36d00fd28093ca41e806ce351a
2012-05-07 19:04:39 -07:00
Randall Spangler
cbdd518422 Clean up sysjump struct parsing and add memmove()
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:9447
TEST=update from old EC 517 to this one

Change-Id: I275b5bf6c4ae1ab6e0c0a05cf9260314d644c79b
2012-05-07 16:26:43 -07:00
Randall Spangler
d01657060e Add GPIOs for WLAN power control and PCH RTCRST#
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7576
TEST=gpioget; signals should be present.  PCH_RTCRSTn should be 1.

Change-Id: Ibdfbf555c0bb919a1a459308b5d832b50df2ffe3
2012-05-07 14:07:34 -07:00
Randall Spangler
5b2fa92369 Add GPIOs for EVT board version stuffing resistors
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:9117
TEST=gpioget; signals should be present

Change-Id: I27473d4d4e0a0b2832ffe3b3dde7cd487367390e
2012-05-07 13:36:51 -07:00
Gerrit
e50b8093db Merge "Initial Snow board port" 2012-05-05 08:57:12 -07:00
Gerrit
8950279289 Merge "stm32f: Fix clock_init" 2012-05-04 16:18:33 -07:00
David Hendricks
4c8fa572b5 Initial Snow board port
Mostly stolen from Daisy.

Notable differences:
- No SYSCFGEN required for external interrupts ?
- No GPIO H bank on STM32F100, OSC_IN and OSC_OUT are not available
  --> CODEC_INT and ENTERING_RW signals are missing

BUG=None
TEST=Tested on ADV2/Snow, able to see EC serialconsole

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I955e2ff180d064294d67b630ae2ee6cfcfe52ab9
2012-05-04 23:10:29 +00:00
Gerrit
4daea3c1ab Merge "daisy: fix a bug in the GPIO enum listing" 2012-05-04 15:52:51 -07:00
David Hendricks
bd6b3267f0 stm32f: Fix clock_init
0b00 for bits 1:0 (system clock switch) indicates HSI, 0b01
indicates HSE. Also, bit 23 is reserved (maybe it was just
a copying error from earlier).

BUG=None
TEST=Compiled and run on Snow

Change-Id: Ie6891492ae6e7e3bd30e4d7b183b156de1290fe0
Signed-off-by: David Hendricks <dhendrix@chromium.org>
2012-05-04 15:00:55 -07:00
David Hendricks
7cbb8df538 daisy: fix a bug in the GPIO enum listing
These GPIOs should have been removed in fd5d6c.

BUG=Yes.
TEST=built a new image and booted Daisy-EVT1

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

Change-Id: Idce4384cdbe548c2e4fe2be8b52e4275445c9f1b
2012-05-04 14:46:11 -07:00
Bill Richardson
3b361af2a7 Update EC config and FMAP to reserve room for vboot signatures
This just reserves room. It doesn't actually perform any verification yet.

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

  make BOARD=link
  dump_fmap build/link/ec.bin

Change-Id: I424db1d601a614be3dfe5abb200e24e8bc62e47e
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-04 14:42:58 -07:00
Gerrit
d5deade06f Merge "Add link helper procedure" 2012-05-04 14:31:59 -07:00
Vadim Bendebury
1cb4a69b92 Add link helper procedure
Add a Jim procedure to program the Link EC image from the default
location as generated by 'emerge-link chromeos-ec'.

BUG=none
TEST=manual
  . emerge-link chromeos-ec
  . start openocd as described in the Link care and feeding document
  . in the port 4444 terminal session type
    flash_emerged_link
  . observe it succeed

Change-Id: Ibfbc38060d7e82ec8c83a73e2ccadff81d633ae4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
2012-05-04 13:42:26 -07:00
Louis Yung-Chieh Lo
391925a1cb Implement new write protect for host commands.
Rework to call functions in flash_common.c.

Also fixed a bug in parsing size of parse_offset_size().

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

BUG=chrome-os-partner:8448
TEST=on link
(CONSOLE) flashwp set 0x3d000 0x1000
(CONSOLE) flashwp lock
(HOST)    flashrom -p internal:bus=lpc --wp-status
          WP: write protect is enabled
          WP: write protect range: start=0x0003d000, len=0x00001000

Change-Id: I4a53735c851ebf4bb0c01a55a1d301d5b706ee0c
2012-05-04 22:46:28 +08:00
Gerrit
0ad2f9226f Merge "Assert PROCHOT when overheated and lower fan control threshold" 2012-05-04 04:55:44 -07:00
Simon Glass
763eb6197e daisy: Rename power signals to indicate polarity
GPIO_KB_PWR_ON and GPIO_PMIC_PWRON are active low, so add _L to each
name to make this clearer.

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: Ibdc0064477c36e8658ef5605cdd5811c2283aff9
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-03 22:06:33 -07:00
Simon Glass
ea845714fd Add gpio_get_name() to return the name of a signal
Add this to the GPIO API. It seems that the implementation is copied
in LM4 and STM32 so I have reluctantly done the same with this new
function.

BUG=chrome-os-partner:9424
TEST=build and boot on Daisy

Change-Id: Ifddc52e69b2b33af2645384c0171dd264e588fcd
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-05-03 22:05:57 -07:00
Gerrit
b67e435d14 Merge "Add header_size in struct jump_data." 2012-05-03 17:16:31 -07:00