Commit Graph

166 Commits

Author SHA1 Message Date
Vincent Palatin
c817472c07 Update Zinger flashing process
Convert the Zinger flash update commands to the new RSA signature
mechanism.

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

BRANCH=samus
BUG=chrome-os-partner:28336
TEST=from the workstation:
./util/flash_pd.py -m 1 build/zinger/ec.RW.bin
from Samus command-line :
ectool --name=cros_pd flashpd 0 1 ec.RW.bin

Change-Id: Ie8cd7f644ec94e461c5775a4dbbcd408782c72e1
Reviewed-on: https://chromium-review.googlesource.com/221560
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-10-07 03:37:48 +00:00
Mohammed Habibulla
876b0f0bdc ectool: Add hostcmd support to set fan duty cycle for each fan separately
ectool fanduty <percent>	- set all fans to <percent> duty cycle
ectool fanduty <fan> <percent>	- set <fan> to <percent> duty cycle

BUG=chrome-os-partner:23803
TEST=Tested the above EC commands on Auron
BRANCH=none

Change-Id: I06ca1552bd8f3412f6e90245da302c9f86ab6103
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221505
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-07 01:29:36 +00:00
Mohammed Habibulla
7b1e58cc43 ectool: Add host command support to set fan RPM for each fan separately
First case is for legacy support
ectool pwmsetfanrpm <targetrpm>		- set all fans to <targetrpm>
ectool pwmsetfanrpm <fan> <targetrpm>	- set <fan> to <targetrpm>

BUG=chrome-os-partner:23803
TEST=Tested the above EC commands on Auron
BRANCH=none
CQ-DEPEND=CL:220960

Change-Id: I8f447f53289abaa9c5cc1285f9f0921328fbf32c
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221291
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-03 22:27:03 +00:00
Mohammed Habibulla
75d7e31b9c ectool: add new host command to get number of fans
BUG=chrome-os-partner:23803
TEST="ectool pwmgetnumfans" returns correct number of fans on Auron
BRANCH=none

Change-Id: I2a1930a8f0965b08558bfb3c6424c571a6149bbb
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220960
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-03 22:26:52 +00:00
Mohammed Habibulla
938ba82bd7 ectool: Fix fanduty help
BUG=none
BRANCH=none
TEST=none

Change-Id: Iff09a24064d4245d2660dd307084cd701d03676b
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221202
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-03 04:30:01 +00:00
Eric Caruso
fb5ff7b1bb lightbar: add seq type PROGRAM for user-programmable sequences
This diff allows the user to send small programs to the EC and
gain control of the lightbar. Right now, this is only exposed
through ectool, and sysfs support will come later.

To send a program to the EC, use
$ ectool lightbar program /path/to/program.bin
and then start running the program with
$ ectool lightbar seq program

BUG=None
BRANCH=ToT
TEST=Using the above steps with hand-assembled programs.
  Checked that infinite bytecode loops do not hang the EC.
  Checked that bad opcodes exit with an error.
  Stress tested pushing programs and changing sequences.

Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Change-Id: I635fb041a5dc5c403f7c26fb9a41b5563be9b6b7
Reviewed-on: https://chromium-review.googlesource.com/219558
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-25 07:59:16 +00:00
Gwendal Grignou
fab7ac3b9a ectool: add new parameter to identify proper EC.
Add parameter name to identify which EC to talk to.
Superseed --dev parameter, removed soon.

--name cros_ec (the default): send commands to /dev/cros_ec.
--name cros_pd: send commands to /dev/cros_pd.
...

BUG=chrome-os-partner:31513
TEST=Tested on samus:
check ectool --name cros_pd version returns proper data:
ectool --name=cros_pd version
RO version:    samus_pd_v1.1.2079-8e4f9fc-dirt
....

CQ-DEPEND=CL:217297
BRANCH=ToT

Change-Id: Ie8b5c6c184d73a89b4445e88d6f104169176b9f3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217311
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-14 09:52:11 +00:00
Todd Broch
f5b7b32423 samus: enhance usbpd host command to return port status.
CL provides some useful information similar to the EC console command
'pd state <port>' when host command 'usbpd <port>' is sent from host
with no additional arguments.

Also added a few build asserts for role & mux strings.

BRANCH=none
BUG=chrome-os-partner:31690
TEST=manual

  ectool --interface=lpc --dev=1 usbpd 1
  Port C1 is enabled. Role:SNK Polarity:CC1 State:6
  # has zinger attached
  ectool --interface=lpc --dev=1 usbpd 0
  Port C0 is enabled. Role:SNK Polarity:CC1 State:2

Change-Id: Id44eb7bf6a6fcfa888a0008a2249601967c50bcc
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217138
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-09-11 20:00:12 +00:00
Todd Broch
7698c323ea samus: Add host command to query USB type-C accessory attached.
PD accessories that are RW update-able will broadcast their rw_hash
SHA1 digest upon connection to the PD MCU which will store it.

For update purposes, the host needs that accessories device id and
rw_hash to determine its proper firmware update payload.

This CL creates a host command that requests the type-C accessory info
attached to a particular port.  It also implements an ectool command
to expose the host command.

BRANCH=none
BUG=chrome-os-partner:31361
TEST=manual,
  # connect zinger to port 1 on samus
  ectool --dev=1 --interface=lpc infopddev 1
  Port:0 Device:1 Hash:  0x7f4d7a13 0xf07b65b9 0x41181e10 0xb99b3d5f 0x9dee1206

  ectool --dev=1 --interface=lpc infopddev 0
  Port:0 has no valid device

