Commit Graph

276 Commits

Author SHA1 Message Date
Todd Broch
8b428e2936 Enable flashing of usbpd mcu for samus.
CL manages various dut-control dependencies for readying the STM32
part for programming.

Additionally deprecated the short-lived --uart_prefix argument as
user's defining this could be problematic without knowledge of
necessary modifications to h/w & s/w.

Signed-off-by: Todd Broch <tbroch@chromium.org>

CQ-DEPEND=CL:200146
BRANCH=none
BUG=chrome-os-partner:28826
TEST=manual,

  util/flash_ec --board=samus_pd succeeds.
  util/flash_ec --board=spring succeeds.

Change-Id: I7627c77293da187700aeddf7382dbb12e163a2ef
Reviewed-on: https://chromium-review.googlesource.com/200148
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-05-19 20:28:46 +00:00
Todd Broch
d67b9f3955 Implicitly decide uart_prefix based on board.
Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chrome-os-partner:28826
TEST=manual
  util/flash_ec --board=samus_pd
  - See uart_prefix is 'usbpd'
  util/flash_ec --board=rambi
  - See uart_prefix is 'ec'

Change-Id: Iba14fd0635d72413e48d45992c852393301b3f6b
Reviewed-on: https://chromium-review.googlesource.com/199939
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-05-19 20:25:43 +00:00
Todd Broch
1fc8e63681 Add uart_prefix flag to control which uart is used to flash.
There are CrOS devices that have multiple embedded controllers and
therefore multiple uarts that can be used for programming.

This CL allows user to set the uart_prefix to access the alternate
uarts via the --uart_prefix argument.  Default is still 'ec'.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chrome-os-partner:28826
TEST=util/flash_ec --board=samus_pd --uart_prefix=usbpd

Change-Id: I9fbe8d13067b7f514447645b2587dda706445661
Reviewed-on: https://chromium-review.googlesource.com/199900
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-05-19 20:25:40 +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
Alec Berg
6d01f2e169 samus: add PD MCU board
Initial patch for samus PD board. This configures GPIOs to match
samus 1.9.

BUG=chrome-os-partner:28350
BRANCH=none
TEST=none, no boards yet.

Change-Id: Ibc9d67325a1d9699b4e76e2998ab830ddbd0fb98
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199660
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 22:53:44 +00:00
Todd Broch
479aa8b1bc ec_uartd: bugfix for buffer pointer on partial write to FD.
Previously I neglected to increment the buffer pointer which would
allow double writing of same data and exclude tail if write didn't
complete in one call.

Also fixing bug with EAGAIN/EWOULDBLOCK to retry in those cases.
Previously we'd just have just failed for those errno values.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chromium:371147
TEST=still compiles

Change-Id: I30dbe56b2a4c735c487464349786a9db430130a8
Reviewed-on: https://chromium-review.googlesource.com/199052
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-05-09 22:04:12 +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
Louis Yung-Chieh Lo
8980e9a53a blaze: remove from ToT.
Since we already created the firmware-nyan-5771.B branch, we can
remove this from ToT now. But for sure we are still able to
cherry-pick changes back to ToT or from ToT.

BUG=none
BRANCH=tot
TEST=make buildall

Change-Id: I637d27b9f8672c5d17b60e210a5211ab8e19b54a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197165
2014-05-03 02:11:02 +00:00
Vincent Palatin
39588b067f stm32mon: fix STM32F03x flash size
The current SKU has 32kB.

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

BRANCH=none
BUG=none
TEST=read-back the flash content from a Zinger power brick using
"stm32mon -r".

Change-Id: Id74e585f4b49b9ef5fecdec8182f3710eb0b4960
Reviewed-on: https://chromium-review.googlesource.com/196690
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:45:59 +00:00
Vincent Palatin
ac4238c299 Add support for the Firefly board
Firefly is the test/burn-in board for Zinger production.
It's acting a Power Delivery sink.

The plug polarity is not managed correctly yet.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: I57f525ad04c519f2fa458635a1c6cc45a503e5ac
Reviewed-on: https://chromium-review.googlesource.com/195586
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:45:54 +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
Vincent Palatin
564fced7b8 util: fix support for dedicated debug dongle in flash_ec
When using a "non-servo" debug dongle or integrated FTDI chip to flash a STM32
microcontroller, add the option to toggle the reset of the
microcontroller if the control exists.

This was not done for the original Toad version because it cannot
control the reset line, but now Firefly, Zinger, Fruitpie debug
interfaces can do it.

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

