Commit Graph

312 Commits

Author SHA1 Message Date
Gerrit
fa8788e8c0 Merge "Jump to RAM before entering hibernate" 2012-05-29 11:19:47 -07:00
Randall Spangler
e31d9a6660 Jump to RAM before entering hibernate
Works around LM4 errata where EEPROM access is unstable while powering down.

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

BUG=chrome-os-partner:9996
TEST=hibernate 1

Change-Id: I99d21ec8ab5a06fb0972edebec3cc58ca9f60fa9
2012-05-29 10:21:36 -07:00
Randall Spangler
d42877300a Use correct EEPROM timeout
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

eeread 2 0 --> note original value
eewrite 2 0 0x1234
eeread 2 0 --> should be 0x1234
eewrite 2 0 (original value)
eeread 2 0 --> should be original value again

Change-Id: Ibb72426663122b22b2bfe87c821c374eab334450
2012-05-29 10:02:34 -07:00
Vic Yang
b85a7ce9d6 Make ectool correctly report when keyboard backlight is off
When keyboard backlight is disabled, make 'ectool pwmgetkblight' reports
'disabled'.

BUG=chrome-os-partner:9966
TEST='ectool pwmgetkblight' shows 'Keyboard backlight disabled' when
lid closed.

Change-Id: Ica690159e30431ccb530275fcc2311fb8f54a9aa
2012-05-26 20:29:54 +08:00
Randall Spangler
e704c712ad Better help for console commands
Additional help messages and usage are gated by
CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds
about 3KB to image size) and turn it off when there isn't.

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

BUG=none
TEST=manual

1) help
2) help list
3) help gpioset
4) gpioset -> wrong number of params
5) gpioset fred 0 -> param1 bad
6) gpioset cpu_prochot fred -> param2 bad

Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
2012-05-25 13:34:06 -07:00
Gerrit
89e1d5a121 Merge "Add mmapinfo command to power_button.c" 2012-05-25 12:47:48 -07:00
Bill Richardson
cc778c70d6 Add mmapinfo command to power_button.c
BUG=none
TEST=none

Change-Id: Id6ced0b87b354136e0b80026a537958586bb1325
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-25 10:20:25 -07:00
Vincent Palatin
38bab6b9f1 stm32: fix keyboard FIFO
When the FIFO is empty, returns the last read entry not the next one.

also rewrite the FIFO index increment to generate slightly better code.

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

BUG=chrome-os-partner:8869
TEST=On Snow, in U-Boot using "stdin=mkbp-keyb" type on internal
keyboard and see the correct text.

Change-Id: I189d230053de40dd563ce672db82dd6217e545e3
2012-05-25 16:04:50 +00:00
Gerrit
61902efd16 Merge "Fix disabling columns when power button is pressed" 2012-05-25 02:41:26 -07:00
Randall Spangler
b62a71a7eb Fix disabling columns when power button is pressed
This works around a problem where columns are not tri-stated when
calling select_column(COLUMN_ASSERT_ALL) with enable_scanning=0.

Also removes polling for power button released; we can use the same
task wait for that as we do for a keypress.

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

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

1) press g then press power button repeatedly.  EC is not rebooted.
2) press power button the g repeatedly.  EC is not rebooted.
3) press power+refresh (or ESC on proto1).  EC is rebooted.

Change-Id: I43a0beae1a6c0ef8fa9379a8fff47b6006e63c8c
2012-05-24 16:42:34 -07:00
Randall Spangler
9d46eb75a2 Enable brown-out reset
This resets the EC when power falls below the brown-out threshold

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

BUG=chrome-os-partner:9952
TEST=hopefully srikanth can; requires hardware mods to test.

Change-Id: I161e49003409cb68eb43303c3c8de0eb4cc27104
2012-05-24 15:33:49 -07:00
Randall Spangler
b0fe455608 Fix I2C port frequency calculation
Also fix 'i2cscan' output, and detect/ignore busy ports

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

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

1) check i2cscan
    i2cscan -> thermal port should report busy
    gpioset enable_vs 1
    i2cscan -> thermal port should show 4 devices

2) probe EC_SMB_CK[012] signals to verify clock frequency

Change-Id: I52e165de77eb9ed2619d648d84f251152772fe1c
2012-05-24 12:25:34 -07:00
Randall Spangler
0d6203adbf Update backlight in lid open/close funcs
...so lidopen/lidclose debug command also update the backlight

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

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

powerbtn -> boot system, display backlight on
kblight 100 -> keyboard backlight on
lidclose -> backlights off
lidopen -> backlights on

Change-Id: I0d092d3061ba8a00c8790b3d1b8380eecd2d1628
2012-05-24 09:28:03 -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
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
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
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
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
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
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
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
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
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
Gerrit
9f39cd9fc3 Merge "stm32: keep power across sysjump" 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
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
Randall Spangler
39149579a4 Add a list of I2C ports
This cleans up I2C init and debug commands across boards.

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

