Commit Graph

82 Commits

Author SHA1 Message Date
Randall Spangler
3a460ea765 Disable fan PWM when +5VS is disabled
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

faninfo
  should report fan is disabled
powerbtn
  system turns on, fan turns on
faninfo
  should report fan is enabled
powerbtn
  system turns off, fan turns off
faninfo
  should report fan is disabled again

Change-Id: I8e94c142bf18d07f83bac05287bcd503a098cee7
2012-02-27 11:09:32 -08:00
Randall Spangler
4f3f3fdf3d Merge "Only deassert RCINn in S0" 2012-02-27 11:06:42 -08:00
Gerrit
3f58f4aa66 Merge "stm32l: update GAIA power sequencing timings" 2012-02-26 20:40:40 -08:00
Gerrit
fc6fb08b56 Merge "stm32l: fix ACOK signal" 2012-02-26 20:40:40 -08:00
Randall Spangler
1d1a38a6cc Only deassert RCINn in S0
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

gpioget PCH_RCINn --> should return 0
powerbtn --> should turn system on
gpioget PCH_RCINn --> should return 1

Change-Id: I8e58e2b6a48c811d5e57549bdcaea27bca964c08
2012-02-24 18:02:20 -08:00
Vic Yang
675cddb258 Write temperature values to LPC mapped value space.
Add a task to update temperature values in LPC mapped value space every
second. Also modify ectool to read directly from LPC mapped space.

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

BUG=chrome-os-partner:8065
TEST="ectool temps" gives same result as "temps" from ec console.

Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
2012-02-24 13:09:44 -08:00
Vincent Palatin
5a2649acf9 stm32l: update GAIA power sequencing timings
Update the timeouts during the power on sequence as recommended by
Frank.

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

BUG=None
TEST=run EC firmware on ADV board and let Frank control he likes the
signals.

Change-Id: I7391a1cdd5ad74e0c22e15eb996955c5b7719154
2012-02-24 11:07:02 -08:00
Vincent Palatin
64e6afdefa stm32l: fix ACOK signal
The PMIC_ACOK signal is active-low.
Let's drive it correctly.

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

BUG=None
TEST=On ADV board, check that a short key press on the power button is
now able to start the board

Change-Id: Iea71939aeb532618019a9e7774721703c632976f
2012-02-23 13:28:46 -08:00
Gerrit
028df3ba51 Merge "stm32l: add a simple shutdown sequence for GAIA SoC." 2012-02-22 08:17:13 -08:00
Randall Spangler
12b12e5334 Add EC host commands for keyboard backlight
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8128
TEST='ectool setkblight X && ectool getkblight' for X=1, 20, 99, 100, 0

Change-Id: I540fd2d05f4caa110cd1dc45e9b5184fc8777a06
2012-02-21 12:59:44 -08:00
Vincent Palatin
bd331737b4 stm32l: add a simple shutdown sequence for GAIA SoC.
Either a 8-second press on the power button or the XPSHOLD signal going
down (triggered the AP/PMIC shutdown sequence) will trigger a shutdown
of the system and switch off all power rails.

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

BUG=None
TEST=on Discovery, test manually various power key press duration and
see power on/power off traces.

Change-Id: Ic37e4a51fe6b131034e24c55f05dae8119ce9992
2012-02-21 17:54:08 +00:00
Vic Yang
0fefd25c0c Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.

Factor out sensor specific part to keep code clean.

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

BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.

Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
2012-02-18 13:37:53 +08:00
Bill Richardson
737fbbd032 Delay enabling UART1 until after LPC bus is enabled.
BUG=none
TEST=manual

Try it on a bds with no LPC bus. It gets a BusFault without this patch.

Change-Id: If3f38df5f7bebaf4c7045a9f48fbe3ac66e8bdbf
2012-02-17 15:55:32 -08:00
Gerrit
ad7a0d5ae6 Merge "Add fixed-point temp calculation as backup option." 2012-02-16 16:46:12 -08:00
Gerrit
10c3954951 Merge "USB charging control LPC command." 2012-02-16 15:58:06 -08:00
Vic Yang
284c2dbb89 Add fixed-point temp calculation as backup option.
We prefer to use floating-point version but we might need fixed-point
version in the future if we don't have FPU support. If CONFIG_FPU flag
is not set, fixed-point object temperature calculation would be used.

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

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

Change-Id: I69364b10bedf1351206e52266d669b4c566bd6f6
2012-02-16 15:37:44 -08:00
Vic Yang
e75a32d2e3 Temporarily remove image RW.B due to code size.
To accomodate our growing code, image RW.B is removed so that RO and
RW.A can both have 60K space. This is just a temporary solution. Add
RW.B back when we have enough space for all three images.