BRANCH=none
BUG=none
TEST=./util/flash_ec --board=zinger

Change-Id: Ia21e3b3403e56b4c0797582659d9a3a0c26bb8bb
Reviewed-on: https://chromium-review.googlesource.com/197050
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-29 03:10:54 +00:00
Vincent Palatin
a1e8b316db Zinger board configuration
Add the USB Power delivery PHY configuration,
and all the pins and details to use the real Zinger
board.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: Ic2d3616c9fd2bf3ebeccba74a5519697e7c3e899
Reviewed-on: https://chromium-review.googlesource.com/194220
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:51 +00:00
Vincent Palatin
6c6276fd45 FruitPie board configuration
Add all the pins configuration to use the real FruitPie board
and the USB Power Delivery configuration.

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

BRANCH=none
BUG=none
TEST=make BOARD=fruitpie

Change-Id: I8c20118400cb6a2e26b541a9ee2da5b706299fcf
Reviewed-on: https://chromium-review.googlesource.com/189862
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:47 +00:00
Doug Anderson
39194d5fc5 flash_ec: Only kill -9 as a last resort
When we use 'kill -9' to kill other users of the serial port then we
end up with stale lockfile warnings.  Try to use a normal kill first
to be a little nicer.

BRANCH=ToT
BUG=None
TEST=flash_ec and no longer get stale lockfile messages from cu.

Change-Id: Idb39ca803a9c54b6fe972f6854515ea5a8bdab03
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194190
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-11 04:01:06 +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
Neil Chen
53d46c5ca1 Add initial blaze support
once firmware branch exists, this commit need go into it and
doesn't need to be carried in master forever

BRANCH=blaze
BUG=chrome-os-partner:27120
TEST=USE="nyan_blaze" emerge-nyan_blaze chromeos-ec;flash nyan
board, verify ec is alive and version is reported as blaze

Change-Id: I115890a7122440a25c3d1f5e4b94248099a1de99
Signed-off-by: Neil Chen <neilc@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/190610
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-03-22 18:49:09 +00:00
Vincent Palatin
7a7c92e15e stm32: add STM32F03x configuration
Add STM32F03x as part of the STM32F0 family.
STM32F031 will be used for devices requiring low-end parts.

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

BRANCH=none
BUG=none
TEST=along with the following CLs, run on STM32F051 Discovery with
limited RAM and Flash to mimic STM32F031.

Change-Id: Ie95303eaf00ce53fe7c8d2ac84c19a983aadbf0d
Reviewed-on: https://chromium-review.googlesource.com/189404
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-03-22 06:24:19 +00:00
Vincent Palatin
39327cc4cd stm32: add support for STM32F0xx family
Add support for the STM32F0xx family of devices using a Cortex-M0 core
and slightly newer peripherals than F1xx family.

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

BRANCH=none
BUG=none
TEST=run EC console on STM32F072B Discovery board.
and pass all available unit-tests on target.

Change-Id: Idaa3fcbf1c0da8a8f448c0e88e58bfd976b0a735
Reviewed-on: https://chromium-review.googlesource.com/188983
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-03-11 05:52:44 +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
Katie Roberts-Hoffman
f4f934c103 Add initial big support
BRANCH=big
BUG=chrome-os-partner:26533
TEST=emerge-nyan_big chromeos-ec; flash big board, verify
ec is alive and version is reported as big

Change-Id: Idbf84d029b5c7b7c198f8c4a2bd2a90d79524441
Reviewed-on: https://chromium-review.googlesource.com/188926
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-06 20:16:49 +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
Bill Richardson
d778fabaaa Fix some stupid.
Off-by-one error in read() call.

BUG=chromium:239205
BRANCH=none
TEST=none

Change-Id: Ifec3dacfa07e83d70b2582036cab0cfc1ee9e8f7
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186738
Reviewed-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-17 17:35:43 +00:00
Bill Richardson
33e967eee1 Update util/lbplay.c to use the sysfs interface.
This is just an example, demonstrating how a userspace program can access
and control the Pixel lighbar. This change reflects the new unprivileged
access methods. You can run this program to drive the lightbar without being
root.

BUG=chromium:239205
BRANCH=none
TEST=manual

Nothing builds this by default, but you can test it with

  cd src/platform/ec
  gcc -static util/lbplay.c

then copy a.out to your Pixel and run it (from /tmp, since other directories
are mounted noexec).

