Commit Graph

672 Commits

Author SHA1 Message Date
Gerrit
0a77eea2e4 Merge "Keyboard scan must stop driving columns when power button is pressed." 2012-05-23 23:07:09 -07:00
Louis Yung-Chieh Lo
29d25d807c Keyboard scan must stop driving columns when power button is pressed.
Tristage all columns as soon as possible right after the power button is
pressed. This can avoid the silego chip to reset the EC.

Resume the interrupt mode after power button is released so that the
deasserted columns doesn't trigger EC reset.

Also change some function names for export.

BUG=chrome-os-partner:7486
TEST=
press g first, then power button. repeat many times. system is not rebooted.
press power button first, then g. repeat many times. system is not rebooted.
ESC+power is still reseting system.
The long press power button still shutdowns system.

Change-Id: Ie5dec20ec3d3c4ffbd4acf5a4dd7f63eec38af56
2012-05-24 13:32:35 +08:00
Gerrit
e5333535f4 Merge "Handle multiple pending lightbar events." 2012-05-23 11:48:56 -07:00
Gerrit
eb7765c0c4 Merge "stm32: try to be more robust against malformed commands" 2012-05-22 19:52:56 -07:00
Gerrit
abc3b2ddce Merge "Add EC command to report board version" 2012-05-22 18:21:59 -07:00
Vincent Palatin
d9954b304a stm32: try to be more robust against malformed commands
Timeout properly when the AP doesn't want our bytes.

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

BUG=chrome-os-partner:8865
TEST=On Snow, boot with an old kernel.

Change-Id: Iac4fa5c3606f2e8731927326fad291dae26a615c
2012-05-23 00:52:36 +00:00
Bill Richardson
967e942084 Handle multiple pending lightbar events.
Since the events are requests for new patterns, we only want to do the
latest one. This does that.

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

No test: multiple events are rare. I had to fake them to see the problem.

Change-Id: I7e7de94655576e16c442a97097a7303e422a551a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-22 17:36:07 -07:00
Gerrit
8b468a8a26 Merge "stm32: ensure I2C properly behave after sysjump" 2012-05-22 15:50:09 -07:00
Gerrit
37732ced8c Merge "snow: ensure we have proper size in the FMAP" 2012-05-22 15:50:09 -07:00
Vadim Bendebury
d80c362969 Add EC command to report board version
The main CPU might need to know the particular hardware version the
system is running on. This information is available to the EC, this
change adds a mechanism for the main CPU to request this information.

The board version is defined as a flat 16 bit number.

BUG=chrome-os-partner:8722
TEST=manual
  . this change was tested in concert with the appropriate coreboot
    modification, the proto1 board returns board version of 0. The
    code was modified manually to return a one off version - and the
    coreboot indeed observed board version of 1

Change-Id: If434d33f43783b18cb202ea15819bd5804694b8e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
2012-05-22 15:10:54 -07:00
Vincent Palatin
4a7774c122 stm32: ensure I2C properly behave after sysjump
Sometimes when requesting a sysjump from the AP, the I2C bus gets
wedged. Ensure we restore it in a proper state during the driver
initialization.

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

BUG=chrome-os-partner:8865
TEST=On Snow, use flashrom to program the EC.

Change-Id: I6279afba2bdeed4473ace42220a0342c4addaf1d
2012-05-22 21:42:36 +00:00
Vincent Palatin
d819f6cee4 snow: ensure we have proper size in the FMAP
The size of the RW partition is size of RW-A + size of RW-B.
When B is de-activated, we need to nullify its size to get the correct
total size.

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

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

Change-Id: Id015af512f072efce5fcafc5a630845c5d9600bb
2012-05-22 21:42:35 +00:00
Bill Richardson
a7d62b4fd4 Add LPC command to handle vboot stuff.
This adds "ectool vboot", which works like so:

  # ./ectool vboot
  0x06 image=A fake_dev=1

  # ./ectool vboot 0
  # ./ectool vboot
  0x02 image=A fake_dev=0

  # ./ectool vboot ff
  # ./ectool vboot
  0x06 image=A fake_dev=1

You can set or unset the fake dev-switch, and see which firmware image the
EC is running from.

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

Boot the host, use crossystem to see the devsw_boot state. Change it with
the ectool command, reboot, see that it's changed.

Change-Id: Iaac40267338c6a07bc47b80e925e829bf1e1ae0c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-22 14:22:13 -07:00
Gerrit
43e26da794 Merge "do not advertise RW-B in FMAP if it doesn't exist" 2012-05-22 14:05:04 -07:00
Gerrit
5177cf3714 Merge "Notify lightbar task when CPU enters/leaves S5" 2012-05-22 14:05:04 -07:00
Gerrit
1089394038 Merge "Add support for printing fixed-point numbers" 2012-05-22 13:43:29 -07:00
Bill Richardson
b0847a726a Notify lightbar task when CPU enters/leaves S5
BUG=none
TEST=none

