Commit Graph

407 Commits

Author SHA1 Message Date
Gerrit
41e427f88f Merge "Don't trigger watchdog when power button is held down" 2012-04-12 15:23:27 -07:00
Gerrit
21c2391e24 Merge "Remove keyboard message on power-up" 2012-04-12 14:45:22 -07:00
Gerrit
77c3f9c35b Merge "Add timeout for flash operations." 2012-04-12 14:24:40 -07:00
Gerrit
81327a620d Merge "daisy: Provide an interrupt function for keyboard scan" 2012-04-12 13:53:05 -07:00
Randall Spangler
3b5ecd0d83 Add timeout for flash operations.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7479
TEST=manual.  From the linux console,

ectool reboot_ec RO
ectool flashread 81920 163840 /tmp/ec.bin
ectool flasherase 163840 81920
ectool flashwrite 81920 /tmp/ec.bin
ectool reboot_ec A

Change-Id: I850f4cea5dfdb76cfe3957988b10cf8841de55c1
2012-04-12 12:27:29 -07:00
Randall Spangler
f411bbbe19 Re-enable watchdog in watchdog_reload()
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

waitms 1500
(see watchdog trace)
waitms 1500
(should see watchdog trace again)
waitms 3000
(should see trace, then system should reboot)

Change-Id: Ieb5009d7a7bc9e1ed795e58efb0cb44a1eeb2706
2012-04-12 12:04:37 -07:00
Randall Spangler
20fdc57a35 Reload watchdog timer during flash operations.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

While ssh'd into the device:

1) Create a test image:

Extracting to: /tmp/ecup

132+1 records in
132+1 records out
136132 bytes (136 kB) copied, 0.000550122 s, 247 MB/s

2) Force the EC into its RO image:

done.

3) Erase the A and B images, then reprogram them:

Erasing 163840 bytes at offset 81920...
done.

Reading 136132 bytes from /home/chronos/user/ecb.bin...
Writing to offset 81920...
done.