Also do the same on port 0 with similar results.

Change-Id: Id63c7edad77a43d43c14d8cd6bd96e08d0d9b501
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/216814
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-09-11 20:00:07 +00:00
Todd Broch
d9c6380a66 samus: Add host command to store USB PD device id & rw_hash entry.
PD accessories that are RW update-able will broadcast their rw_hash
SHA1 digest upon connection and remain in RO briefly for a response.

In order to speed-up the response and decouple common case of
accessory is up-to-date, the PD MCU will keep a small 4 entry table of
PD accessory device ids and their corresponding RW hashes for quick
lookup.

The AP will be the source of new updates and their corresponding
device id's and RW hashes and therefore needs a method to update the
PD MCU table.

This CL creates the table, host command & ectool command to facilitate
future driver / daemon to update the RW hash entries.

BRANCH=none
BUG=chrome-os-partner:31361
TEST=manual,

  # from AP
  for i in `seq 1 8` ; do
    ectool --dev=1 --interface=lpc rwhashpd $i $i $i $i $i $i
  done

  # from samus_pd console
  pd rwhash
  Device:5 Hash: 0x00000005 0x00000005 0x00000005 0x00000005 0x00000005
  Device:6 Hash: 0x00000006 0x00000006 0x00000006 0x00000006 0x00000006
  Device:7 Hash: 0x00000007 0x00000007 0x00000007 0x00000007 0x00000007
  Device:8 Hash: 0x00000008 0x00000008 0x00000008 0x00000008 0x00000008

Change-Id: Ibe87b3594793cd5215eba42160489b26974aadbc
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/214366
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-09-11 19:59:59 +00:00
Alec Berg
e913bc15b8 samus: add host commands for flashing zinger RW
This adds a new host commmand for sending RW updates to PD devices.
The host command has a variety of sub-commands for performing the
update, including: erase RW, reboot, write new hash, write flash.

