Commit Graph

979 Commits

Author SHA1 Message Date
Randall Spangler
fbfc353cef Revert "i2c: Support command version numbers"
This reverts commit b983290238458f88a897ce3cfb06faae9ec79a40

Dependent on reverted change.

Change-Id: I3bb4c6acf4ff327f956ee5e1b6deefcd84dc8fbb
Reviewed-on: https://gerrit.chromium.org/gerrit/28138
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2012-07-22 13:17:03 -07:00
Randall Spangler
7143c4544c Clean up ectool
Assorted minor cleanup; make protocol a bit more efficient, and add a
missing line of output to flash protect status.

BUG=none
TEST=ectool flashprotect; should print valid bits = 0x3f on link

Change-Id: I9bea78506b3ed367df731d358982d3e2febb13af
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28097
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-07-22 13:17:03 -07:00
Randall Spangler
360d91573a Support up to 24 thermal sensors
And tidy reporting fan/thermal via memmap.

BUG=chrome-os-partner:11628
TEST=manual
  ectool pwmgetfanrpm -> should report fan speed
  ectool temps N ->
    should work for N=0-9
    reports error for N=15-23
    reports invalid sensor ID for N<0 or N>23

Change-Id: I484f81399f5e9dae9c759401091cc6f5acc733ff
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28032
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-22 13:17:02 -07:00
Simon Glass
bff14cac0b i2c: Support command version numbers
Currently, I2C commands look like this:

Input:
  cmd8 [params bytes] checksum
Output:
  response8 [response_ptr bytes] checksum

Use a prefix byte of (0xDC + cmd_version) to indicate the command
version.  This is compatible with the existing protocol, since there
are no host commands in the range 0xDC-0xFB.  If the first byte of
the from-host data is 0x00-0xDB, it's a version 0 command.

There is no change to the output format, since the EC needs to hand
back a response which matches the version requested by the host.

New input:
  (0xDC+ver8) cmd8 paramlen8 [params bytes] checksum
New output:
  response8 responselen8 [response_ptr bytes] checksum

If the host gets a response of EC_RES_INVALID_COMMAND, it knows it's
talking to an old EC, and at most version 0 of the command is supported.

BUG=chrome-os-partner:11317
TEST=manual and a bit ad-hoc:
(note, this testing is not completed yet, so far only snow is tested)
Check that snow and link still process commands correctly over I2C
from U-Boot.
SMDK5250 # mkbp test
Old interface:

New interface:
Test passed

Change-Id: I1c21f2b036091e9122b4f980ca5f5af34f7fc070
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27470
2012-07-22 00:36:39 -07:00
Simon Glass
37a6387fa9 i2c: Move host command processing into a function
We are about to add more logic here, so move it this code out of
the event handler and into its own function.

BUG=chrome-os-partner:11317
TEST=manual and a bit ad-hoc:
(note, this testing is not completed yet)
Check that snow and link still process commands correctly over I2C
from U-Boot. At this stage only the old interface is supported.
SMDK5250 # mkbp test
Old interface:

New interface:
Version 0: ec_command() returned error
Test failed with error -1
SMDK5250 #

Change-Id: I5387eb5533ab6faa27769f4cf21075387357371d
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27469
2012-07-22 00:36:39 -07:00
Simon Glass
949d525e2a host_command: Add send_result() to the arg structure
It's a bit odd that the drivers package up a command to be processed
by host_command, but then host_command calls a global function to
pass the response back.

This adds ambiguity in the host_send_response() implementations as to
whether the command being responded to really is using the same
buffers that the driver set up.

Add a function pointer to the command, and have host_command call
that. Add status to the args structure also, which removes some of
the special case logic for error handling.

BUG=chrome-os-partner:11317
TEST=manual and a bit ad-hoc:
(note, this testing is not completed yet)
Check that snow and link still process commands correctly over I2C
from U-Boot. At this stage only the old interface is supported.
SMDK5250 # mkbp test
Old interface:

New interface:
Version 0: ec_command() returned error
Test failed with error -1
SMDK5250 #

Change-Id: Ic4afdcd7689666cc0f6af228abc6cffe41b0fcbf
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27468
2012-07-22 00:36:39 -07:00
Vic Yang
c26eb30863 stm32f: Fix some error in flash write protect
And also add a fake write protect pin command for futher development and
testing.