Also add license header to firmware_image.lds.S so that repo does not
complain about it.

BUG=chrome-os-partner:8079
TEST=build image and run on proto-0.

Change-Id: I85b723f3e645c12fd89b189263ca44d58c4621eb
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 14:06:55 -08:00
Vic Yang
6a60a7fbdc USB charging control LPC command.
Add a LPC command to control USB charging mode. Also add the command to
ectool.

BUG=chrome-os-partner:7476
TEST=Manually test on link proto-0.

Change-Id: Ica87d0a690bc86e28844bd695f31641398b21939
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 12:45:51 -08:00
Vincent Palatin
4778d823be stm32l: add a simple power sequencing for Daisy board
This should be enough to switch on the board from either the power
button or the EC console.

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

BUG=None
TEST=run Daisy firmware on Discovery board with logic analyzer attached
to GPIO pins. With an added task to simulate PMIC startup and AP
startup, check the timing chart looks good.

Change-Id: I5dfeab05d0481d121ddacb36b69a542cc1bd428c
2012-02-16 02:52:29 +00:00
David Hendricks
05f0eb3005 Make i8042 independent of host <--> KBC bus.
This CL attempts to abstract underlying bus from i8042 code. Nearly
all i8042 logic is isolated already. This patch is intended to allow
us to use i8042 logic for processing keys and commands on boards which
do not necessarily use LPC as the host <--> KBC bus interface.

This CL does the following:
- Define KBC bus <--> host (kbc_host_bus) on a per-board basis in
  board.c.

- Add generic wrappers in place of lpc_keyboard_* in i8042 code.

- Define the behavior of generic wrappers in EC-specific keyboard
  sources. If board.c specifies LPC, then send via LPC.

TODO: This needs to be tested on real hardware...

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

BUG=None
TEST=Locally compiled for Link, BDS and Discovery.

Change-Id: I9cabd514bd44fd6b508c26994eccc3011eedbc0f
2012-02-15 18:20:28 -08:00
Vic Yang
93d77ada6c Change TMP006 temperature calculation to use FP.
The temperature calculation currently uses fixed point operations.
Change it to use floating point for better readability and maintenance.
Also changes disable_fpu() to accept parameter which serves as
optimization barrier to prevent floating point operations after
disabling FPU.

BUG=chrome-os-partner:7801
TEST=In console, tempremote "tempremote 29715 -105000 6390" gives 28506.

Change-Id: Ib766904b8feb9a78eac9f7cd53afeca85091c5a5
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-15 16:34:54 -08:00
Randall Spangler
805c89652f Check for recovery key sequence at init
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7451
TEST=hold down no keys; KB init state should be blank
hold down reload (F3); KB init should indicate recovery key pressed
hold down F3 + ESC; same
hold down F3 + F2 + ESC; KB init should NOT indicate recovery key pressed

Change-Id: I0fbf15407b20669396f667e6499ee5a9d545a4d5
2012-02-14 10:51:24 -08:00
Randall Spangler
1dd47c8ef3 Make port 80 output less scrolly
It was scrolling so much that the EC debug output for power state
transitions was getting lost.  Now it uses CR instead of LF.