4) Repeat step 3 about 10 times while monitoring the EC debug console.
Commands should complete successfully all the time.  (Note that during
the flashwrite, there's a ton of debug output; what you should NOT see
is something like this:
   WATCHDOG PC=00002104 / LR=0000597f / pSP=200013a0

Change-Id: I2f1f05eb19abcd6e19c6364f6d4ac785cca6a4c6
2012-04-12 09:41:35 -07:00
Simon Glass
8e326b6b0a Don't trigger watchdog when power button is held down
This situation occurs during USB download - the EC resets itself which
causes USB programming to generally fail.

Is this the correct fix?

BUG=none
TEST=build on daisy and discovery; run on daisy
$ cros_bundle_firmware -b daisy -w usb
See that it now succeeds

Change-Id: I293e85d08d3c488d5b6bebe3379deb949f211986
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-12 09:13:56 -07:00
Simon Glass
c748a0a9df Remove keyboard message on power-up
We want the Chrome EC message to be the first one produced after
start-up, so remove the message for the keyboard:

[kbscan keyboard_scan_init()] initializing keyboard...

BUG=none
TEST=build on daisy and discovery; run on daisy

Change-Id: I264450036145406e2d3bc39171ba672984f7dc99
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-12 09:13:56 -07:00
Simon Glass
c7f8239afd daisy: Provide an interrupt function for keyboard scan
Provide a function which is called when keyboard scan data is ready,
and make it do the right thing.

BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy
Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: I0089a7ff78ba035ba6648220ae2e03a958d444d8
2012-04-12 09:13:56 -07:00
Gerrit
e581c9e4ca Merge "Update keyboard scanning for stm32 to use messages" 2012-04-11 17:21:21 -07:00
Simon Glass
220a5a496d Update keyboard scanning for stm32 to use messages
Provide the required plumbing for the stm32 keyboard scan code so that
the message layer will pick up keyboard scans.

The design is as follows:
- When a change in keyboard state is detected, the keyboard matrix
  scanning code will call the board-specific board_keyboard_scan_ready()
  function to interrupt the AP.
- The AP will initiate a CMDC_KEY_STATE transaction over SPI or I2C
- The SPI or I2C driver will call message_process_cmd() to process the
  command
- This in turn will call keyboard_get_scan() to get the latest scan data

For SPI:
- The AP will initiate an 20-byte (or longer) SPI transaction
- The EC will see the command, and provide the keyboard state in response,
  with the response being part of the same transaction

For I2C:
- The AP will initiate a 1-byte write to set the EC mode.
- The AP will then initiate an 18-byte read, and the EC will send the
  message including keyboard state

BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy
Change-Id: I905ef9d567e43d85fb851052f67586eff58e1167
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-11 16:28:53 -07:00
Randall Spangler
406158a2a7 Add USER_REG3 and indicate it's reserved for preprogramming process data.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8889
TEST=code still builds

Change-Id: Ifdd31189fb5de779f090aa089173407e381c62b7
2012-04-11 16:16:20 -07:00
Simon Glass
84ee7cd803 Add a message format and processing function
Whatever means is used to talk to the AP there is no justifcation for
putting message processing directly in drivers. Create a suitable
header file to define the interface, and provide a processing function
which can provide responses to incoming messages.

BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy

Change-Id: If09ea3e30d42d8c5f226dc4421d4895adc54f937
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-11 11:57:43 -07:00
Simon Glass
66052e8b11 daisy: Initialize DMA library
We want to use this for drivers, so start it up on boot.

BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy

Change-Id: Ie69fb9d6df75150dd3903fe37a9b72c0a663f045
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-11 11:01:50 -07:00
Simon Glass
9e50df36b3 Add support for DMA controller
Add some basic functions to start DMA operations for transmit and
receive.

BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy

Change-Id: Ifceeed2af80cf5f00e1ce1a49b1139a76585b0bf
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-11 11:01:50 -07:00
Gerrit
9ac6546f9c Merge "Pass include directories to C preprocessor" 2012-04-11 10:57:19 -07:00
Randall Spangler
322eebbae4 Add fake developer switch
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

  optget fake_dev_switch --> 0
  optset fake_dev_switch 1
  optget fake_dev_switch --> 1
  optset fake_dev_switch 0
  optget fake_dev_switch --> 0

Reboot by holding ESC+D and tapping power

  optget fake_dev_switch --> 1

Reboot by holding ESC+F and tapping power

  optget fake_dev_switch --> 0

Change-Id: Iccb3bc8b3d571e551e204892769efc4161858055
2012-04-10 14:09:40 -07:00
Simon Glass
ee753a7ed1 Pass include directories to C preprocessor
If we include a header file within board/daisy/board.h then the code in the
top-level Makefile which transforms the configuration into make variables
cannot locate the header file. We get a warning:

$ make BOARD=daisy clean
board/daisy/board.h:11:20: fatal error: common.h: No such file or directory
compilation terminated.

To fix this, pass the include directories to the preprocessor also.

BUG=none
TEST=manual:
add common.h header to board/daisy/board.h; make BOARD=daisy clean;
see that no warning is issued

Change-Id: I04b718e014490a3f6008b7d03afce4d79a38eb56
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-04-10 13:46:18 -07:00
Gerrit
eac723c3e5 Merge "use the full 256kB for partitions" 2012-04-09 18:08:54 -07:00
Vic Yang
3d6c4a2d6d Stack overflow detection
Fix some mistakes in previous commit. Modified some comments and moved
guard value initialization to a more readable place.

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

BUG=chrome-os-partner:8069
TEST=Compile with detection enabled. Cause a task to overflow and see
device halted. Hook gdb and see it stopped at the assertion.

Change-Id: I608ee9aec3fda8c3945e1874d4bbb2c4ae1fc6dd
2012-04-10 08:35:41 +08:00
Vincent Palatin
d8541f29c8 use the full 256kB for partitions
Now Link has 256kB parts, we can restore the third partition and use 80kB partitions.

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

BUG=None
TEST=on Link proto-1, try to use RO/A/B images (sysjump B, then boot).

Change-Id: I9b7e4cae1504e86a62643db4d035cc9f3de0af52
(cherry picked from commit cefaf59328e4b91308d0347cc1f55861e93db480)
2012-04-10 00:31:17 +00:00
Vic Yang
1e35906acd Stack overflow detection
Use guard value to detect stack overflow

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

BUG=chrome-os-partner:8069
TEST=Compile with detection enabled. Cause a task to overflow and see
device halted. Hook gdb and see it stopped at the assertion.

Change-Id: I3417cca8edf4e1291ccb7848bd564b631a9ce463
2012-04-10 07:57:17 +08:00
Randall Spangler
7209e7c2d0 Clip charging current to valid range
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

Plug in a fully-discharged system.  Run 'charger' and 'battery'
commands to see that it's requesting a really small current.  See that
we're now feeding it a larger current.

Change-Id: I4312e2976b4f39d093deb73f665f8fbaba72d7c8
2012-04-09 14:47:29 -07:00
Gerrit
d79abe08d1 Merge "Support dynamically changing the system clock" 2012-04-09 11:13:47 -07:00
Randall Spangler
e9328ac4f6 Support dynamically changing the system clock
Add nopll command to turn off the PLL, reducing the system clock to 16Mhz.

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

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

boot system
press power button to boot x86
temps   // should print all temperatures
timerinfo
timerinfo
timerinfo  // convince yourself this is counting up at about 1MHz
nopll  // this drops the system clock to 16MHz
temps   // should still print all temperatures
timerinfo
timerinfo
timerinfo  // should still be counting up at about 1MHz

Change-Id: Ie29ceb17af348148bffadf63d60c1b731f4c3f6d
2012-04-09 10:33:35 -07:00
Duncan Laurie
5d003a3489 Make lpc_commands.h usable in coreboot for both C and ACPI
- The max IO buffer size in ACPI is 255/0xFF bytes.
- The ACPI ASL code in coreboot is pre-processed to handle
constant #defines, but the IASL compiler cannot handle any
actual C code so add an __ACPI__ guard.

BUG=chrome-os-partner:7734
TEST=include this header in coreboot and compile successfully

Change-Id: Ife61935cec1a39f072625c2788f70487c3559060
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
2012-04-09 10:28:03 -07:00
Louis Yung-Chieh Lo
1a9a415cf6 Support chipinfo command (ectool/host commands)
Add a host command returning chip information. The interface is in common/
while the implementations are in chip-specific code (note: added simple
value for stm).

BUG=chrome-os-partner:8567
TEST=on board
% ectool chipinfo
Chip info:
  vendor:    xx
  name:      yyyy
  revision:  zzzzz

Change-Id: I5030a03a6fcfbfc080d5acd8efb763fde7eefde5
2012-04-09 14:25:30 +08:00
Duncan Laurie
9936df2b8b Split lid handling into separate functions and add command interface
This has been useful for me to be able to test lid behavior remotely
since it is not available via servo.

This also has a minor change to send a task message after sending
the power button pulse so the state machine behaves properly.

BUG=none
TEST=Execute 'lidclose' and 'lidopen' commands via ec uart and
see the appropriate events set and wake behavior when the system
is off.  With a (not yet published) coreboot I am able to handle
lid close events to enter suspend.

Change-Id: Iec1c68121d42b66305ba5dfd20e81453538a97e2
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
2012-04-06 14:49:42 -07:00
Duncan Laurie
6abb3579af Add support for generating SCI via LPC
The SCI pin is not connected to a GPIO and it uses a different
method to trigger a pulse via LPC0SCI.

The ACPI specification requires SCI for 3 conditions:
- SCI event pending
- Input Buffer Empty
- Output Buffer Full

The buffer full/empty SCIs are used to nudge the kernel driver
along so it does not have to poll for a potential slow EC to
be ready.  This only really makes sense for the kernel channel
so they are only generated there.

BUG=chrome-os-partner:8277
TEST=using (unreleased) coreboot BIOS to test that the kernel
can receive SCI events and the ACPI method is successfully run.

Change-Id: I6b3717fcad6569bda4482d9aaa37d45b4cf36335
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
2012-04-06 14:49:30 -07:00
Duncan Laurie
32012be3c0 Export more battery information in LPC map
This data is used to populate the _BIF/_BIX packages in ACPI
but it currently needs an EC command to retrieve that isn't
easy to query in ACPI since it isn't using standard EC RAM.

1) Export these additional fields in init() state:
- Design Capacity of Full
- Design Voltage
- Last Full Charge Capacity
- Cycle Count
- Manufacturer String
- Model String
- Serial Number String