BUG=chrome-os-partner:11595
TEST=Enable pstate read/write for stm32f.
      1. 'flashinfo' -> WP pin deasserted. No blocks protected.
      2. 'flashwp enable' -> Nothing changes.
      3. 'fakewp 1'; 'flashinfo' -> WP pin asserted. No blocks
         protected.
      4. 'flashwp enable'; 'flashinfo' -> RO protected.

Change-Id: Id5b1997442d9104d9cb254a295e0bd2f8c83bc78
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28062
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-21 21:47:52 -07:00
Vic Yang
dde4e99faa Prevent parallel make from failing
When we do parallel 'make', it fails intermittently. We might be hitting
a make bug: http://savannah.gnu.org/bugs/?30653
Let's remove the intermediate file for now and see if this happens
again.

BUG=chrome-os-partner:11614
TEST=Repeatedly remove some file and parallel make. This originally
gave an error once every two time. It doesn't now.

Change-Id: Iaaf48e7d19b11dad30bc70cd50e73c195caf17b4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28105
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-20 18:57:06 -07:00
David Hendricks
1911400b8b daisy/snow: enable SUSPEND_L interrupt
This enables interrupts on SUSPEND_L.

Signed-off-by: David Hendricks <dhendrix@chromium.org>
BUG=none
TEST=Power LED on Snow throbs when powerd_suspend is used

Change-Id: I5f06e717ddc07d5c2f129ff59a108131da8dbf87
Reviewed-on: https://gerrit.chromium.org/gerrit/27968
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2012-07-19 20:41:54 -07:00
Vincent Palatin
f9c2d375c3 link: update fan policy
As per James advice :
- increase fan speed at low temperature up to maximum "silent RPM",
this will give us more margin for later operations.
- lower the maximum fan RPM threshold to 86 C to try to lower CPU
  temperature impact on skin temp.
- do not take into account "object" temp sensors, they are too random
  at the moment.

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

BUG=None
TEST=adhoc

Change-Id: I3b60570e33f82e4015c6588d9e2ae538a33ad14f
Reviewed-on: https://gerrit.chromium.org/gerrit/27921
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-07-19 20:41:53 -07:00
Vic Yang
3036dcdb1e stm32f: Support hard reset
Now that we have hibernate ability, we can use this to perform a hard
reset.

BUG=chrome-os-partner:11579
TEST=Build success and working on 'snow':
       'reboot' and see reset cause is 'reset-pin soft'.
       'reboot hard' and see reset cause is 'hard'.
     Build success on 'daisy'.

Change-Id: I18132eee2f0d574d7d1674f7be25249dbe19749d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27930
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-19 17:01:55 -07:00
Vic Yang
b58c424a65 stm32f: Add hibernate support
This adds hibernate support to stm32f. Watchdog can wake us but cannot
be stopped unless system resets, so the longest time we can hibernate
for now is about 26s. And wake from wake pin is not working.
Nevertheless, we can use this for hard reset for now, and fix these
problems later.

BUG=chrome-os-partner:11579
TEST='hibernate 1' and see system wakes after 1 second. See reset cause
is 'hibernate'.

Change-Id: Iafa42012b59c12b70e18a7908c5d864c6e8bd2b4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27909
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-19 15:53:44 -07:00
Randall Spangler
e5bdf41f39 Add interface to charge_state for lightbar
Use these functions to get charging state and battery percent.  Use
power_ac_present() from power_button.h to find out if AC adapter is present.

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

Change-Id: Ied670c297be316b0b8fa56a450a1566470099b5b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27830
2012-07-19 11:35:21 -07:00
Vic Yang
812a58825f stm32: Support backup registers and preseving reset flags
This CL configures backup registers and add support of preseving reset
flags in backup registers before rebooting.

BUG=chrome-os-partner:11368
TEST=On snow there's always a reset-pin flag now, so test this with
     watchdog and soft reset.

1. reset with keyboard.    flags -> reset-pin
2. trigger watchdog reset. flags -> reset-pin watchdog
3. 'reboot soft preserve'  flags -> reset-pin watchdog soft
4. trigger watchdog reset. flags -> reset-pin watchdog
5. 'reboot soft'           flags -> reset-pin soft