Change-Id: I07e3751c8fece18cf34d9b7c628fb3c6ab63d6b3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-22 12:58:16 -07:00
Vincent Palatin
5e1f87ce56 do not advertise RW-B in FMAP if it doesn't exist
The Snow board has currently the second RW partition de-activated due to
flash space constraints, we don't want to send false information to the
tools.

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

BUG=chrome-os-partner:8865
TEST=on Snow, flashrom -p internal:bus=lpc -i EC_RW -w ec.bin

Change-Id: I6da60028aa69aeb476d5c2d98df5a03ece961891
2012-05-22 19:48:30 +00:00
Vincent Palatin
9ab7beb509 stm32: fix sysjump on stm32f100
The warm boot condition was badly detected since we are tweaking the
GPIO enables in board.c. The timer enable (TIM2) is a more reliable
condition.

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

BUG=chrome-os-partner:8865
TEST=on Snow, boot Linux then type "sysjump A" in the EC console and see
that AP & Linux are still alive.

Change-Id: If375aa320c140360d313241b5d9219ffa8bcecd7
2012-05-22 19:41:43 +00:00
Randall Spangler
9b44097d23 Add support for printing fixed-point numbers
This makes timestamps much easier to read.

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

BUG=chrome-os-partner:9866
TEST=timerinfo, taskinfo, battery commands have fixed-point numbers,
and timestamps printed in the log look right.

Change-Id: If91c83f725984c8e04bfb7cdcff316d9c3bfe24c
2012-05-22 10:37:56 -07:00
Vincent Palatin
aa5397e484 stm32mon: complete support for stm32f100
- add the simple erase command
- fix the flash size

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

BUG=None
TEST=./build/snow/util/stm32mon -d /dev/pts/10 -w ec.bin

Change-Id: I9bdb0cf06759a04bd2bbef24d559eb67e4c0aa00
2012-05-22 15:53:54 +00:00
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
Vincent Palatin
1ac197d566 stm32: de-activate write protect feature until it is validated
Don't do anything on write protect until we have properly verify the
current implementation to avoid bricking Daisy and Snow boards.

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

BUG=chrome-os-partner:8865 chrome-os-partner:9849
TEST=None

Change-Id: I599a2a733b7304dc17286fae6fd7807fd8f6981c
2012-05-21 18:48:27 +00:00
Vincent Palatin
6b2a23bf83 stm32: add flash driver for stm32f100 SoC
Implementation of the flash driver for the stm32f100 chip used on Snow board.

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

BUG=chrome-os-partner:8865
TEST=On Snow board, use "flashwrite/flasherase" commands from EC console
and verify result with "rw" command.

Change-Id: Ie8b8be3d549ff9ec8c3036d5f4a97480daa5e03e
2012-05-21 18:48:27 +00: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
d0b9c23373 Merge "Workaround 64-byte limitation on flash write host packet" 2012-05-21 09:11:00 -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
Gerrit
9f39cd9fc3 Merge "stm32: keep power across sysjump" 2012-05-18 15:53:05 -07:00
Gerrit
bd52409ba4 Merge "Refactor power button state machine" 2012-05-18 15:53:05 -07:00
Randall Spangler
38a340e32a Refactor power button state machine
Simulation now simulates the physical signal, so uses the power state machine.

Power state machine now doesn't send a spurious press/release event if
the power button signal glitches and returns to its previous state.

Properly handles powering back on when waking from hibernate, if the
lid is open.

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

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

All of the following should power on the system:
1) at debug console, powerbtn
2) press power button
3) lid open
4) press power+esc+refresh
5) hibernate 10, then press power button
6) hibernate 10, then open lid

These should leave the system off:
1) press power+esc
2) hibernate 10, then let it wake up on its own

Hold down the power button to power on the system, and keep holding it
down; system should shut back down after 8 sec.

Hold down power+esc+refresh, and keep holding it down; system should
boot and NOT shut down after 8 sec.

Change-Id: I2dde951fe67544b6a24c607f0c4ba415ccd2f82f
2012-05-18 15:18:53 -07: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
5701e66a98 Workaround 64-byte limitation on flash write host packet
The stm32 needs to flash half a page (ie 128 bytes),
the current communication protocol is limited to a 64-byte payload for
flash write message.
The workaround buffers the first 64 bytes to be able to flash a full
128-byte half page.

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

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

Change-Id: I8036e66d2aa456b3409f4f8c74daa3755e7c9a51
2012-05-18 17:57:51 +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
Bill Richardson
3e747005b3 Add a tiny bit of debugging output.
BUG=none
TEST=none

Change-Id: Ic20efadaf4c1e9e5e98734ccaa60050c0f04a906
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-18 08:52:42 -07:00
Gerrit
86a36e5bcc Merge "Preserve USB port state when jumping" 2012-05-17 21:43:56 -07:00