2) Fix an issue where battery current was not reported when
the battery was charging.

3) Remove the command interface so there is no duplication.

BUG=chrome-os-partner:7734
TEST=using (not yet published) coreboot to read battery status
via ACPI and verify that battery removal/insertion events
are properly handled.

Change-Id: If337aad3255e5b1a0f85168838f1dd86a32bbeb3
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
2012-04-06 14:49:30 -07:00
Randall Spangler
a61d8db3d3 Change task messages to events
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

make BOARD={bds,link,daisy}
make tests
flash link system and make sure it boots

Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
2012-04-06 09:06:53 -07:00
Louis Yung-Chieh Lo
0eb9447051 Fix the build error on adv board.
BUG=none
TEST=successfully BOARD=adv make.

Change-Id: I75e0f1e0487f52411c0c50b804e8997065f4e06c
2012-04-06 10:19:10 +08:00
Gerrit
8ea8bbbfd5 Merge "Increase fan speed control to 5 steps." 2012-04-05 17:39:41 -07:00
Vic Yang
94ef5f3ab3 Increase fan speed control to 5 steps.
Factor out fan speed control for easier adjusting fan speed stepping.
Also increase number of fan speed steps from 2 to 5.

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

BUG=chrome-os-partner:8466
TEST=Manual test.