Change-Id: I8b8a8abfbd69d8abb3386b188af73b9f662f4b38
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27848
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-19 11:35:19 -07:00
Duncan Laurie
a788fffd24 Disable keyboard backlight on suspend entry
In theory this should be done by a kernel driver,
but there is already a suspend hook so it is easy
to have the EC turn off the backlight if it is
not done by the host.

BUG=none
TEST=manual

1) boot Link device
2) log in and run 'powerd_suspend'
3) observe that keyboard backlight is turned off

Change-Id: I10b83505d681f5b6d9cb32c1bef62dc21dd038e1
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27721
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-19 09:59:13 -07:00
Vic Yang
c51466d0d0 Add host command to exit force idle charge state
Currently the only way to exit force idle state is to unplug AC power.
Let's add a host command to do so.

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

BUG=chrome-os-partner:9716
TEST=# ectool chargeforceidle 0
     - Check nothing happened
     # ectool chargeforceidle 1
     - Power LED blinking green. Check current = 0.
     # ectool chargeforceidle 0
     - Power LED back to yellow. Check charging.

Change-Id: Ia8f504b6cf9f42b7d57af3ce2d240f3b00a095f1
Reviewed-on: https://gerrit.chromium.org/gerrit/27768
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-07-18 22:36:42 -07:00
Vic Yang
35c349cca3 Add new TMP006 sensors
Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:11491
TEST=Build success. System still works fine except with error when
reading currently non-existing sensors.

Change-Id: I2fa1298ab11296f8b492534b5a8893588df34c82
Reviewed-on: https://gerrit.chromium.org/gerrit/27766
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-07-18 22:36:40 -07:00
Vic Yang
5251382d0b Send hook notification on GAIA power event
GAIA power module should send hook notification when power state
changes.

BUG=chrome-os-partner:11536
TEST=Hook a console message to HOOK_CHIPSET_SHUTDOWN and check this
message is printed to console when system shuts down.

Change-Id: I5bc3e69eeefeeda453526625887f852b9095ac08
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27814
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-18 22:36:39 -07:00
Hung-Te Lin
7a7d7b7c86 chromeos-ec: Refine FMAP.
Make EC FMAP more compliant to existing devices (EC_RO, EC_RW, RW_FWID),
eliminating unnecessary areas (RO_SETION, EC_IMAGE), and add more detailed
comments to each area.

BUG=chrome-os-partner:11360
TEST=emerge-link chromeos-ec; dump_fmap -x ec.bin

Change-Id: I3d30d6fe0d3cee2e944009dccef488f7215b6395
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27739
2012-07-18 20:27:42 -07:00
Randall Spangler
8137b29125 Add EC flash protect command to ectool
BUG=chrome-os-partner:11150
TEST=manual

Enable WP GPIO.  Then from a root shell

   localhost ~ # ectool flashprotect
   Flash protect flags: 0x00000008 wp_gpio_asserted
   Writable flags:      0x00000005 ro_at_boot rw_now
   localhost ~ # ectool flashprotect enable
   Flash protect flags: 0x0000000b wp_gpio_asserted ro_at_boot ro_now
   Writable flags:      0x00000004 rw_now
   localhost ~ # ectool flashprotect enable
   Flash protect flags: 0x0000000b wp_gpio_asserted ro_at_boot ro_now
   Writable flags:      0x00000004 rw_now
   localhost ~ # ectool flashprotect now
   Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
   Writable flags:      0x00000000
   localhost ~ # ectool flashprotect now
   Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
   Writable flags:      0x00000000
   localhost ~ # ectool flashprotect disable
   Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
   Writable flags:      0x00000000
   Unable to set requested flags (wanted mask 0x00000001 flags 0x00000000)
   Which is expected, because writable mask is 0x00000000.

Then disable WP GPIO and reboot

   localhost ~ # ectool flashprotect
   Flash protect flags: 0x00000001 ro_at_boot
   Writable flags:      0x00000001 ro_at_boot
   localhost ~ # ectool flashprotect disable
   Flash protect flags: 0x00000000
   Writable flags:      0x00000001 ro_at_boot