To program zinger RW, you should send host commands in this order:
write new hash to all 0's
reboot (zinger boots into RO since RW hash doesn't match)
erase RW
write flash
write new hash to match contents of RW
reboot

This also adds an ectool command to write a new RW. Just pass it
the RW .flat or .bin file.

BUG=chrome-os-partner:31361
BRANCH=none
TEST=ectool --dev=1 --interface=lpc flashpd 0 0 zinger.RW.flat

Change-Id: Ia81615001b83ad7ee69b1af2bf1d7059177cde04
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/213239
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-08-26 23:06:23 +00:00
Vic Yang
139a9c6880 Host command for USB PD role and mux control
This allows us to control PD role and type-C mux through ectool.

BUG=None
TEST=Change role/mux on samus using ectool:
     $ ./ectool --interface=lpc --dev 1 usbpd 0 usb
     -> In EC console, 'typec 0' shows 'Superspeed USB1'
     $ ./ectool --interface=lpc --dev 1 usbpd 0 sink
     -> In EC console, 'pd 0 state' shows 'force sink'
BRANCH=None

Change-Id: I5b90fb53ea1c30e3bc269c12d61e4398c5dcee6c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/209956
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-07-30 05:31:35 +00:00
Randall Spangler
241cc62685 samus: add options for device passthru and interface
This allows sending host commands to the PD chip through the EC.

The --interface option allows forcing a particular host interface.
This is necessary at present because the crosec device driver doesn't
support host protocol v3 so only has 8-bit command numbers.

BUG=chrome-os-partner:30079
BRANCH=none
TEST=from EC console,
   ectool version -> prints EC version
   ectool --interface=lpc --dev=0 version -> prints EC version
   ectool --interface=lpc --dev=1 version -> prints PD version
   ectool --interface=lpc --dev=2 version -> prints error
   ectool --interface=i2c version -> can't find EC
   ectool --interface=dev version -> prints EC version

Change-Id: I9dd10578dac77e3e104d19e2f37759814eec6ca2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207948
2014-07-16 07:16:47 +00:00
Randall Spangler
94126fbfa3 Add getopt support to ectool
This is needed for supporting device passthru.  Right now, the --dev
option simply prints an error.

BUG=chrome-os-partner:30079
BRANCH=none
TEST=manual
	ectool -> prints an error
	ectool help -> prints list of commands
	ectool version -> prints EC version
	ectool --dev=0 version -> prints EC version
	ectool --dev=1 version -> prints error about bad device 1
	ectool --dev=0 -> prints an error (because there's no command)
	ectool --dev=0 foo -> prints 'unknown command foo'

Change-Id: I0f431a4789428cd6cc8ef48b396b38237935282a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207904
2014-07-15 04:04:02 +00:00
Dave Parker
88c0ffd692 ectool: Add back support for version 0 of batterycutoff command
ectool must support all prior versions of commands that shipped
EC binaries use.

BUG=chrome-os-partner:29830
BRANCH=None
TEST=Manual
With an EC that only supports version 0:
- Run 'ectool batterycutoff' -> success
- Run 'ectool batterycutoff at-shutdown' -> error with explicit
  message about at-shutdown not being supported
- Run 'ectool batterycutoff foo' -> error, bad parameter
With an EC that support version 0 or 1:
- Run 'ectool batterycutoff' -> success
- Run 'ectool batterycutoff at-shutdown' -> success
- Run 'ectool batterycutoff foo' -> error, bad parameter

Change-Id: Ia88cfc5fa7c5125828ec0595f0b6a505916c97ea
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205155
Reviewed-by: Vic Yang <victoryang@chromium.org>
2014-06-26 02:42:32 +00:00
Dave Parker
efd3a8925e Add 'at-shutdown' option to batterycutoff host command
If at-shutdown is specified, the battery is cut off
1 seconds after the host has shutdown.

BUG=chrome-os-partner:29292,chrome-os-partner:28887
BRANCH=tot,nyan
TEST=Run batterycutoff ectool command and cutoff console
command with and without 'at-shutdown' option. Verify
the battery is cut off immediately without the option
specified and 1 seconds after shutdown with. View the
console log to see the deferred cutoff occur.

The following tests are verified on big.

console:
  cutoff, AC on: system is off after removing AC.
  cutoff, AC off: system is off immediately.
  at-shutdown, AC on: system is off after "power off" and removing AC.
  at-shutdown, AC off: system is off after "power off".
ectool:
  batterycutoff, AC on: system is off after removing AC.
  batterycutoff, AC off: system is off immediately.
  at-shutdown, AC on: battery is cut off after 1s of shutdown.
                      system is off right after removing AC power.
  at-shutdown, AC off: system is off after 1s of shutdown.
      [84.058416 power state 3 = S0, in 0x0000]
      [84.058803 power lost input; wanted 0x0001, got 0x0000]
      [84.059120 power off 3]
      [84.072148 Cutting off battery in 1 second(s)]
      [84.123896 power shutdown complete]
      [84.128790 power state 7 = S0->S3, in 0x0002]
      [84.139694 power state 2 = S3, in 0x0002]
      [84.150857 power state 8 = S3->S5, in 0x0002]
      [84.166975 power state 1 = S5, in 0x0002]
      [84.177972 power state 1 = S5, in 0x0002]
      [85.080012 Battery cut off succeeded.]

Change-Id: Id4bacf79ad3add885260655f80cb8127bafe1ad6
Signed-off-by: Dave Parker <dparker@google.com>
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/203694
Reviewed-by: Vic Yang <victoryang@chromium.org>
2014-06-15 01:45:21 +00:00
Bill Richardson
f7ae0fb81b Add display-battery-level function to lightbar
This adds a new lightbar sequence (TAP), which temporarily displays the
battery level. It pulses if the system is charging.

BUG=chrome-os-partner:29041
BRANCH=ToT
TEST=manual

From the EC console, run

  lightbar seq tap

The lightbar should change temporarily.

Then run

  lightbar demo on

and press the Up, Down, Left, and Right keys to fake the battery charge
level (up & down) and the AC present state (left & right). Run the

  lightbar seq tap

command periodically to watch it change.

Change-Id: I84ff928d93060f7ef7d46d608732d37cf5185aff
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202964
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-06-07 06:01:00 +00:00
Bill Richardson
9d3286301d Add GET_RGB, GET_BRIGHTNESS, and GET_DEMO subcommands to lightbar
This adds three new lightbar subcommands to the EC_CMD_LIGHTBAR_CMD host
command, allowing the AP to read the current brightness level, the
current lightbar LED values, and the state of demo mode.

Because this is new, also update LIGHTBAR_IMPLEMENTATION_VERSION. All the
previous commands are unchanged, though.

BUG=chrome-os-partner:28596
BRANCH=ToT
TEST=manual

From the AP, run these commands to see the changes:

  ectool version
  ectool lightbar brightness
  ectool lightbar 0
  ectool lightbar 1
  ectool lightbar 2
  ectool lightbar 3
  ectool lightbar demo

The version output is different, the other commands used to just emit
errors.

Change-Id: If32a5d2388217edc3ae7b9b091d66e9d2cf753be
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199881
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-05-15 05:18:16 +00:00
Wenkai Du
372317af34 CHROMIUM: ec: Add Port 80 history access from ectools
While debugging reboot issue, it was difficult to get POST code from failing
boards. Currently POST code is only accessible from EC console. Not all boards
are fitted with servo board.

This patch adds Port 80 history access from ectool. Reuse command code 0x48,
EC_CMD_PORT80_LAST_BOOT with version 1.

Signed-off-by: Wenkai Du <wenkai.du@intel.com>

BUG=chrome-os-partner:28514
BRANCH=rambi
TEST=manually test on rambi to confirm port 80 history match EC console

Change-Id: If204d8fb457d8d8d18055f8282a406a35c03305e
Reviewed-on: https://chromium-review.googlesource.com/198012
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Wenkai Du <wenkai.du@intel.com>
Commit-Queue: Wenkai Du <wenkai.du@intel.com>
Tested-by: Wenkai Du <wenkai.du@intel.com>
2014-05-07 03:41:27 +00:00
Mohammed Habibulla
2457b509cc Added v1 version of ectool gpioget supporting more functions
ectool gpioget             - returns all GPIOs (with flag info)
ectool gpioget <GPIO_NAME> - get value of <GPIO_NAME>
ectool gpioget count       - returns number of GPIOs
ectool gpioget all         - returns all GPIOs (with flag info)

BUG=chromium:344969
TEST="ectool gpioget [<subcmd> <GPIO_NAME>]" returns correct information
on squawks
BRANCH=none

Change-Id: Ib6f0d8135a76501f08b084bfd7eb1f2689d5d6e0
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196680
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-29 03:11:16 +00:00
Dave Parker
4e1472e303 Add host command to set battery vendor parameters
Also adds 'battparam' console command.

BUG=chrome-os-partner:25145
BRANCH=ToT
TEST=Run 'ectool batteryparam set 0 0x1234'
         'ectool batteryparam get 0'
and on the console:
         'battparam 0'
         'battparam 0 0x1234'
on a board that implements parameter 0.

Change-Id: I9cc54d001631f53dd39ae64cfdeececaa1747181
Original-Change-Id: Ib2812f57f2484309d613b23dab12ad43e0417bd2
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195824
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197162
2014-04-29 03:11:01 +00:00
Alec Berg
eaa645e0cc accel: Add host cmd for setting lid angle threshold for disabling keyboard wake
Added a sub-command to the motionsense host command (0x2b) for getting/setting
the lid angle at which the keyboard is disabled as a wake source in S3. The
value can be anywhere from 0 to 360 degrees, default set to 180. Note, this
only takes affect for boards that have CONFIG_LID_ANGLE_KEY_SCAN defined.
Modified ectool motionsense command to use new host sub-command.

Also modified the lid angle measurement in the EC to be in the range [0, 360],
instead of [-180, 180], and changed casting of lid angle as an int to round
to nearest.

BUG=none
BRANCH=rambi
TEST=Tested on a glimmer:
Using default keyboard disable lid angle of 180, made sure that when lid
angle is past 180, key presses do not wake system, and when lid angle is
less than 180, key presses do wake up system.

Used ectool motionsense kb_wake to set the keyboard disable lid angle to 0.
Made sure that keyboard never wakes up the system. Set keyboard disable lid
angle to 360 and made sure that the keyboard always wakes up the system.

Change-Id: I437164c6e38c29169ef6e20e86c9cf2a1c78f86e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193663
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194172
2014-04-11 04:00:44 +00:00
Alec Berg
335ad0c397 accel: Add arg to ectool motionsense to print sensor active flag.
Added arg to ectool motionsense command to print the active flag.

BUG=none
BRANCH=rambi
TEST=Tested ectool command on glimmer

Change-Id: I4066302d388857b2646a4ee778aa7f671e9b7d2a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193630
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
(cherry picked from commit 6c09268ca19d7d3db497beff65a5db79f33657cb)
Reviewed-on: https://chromium-review.googlesource.com/194082
2014-04-10 22:23:32 +00:00
Alec Berg
b12206307e accel: refined motion sense host command interface
Added enum for motion sensor ID's into ec_commands.h so that the host
can easily send host commands targeting the desired accelerometer.

Changed sensor present flag to just senosr flags, currently with only a
single mask defined for sensor present. This allows for easier future
expansion of various flags.

Also, added a motion sense module flags to the dump sub-command for flags
that represent all sensors, such as is the motion sense task active.

BUG=chrome-os-partner:27321
BRANCH=rambi
TEST=Manual test on a glimmer by testing ectool motionsense command

Change-Id: Iac052269a60db9ff4506f0490c3a0c6daad5b626
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193122
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193309
2014-04-05 03:27:13 +00:00
Alec Berg
529548208c accel: add host command to modify accel params and add ectool command
Created a host command to set/get various motion sensor parameters and
added an ectool command to use that host command.

The host command is created such that the first argument is a
sub-command. Sub-commands created include:
dump: dumps all current motion sensor data
info: returns general information about each motion sensor
ec_rate: set/get the EC sampling rate of sensors
sensor_range: set/get the sensor range (ie +/- 2G,4G,8G)
sensor_odr: set/get the sensor output data rate (ie 50Hz, 100Hz, ...)

For sensor_range and sensor_odr parameters, since the host doesn't know
what are valid values for the parameter, the host can specify to round
up or down to the nearest valid value. For example, the host can specify
to set the output data rate to at least 100Hz, and the EC will return
the closest valid output data rate that is at least 100Hz.

BUG=chrome-os-partner:27321
BRANCH=rambi
TEST=Test on a glimmer using ectool from vt-2 prompt:

> ectool motionsense help
Usage:
  motionsense                            - dump all motion data
  motionsense info NUM                   - print sensor info
  motionsense ec_rate [RATE_MS]          - set/get sample rate
  motionsense odr NUM [ODR [ROUNDUP]]    - set/get sensor ODR
  motionsense range NUM [RANGE [ROUNDUP]]- set/get sensor range
>
> ectool motionsense
Sensor 0: 0, 0, 1024
Sensor 1: 1024, 0, 0
Sensor 2: None
> ectool motionsense info 0
Type:     accel
Location: base
Chip:     kxcj9
> ectool motionsense ec_rate
10
> ectool motionsense ec_rate 1000
1000
> ectool motionsense odr 0
100000
> ectool motionsense odr 0 40000 1
50000
> ectool motionsense range 0 8
8

After running this I verified on the EC console that all the parameters
were set appropriately. I tested the EC sampling rate was 1000ms by
running lidangle on and making sure samples were displayed roughly every
second. I verified the sensor odr and range by defining
CONFIG_CMD_ACCELS and typing:

> accelrange 0
8
> accelrate 0
50000

Change-Id: I444e2f0eafabd607f1c7aa78b5c4e91f6cb06387
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192064
Reviewed-on: https://chromium-review.googlesource.com/193307
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-05 03:25:47 +00:00
Bill Richardson
f06ad7e2ab Add host command to control charge state v2
This replaces the obsolete and temporary (ha!) EC_CMD_CHARGE_DUMP host
command with EC_CMD_CHARGE_STATE. This is used to monitor and adjust the new
charge state implementation, including any board-specific customizations.

This command is a single catch-all command with multiple subcommands
(similar to EC_CMD_LIGHTBAR_CMD) so that we don't have to keep adding new
top-level host commands just to support incremental changes.

BUG=chrome-os-partner:23776
BRANCH=ToT
TEST=manual

From the AP, try these commands:

  ectool chargestate show
  ectool chargestate param
  ectool chargestate param <NUM>
  ectool chargestate param <NUM> <VALUE>

Watch the EC console and use its "chg" command to verify the effects of
setting various params.

Note: the Samus-specific fast-charging profile override is param 0x10000.
You can check it with the EC console "fastcharge" command.

Change-Id: Iad2f773a085bc25c05073b3eed9866f122ae9d78
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193305
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-05 01:42:21 +00:00
Louis Yung-Chieh Lo
71766a3926 ectool: "temps all" lists nothing if no sensor connects to EC.
On some boards, the temperature sensor doesn't route to EC.
Thus the 'ectool temps all' would get "200" for every temp sensor.
This is misleading information.

So, check the EC_MEMMAP_THERMAL_VERSION before we dump. If it is 0,
then the temp data is not filled (and properly will not be filled).

BUG=chrome-os-partner:27460
BRANCH=all
TEST=Tested on big, which doesn't have sensor routed to EC.

Change-Id: I03e9736054ed602b7cc126e9fd958e0cecea79b4
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192149
Reviewed-by: Mao Huang <littlecvr@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-01 02:46:37 +00:00
Randall Spangler
c42bf99402 samus: Add host command to read raw tmp006 data
This is needed to calibrate the tmp006 remote sensor values.

BUG=chrome-os-partner:26581
BRANCH=none
TEST='ectool tmp006raw N' works for N=0,1,2,3
     And fails with invalid param for N=4.
     Data matches result of tmp006 ec console command.

Change-Id: I04ec093c7727b55caca7d02baaf373d1ff234731
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189207
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-03-07 20:33:31 +00:00
Randall Spangler
4eddcbd748 ectool: pwmgetfanrpm supports multiple fans
The EC already provided this information, but ectool wouldn't print it.

BUG=chrome-os-partner:23803
BRANCH=samus
TEST=from ec console, 'fanset 0 3000' and 'fanset 1 1000'
     ectool pwmfangetrpm -> prints both fans
     ectool pwmfangetrpm all -> prints both fans
     ectool pwmfangetrpm 0 -> prints ~3000
     ectool pwmfangetrpm 1 -> prints ~1000

Change-Id: I19d3081d09edd42c16bf8b0cdbc48ca58d134027
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187454
Reviewed-by: Sameer Nanda <snanda@chromium.org>
2014-02-22 00:50:39 +00:00
Randall Spangler
930b41e6a9 Allow AP to set wireless power state in suspend
Previously, the AP could only set the current wireless power state.
It couldn't determine what the EC would do in S3, nor could it get the
current wireless power state.  Extend the wireless command to do so,
and add an EC console command to aid in debugging.

BUG=chrome-os-partner:25655
BRANCH=rambi
TEST=manual; expected numbers are from EC 'wireless' command
  AP off -> 0x0, 0x9
  AP on -> 0xd 0x9
  AP suspended -> 0x9 0x9
  AP on -> 0xd 0x9
  ectool wireless 0x1 -> 0x1 0x9
  ectool wireless 0xd -> 0xd 0x9
  ectool wireless 0 0 0 0 -> 0xd 0x9 (and prints 0xd 0x9 to root shell)
  ectool wireless 5 -1 -1 0 -> 0x5 0x9
  AP suspended -> 0x1 0x9 (doesn't turn on 0x8, just turns off 0x4)
  AP on -> 0xd 0x9
  ectool wireless 0 0 0 -1 -> 0xd 0x0
  AP suspended -> 0x0 0x0
  AP on -> 0xd 0x9

Change-Id: I8ead2d4a4423b51ec4f638bf94c62de98726b25c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187273
2014-02-22 00:50:37 +00:00
Louis Yung-Chieh Lo
9ccbedda19 nyan: add 'max_size' parameter to read_mapped_string()
We changed the behavior of indata.size==0 case in cros_ec kernel driver.
This breaks the nyan battery driver. Change the ectool as well.

BUG=chrome-os-partner:24851
BRANCH=nyan
TEST=verified on nyan rev B
% ectool battery
Battery info:
  OEM name:               SANYO
  Model number:           AP13J3K
  Chemistry   :           LION
  Serial number:          174E
  Design capacity:        4030 mAh
  Last full charge:       4030 mAh
  Design output voltage   11250 mV
  Cycle count             0
  Present voltage         12934 mV
  Present current         0 mA
  Remaining capacity      3966 mAh
  Flags                   0x03 AC_PRESENT BATT_PRESENT

Change-Id: Id63d933802ed85d7f5d8f1c53e6389b083f41a8a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181667
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-07 02:52:54 +00:00
Randall Spangler
6ab8e91658 cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols
to keep checkpatch from complaining.  The goal is to reduce the
temptation to use 'repo upload --no-verify'.

This is a big furball of find/replace, but no functional changes.

BUG=chromium:322144
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180495
2013-12-19 00:12:28 +00:00
Randall Spangler
616e70998d Add AP hang detection
BUG=chrome-os-partner:24558
BRANCH=none
TEST=see procedure in bug

Change-Id: I42614a1da5f24c93b6267d81339ff9d721bf0d8f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180080
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-12-17 21:27:53 +00:00
Vincent Palatin
1762de9d19 extract common core code
Move the non-core dependent code out of core/$(CORE) directory to
common/ directory.

Put all panic printing code in common/panic_output.c
Put timer management code in common/timer.c

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

BRANCH=none
BUG=chrome-os-partner:23574
TEST=./util/make_all.sh
use "crash divzero" and "panicinfo" on Link.

Change-Id: Ia4e1ebc74cd53da55fe24f69e96f39f512b9336d
Reviewed-on: https://chromium-review.googlesource.com/178871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2013-12-05 22:30:58 +00:00
ChromeOS Developer
9a568cc154 Add boardversion command to ectool
BRANCH=none
BUG=chromium:318342
TEST=Run "ectool boardversion" on device with and without support
for board ID. Note, boards without support will return an error.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: Ib7599570c84a7ed5cf70ce9d8336467785b35569
Reviewed-on: https://chromium-review.googlesource.com/176543
2013-11-13 05:19:09 +00:00
Randall Spangler
c1e02ca220 cleanup: Yes, even more TODO comments
Almost done.  Comment changes only.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I974dfc12aa264e2035b3bae35a089c19344e7d45
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-04 19:48:49 +00:00
Randall Spangler
c0fbbaefed cleanup: comments in i2c modules
No code changes; just update comments with bug links

BUG=none
BRANCH=none
TEST=build all platforms

Change-Id: I8b845f9c43315b7db5a746a16c6618c3ee96979d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174614
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-25 01:32:31 +00:00
Yunlian Jiang
fe0b6c1acd ec: fix duplicate 'const' declarartion.
BRANCH=None
BUG=chromium:292965
TEST=CC="i686-pc-linux-gnu-clang" CXX="i686-pc-linux-gnu-clang++"
     emerge-x86-generic chromeos-ec passes.
Signed-off-by: yunlian@chromium.org

Change-Id: I936f5e9b3e6ab5a5c1c2f6b6c41d054d748545e3
Reviewed-on: https://chromium-review.googlesource.com/169633
Reviewed-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2013-09-17 23:17:13 +00:00
Bill Richardson
bd9d1746c7 Change get-set host command to be less generic
Having a per-device enum list for use by the EC_CMD_GET_SET_VALUE command
won't work when the one-and-only ectool tries to talk to different devices.
Any particular enum may be missing or have a completely different meaning.

Instead, we can do the same thing that EC_CMD_HOST_EVENT_* does - use the
same structs for a bunch of different commands.

If/when we run out of command numbers (it's currently only 8 bits), we'll
just switch to using EC protocol v3 (see crosbug.com/p/20820), which
provides 16 bits for the command.

This CL renames EC_CMD_GET_SET_VALUE to EC_CMD_GSV_PAUSE_IN_S5 (since that's
the one-and-only use of it at present), and renames the params/response
structs as well. Since only the names are changing, the implementation
remains backwards-compatible (assuming the flags value usage is preserved by
ectool for the EC_CMD_GSV_PAUSE_IN_S5 command, which it is).

If I can cherry-pick this change into the one place where it's being used, I
will.

BUG=chromium:287969
BRANCH=ToT
TEST=manual

Although this is primarily an internal name change, it also means that the
commands to invoke the previous usage of this feature have changed. To test:

On Haswell systems only.

To enable the pause in S5 at shutdown, do either of these:

  EC console:      pause_in_s5 on
  root shell:      ectool pause_in_s5 on

Shut the AP down politely, and it should pause in S5 for 10 seconds before
continuing to G3. You can see this by watching the EC console.

To disable the pause in S5 at shutdown, do any of these:

  EC console:      pause_in_s5 off
  root shell:      ectool pause_in_s5 off

or

  press Refresh + POWER

Boot the system, then politely shut down. This time it should go directly to
G3 without pausing in S5.

Change-Id: Ic614fed37ad89db794c2bbcca2b83d1603030ab2
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/168816
2013-09-12 01:49:32 +00:00
Bill Richardson
2a31e2ac4b Add command for Haswell to pause in s5 at shutdown
At normal AP shutdown, Haswell systems skip S5 entirely and go directly to
G3. It's sometimes handy to pause in S5 as the other systems do, for things
like power-cycle tests that use the RTC to do a delayed wake from S5.

This CL adds a console command and a host command to enable/disable that
pause in S5.

The default is to skip S5, and the override value is not persistent across
EC reboots, so whenever the EC hibernates or reboots (Refresh + Power, software
sync), you'll have to re-enable it again.

BUG=chrome-os-partner:22346
BRANCH=falco,ToT
TEST=manual

On Haswell systems only.

To enable the pause in S5 at shutdown, do either of these:

  EC console:      gsv s5 1
  root shell:      ectool pause_in_s5 on

Shut the AP down politely, and it should pause in S5 for 10 seconds before
continuing to G3. You can see this by watching the EC console.

To disable the pause in S5 at shutdown, do any of these:

  EC console:      gsv s5 0
  root shell:      ectool pause_in_s5 off

or

  press Refresh + POWER

Boot the system, then politely shut down. This time it should go directly to
G3 without pausing in S5.

Change-Id: I324e6e2373bc20b61a731b4ef443d7bb8edb6b83
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/168086
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-09-06 00:13:17 +00:00
Bill Richardson
32045efb23 Add LIGHTBAR_CMD_VERSION command to detect lightbar features.
Most systems don't have a lightbar. Those that do need a way to detect that
one exists. That's easily done by just sending a EC_CMD_LIGHTBAR_CMD command
to the EC and checking the result. If the response is
EC_RES_INVALID_COMMAND, there isn't a lightbar.

But what .cmd value should we use in struct ec_params_lightbar? Future
lightbar implementations (if any), could remove existing functions or add
new ones, so there isn't a safe choice.

This change adds a LIGHTBAR_CMD_VERSION operation to determine if any new
implementation exists. Future systems should return some useful information
in response to this command. Existing systems will return
EC_RES_INVALID_PARAM, which is enough to distinguish them.

BUG=chromium:239205
BRANCH=none
TEST=manual

make BOARD=link
make BOARD=link runtests

There are no user-visible changes in functionality to anything.

Change-Id: Ibe37f74a4dcbf68dd6bfd1963530aec907e67534
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167549
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-30 16:47:14 +00:00
Bill Richardson
fcce7223a5 Completely new thermal/fan implementation
Problems with existing thermal control loop:
* Not multi-board friendly. thermal.c only supports Link and needs
  refactoring. Temp thresholds and fan speeds are hard-coded.
* Only the PECI temp is used to determine the fan speed. Other temp sensors
  are ignored.
* Has confusing data structures. Values in the CPU temp thresholds array mix
  ACPI thresholds with fan step values.

With this change, the thermal task monitors all temp sensors in order to
perform two completely independent functions:

Function one: Determine if the host needs to be throttled by or informed of
              any thermal events.

For thermal events, each temp sensor will have three threshold levels.

TEMP_HOST_WARN
* When any sensor goes above this level, host_throttle_cpu(1) will be called
  to ask the CPU to slow itself down.
* When all sensors drop below this level, host_throttle_cpu(0) will be called.
* Exactly AT this level, nothing happens (this provides hysteresis).

TEMP_HOST_HIGH
* When any sensor goes above this level, chipset_throttle_cpu(1) will be
  called to slow the CPU down whether it wants to or not.
* When all sensors drop below this level, chipset_throttle_cpu(0) will be
  called.
* Exactly AT this level, nothing happens (this provides hysteresis).

TEMP_HOST_SHUTDOWN
* When any sensor is above this level, chipset_force_shutdown() will be
  called to halt the CPU.
* Nothing turns the CPU back on again - the user just has to wait for things
  to cool off. Pressing the power button too soon will just trigger shutdown
  again as soon as the EC can read the host temp.

Function two: Determine the amount of fan cooling needed

For fan cooling, each temp sensor will have two levels.

TEMP_FAN_OFF
* At or below this temperature, no active cooling is needed.

TEMP_FAN_MAX
* At or above this temperature, active cooling should be running at maximum.

The highest level of all temp sensors will be used to request the amount of
active cooling needed. The function pwm_fan_percent_to_rpm() is invoked to
convert the amount of cooling to the target fan RPM.

The default pwm_fan_percent_to_rpm() function converts smoothly between the
configured CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX for percentages
between 1 and 100. 0% means "off".

The default function probably provide the smoothest and quietest behavior,
but individual boards can provide their own pwm_fan_percent_to_rpm() to
implement whatever curves, hysteresis, feedback, or other hackery they wish.

BUG=chrome-os-partner:20805
BRANCH=none
TEST=manual

Compile-time test with

  make BOARD=falco runtests

On the EC console, the existing fan commands should work correctly:

  faninfo       - display the fan state
  fanduty NUM   - force the fan PWM to the specified percentage (0-100)
  fanset RPM    - force the fan to the specified RPM
  fanset NUM%   - force the fan to the specified percentage (0-100) between
                  its configured minimum and maximum speeds from board.h
                  (CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX)
  fanauto       - let the EC control the fan automatically

You can test the default pwm_fan_percent_to_rpm() with

  fanset 1%
  faninfo

The fan should be turning at CONFIG_PWM_FAN_RPM_MIN. Let the EC control it
automatically again with

  fanauto

Also on the EC console, the thermal settings can be examined or changed:

  > temps
  PECI                : 327 K = 54 C
  ECInternal          : 320 K = 47 C
  G781Internal        : 319 K = 46 C
  G781External        : 318 K = 45 C
  >
  > thermalget
  sensor  warn  high  shutdown   fan_off fan_max   name
    0      373   387    383        333     363     PECI
    1        0     0      0          0       0     ECInternal
    2        0     0      0          0       0     G781Internal
    3        0     0      0          0       0     G781External
  >
  > help thermalset
  Usage: thermalset sensor warn [high [shutdown [fan_off [fan_max]]]]
  set thermal parameters (-1 to skip)
  >
  > thermalset 2 -1 -1 999
  sensor  warn  high  shutdown   fan_off fan_max   name
    0      373   387    383        333     363     PECI
    1        0     0      0          0       0     ECInternal
    2        0     0    999          0       0     G781Internal
    3        0     0      0          0       0     G781External
  >

From the host, ectool can be used to get and set these parameters with
nearly identical commands:

  ectool thermalget
  ectool thermalset 2 -1 -1 999

Change-Id: Idb27977278f766826045fb7d41929953ec6b1cca
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66688
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-23 10:38:36 -07:00
Dave Parker
63a71a6adc Peppy ectool led command
Glue between the existing ectool led command and the
led control logic.

BUG=chrome-os-partner:20776
BRANCH=peppy
TEST=Manual. Run "ectool led" commands:

Should pass:
ectool led power blue|yellow|off|auto|blue=1 yellow=1
ectool led battery blue|yellow|off|auto|blue=1 yellow=1

Should fail:
ectool led adapter <color>
ectool led power|battery red|green|white

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I2540940baa553866760dd9ae62278b6b845793ef
Reviewed-on: https://gerrit.chromium.org/gerrit/64627
2013-08-07 12:43:48 -07:00
Dave Parker
7f1c49ab4b Add ectool discharge command to Falco and Peppy.
Expands and renames ectool 'chargeforceidle' command to
'chargecontrol'. Board-specific calls are needed to enable and
disable the discharge while on AC power state.

BUG=chrome-os-partner:20506
BRANCH=falco,peppy
TEST=Run ectool chargecontrol command with each option (normal,
 idle, discharge) on Falco and Peppy. Verifiy battery is discharging
 in discharge mode via EC console 'battery' command.

Change-Id: I7ac2b18b4f143bf6abc1e0bb878ad21a99f52100
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60689
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 10:58:18 -07:00
Randall Spangler
5691ac8168 Add EC_CMD_GET_FLASH_INFO version 1
This adds two new fields: the ideal write size for best EC flashing
performance (e.g., page mode instead of word mode), and a flags field
with a flag to indicate whether the EC erases its bits to 0 or 1.

The EC still supports the old version 0 command, since u-boot and
flashrom expect that to work.

BUG=chrome-os-partner:20973
BRANCH=(all haswell); this will speed up flashing and software sync
TEST=ectool flashinfo
     1. old EC, new ectool -> only reports version 0 info
     2. new EC, old ectool -> only reports version 0 info
     3. new EC, new ectool -> reports new fields

Change-Id: I484327fe22a58d2b69d7f6ac767b2d3e81b3e0b7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62378
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2013-07-18 16:47:00 -07:00
Bill Richardson
1eeafbacbf Add 'version' option to ectool test command.
This is just handy to be sure we're correclty passing the command version to
the EC.

BUG=chromium:242706
BRANCH=falco, peppy
TEST=manual

Run "hcdebug params" the EC console (using ToT EC)

Compare the output on the EC console when you run these two commands on the
host:

  ectool test 0 13
  ectool test 0 13 1

You should see these two lines (among other things):

[5728.756652 HC 0x0a.0:000000000d00000030313233343536373839616263646566303132333
43536373839414243444546]

[5730.809596 HC 0x0a.1:000000000d00000030313233343536373839616263646566303132333
43536373839414243444546]

The "0x0a.0" and "0x0a.1" indicate that the version is being passed
correctly.

Change-Id: I23b97ac6622274a157717f9375945d0866691a37
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61920
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-16 10:59:06 -07:00
Randall Spangler
eb8920c939 Split wireless power/radio control out of switch.c
Chipset control of wireless power uses the new API instead of overriding
the wireless power itself.

Refactor board-specific support for it to just a few config #defines
instead of board-specific functions.  This makes some assumptions
about the polarity of the enable signals.  Not making those
assumptions would require defining an array of structs or some other
heavier-weight board-specific info.  Since the assumptions hold for
all current boards, let's make them now because this is a step in the
right direction, and reserve doing something more general until we
actually have a use case for it (so we build in just the flexibility
we need).

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; see that link wifi turns on at boot and off at
     shutdown (verify via 'gpioget' from EC console)

Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61608
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-11 16:51:40 -07:00
Vic Yang
01ed345ebd Uprev panic data struct version
The struct was changed in commit 74c34bbad, but the struct version was
left as 1. We need to uprev this so the data returned by host command is
useful.

BUG=chrome-os-partner:16901 chrome-os-partner:20548
TEST='ectool panicinfo' with new and old struct. Compare output with
output from console command 'panicinfo'.
BRANCH=None

Change-Id: I4df3142497dc5ee21d100c4cb8118fb7a0ce7a7e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60314
Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
2013-07-10 11:16:18 -07:00
Simon Glass
c7005a4d95 ectool: Correct the empty console check
ectool is waiting for an empty response from the EC to tell it to stop
requesting console data. However, the EC only sends an empty response when
there is no snapshot data. In particular, it seems to send a 1 byte response
(containing just a \0 byte) when there is an empty string.

Adjust the check to stop when no data is provided.

BUG=chrome-os-partner:20639
BRANCH=none
TEST=manual
Run on test device and see that 'ectool console' now completes and does not
run forever.

Change-Id: I565f1be506833c823e5e7eca09be8b2420c8190c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60640
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2013-07-02 14:34:43 -07:00
Randall Spangler
0ee2689ee9 Add get-protocol-information command
This is necessary to support larger packet sizes for host protocol
ver.3.  The host previously didn't have any way to know how big a
packet the EC could accept / respond with (except on LPC, where the
size is determined by the I/O window).

BUG=chrome-os-partner:20257
BRANCH=none
TEST='ectool protoinfo' returns good info; on link,

  Protocol info:
    protocol versions: 2 3
    max request:   256 bytes
    max response:  256 bytes
    flags: 0x00000000

and on pit,

  Protocol info:
    protocol versions: 2 3
    max request:   544 bytes
    max response:  544 bytes
    flags: 0x00000001

Change-Id: Ic1e3831d9b4a96ffbf365c0d09b6023472de39a9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60703
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-02 09:32:52 -07:00