Change-Id: I0ff601c0a4f2ed2a4867bdc6e550eb2827404754
2012-04-05 11:30:16 +08:00
Gerrit
732d256dd9 Merge "First "ectool lightbar" command." 2012-04-04 17:46:50 -07:00
Randall Spangler
bae507a2da Invert write protect signal
Write protect is active-high, not active-low.

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

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

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:on
From console:
  gpioget WRITE_PROTECT
  0  WRITE_PROTECT

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:off
From console:
  gpioget WRITE_PROTECT
  1  WRITE_PROTECT

Change-Id: I81c7858cac43c6c9b8630bf7f5aa0f491e6554ad
2012-04-04 15:26:25 -07:00
Randall Spangler
0f23e72532 Power button state machine handles keyboard-controlled reset
On Power+ESC -> ignore the power button being down until it's
released; system stays powered down.

On Power+ESC+Refresh -> send a power button pulse to the PCH.  Ignore
the power button until after both the pulse has finished and the power
button is released.

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

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

Reboot system.
Press power.
System powers on normally.

Hold down ESC, tap power very quickly.
System resets and stays off.

Hold down ESC and power for several seconds.
System resets and stays off.

Hold down ESC and refresh and tap power very quickly.
System powers on; EC console indicates it's in RO.

Hold down ESC and refresh and press power for ~100ms
System powers on; EC console indicates it's in RO.

Hold down ESC and refresh and press power for several seconds.
System powers on; EC console indicates it's in RO.

Hold down ESC and refresh and press power for at least 10 seconds.
System powers on; EC console indicates it's in RO.

Change-Id: Idf9619da54ab299b0c65e6d68abb5e35e2ce9c79
2012-04-04 15:12:27 -07:00
Bill Richardson
17fe1ce017 First "ectool lightbar" command.
BUG=chrome-os-partner:8728
TEST=manual