Change-Id: I7c07512087c924d16c1c03df6176fba995fcd4f4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186672
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-02-15 00:50:01 +00:00
Vic (Chun-Ju) Yang
fe7194d29d Remove deprecated make_all.sh
This script has been deprecated for more than a month. It's time to
remove it.

BUG=None
TEST=None
BRANCH=None

Change-Id: I6604d556e37ad90d9e9bec01664cbfaafcfb7a51
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185541
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-02-09 23:10:18 +00:00
Vic (Chun-Ju) Yang
798df2a6d0 Add presubmit check for unit test
This enforces that "make buildall" runs at least once after the last
file change.

TEST=Try to upload without running "make buildall"
TEST=Change a file without re-running "make buildall", and try to
upload.
BUG=None
BRANCH=None

Change-Id: Ia4abb3c0e17cf4d559975574f398d74c7986c89f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185116
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-06 19:27:18 +00:00
Vic (Chun-Ju) Yang
21dd832871 Remove obsolete TODO
LPC mapped memory is not supported for MEC1322. We'll need a separate
communication module. Update comment to reflect this.

BUG=chrome-os-partner:24280
TEST=None
BRANCH=None

Change-Id: I1863c7c230f895cb2cef65459406ffcf1e2b515d
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182798
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-01-17 18:17:06 +00:00
Vic (Chun-Ju) Yang
a32f1d5643 mec1322: Speed up LPC transfer with auto-increment mode
The main bottleneck on current LPC transfer speed is the delay required
between address write and data read/write. Using auto-increment mode, we
can not only skip most of the delay but also skip repeated address
write.

This gives about 30x speed-up (comparing the time spent on 4096-byte
read test.)

BUG=chrome-os-partner:24107
TEST=Measure speed of 'ectool readtest'
BRANCH=None

Change-Id: Ib34661474b149b19a900c60db884bd474881f742
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182797
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-01-17 18:12:53 +00:00
Vic (Chun-Ju) Yang
83d082a1f2 mec1322: Use EMI module for port 80
EMI module is the only LPC module suitable for port 80 implementation,
and thus let's move it to 0x80. Consequently the EMI mapped memory is
moved to 0x82-0x87.

BUG=chrome-os-partner:24107
TEST=Write to port 80 and see the data printed to console
BRANCH=None

Change-Id: I7d749650d6d109af2941a1db6e6c4a32e7482f61
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182796
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-01-17 18:06:58 +00:00
Vic (Chun-Ju) Yang
361731dc58 Clean up run_host_test script
This includes:
  - Remove an unused function argument
  - Style fix
  - Handle EOF by pexpect instead of catching exception

BUG=chrome-os-partner:19235
TEST=Run all tests
TEST=Make a test crash and check EOF is handled properly
BRANCH=None

Change-Id: I3636cdab6e68cacf97c4b245b14b2d57613a1674
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182049
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-01-15 04:52:54 +00:00
Vic (Chun-Ju) Yang
7cc75628eb emulator: Treat unexpected EOF as test failure
Unexpected EOF usually means error in the test code or assertion
failure. In this case, let's treat it as test failure.

BUG=chrome-os-partner:19235
TEST=Check assertion failure fails the test.
BRANCH=None

Change-Id: I9270d223d7252f611673a2c55af0c2d68b6116c4
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181747
2014-01-08 16:39:41 +00:00
Vic (Chun-Ju) Yang
61d2652ca4 Dump stack trace on emulator test failure
Emulator test failures are sometimes hard to debug, especially when the
test is stuck somewhere and times out. Let's have the emulator dump
stack trace when an assertion fails or a test times out.

The produced stack trace is in this format:
  #0  build/host/kb_8042/kb_8042.exe() [0x412421]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:104
  #1  build/host/kb_8042/kb_8042.exe() [0x4124a9]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:129
  #2  build/host/kb_8042/kb_8042.exe(run_test+0x3a) [0x412e2c]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:262
  #3  build/host/kb_8042/kb_8042.exe(_run_test+0x11) [0x4061de]
      /home/victoryang/trunk/src/platform/ec/core/host/task.c:90
  #4  build/host/kb_8042/kb_8042.exe(_task_start_impl+0x79) [0x406b72]
      /home/victoryang/trunk/src/platform/ec/core/host/task.c:408
  #5  /lib64/libpthread.so.0(+0x70b1) [0x7f6dc2fa10b1]
      ??:0
  #6  /lib64/libc.so.6(clone+0x6d) [0x7f6dc2cd8efd]
      ??:0