Change-Id: Idc5de3b3033521467aca8fb0ba9b7c378d0ad2a1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27799
2012-07-18 18:15:29 -07:00
Randall Spangler
3dfc336b44 Better handling of corner cases for flash protection
If WP isn't asserted, 'flashwp now' does nothing.
If WP is already enabled, 'flashwp enable' succeeds.

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

(disable physical WP)
flashwp now
flashinfo -> nothing protected
flashwp enable
flashinfo -> ro_at_boot set, nothing protected
(enable physical WP)
reboot
flashinfo -> ro_at_boot ro_now
flashwp enable -> (succeeds)
flashwp disable -> fails
flashinfo -> ro_at_boot ro_now
flashwp now
flashinfo -> ro_at_boot ro_now rw_now
(disable physical WP)
reboot
flashwp disable
flashinfo -> nothing protected

Change-Id: I4660d822886635e71ab1636c737611214852f58c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27798
2012-07-18 18:15:18 -07:00
Randall Spangler
c7b4a30a53 Use config values for flash protect/erase/write sizes
Since they're config values anyway.  Gets rid of an unneeded layer of
function call.

BUG=chrome-os-partner:11150
TEST=build link, snow, daisy; flashinfo returns same values

Change-Id: I27fa007f64a446f1ec0fe22ae16c5c1ac667f8e9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27797
2012-07-18 18:15:00 -07:00
Randall Spangler
9a8223a8db Remove flash_read()
Everything now uses flash_dataptr() to get at flash memory rather than
calling the read function, since the read function adds a needless memcpy().

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

flashwp enable
reboot
flashinfo -> should show ro_at_boot
flashwp disable
reboot
flashinfo -> should no longer show ro_at_boot

Change-Id: I1830e2f036cf6777115c782c1737335ff2eb4ce0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27796
2012-07-18 18:14:47 -07:00
Randall Spangler
1a76325fa8 Continue refactoring flash write protect
Now properly detects partially-protected flash banks.

Also renames 'flashwp lock/unlock' to 'flashwp enable/disable'

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

ww 0x400fe400 0x7fffffff
flashinfo -> ro_now PARTIAL
reboot
ww 0x400fe404 0x7fffffff
flashinfo -> rw_now PARTIAL
flashwp now
flashinfo -> ro_now rw_now (and NOT partial)

Change-Id: I9266a024eee6d75af052cd47e3f54468ad959a12
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27795
2012-07-18 18:14:36 -07:00
Randall Spangler
2223179cbc Move looking at write protect GPIO to button/switches module
Since that already monitors the WP signal for reporting it as a
switch.  And if we have that code in two places and the WP signal
polarity changes, we'll inevitably forget to change it in the other
place...

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

flashinfo -> WP pin asserted
remove WP screw
flashinfo -> WP pin deasserted

Change-Id: I6091c8bb470c357e02ede8a5b184b2a76b70dc60
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27720
2012-07-18 15:51:36 -07:00
Randall Spangler
0255a72d07 Stop reporting keyboard recovery switch
This uses the new keyboard recovery EC event to determine when
keyboard recovery is requested.  It is paired with a change to the EC
to stop reporting keyboard recovery as a switch, since that didn't
provide a good mechanism for the AP to tell the EC to stop reporting
the switch value.

This REQUIRES an updated BIOS; without it you won't be able to get
into recovery mode manually.  You'll need to press space at the
developer screen, or use the debug console to request recovery.  Your
BIOS must have https://gerrit.chromium.org/gerrit/27509.

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

1. boot using power+refresh+esc.  See insert screen.
2. power button to power off
3. power button to power on.  Boots to Chrome OS (not insert screen).

Change-Id: I699ce004ed1190044170c4ea810b8969b40f523b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27508
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-18 15:51:36 -07:00
Randall Spangler
3f492b471b Continue simplifying flash write protect
Now that read-only code is protected iff the persistent state is
locked, we don't need to track per-block in the persistent state.

BUG=chrome-os-partner:11150
TEST=if it builds and boots, it's fine

