Commit Graph

83 Commits

Author SHA1 Message Date
Vincent Palatin
a94e3277b3 update versioning information stored in the EC
Add build information (date/time/builder) which can be displayed at the
EC console.

Generate a version from the board name and the branch tag.

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

BUG=chromium-os:27013
TEST=on BDS, run version command on the console.
inspect the built binary.

Change-Id: Idb1f68898ba6b811d02919f17ab4536ed9f8934a
2012-03-02 16:46:26 +00:00
Randall Spangler
9a60f37c8d Refactor LPC status / result codes
This is necessary to support SCI/SMI events.

Note that this breaks compatibility with previous ectool builds - and
probably also breaks flashrom support.

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

BUG=chrome-os-partner:8253
TEST='ectool hello' and 'ectool flashinfo' still work
and 'ectool usbchargemode 3 1' fails with error 2

Change-Id: If39e5b6e7cdcec1b5ec765594e8492925b430b10
2012-03-01 15:22:14 -08:00
Vic Yang
747b1f7520 Thermal Engine: LPC commands.
Implement LPC commands and ectool commands to
  1. Set/get threshold temperature values.
  2. Toggle on/off automatic fan speed control.

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

BUG=chrome-os-partner:8251
TEST=Manual test

Change-Id: Ia4282a6fa47a838aed26540f33c1eb7acc92ef0e
2012-02-29 14:42:45 -08:00
Vic Yang
13b5c41951 Thermal Engine
The thermal engine monitors the temperature readings from all sensors.
For each sensor, five threshold temperatures can be set:
    1. Low fan speed.
    2. High fan speed.
    3. SMI warning.
    4. Shutdown CPU.
    5. Shutdown everything we can.
Each of these thresholds can be set to either a fixed value or disabled.
Currently the real implementation of SMI warning and shutting down is
left as TODO, as indicated in the comment.

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

BUG=chrome-os-partner:8250
TEST=Manually change threshold value to test all actions can be triggered.

Change-Id: If168dcff78ef2d7a3203cb227e1739a08eca961e
2012-02-28 16:51:54 -08:00
Randall Spangler
4c89ccd89e Register host commands the same clever way we do console commands
BUG=none
TEST=run assorted ectool commands

Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
2012-02-28 13:58:34 -08:00
Gerrit
e632029ed0 Merge "Add persistent host storage in EC EEPROM" 2012-02-28 13:34:37 -08:00
Randall Spangler
e84fc7b110 Add persistent host storage in EC EEPROM
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

from root shell on host:
  ectool pstoreinfo   --> should print PstoreSize 1024 AccessSize 4
  echo testing 1 2 3 4 > /tmp/infile
  ectool pstorewrite 8 /tmp/infile
  ectool pstoreread 8 /tmp/outfile
  diff /tmp/infile /tmp/outfile

Change-Id: I565e580307584f7def36c5e53d360c1a897d67d2
2012-02-28 13:02:17 -08:00
Gerrit
2a469c61cf Merge "Make all warnings into errors." 2012-02-28 10:08:56 -08:00
Gerrit
b4edad6922 Merge "Add APIs for thermal module to tell x86_power about overheating" 2012-02-27 18:42:52 -08:00
Randall Spangler
a395a7272d Add APIs for thermal module to tell x86_power about overheating
(implementation of APIs still todo)

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

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

Change-Id: Idbd38c4e873e95382ae815e1d5b827d95396be8f
2012-02-27 16:58:43 -08:00
Bill Richardson
ae8dd20d77 Make all warnings into errors.
Also fix a couple places where that makes it fail.

BUG=none
TEST=none

Change-Id: I3b434b4bfa547a579193aac67c1a9d440a2c4e51
2012-02-27 15:54:00 -08:00
Gerrit
2d94379984 Merge "EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM" 2012-02-27 15:50:44 -08:00
Vic Yang
44140b3c57 EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM
Actual RPM is now read from LPC mapped space. Modify this command to
return target RPM so we can verify EC receives target RPM.

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

BUG=chrome-os-partner:8238
TEST=Get the same value after setting target RPM.

Change-Id: I9bcc9edd327cec1311b51fd0fcbc4a43b353daff
2012-02-27 15:11:42 -08:00
Vic Yang
b9999a2c6c Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS
We now read temp sensor readings using the EC mapped space.
So we don't need this command.

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

BUG=chrome-os-partner:8239
TEST="ectool temps 0" works.

Change-Id: I47f425e45cea992b19734f39ac6d9f6db6433d39
2012-02-27 14:18:25 -08:00
Randall Spangler
28b89fdf94 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: I1be67004edb23ccd18ad434c9340bfbecc22e7c4
2012-02-27 12:32:20 -08:00
Dave Tu
80c2f0ff66 Revert "Disable fan PWM when +5VS is disabled"
This is causing a merge conflict on https://gerrit.chromium.org/gerrit/#change,16827.