BUG=none
TEST=on link and bds:
  i2cscan
  lightbar run
  powerbtn (to power on system)
  temps (to read i2c temp sensors)
  battery (to read battery)
  charger (to read charger)

Change-Id: If3fb0cdb8d3178592bf68cbb2e72bc4b7f71dec5
2012-05-17 12:22:39 -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
Gerrit
134f80ee06 Merge "Disable interrupts while waiting for reboot" 2012-05-17 09:21:51 -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
David Hendricks
546aeddc97 stm32: add a FIFO for keyboard usage
This CL adds a simple FIFO to store keystrokes. The keyboard_scan()
function will push keystrokes into the FIFO and is the only producer,
while keyboard_get_scan() will pop entries and is the only consumer.

BUG=chrome-os-partner:9594
TEST=tested on daisy
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Testing was mostly subjectively done by typing a sentence quickly
at the Chrome UI.

Change-Id: I6faff41b0f16b75d6426df13a239f84eb62634ec
2012-05-16 16:53:59 -07: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
David Hendricks
dd839d851a daisy/snow: seperate EC_INT and CODEC_INT handling
This patch splits apart EC_INT and CODEC_INT handling for two reasons:
1. Allow other tasks to interrupt the AP without triggering
   the keyboard noise suppression.
2. Allow more work to be done after a keystroke is detected but
   before interrupting the AP. This is intended to prevent latency
   issues with the noise suppression.

Also, Snow does not currently have CODEC_INT hooked up, so it
does not need the extra function for suppressing keystroke noise.

BUG=chrome-os-partner:9594
TEST=tested on daisy (keys still respond), locally compiled for snow.

Change-Id: I73bd42bb7263005b11724337162646092292556f
Signed-off-by: David Hendricks <dhendrix@chromium.org>
2012-05-15 16:47:43 -07:00
Randall Spangler
e589f085c4 Disable interrupts while waiting for reboot
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7471
TEST=from console, reboot

Change-Id: I932ce34a13f4d6a30e2575450fafa16a7d909e3e
2012-05-15 15:43:52 -07:00
David Hendricks
be32534e44 daisy/snow: define KB_OUTPUTS in board.h, remove KB_COLS
An upcoming CL will use the number of keyboard outputs (currently
and incorrectly called KB_COLS) in another file. So this is a good
time to clean up the naming to remove some column/row ambiguity and
move the #define to board-specific configuration.

BUG=none
TEST=locally compiled for link and daisy
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I155e3d6f2069c582517016c1116eaf668ffca86a
2012-05-15 15:13:16 -07:00
Randall Spangler
50e0966af8 Add option to pll command to divide down system clock
Also fix sleep command triggering watchdog timer in spin-idle

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

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

1) check PLL operation - system keeps operating
    pll on
    pll off
    pll 4
    pll 16

2) check sleep operation - no watchdog
    sleep 0
    (reboot)
    sleep 1

Change-Id: Ib3079634a883d7c96b221f9e06a148221628cc3c
2012-05-15 12:49:56 -07:00
Randall Spangler
47bfcb2c61 Fan power is on +5VALW, not VS.
This has been true since proto1, and will continue to be so on EVT+.

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

BUG=none
TEST=faninfo
(on the one board modified for EC +5VALW control, you can also toggle +5VALW and see that powered reports the correct state).

Change-Id: Iaabfa3b84eb7eba46cf9972ec402153770f49fd7
2012-05-15 09:06:49 -07:00
Louis Yung-Chieh Lo
be7b5b44a3 Add chipinfo string for LM4FS1GH5BB.
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

BUG=chrome-os-partner:9625
TEST=test on link.
(EC console) > chipinfo
Chip vendor:   ti
Chip name:     lm4fs1gh5bb
Chip revision: A3

(VT2) % ectool chipinfo
Chip info:
  vendor:   ti
  name:     lm4fs1gh5bb
  revision: A3

Change-Id: I5f18ee068f4d5d64a51933fa3cc69d45b18ecaf3
2012-05-15 10:32:17 +08: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
Gerrit
805299d838 Merge "Add #define CONFIG_NO_RW_B for stm32f100" 2012-05-14 15:27:40 -07:00
David Hendricks
214e6b6017 Add #define CONFIG_NO_RW_B for stm32f100
We don't actually use image B for boards with the STM32F and there is
no longer enough space for it.

BUG=none
TEST=locally compiled for Snow

Change-Id: Ic668c718feaef4cf808869474dc05e45a5f7290c
Signed-off-by: David Hendricks <dhendrix@chromium.org>
2012-05-14 12:34:32 -07:00