Change-Id: I80e6a85c0c72136b7ed8964ce02c8abdbaafe637
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27719
2012-07-18 13:49:11 -07:00
Randall Spangler
aabe50f0d5 Move flash commands into flash_common.c
In preparation for more flash refactoring.

BUG=chrome-os-partner:11150
TEST=build link, snow

Change-Id: If877e5ebee5af0f9b167ec7b28fd9d718d0108ec
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27718
2012-07-18 13:48:56 -07:00
Randall Spangler
ad2268e739 Simplify flash protection, part 1
1. If the flash protection state is locked, RO firmware is explicitly locked.
2. Protecting flash now locks the entire flash.

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

flashinfo -> nothing protected
flashwp now
flashinfo -> unlocked,applied; everything protected
reboot
flashinfo -> nothing protected
flashwp lock ->
flashinfo -> locked,applied; now has 40 Y's at start and 1 at end
reboot
flashinfo -> locked,applied; now has 40 Y's at start and 1 at end
remove WP screw
reboot
flashinfo -> locked, not applied; nothing protected
flashwp unlock
flashinfo -> nothing protected

Change-Id: I2cf0e8bfe82ab7a5bf88b9161b7a05b889cae71a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27717
2012-07-18 13:48:46 -07:00
Duncan Laurie
2bee304abd Remove the keyboard "cold reset" hack
This was needed because we could not do a clean
reset with CF9 and were relying on the keyboard
reset pulse to trigger a cold reset.

However it has the downside of causing a kernel
panic to be a cold reset and the kernel panic
information in memory is lost.

Now that we have a VR workaround this hack can
be disabled and the keyboard can instead issue
a warm reset.

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

1) install this EC on a Link device and boot
2) log in and execute "echo panic > /proc/breakme"
3) after reboot look for kernel entry in /var/spool/crash

Change-Id: I1134618f0a202d37aaae69a1d857fa8853a7e52c
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27722
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-18 13:11:07 -07:00
Randall Spangler
60e7844818 Remove old flash WP commands
These don't accurately reflect how flash write protect was/is implemented.

BUG=chrome-os-partner:11150
TEST=build link, snow

Change-Id: I126253a2ce05e5d3a51471c32211e6cacbfd85d4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27716
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-18 13:11:07 -07:00
Vincent Palatin
f211884888 ir357x: update voltage regulator settings
- add settings for IR3570A
- disable low voltage fault and keep ready signal when SVID=0.
 (on IR3571 and IR3570A)
- match IR3571 settings with IR3571_REV7_DRC_6_28_12 to ensure we are
  meeting all power requirements.

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

BUG=chrome-os-partner:8397 chrome-os-partner:10171
TEST=on Link EVT with IR3571 and Link EVT reworked with IR3570A,
test reboot and RC6+.

Change-Id: Ibe34e3c6f0de1e6a08d526fe5fce743feb42645c
Reviewed-on: https://gerrit.chromium.org/gerrit/27504
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2012-07-18 12:06:54 -07:00
Vic Yang
f322e1b96a Set power LED to green when we are trickle charging nearly full
When battery is nearly full, battery sometimes demands for very low
current and we are actually trickle charging. This causes the last part
of charging process very long, but the actual charged amount is only few
mAh. Let's set power LED to green in this case so that user doesn't feel
the device is charging forever.

BUG=chrome-os-partner:11248
TEST=Charge the battery to nearly full. Disconnect and connect AC power.
     Check the power LED is green when we are trickle charging.

Change-Id: Ide108778232e9f1d3abe6b61af7518af25040d10
Reviewed-on: https://gerrit.chromium.org/gerrit/27264
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-18 09:31:27 -07:00
Louis Yung-Chieh Lo
9c289eda9f Enable Lucas EC WP again.
Uncomment back the old code and fix the bug of WRP bit definition and
also write_opt().

Note that to make this functional, wp_pin_asserted() always returns true.

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Change-Id: Ic09d3346ca68a2700697ff863f0fa08525129b11
BUG=chrome-os-partner:9849
TEST=run on lucas.
> flashwp set 0 0x1f000
> flashwp lock
> flashinfo  # ensure the setting is right.
stm32mon -r to read the firmware.
stm32mon -w to write a different image.
stm32mon -r to read again and compare the firmware is non-changed.
> flashwp unlock
Command returned error 1
stm32mon -u to unlock write protection.
Reviewed-on: https://gerrit.chromium.org/gerrit/27503
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-07-18 00:56:45 -07:00
Simon Glass
73b042f3dc gaia_power: Allow AP power to be controlled
Enhance the power command to support turning power on/off.