The file name and line number in the trace is generated by addr2line.

BUG=chrome-os-partner:19235 chromium:331548
TEST=Put in a infinite loop in a test, and see stack trace when it times
out.
TEST=Add a failing assertion, and see stack trace when it fails.
BRANCH=None

Change-Id: I4494ffd1ebc98081ce40e860a146202084aa2a1e
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181730
2014-01-08 16:39:24 +00:00
Randall Spangler
91abb52837 Add squawks board
Implement LED color policy (crosbug.com/p/23957)

Update battery vendor information (crosbug.com/p/24684)

BUG=chrome-os-partner:24885
BRANCH=rambi
TEST=manual
  system on, lidclose -> power LED off
  system on, lidopen -> power LED on
  system suspended -> power LED blinks green every 2 sec
  system suspended, lid closed -> power LED off
  system off -> power LED off
  plug AC in, battfake 95 -> charging LED green
  plug AC in, battfake 94 -> charging LED orange
  unplug AC, battfake 10 -> charging LED off
  unplug AC, battfake 9 -> charging LED blinks orange
  battcutoff -> after a few sec, system powered down
  plug back in AC -> system comes back on
  charger -> I_in < 1700

Change-Id: I89161e2c024d85197b8612a40a61dd50c106549e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181755
2014-01-08 02:22:34 +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
Vic (Chun-Ju) Yang
56dd81e39c Merge make_all.sh to Makefile
By merging make_all.sh to Makefile, parallel make can be made faster.
Previously, if one does 'util/make_all.sh -j32', most of the time is
spent on waiting for linking. Now that we invoke sub-make, linking an
executable doesn't block the next board.

With '-j32', the new 'make buildall' takes about 7 seconds, while the
original 'util/make_all.sh' takes about 27 seconds.

BUG=None
TEST=make buildall -j32
BRANCH=None

Change-Id: I7c2f0d1e928a9b60a8a9070bdcb71b00a3d534cd
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181091
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-27 07:50:56 +00:00
Vic (Chun-Ju) Yang
08a030e152 Add support for igloo board to ec_uartd
The igloo board has a different product ID than bds board. Add the new
product ID to ec_uartd.

BUG=chrome-os-partner:24713
TEST=Run ec_uartd with igloo board
BRANCH=None

Change-Id: Idcbb08072661e12ed744a60fb04a55d4f58cf89b
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181082
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-27 07:50:52 +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
Vic (Chun-Ju) Yang
715ad86d43 mec1322: temporary hack for using EMI module
We are using EMI module instead of LPC memory transaction. This requires
a different protocol for accessing mapped memory from host. For easier
development, let's add a new comm-mec1322.c until we can switch back to
LPC memory transaction.

BUG=chrome-os-partner:24280
TEST=ectool version
TEST=util/make_all.sh
BRANCH=None

Change-Id: Id8914d0413561991d3e46bef7e3fe76c4f8b83e4
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178251
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-04 13:34:53 +00:00
Randall Spangler
34b94121c7 Remove bolt, daisy, kirby, puppy, slippy boards
These boards are unloved and unsupported.  They'll never grow up to be
laptops, and hardware is increasingly hard to come by.

Comparable functionality is available in the other, more-loved boards.

Removing these boards speeds up util/make_all.sh by 40%.  (If you're
not running that before every upload, you should be...)

BUG=chrome-os-partner:24062
BRANCH=none
TEST=build all remaining platforms and pass unit tests

Change-Id: I4d8a49e4d52d7393471f1b1cbef059c8db4a4f77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177373
2013-11-21 22:21:56 +00:00
Vincent Palatin
4b59746600 util: declare all host utils source dependencies in build.mk
Instead of hardcoding the common files for host utils in the generic
rules, let's declare them in the build.mk file using the same system as
the Linux kernel build.

if a binary "foo" declared in "host-util-bin" or "build-util-bin" has a
matching "foo-objs" variable, it will be build from all objects declared
in "foo-objs" else it uses directly "foo.o" (single source file).

This is preparatory to add new "build" tools sharing common sources.

note: the dependencies on the utils are a bit less fine-grained as a
result of this change, but given the low number of tools, that should be
acceptable.

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

BRANCH=none
BUG=none
TEST=./util/make_all.sh

Change-Id: Ieffce7ca6f5b685ffb7d1f4626b99aff07b61443
Reviewed-on: https://chromium-review.googlesource.com/176174
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-14 17:52:39 +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