I don't have a system that has both an EC and a lightsaber, so I can't be
certain this works, but I *think* it will.

I do have a Link proto 0.5. With that, you can say

  ectool lightbar test

and the EC console says it's poking at the lightbar, but of course there's
nothing there. If there was, it *should* flash in pretty colors. I have a
lightsaber attached to a BDS, and from the EC console running "lightsaber
test" does make it blink.

Change-Id: Ib6021ad8e53959de52b12efda376254071e5fb4b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-04-04 13:14:04 -07:00
Randall Spangler
206476570d Only check for recovery key if reset was triggered by reset pin
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

1) Hold down refresh key and type 'reboot' from EC console.  Console
should not show "[KB recovery key pressed at init!]"

2) Press power+esc+refresh.  Console SHOULD show the message.

3) Press power+esc.  Console should NOT show the message.

Change-Id: I642a7667b81c8d90c9490b23ce0f3519364427e4
2012-04-04 12:16:14 -07:00
Vic Yang
afe7cda377 Revert "Add back LPC temperature read command as workaround."
This reverts commit dfe22b2b1e.
We seem to have solved I2C block issue. Reverting the workaround LPC
command and ectool command.

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

BUG=chrome-os-partner:8239
TEST=Compilation succeed. Manually tested temperature polling still
works.

Change-Id: I0acb567a138282479c7cc07cbfa723c439d04cd7
2012-04-05 00:06:49 +08:00
Gerrit
8ee84c5db5 Merge "lightbar: add reset GPIO" 2012-04-03 22:37:03 -07:00
Gerrit
84b4dc972d Merge "Remove write protect -> recovery signal hack" 2012-04-03 18:26:01 -07:00
Bill Richardson
e881236a72 lightbar: add reset GPIO
De-assert the lightbar reset GPIO to be able to access its registers.

According to the HW guys, it will consume less power in standby than in
reset due the pull-up on the reset line.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>

BUG=None
TEST=manual

On Link proto-1, type "lightbar test" in the EC console and see it blink.

On BDS, just build it. Nothing actually changes for BDS.

Change-Id: I9ec612c80f48d41ccf779f0962fc047966d4b7ba
2012-04-03 17:57:05 -07:00
Gerrit
e215358e8f Merge "Don't wait for CPU_CORE and VGFX_CORE good before asserting PWROK" 2012-04-03 16:19:26 -07:00
Randall Spangler
cb214ee8d8 Remove write protect -> recovery signal hack
Servo2 can set the write protect signal

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

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

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:on

Then from EC console:
  gpioget WRITE_PROTECTn
  0  WRITE_PROTECTn

From chroot:
  dut-control fw_wp_en:on
  dut-control mfg_mode:off

Then from EC console:
  gpioget WRITE_PROTECTn
  1* WRITE_PROTECTn

Change-Id: I9976cd6f114c8dae75434adf99d9409107b6ada0
2012-04-03 15:58:11 -07:00
Randall Spangler
3d2c4f758f Don't wait for CPU_CORE and VGFX_CORE good before asserting PWROK
In addition, it's not necessary for VGFX_CORE to be enabled for the
system to be in S0; just CPU_CORE is sufficient.

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

BUG=chrome-os-partner:8725
TEST=boot system via power button; should boot normally

Change-Id: Iea32837b698845355f7fa6bd2eaca9fd95f6726b
2012-04-03 15:24:22 -07:00
Gerrit
422f8ea6ba Merge "Add %T format code to print current timestamp." 2012-04-03 13:58:05 -07:00
Randall Spangler
95462ad4fe Add %T format code to print current timestamp.
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8724
TEST=if timestamps show up in the debug output, it works

Change-Id: I5264a3a40a07a824cc15b39a7bd81f2db02a3c13
2012-04-03 11:35:47 -07:00
Gerrit
25c6072b7b Merge "lm4f: fix watchdog trace" 2012-04-03 10:41:05 -07:00