Do this by requesting the state of the main power control loop,
rather than hacking in new states or flags.

BUG=chrome-os-partner:11427
TEST=manual
Try 'power on' and 'power off' and see that it obeys.

Change-Id: Ie6db41dda16176818510f8902ab803e165494424
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27654
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-07-17 23:14:11 -07:00
Simon Glass
698ae9f5ad gaia_power: Add power command to check power state.
It is useful to be able to see the current AP power state, and x86
has a command for this. Add one for gaia.

BUG=chrome-os-partner:11427
TEST=manual
(start with power off)
> powerinfo
off

(press power button)
> [batt] state idle -> pre-charging
AP running ...
Power button released
Setting pwron timer 10038870
powerinfo
on
> Releasing pwron

(after kernel boots, make device go into suspend by typing this at
kernel command line:
type echo mem > /sys/power/state)
> powerinfo
suspend

Change-Id: I3244b3a7fd0b6dd689f3470fb97ffe5a72c8d8f9
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27653
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-07-17 23:14:10 -07:00
Louis Yung-Chieh Lo
228259479a stm32mon supports read unprotection.
Details please refer to AN3155 document.

BUG=None
TEST=run on real machine.
% stm32mon -U
% stm32mon -u
% stm32mon -w new_image

Change-Id: I070e18a7cb112afe0ab0d0f0bd06cecc4eefb37e
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27630
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-07-17 20:55:41 -07:00
Randall Spangler
8978c6abac Tidy debug output for reboot command
Should print what command is being executed, to help debug software sync

BUG=chrome-os-partner:11087
TEST=power on system, look for updated debug message, for example
   [1.636893 Executing host reboot command 5]

Change-Id: Ib543fc265fe881dc2089119ab3c0a52b0fce3b4d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27659
2012-07-17 14:41:01 -07:00
Randall Spangler
561a121526 Rename ROLLBACK constant to PSTATE
Since flash_common calls the top bank of flash pstate, use the same
nomenclature in config.h

BUG=none
TEST=build link

Change-Id: I22efe7d0fd3a24bc0b2b4a6632406f0e1e529dc6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27662
2012-07-17 14:41:01 -07:00
Rong Chang
9eb416e315 Fix I2C arbitration timeout when chipset is suspended
When system is off or suspended, board_i2c_claim() should not wait
for AP's signal.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:11285
TEST=manual
Put AP into suspend
Type 'i2c r 0x90 0' and see that no arbitration error is obtained.

Change-Id: I22243457fc29bc6c88f413ce0660c700e54f6761
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27498
2012-07-17 14:41:00 -07:00
Rong Chang
ea1cde3971 daisy: Re-read suspend gpio when asked for chipset state
The SUSPEND_L GPIO is marked interruptable, but this apparently
does not work, and the gaia_suspend_event() function is not updated as expected.

As a workaround, check the GPIO value on ever call to
chipset_in_state().

BUG=chrome-os-partner:11285
TEST=manal
Using new 'power' command check that the state updates when the AP
is in suspend from 'on' to 'suspend'.

Change-Id: I9c520e69b9910c649bf6d8381ee167da6facc634
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27652
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-17 14:41:00 -07:00
Randall Spangler
c89edce83f Don't waste space on vblock and root key if not doing sig-based EC vboot
BUG=chrome-os-partner:11455
TEST=dump_fmap build/link/ec.bin; shouldn't see VBLOCK or ROOT_KEY sections

Change-Id: I8c1309936d86772fdf9aecdc8d95f0578ef0f65b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27661
2012-07-17 14:41:00 -07:00
Randall Spangler
eb93d200be Rename section A to RW, to match other platforms
BUG=chrome-os-partner:11149
TEST=make link, snow, bds; on reboot,
  sysjump rw
  sysinfo   <- should indicate current image is rw
Then on root shell,
  ectool version  <- should indicate rw