Use 'port80 scroll' to turn scrolling back on (it's off by default).

Port 80 history is still visible via the 'port80' command, in all cases.

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

BUG=none
TEST=powerbtn  ; power on; should not scroll screen
port80  ; confirm history is still there
port80 scroll  ; enable scrolling
powerbtn ; turn system off
powerbtn ; turn system back on; should scroll screen
port80  ; confirm history is still there

Change-Id: I85d058ff0b2b9d3d5296060747bde5e872b85817
2012-02-14 09:34:02 -08:00
Vic Yang
938649ac67 Change temperature sensor debug command behaviour
Currently, 'tempsinfo' command would abort when encountering problems
reading temperature sensor info. Change this command to continue reading
succeeding sensors.

Also change 'temps' to show temperature in both 'K' and 'C' for better
reading and easier debugging.

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

Change-Id: I41a4068fb58804cb000e6725c0894aabd0104119
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-14 22:30:47 +08:00
Bill Richardson
12cdccc00c Add 'lightsaber' command to test the blinky lights.
BUG=chrome-os-partner:7839
TEST=none, work in progress

Change-Id: I20acde8db7f250227adcd4b9dc59328362e68720
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-02-13 16:16:20 -08:00
Randall Spangler
6b8e8be703 Fix discovery and bds builds, which don't have temp sensor or peci
Remove id field from temp_sensor_t struct, since it's only used by the
console command (which already knows the id, because it's looping over
it).

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

BUG=none
TEST='temps'

Change-Id: I0970850073d644509cd5501d7ac4421c7373143b
2012-02-13 10:41:34 -08:00
Bill Richardson
3b02beb41c Merge "Make strtoi() do the right thing for base==16" 2012-02-10 16:33:40 -08:00
Rong Chang
62df62ccd4 Add basic smart battery driver
This change adds a common part of smart battery driver. Following
features are not implemented, or in chip specific driver:
  Battery access control, authentication, factory mode
  Manufacturer access/data commands
  Block read/write, device name, flash data
  Chip specific features, per cell info/temp/capacity

Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7856
TEST=console command check battery staus
  [unplug power]
  > battery
  [check voltage,current,capacity,time to empty]
  [plug power]
  > charger voltage 8400
  > charger current 4250
  > battery
  [check current,time to full]
  > charger input 4032
  > battery
  [check current,time to full]
  [wait 130 seconds, charger watch dog timeout]
  > battery
  [check current]

Change-Id: Ifac17a0892f52e8f37eebc14b00e71f18360776c
Signed-off-by: Rong Chang <rongchang@chromium.org>
2012-02-10 16:12:56 -08:00
Bill Richardson
6e1cdb7898 Make strtoi() do the right thing for base==16
Before, strtoi("11", 0, 16) returned 11.
Now, strtoi("11", 0, 16) returns 17.

BUG=none
TEST=none
2012-02-10 16:11:30 -08:00
Randall Spangler
6063ad473c Add PECI module and CPU temperature monitoring
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7493
TEST='powerbtn' to boot main processor, then 'temps' and 'pecitemp'

Change-Id: Id57526ebb37c8aecb05ecebccc2824f462b9de1a
2012-02-10 14:09:42 -08:00
Louis Yung-Chieh Lo
186c81dcac Send scan code to host when power button is pressed/released.
But only if the system is in S0.

Approved at internal gerrit: 11595.

BUG=none
TEST=tested on bds.
2012-02-10 12:11:42 +08:00
Randall Spangler
e42cd379de Print repeated port 80 writes, for coreboot/uboot debugging
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7972
TEST=boot main processor; look for repeated sequential port 80 writes

Change-Id: I07b247130945296ce73177a342e0b2cf5645f4fb
2012-02-09 11:00:11 -08:00
chrome-bot
898aaf1914 Merge "Add tmp006 object temperature calculation" 2012-02-08 17:59:11 -08:00
Vic Yang
059c633a27 Add tmp006 object temperature calculation
Implement TMP006 object temperature calculation. Also add a console
command to calculate temperature with manually entered data.

BUG=chrome-os-partner:7801
TEST=In console, "tempremote 29715 -105000 6390" gives 285.00K.

Change-Id: I0f9193fb970fdc36566399e7083e73ab58965a85
2012-02-08 14:53:17 +08:00
Rong Chang
61e995edaa Fix charger init crash
The current calculation was wrong in previous code import. This CL
fixes current calculation, remove init input current setting, and
adds charger set commands.

Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7855
TEST=build and flash link image, run following commands:
    charger
    charger voltage 4096
    charger current 128
    charger input 4032
    charger

Change-Id: I156ffac9f03d490475088c430232622a12b9ec29
2012-02-07 18:06:20 -08:00
chrome-bot
16df421edc Merge "Initial bq24725 charger driver import" 2012-02-07 16:15:16 -08:00
Randall Spangler
7423b63ea3 More complete x86 power module
Supports turning system on and off via power button.

Also added 'powerbtn' command, which sends a power button press of the
specified duration, and deprecated the 'x86power s0' command, since
pressing the power button is a more correct way of powering on/off the
system.

Note that current coreboot doesn't seem to boot reliably; when it
fails, the x86 asks for S5 and then S0 a second later.  It boots about
every 3rd try.  No indication this is due to the EC; the EC just was
ignoring these requests until this CL.

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

BUG=chrome-os-partner:7851
TEST=reboot, 'powerbtn', system should power on
'powerbtn', system should power off
'powerbtn 5000', system should power off regardless of previous state
press power button, system should power on
press power button again, system should power off
hold power button 8 sec, system should power off regardless of previous state

Change-Id: I89f419553289b20c78a57bc8cb1699932b095aa1
2012-02-07 15:01:50 -08:00
Rong Chang
812b3f8cb6 Initial bq24725 charger driver import
Battery charging state machine contains many file changes.
This is the 1st part of the break down. Refactor original
test code into board dummy driver. Normalize charger API.
And import link's charger IC driver.

Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7855
TEST=build without warning and error
  BOARD=bds make
  BOARD=link make
  BOARD=discovery make

Change-Id: I34b6e9862a45331378916bc77653d4adb22ca548
2012-02-07 12:54:28 -08:00
Randall Spangler
f214e47717 Turn on when power button pressed
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7850
TEST=reboot, press power button; system should turn on
reboot, type 'x86power s0'; system should also turn on

Change-Id: Iac114c2655240d8aba81283d12f667f8e64d3ad3
2012-02-07 10:33:42 -08:00
Vic Yang
730f099c83 Handle up/down arrow keys for UART console.
Record commands used previously and use up/down arrow key to navigate in
the command history.
Also removed the command '.' of repeating last command as we can use up
arrow key now.

Also changed the behaviour of uart_write_char() to be blocking on
transmit FIFO full, so that we do not lose echoed character and do not
need to flush.

BUG=chrome-os-partner:7815
TEST=Type 'help' and enter. Then type 'aaaa' and up arrow key, should
show 'help', and pressing enter prints help.
Type 'hellp' and enter. Then type 'aaaaaa' and up arrow key, should show
'hellp'. Should be able to use left/right arrow key and backspace to
correct it to 'help', and pressing enter prints help.
Type 'help' and enter. Then type 'aaa', up arrow key, and down arrow
key. Should show 'aaa'.

Change-Id: I65c615d61bf63acb31bea329aa91a3202d4db0ad
2012-02-07 10:23:59 +08:00
chrome-bot
d3e1de758c Merge "Additional compilation fix-ups for non-LM4 targets" 2012-02-06 17:03:28 -08:00
David Hendricks
53c1c20fb8 Additional compilation fix-ups for non-LM4 targets
- Add #ifdef CONFIG_TEMP_SENSOR before #include'ing temp_sensor.h
  which actually requires temp_sensor_id to be defined.
  Revert the forward declare used earlier since it is not the
  correct solution in this case.
- Add #ifdef CONFIG_CHARGER before calling charger_init()

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

BUG=None
TEST=compiled on both BDS and Discovery

Change-Id: I60b7e4ba91eb958b3ad724cc9ffa9a12fe9c3a71
2012-02-06 15:40:23 -08:00
Randall Spangler
99b297f990 Merge "Increase simulated power button duration in x86power s0 command" 2012-02-06 15:35:32 -08:00
Randall Spangler
4a7bfe7c43 Increase simulated power button duration in x86power s0 command
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7906
TEST=from ec console, 'x86power s0' should power the system on reliably.

Change-Id: Idebfc8b4e86587b540934d245649f912ccb4aa95
2012-02-06 15:02:57 -08:00
Louis Yung-Chieh Lo
6409913523 Fix some scancodes: F1-F10, arrow keys, and search key.
F1-F7: swap scancode of set 1 and set 2
F8-F10: change from (F9, F10, F11)
arrow keys: swap scancode of set 1 and set 2
Search key: change from CapsLock key

BUG=none
TEST=tested on bds.

Change-Id: Ifb8e715a2cd5f8ea174f7c38647c5ce550382615
2012-02-06 23:15:59 +08:00
Louis Yung-Chieh Lo
d2fc22dcad Uses update_ctl_ram() in 'ctrlram' command.
BUG=none
TEST=tested on bds.

Change-Id: I564e1be8201558d755636205157a6f1c581ec0dc
2012-02-06 22:20:32 +08:00
Louis Yung-Chieh Lo
e3fa162827 Add ctrlram command to get/set controller RAM content.
BUG=none
TEST=tested on bds.

Change-Id: Ibfabf2c35d19c231f3ebe860877b9f4020b0f870
2012-02-06 12:21:53 +08:00
Vic Yang
000a6d5742 Refactor temperature sensor code and add support of Link I2C temp sensor.
Refactor board/chip-specific code into corresponding directories.
Add support of the four I2C temp sensor in Link.
Use table lookup to handle different types of temperature sensors.

BUG=chrome-os-partner:7527
TEST=Correctly read EC internal temperature on bds.
Compile for link succeeded.

Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2
2012-02-04 14:37:04 +08:00
Vincent Palatin
a72b9cc07e Split out GPIO console commands
The GPIO console commands are common to all platform, let's push them in
the common code.

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

BUG=None
TEST=make BOARD=link && make BOARD=bds && make BOARD=discovery
on BDS console, try gpioget command.

Change-Id: I26e6d26b8d661e78b80d5d5f665e81f4daef0c11
2012-02-03 02:00:27 +00:00
Vincent Palatin
55f990cd0f Fix image copy detection
When the flash base address is not zero (e.g. STM32L chip), the current
image index is wrongly computed.

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

BUG=None
TEST=check it compiles for all boards, run on Discovery board and see
proper value.

Change-Id: I06f5508cdffce6d754bd93e870d64087d299c9c7
2012-02-02 19:15:06 +00:00