This reverts commit 3a460ea765
2012-02-27 11:41:04 -08:00
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
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
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
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
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
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
Gerrit
30fc5d7284 Merge "Change TMP006 temperature calculation to use FP." 2012-02-15 17:29:01 -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
Gerrit
42c3bee3ea Merge "Reduce LPC command parameters to 128 bytes; add LPC memory-mapped space" 2012-02-15 16:06:35 -08:00
Randall Spangler
6101cebb6a Reduce LPC command parameters to 128 bytes; add LPC memory-mapped space
This will allow more efficient access to EC-provided data (temperature,
fan, battery) by the main processor.

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

BUG=chrome-os-partner:7857
TEST='ectool hello' from link main processor should still work

Change-Id: I2dc683f3441b34de9fb4debf772e386b9fdcfa82
2012-02-15 15:12:03 -08:00
Vic Yang
502613771e FPU control
Implement enable_fpu() and disable_fpu().
enable_fpu() disables interrupt and then enables FPU.
disable_fpu() disables FPU and enables interrupt.
Also added a CONFIG_FPU flag.

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

Change-Id: I2d71f396d9c7d7ac4a6a2d525f3d86f8aae87521
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 05:42:08 +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
Bill Richardson
e5b17f9047 Add 8-bit I2C read/write functions.
These provide 8-bit accesses to registers within an I2C device.

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

Testing will come when I start using them.

Change-Id: Ib53d3347253bccee93cb9c5da12db92970155d92
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-02-13 16:16:10 -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
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
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
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
chrome-bot
16df421edc Merge "Initial bq24725 charger driver import" 2012-02-07 16:15:16 -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
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
Randall Spangler
bd1d0b11c8 Merge "Add UART1 receive support (UART to x86 console)" 2012-02-06 15:56:00 -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
300e7edb87 Add UART1 receive support (UART to x86 console)
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7488
TEST=type things into the x86 console UART; should appear on the u-boot prompt

Change-Id: I75fd225842c03d11d79280fb7453ad37695279e3
2012-02-06 14:53:49 -08:00
David Hendricks
af9532d6fe Add forward declarations in ADC and temp_sensor headers
This is a trivial patch to fix compilation for boards that are not
based on LM4 (e.g. Discovery).

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

TEST=Compiled for Discovery
BUG=None

Change-Id: Ia1f29c61ff4a1f65fe65c43a8e58def7d1217ab2
2012-02-06 13:36:19 -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
Louis Yung-Chieh Lo
038b86ca8e Merge "Fix the missing IRQ problem." 2012-02-02 05:11:25 -08:00
Louis Yung-Chieh Lo
7e8d739b38 Fix the missing IRQ problem.
The problem comes from the different assumption of interrupt mode in EC and
the PCH. The PCH assumes IRQ1 is edge-triggered and triggered at a rising edge.
However, the auto-IRQ functino of EC is level-triggered and uses low-active to
assert an IRQ. This makes the deadlock so that the kernel never gets an
interrupt until a byte is manually pulled from host.

So, the solution is manually firing an IRQ_1 to host after EC puts a byte to
port 0x60. Note that the auto IRQ needs to be disabled in order to avoid
the interference with manual IRQ generation.

This CL also moves chip specific code to lm4/lpc.c and handle some minor
keyboard commands.

BUG=none
TEST=on hacked baord.

Change-Id: Ib57f5a4d749cb019e4c3c00da110054c4f335c7b
2012-02-02 20:51:45 +08:00
Vic Yang
b7f2a18859 Fix a bug that ADC input is not correctly configured.
The ADC input pin was always configured as BDS. Modified it to configure
the correct pin.

BUG=none
TEST=On Link, "rw 0x4002451C" show 0xff instead of 0xf7.

Change-Id: I1efd5cd59ad65f55cd673529afa6153add63ecac
2012-02-02 17:10:40 +08:00
chrome-bot
965987eeac Merge "Refactor ADC code and add Link charger current ADC support" 2012-02-01 18:55:58 -08:00
Vic Yang
1e5233a66d Refactor ADC code and add Link charger current ADC support
Refactor ADC code and move board/chip-specific part to corresponding
directories.
Implement function and console command to read Link charger current.

BUG=chrome-os-partner:7527
TEST=Read EC temperature and POT input on BDS.

Change-Id: I7fafd310ea49d9b2781f10c3453f5488da29a08a
2012-02-02 10:24:26 +08:00