Change-Id: I833fcb814165379dd044e4cb46ae338e5da81212
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27660
2012-07-17 14:40:59 -07:00
Randall Spangler
fc7b64e186 Remove firmware B
BUG=chrome-os-partner:11449
TEST=build link, snow, bds; ectool reboot_ec cold to make sure enums line up

Change-Id: Ie09db2080a00f1a7e2c05579b9b41ea5137c1af0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27658
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-17 13:11:44 -07:00
Randall Spangler
c44c17890c Rename A and B images to RW and RW_B, part 1
All of our current EC configs have RO and a single RW image.  Calling
that image 'A' is confusing, particularly when combined with EC
software sync (where the RW image is updated from either the A or B AP
RW firmware).  So, rename it.

This changes all the build artifacts and constants.  Internal EC
commands and host commands still refer to A/B; that will be fixed in
part 2.

BUG=none
TEST=build link, snow, bds

Change-Id: Icfed4914745f0799bb71befb6a6563cfd8bc90ab
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27649
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-17 10:50:30 -07:00
Vic Yang
dae19428a6 Fix a bug in I2C host command handler
Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=none
TEST='ectool i2cread' succeed.

Change-Id: I0639c340b600ff5e07b9c0aa707fe335e90771b5
Reviewed-on: https://gerrit.chromium.org/gerrit/27599
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-07-16 23:10:01 -07:00
Vic Yang
096ffbb04e Append "shift" to version string in shifted image
For EC update test, we produce binary-wise shifted image. To make it
easier to tell if update has succeeded, let's append "shift" to the
verison in this image.

BUG=chrome-os-partner:10264
TEST=Build shifted image and check the version string.

Change-Id: I16187611cf61fc97a74bc3707a77ad9ad5274f37
Reviewed-on: https://gerrit.chromium.org/gerrit/27577
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-07-16 20:52:00 -07:00
Randall Spangler
acf6f963a1 Flash pre-init reboots if it needs to clear protection registers
BUG=chrome-os-partner:11171
TEST=manual

1. Clear some of the writable-bits in the flash registers
> ww 0x400fe40c 0xffff1234
write 0x400fe40c = 0xffff1234
> rw 0x400fe40c
read 0x400fe40c = 0xffff1234
2. Reset using power+refresh
3. Register should be clear again
> rw 0x400fe40c
read 0x400fe40c = 0xffffffff
4. Sysinfo should indicate reset-pin reason AND hard-reset reason
> sysinfo
Reset flags: 0x0000000a (reset-pin power-on)
5. Reset using power+refresh
6. Sysinfo should indicate reset-pin reason only
> sysinfo
Reset flags: 0x00000002 (reset-pin)
7. Clear writable-bits again
> ww 0x400fe40c 0xffff1234
write 0x400fe40c = 0xffff1234
8. Jump to another image.  This should NOT trigger a hard reset.
> sysjump A
> sysinfo
Reset flags: 0x00000402 (reset-pin sysjump)

Change-Id: Ie1d6af2acc68217bb82faae464798ee85d63d1ea
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27540
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-16 17:49:10 -07:00
Duncan Laurie
a42edb86c5 Print console messages for overtemp and shutdown
I have a system with bad temperature sensors and the EC is
constantly shutting the system down, but provides no
visible indication that it is doing so.

I have serious concerns about the EC behavior in this case
as it seems to be doing things it shouldn't.  However just
providing indication via the console about what it is doing
is at least useful for development and debug.

BUG=none
TEST=boot on system with bad temp sensors and see that
the EC indicates it is initiating a shutdown.

[14.008340 critical temperature; shutting down]
[14.008660 x86 power force shutdown]
[14.009153 LPC RESET# asserted]

Change-Id: I6beeb269a135bd8c245c0357670fe29648d48968
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27553
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-16 17:49:10 -07:00
Randall Spangler
0e6daeb6ab Fix return code from ectool
lbplay and burn_my_ec didn't have this problem.

BUG=chrome-os-partner:11402
TEST=ectool lightbar init && echo $?
Should echo 0

Change-Id: I7e9585555cc285ff02502fd4e6bb80e41c889e9d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27527
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-16 15:32:31 -07:00