Commit Graph

585 Commits

Author SHA1 Message Date
Vijay Hiremath
2324ed47aa ectool: Add ectool command to do AP force shutdown
Added support to do force AP shutdown from kernel console using
the ectools.

BUG=chrome-os-partner:56681
BRANCH=none
TEST=make buildall -j; Manually tested on reef.
     "ectool reboot_ec apshutdown" puts system in G3.

Change-Id: I509678a67a6a54da67de99efb00e1f08a1ed1fea
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/376863
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-30 02:50:32 -07:00
Kevin Cheng
0f5f4862e2 flash_ec: Add check for servo_has_cold_reset.
When flashing a servo v4, the function will try to initiate a cold_reset
but that interface does not exist for a servo v4. Add in a check for
cold_reset before trying an ec_reset to prevent printing the useless
error message 'No control named "cold_reset"'.

BRANCH=None
BUG=None
TEST=flashed and did not see error message anymore.

Change-Id: I6086883f002b4961807ae0663b0ee32aea4c63d8
Reviewed-on: https://chromium-review.googlesource.com/365151
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2016-08-22 14:52:24 -07:00
Nick Sanders
65ba93af93 sweetberry: add build target for sweetberry
sweetberry is an stm32f446 based power monitoring
board, with 48 channels of INA current sense chips

BUG=chromium:608039
TEST=boots
BRANCH=none

Change-Id: If263bcee3a648ba3605f991999d481b7a0e2a1db
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/370718
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-08-19 14:21:19 -07:00
Nick Sanders
6fcd163da5 stm32f446e-eval: add support for stm32f446
This adds basic support for the stm32f446.
This consists of:
* New DMA model for stm32f4
* New clock domain support.
* MCO oscillator gpio export support.
* Flash support for irregular blocks.

BUG=chromium:608039
TEST=boots w/ correct clock, stm32f0 also boots.
BRANCH=None

Change-Id: I1c5cf6ddca09009c9dac60da8a3d0c5ceedfcf4d
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363992
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-08-17 16:19:07 -07:00
Shawn Nematbakhsh
de4d25964d mkbp_event: Allow host to report sleep state for non-wake event skipping
Allow the host to self-report its sleep state through
EC_CMD_HOST_SLEEP_EVENT, which will typically be sent with SUSPEND
param when the host begins its sleep process. While the host has
self-reported that it is in SUSPEND, don't assert the interrupt
line, except for designated wake events.

BUG=chrome-os-partner:56156
BRANCH=None
TEST=On kevin, run 'ectool hostsleepstate suspend', verify that
interrupt assertion is skipped for battery host event. Run 'ectool
hostsleepstate resume' and verify interrupt is again asserted by the
battery host event.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I74288465587ccf7185cec717f7c1810602361b8c
Reviewed-on: https://chromium-review.googlesource.com/368391
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-12 13:45:35 -07:00
Shawn Nematbakhsh
d54387c18e kevin / gru: Notify host of HPD IRQ status
If an HPD IRQ event is seen, make note of it and keep the status set
until informing the host.

BUG=chrome-os-partner:55925
BRANCH=None
TEST=Manual on kevin, trigger HPD event, verify that event bit is set in
reply to first host command and not subsequent host commands.

Change-Id: I0900a683dcb344d5d4d03a1fa6e3d8de913597b2
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366990
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
2016-08-10 20:07:32 -07:00
Vadim Bendebury
ea91c71c08 util: do not generate unrelated version information
The recent addition of the multicomponent version string for cr50,
requires further tweaking of the version generating script. In
particular, the CROS_EC_VERSION32 variable used by the "verson" cli
command is not supposed to include any information about subcomponents
of the image, it should reflect the EC version only.

Separating everything after the first space accomplishes that.

BRANCH=none
BUG=chrome-os-partner:55373
TEST=verified that RO_x and RW_x versions are printed properly:
  > vers
  Chip:    g cr50 B2
  Board:   0
  RO_A:    0.0.1/84e2dde7
  RO_B:  * 0.0.3/8fe06b9e
  RW_A:    cr50_v1.1.4992-7c9f891+ private
  RW_B:  * cr50_v1.1.4989-52b3cc6+
  ...

Change-Id: I192eb29816dfa963b08aa97f749b978b1367d6b7
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364490
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-07-29 21:37:54 -07:00
Vadim Bendebury
33bbf37d2a util: collect cr50 versions from multiple git trees
The cr50 code comes from four different repositories. This patch
introduces an array of the repositories where version information is
supposed to come from.

For all boards but cr50 this array includes just the local repository,
for cr50 the array is extended with the three other components.

This patch also allows to change the 'tree dirty' marker appended to
the sha1s of the 'dirty' trees, having a shorter marker helps to keep
multicomponent version strings shorter.

All external component's version information in the generated combined
version string is prepended by the component's root directory name.

BRANCH=ToT
BUG=chrome-os-partner:55373
TEST=ran the script for two EC boards, kevin and cr50, verified the
     output:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
$ BOARD=kevin ./util/getversion.sh
/* This file is generated by util/getversion.sh */
/* Version string for use by common/version.c */
/* Version string, truncated to 31 chars (+ terminating null = 32) */
/* Sub-fields for use in Makefile.rules and to form build info string
 * in common/version.c. */
/* Repo is clean, use the commit date of the last commit */
$
$ BOARD=cr50 ./util/getversion.sh
/* This file is generated by util/getversion.sh */
/* Version string for use by common/version.c */
/* Version string, truncated to 31 chars (+ terminating null = 32) */
/* Sub-fields for use in Makefile.rules and to form build info string
 * in common/version.c. */
/* Repo is clean, use the commit date of the last commit */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

then introduced some local changes in the ec and tpm2 directories and
ran the script again. Note the '+' used as the 'dirty' marker in the
cr50 string:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
$ BOARD=kevin ./util/getversion.sh
/* This file is generated by util/getversion.sh */
/* Version string for use by common/version.c */
/* Version string, truncated to 31 chars (+ terminating null = 32) */
/* Sub-fields for use in Makefile.rules and to form build info string
 * in common/version.c. */
/* Repo is dirty, using time of last compilation */
$
$ BOARD=cr50 ./util/getversion.sh
/* This file is generated by util/getversion.sh */
/* Version string for use by common/version.c */
/* Version string, truncated to 31 chars (+ terminating null = 32) */
/* Sub-fields for use in Makefile.rules and to form build info string
 * in common/version.c. */
/* Repo is dirty, using time of last compilation */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Change-Id: I4b4ec23ce003970c09442e8d8aeed2306d4e5dd8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363917
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-07-28 22:57:21 -07:00
Vadim Bendebury
3531d6123b util: refactor getversion.sh
It is necessary to collect information about more then one git
repositories status for the cr50 board. To facilitate this, separate
the code retrieving build version information into a function,
get_tree_version().

The function returns a two element string, the version information and
the 'dirty' marker in case the tree has any uncommitted changes. The
0x01 character is used to join the elements of the string, which makes
it easier to split the string when processing it.

BRANCH=ToT
BUG=chrome-os-partner:55373
TEST=ran the script before and after changes, observed that generated
      output is identical.

Change-Id: I2c211cbda8c3cab3c8c21b4430e4b3102691e74a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362849
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-07-28 20:20:44 -07:00
Mary Ruthven
8957da7fdc flash_ec: Add support for flashing using CCD
When a kevin, gru, or reef are attached to the host machine using a
suzyQ, they can use CCD to update the AP or EC using flashrom. To use
suzyQ you have to specify raiden_debug_spi as the flashrom programmer.
This change adds support to flash_ec for using the right programmer to
update with CCD over suzyQ instead of servo.

BUG=chrome-os-partner:50701, chrome-os-partner:50712
BRANCH=none
TEST=make sure "util/flash_ec --BOARD=kevin --raiden" updates the EC
when CCD is enabled

Change-Id: Ie63337b9689c68aa60163d7e54c5ebefa97b4e21
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/344427
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-22 15:36:10 -07:00
Divya Sasidharan
5df351f63c ectool: Fix incorrect fan numbers from ectool
Return 0 if the board does not need fan indicated
by EC_FEATURE_PWM_FAN.

BRANCH=None
BUG=chrome-os-partner:55090
TEST=make buildall -j;
     in reef command "ectool pwmgetnumfans" returns 0

Change-Id: I7b59d266532622607c61fe3e7dd1bd0cc8ea9766
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/359069
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-21 13:13:41 -07:00
Stephen Barber
24abdc9a4e common: add EC_FEATURE_RTC to features host command
If the EC has CONFIG_HOSTCMD_RTC set to 'y', then export this via the
features host command. The kernel can then use this feature to expose
an RTC device under /dev/rtc*.

Signed-off-by: Stephen Barber <smbarber@chromium.org>

BRANCH=none
BUG=chrome-os-partner:54639
TEST=`ectool inventory` shows RTC on kevin

Change-Id: I644c8e61c4d9f691cc6ca94ef60bee4384c21660
Reviewed-on: https://chromium-review.googlesource.com/359414
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-09 01:40:59 -07:00
Daisuke Nojiri
9a13c52f30 ectool: Fix uninitialized variable warning
gcc 4.8.4 warns read_buf is not initialized. This patch seizes the
warning.

BUG=none
BRANCH=none
TEST=make BOARD=stm32l476g-eval

Change-Id: I07a8e01ea285e3462d6b45604350ffeab6cc00e3
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359002
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-09 01:40:43 -07:00
Gwendal Grignou
f6b26dee24 motion: Add ability to stop ring interrupts.
Currently, it is assumed the host will sooner or later retrieve the
events from the sensor ring: It is only used by Android and the sensor
HAL is enabling the ring buffer at boot.
But if nobody processes the ring, and the ring is almost full, the EC will
generate interrupt for every new events.
This can happen with ARC, where events generated for ChromeOS
will be in the ring but nobody will process them until Android is
started.

Add a command to allow sending ring MKBP events. It will be used when
the IIO ring buffer is enabled / disabled.
It also can be used for preventing raising interrupt when the device is
about to go to sleep.

BRANCH=ryu,cyan
BUG=b:25425420,b:27849483
TEST=Check with fiforead that no events are queued when IIO ring
buffer is disabled.
Check with ectool and androsensor that interrupt generation stops.

Change-Id: Ibc85eed2e0eae3a9ec07d191e692118bc2fd0dab
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/356689
2016-06-30 23:10:58 -07:00
Shawn Nematbakhsh
203063609b usb_mux: Add support for host-controlled 'virtual' USB mux
For designs where the host SOC is responsible for setting the USB-C SS
mux, the EC must track the desired mux state and inform the host when
the desired state changes. Then, the host must ask the EC for the new
desired state and set the mux accordingly.

BUG=chrome-os-partner:52639
BRANCH=None
TEST=Manual on gru with subsequent commit.
Attach USB dongle in port 1 and DP dongle in port 0, then verify `ectool
usbpdmuxinfo` output:
Port 0: DP
Port 1: USB
Flip DP dongle and verify output changes:
Port 0: DP INV

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6a99ce93a76c3197f9195cfaa25c5217d09aeb75
Reviewed-on: https://chromium-review.googlesource.com/355281
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-24 17:23:14 -07:00
David Hendricks
f8bcbca2f7 sb_firmware: update lockfile path
This updates the lockfile path for FHS 3.0 since powerd as well
as other pieces of software are migrating over.

BUG=chromium:616620
CQ-DEPEND=CL:351271
BRANCH=none
TEST=compiled

Change-Id: I6aa5fa30225e45039316e4a3af0e50cdef0fdf4e
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/351345
Reviewed-by: Dan Erat <derat@chromium.org>
2016-06-24 17:23:07 -07:00
Shelley Chen
9ceaa9d8e0 rk3399: kevin: Adding get_rtc_alarm functionality.
Adding ability to get # seconds before rtc alarm
goes off.

BUG=chrome-os-partner:52218
BRANCH=None
TEST=ectool rtcgetalarm w/o setting returns
     Alarm not set.
     ectool rtcsetalarm 30; ectool rtcgetalarm
     to make sure counting down to 0.  After alarm
     goes off, rtcgetalarm should return alarm not
     set again.
     rtcsetalarm 30; rtcgetalarm to check alarm is set.
     rtcsetalarm 0; should disable alarm.  Use
     rtcgetalarm to ensure that alarm is disabled.

Change-Id: I176b12fe2dda08eedd23ea33dc64785f09f1d9ae
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/353331
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-21 20:28:09 -07:00
Nicolas Boichat
d766e4cf4e ec_commands: Add new EC_CMD_PD_CONTROL command
This commands makes it possible to control the PD chip (or
the interaction between EC and PD), from the AP.

 - PD_SUSPEND: Suspends the PD chip: EC needs to stop talking
   to PD chip. Useful at beginning of PD FW update.
 - PD_RESUME: Resumes the PD chip: EC can start talking to PD
   chip again. Useful at end of PD FW update.
 - PD_RESET: Resets the PD chip (called at the end of the update).
 - PD_CONTROL_DISABLE: Prevents further calls to this command
   (for security reason, we do not want the AP to be able to
   call the other subcommands after the update has been performed).

BRANCH=none
BUG=chrome-os-partner:52433
TEST=ectool pdcontrol {suspend,resume,reset,disable}

Change-Id: I7a955dd27b65086c21d195a6504aa7392eb0406d
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342584
Reviewed-by: Randall Spangler <rspangler@google.com>
2016-06-07 08:21:34 -07:00
Shawn Nematbakhsh
0e532c6044 cleanup: Remove SHIFT_CODE_FOR_TEST handling
SHIFT_CODE_FOR_TEST images were used for an old FAFT test but is no
longer in use today.

BUG=chromium:616806
BRANCH=None
TEST=`make buildall -j`
CQ-DEPEND=CL:349281

Change-Id: I1b4e8c2560e2a7ff507cf2275dbbbdabf435866b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/349272
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Tom Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-06-03 03:00:08 -07:00
David Hendricks
4b680119cc file_lock: Add fallback directory
This adds a fallback directory in case SYSTEM_LOCKFILE_DIR is
unavailable. Since this is a band-aid meant to help older systems
auto-update, the fallback path is hardcoded to "/tmp" as to avoid
polluting the overall lockfile API.

BUG=chromium:616620
BRANCH=none
TEST=Tested on veyron_jaq by removing /run/lock and seeing
mosys, flashrom, and ectool run successfully with
firmware_utility_lock in /tmp.

Change-Id: Idbe63a574474ec35a5c3b6fe2b0fb3b672941492
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/348850
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2016-06-02 17:02:51 -07:00
Nicolas Boichat
b6576ce2db ectool: i2cread/write: Use EC_CMD_I2C_PASSTHRU
EC_CMD_I2C_READ/WRITE are deprecated, and can easily be replaced
by EC_CMD_I2C_PASSTHRU: stop using them so that we can remove them
from EC image.

BRANCH=none
BUG=chrome-os-partner:23570
TEST=emerge-elm ec-utils && cros deploy IP ec-utils
     cd /usr/sbin
     ./ectool i2cxfer 1 0x28 0 0xE0 0xAB 0xCD
     ./ectool i2cxfer 1 0x28 2 0xE0
     ./ectool i2cwrite 16 1 0x50 0xE0 0xDEEF
     ./ectool i2cread 16 1 0x50 0xE0
     ./ectool i2cwrite 8 1 0x50 0xE0 0xAA
     ./ectool i2cread 8 1 0x50 0xE0

Change-Id: Ia2a6115b62e81e4f256d67340993c55bf016989a
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/348126
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-06-01 03:44:31 -07:00
Shawn Nematbakhsh
d1beddc463 pwm: Modify new PWM host commands to take 16-bit duty cycle
EC_CMD_PWM_SET_DUTY / EC_CMD_PWM_GET_DUTY were recently added and are
not yet in use. Future-proof these commands by taking a 16-bit duty
cycle parameter and converting it between the [0-100] percent used by
internal EC functions.

BUG=chromium:615109
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty kb 65535` - Verify KB backlight goes to 100%
`ectool pwmgetduty kb` - Prints 65535
`ectool pwmgetduty 0` - Prints 65535
`ectool pwmsetduty 0 0` - Verify KB backlight goes to 0%
`ectool pwmgetduty kb` - Prints 0
`ectool pwmgetduty disp` - Error res 3 (unsupported PWM type)
`ectool pwmsetduty 1` - Error res 3 (non-existent PWM index)
`ectool pwmsetduty kb 6550` +
`ectool pwmgetduty kb` - Prints 6553 (round up)
`ectool pwmsetduty kb 6560` +
`ectool pwmgetduty kb` - Prints 6553 (round down)

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic6996fc6e1e69359274b2f9a1120ee7002db991c
Reviewed-on: https://chromium-review.googlesource.com/347608
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
2016-05-27 18:08:58 -07:00
Shelley Chen
cebf8734d9 kevin: rk3399: ectool interface for EC RTC alarm
Only way to set alarm previously was through
rtcalarm command on EC console.  Implemented
interface through ectool so that the AP can set
it as well.

BUG=chrome-os-partner:52218
BRANCH=None
TEST=from AP console, run ectool rtcalarm <sec>
     Should see [event set 0x02000000] from EC
     console in approximately <sec> seconds.

Change-Id: I3202b826cb994dbca456b8b9c22bbca4dbe2766a
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347493
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-27 13:47:02 -07:00
Brian Norris
840d61282c ectool: use v2 ABI for fallback 'readmem' ioctl
ec_readmem_dev_v2() was copy/pasted from ec_readmem_dev(), but we forgot
to switch over the fallback 'fake_it' case to the new ioctl format. This
case is used over transports like SPI, which don't implement
cmd_readmem.

BUG=none
TEST=run `ectool version` on kevin (with cros-ec-spi) and don't see:
     ioctl -1, errno 25 (Inappropriate ioctl for device), EC result 255 (<unknown>)
BRANCH=none

Change-Id: I4335f8fc3d43169cf628e26cadf1ac8d263955f2
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347111
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2016-05-24 19:23:30 -07:00
Nicolas Boichat
f5bba241fd common/i2c: Add I2C passthru_protect command
This allows the AP to protect a I2C passthru bus. A board-specific
function then defines what I2C commands are allowed, so that we
can white/black list some addresses (e.g. I2C address allowing
PD chip FW updating).

BRANCH=none
BUG=chrome-os-partner:52431
TEST=Book elm-rev1

Change-Id: Ib106924418b16388ea8ea53c7b6bda6ef92e1d09
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/345761
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@google.com>
2016-05-24 19:23:27 -07:00
David Hendricks
b14f89cfdb reef: Initial commit
This adds the basic framework for Reef including full GPIO listing,
board config file, and rudimentary functionality. It has not been
fully tested and still has several TODOs/FIXMEs. For now we just need
something that will build and can be incrementally improved.

BUG=chrome-os-partner:53035
BRANCH=none
TEST=EC and AP both boot, seems reasonably stable for now

Change-Id: I4934ad00917e251dd1d7eb759207a92c45a36136
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339292
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-05-20 17:08:34 -07:00
Shawn Nematbakhsh
541433abaf cleanup: lars / kunimitsu (and _pd): Remove board-level code
Authoritative firmware for these boards can be found on
firmware-glados-7820.B branch.

BUG=chrome-os-partner:49909
BRANCH=None
TEST=`make buildall -j`

Change-Id: I78dddef7bc36ecceb5cd9f0eb07052e8e16b6c15
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343201
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 13:06:45 -07:00
Donald Huang
f36943f95a flash_ec: Add support for it83xx_evb
Add it83xx_evb support in flash_ec script.

BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run
     "~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin"

/* ==SNAPSHOT START== */
(cr) (flashec) donald@donald-nb ~/trunk/src/platform/ec $ ~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin
INFO: Using ec image : ./build/it8380dev/ec.bin
INFO: Flashing chip it83xx.
Waiting for the EC power-on sequence ...CHIPID 8390, CHIPVER 82, Flash size 256 kB
Done.
CHIPID 8390, CHIPVER 82, Flash size 256 kB
Erasing chip...
/100%
Writing 262144 bytes at 0x00000000
Done.
Verify 262144 bytes at 0x00000000
-100%
Verify Done.
INFO: Flashing done.

/* ==SNAPSHOT END== */

Change-Id: I0a76c0ccfcc3726796372ba3b7915a41c64d5766
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/343985
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 00:56:35 -07:00
Shawn Nematbakhsh
9494fc0dd1 pwm: Add generic PWM control host commands
Add generic PWM host commands for setting + getting duty cycle. PWMs can
be controlled through index (board-specific meaning) or by type
(currently KB backlight and display backlight are supported, more can be
added as needed).

BUG=chrome-os-partner:52002
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty kb 100` - Verify KB backlight goes to 100%
`ectool pwmgetduty kb` - Prints 100
`ectool pwmgetduty 0` - Prints 100
`ectool pwmsetduty 0 0` - Verify KB backlight goes to 0%
`ectool pwmgetduty kb` - Prints 0
`ectool pwmgetduty disp` - Error res 3 (unsupported PWM type)
`ectool pwmsetduty 1` - Error res 3 (non-existent PWM index)

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I607c92a291e6c2e3af8238eaf22ad2bb81ffc805
Reviewed-on: https://chromium-review.googlesource.com/344012
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-11 18:24:30 -07:00
Shawn Nematbakhsh
bdbf0810d0 gru: Initial mainboard commit
Clone of kevin w/ minor GPIO / LED changes.

BUG=chrome-os-partner:52736
BRANCH=None
TEST=Verify image boots + sequences on kevin p1.

Change-Id: I7d3f3ce97a8b080516b635a3d2b7bc3c6515c6d9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340542
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-04 16:15:02 -07:00
Bruce
d539c79960 sb_firmware_update: Set ac flag at fw update mode
Some reason cause the power off during battery fw update process.
Then execute the process again, tool can't detect AC because EC
can't read data from battery. So set AC_PRESS flag after check
battery is in battery fw update mode.

BUG=None
BRANCH=None
TEST=check the battery can execute fw update in this case.

Change-Id: Iafe501eb1719a12425d5cac42d27c897e078acc1
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/341044
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-02 21:30:13 -07:00
Gwendal Grignou
e54d1284ff ectool: Revert "ectool: Remove CROS_EC_DEV_IOCRDMEM"
CROS_EC_DEV_IOCRDMEM must be used on architecture where legacy IO mapped
registers are accessed inderectly via EMI. The kernel is taking care of
the translation.

TEST=Check on reks that we need to use the IOCTL.
BUG=chrome-os-partner:52550,chromium:602832
BRANCH=none

This reverts commit de45353bbd ("ectool: Remove CROS_EC_DEV_IOCRDMEM").

Change-Id: I8efad56df90c58c25bdc9ccd70a508547e629a77
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340348
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-22 17:17:56 -07:00
Kevin K Wong
b737fe07a3 amenia: initial board code
used board wheatley as the initial code base for amenia

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ifa561dae01e486058b2a3115bf37075a164369c2
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/331652
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-04-15 21:29:14 -07:00
Gwendal Grignou
de45353bbd ectool: Remove CROS_EC_DEV_IOCRDMEM
On !LPC EC, we can read memory via CROS_EC_DEV_IOCXCMD ioctl,
using command EC_CMD_READ_MEMMAP.
On platform that supports direct memory access (lpc), we access
the memory directly, bypassing the ioctl.

BUG=chromium:602832
TEST=On gnawty and veyron, check 'ectool battery' works.
Verify that gnawty use io mapped registers.
BRANCH=none

Change-Id: I9bfcddcf450bf8df63ead78e1df97dd7392289e6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338853
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-04-15 13:40:17 -07:00
Rong Chang
8d2aac6bef elm: initial elm mainboard
Elm is an oak variant that uses ANX7688 PD port controller. This CL sets
PD port count to 1 and modifies TCPC I2C address to 0x50.

Other elm changes are included in this change:
  - add 2 KX022 motion sensors, remove BMI160
  - remove ALS
  - LED configuration changed to 2 bi-color LEDs
  - remove pi3usb30532
  - add ANX7688 mux driver
  - change PD interrupt polarity

BRANCH=none
BUG=none
TEST=manual
  make BOARD=elm -j
  load and test on elm proto

Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: I8ad02da9acade985bc0e7e2f85d9e58db7e6b38d
Reviewed-on: https://chromium-review.googlesource.com/331453
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-14 03:43:09 -07:00
Guenter Roeck
7ce63a09f9 ectool: Upgrade to improved ioctl format
Support both old and new ioctl formats at the same time.
Auto-detect the ioctl format used by the kernel.

BUG=chromium:481710
BRANCH=None
TEST=Work on Samus with kernel 4.4 and 3.8/3.14/3.18

Change-Id: I31d7ce5b517b4b5af8e2b617e386c3cfd3276f20
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331830
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-04-12 19:00:36 -07:00
Devn Lu
93be0c3b0a ectool: Support keyboard factory scanning
This is keyboard test mechanism request for "multiple key press test",
we can thru the testing to scan out kso ksi pins shortting or keyboard has
multiple key pressing, below was the testing steps:

1. Turn off internal keyboard scan function.
2. Set all scan & sense pins to input and internal push up.
3. Set start one pin to output low.
4. check other pins status if any sense low level.
5. repeat step 3~4 for all keyboard KSO/KSI pins.
6. Turn on internal keyboard scan function.

BUG=chrome-os-partner:49235
BRANCH=ToT
TEST=manual
  Short any KSO or KSI pins and excute "ectool kbfactorytest", it shows failed.
  if no pins short together, it shows passed.

Change-Id: Id2c4310d45e892aebc6d2c0795db22eba5a30641
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/332322
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-01 00:21:35 -07:00
Shawn Nematbakhsh
4e1ddc02c6 flash_ec: Add support for kevin
Add support for kevin, which uses external 1.8V SPI.

BUG=chrome-os-partner:51722
TEST=Verify kevin EC is flashable. Verify wheatley still uses pp3300 SPI
voltage.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I13e45e829cdc7b2298715812f5714d5dd806df06
Reviewed-on: https://chromium-review.googlesource.com/335396
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-28 21:55:20 -07:00
Donald Huang
cb38156bbc it8380dev: util: Enable Host Global Reset
BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run "make -j BOARD=it8380dev" to build ec.bin
     and flash the ec.bin via
     "sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin"

Change-Id: I2077012114bdbd5a8cc8f7dc29e43cdcb77d65b6
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/334176
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-03-24 00:03:08 -07:00
Shawn Nematbakhsh
6ea8793394 cleanup: ectool: Ensure LED-related strings are defined for all types
Use asserts to ensure that new strings are added when new ec_led_colors
/ ec_led_id enum types are defined.

BUG=None
TEST=`make buildall -j`
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I4bcd6ad6de15b96a1c6a3fb70dbcc74f4d7f2857
Reviewed-on: https://chromium-review.googlesource.com/334382
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-22 16:21:33 -07:00
Shawn Nematbakhsh
f06443e2f7 ectool: Eliminate needless stderr output from tempsinfo
`tempsinfo all` will probe all 24 sensor IDs, which will produce stderr
output due to host command failure if a given sensor does not exist.
Therefore, check memmap data for presence before probing a given ID.

BUG=chrome-os-partner:51026
BRANCH=None
TEST=Manual on Sentry. Verify "ectool tempsinfo all" dumps info on 4
temperature sensors and prints nothing to stderr.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I14d65c1ad03eafafc21db41781c434b3ed74cb7e
Reviewed-on: https://chromium-review.googlesource.com/333779
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-18 20:49:23 -07:00
Nick Sanders
d3a8bd0c36 servo_micro: add initial servo_micro build
* Update flash_ec to allow flashing servo_micro
* Add servo_micro build

BUG=chromium:571477
BRANCH=None
TEST=updated servod is able to control gpio, gpio extender,
     SPI flash, ec uart, ap uart on test yoshi

Signed-off-by: Nick Sanders <nsanders@google.com>

Change-Id: I4d69c83ae581cb41da928a27c39b7152475d7ca8
Reviewed-on: https://chromium-review.googlesource.com/327214
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-03-16 16:19:53 -07:00
Mulin Chao
3424deb481 npcx: Add 256KB alignment of RO & RW regions for npcx5m6g.
Since npcx5m6g has larger than 128 KB code ram for FW, the original
alignment between RO & RW regions isn't suitable for new chip.
Therefore, we add 256KB alignment of them for npcx5m6g.

In order to program the flash used by npcx5m6g, we add new board array,
BOARDS_NPCX_5M6G_JTAG, in flash_ec to distinguish which flash layout
ec used. In npcx_cmds.tcl, add new script funcs such as flash_npcx5m5g
and flash_npcx5m6g to program flash with different layout.

Modified sources:
1. config_flash_layout.h: Add 256KB alignment of RO & RW regions for
   npcx5m6g.
2. util/flash_ec: Add new board array, BOARDS_NPCX_5M6G_JTAG, to
   distinguish which flash layout ec used.
3. openocd/npcx_cmds.tcl: Add new script funcs to program flash with
   different layout.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I0ace31d96d6df2c423b66d508d30cefb0b82ed6c
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/331903
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-15 21:49:36 -07:00
Shawn Nematbakhsh
554ecc6b9d util/iteflash: Return error on all verify failures
BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Iefc8e1eaf1e5d7c8533d8497c227c8c16eb2c06d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331200
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-08 13:56:40 -08:00
Bruce
1e20c1f88d sb_firmware_update: Remove battery HWID check
We're supporting a wide range of batteries, and since file name
matching is based on HWID, we don't need to maintain a separate
table of supported HWIDs in our utility.

BUG=chrome-os-partner:49589,chrome-os-partner:50469
BRANCH=None
TEST=buildall

Change-Id: I3e7c62379c07a598e23f3c543959503d3d25aee3
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/330231
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-07 01:20:09 -08:00
Anatol Pomozov
da191ee1ac iteflash: Initialize variable that later used in the function
Latest GCC gives compiler error:
  util/iteflash.c: In function verify_flash:
  util/iteflash.c:927:9: error: res may be used uninitialized in
                this function [-Werror=maybe-uninitialized]
    return res;
           ^

BUG=None
TEST=`make buildall -j` outside chroot
BRANCH=None

Change-Id: I184d8673020552797fd54bb98ee582a63debbf16
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/330873
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-06 11:48:07 -08:00
Ryan Zhang
9d472018f9 Common : Fix ectool led cmd segmentation fault
led_color_names[] should have EC_LED_COLOR_COUNT numbers of data.

A missing data cause strcasecmp() compare argv[] with NULL in
find_led_color_by_name(), that results in Bundle Image test error

BUG=chrome-os-partner:50612
BRANCH=lars
TEST=`make -j buildall`, `ectool led power blue=255` with homemade ectool.
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>

Change-Id: I2132775f9d4a074517f9a98b81919dd77bc86102
Reviewed-on: https://chromium-review.googlesource.com/330075
Commit-Ready: David Wu <david_wu@quantatw.com>
Tested-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-04 11:35:50 -08:00
David Hendricks
ad7d6516b5 locks: Update lockfile dir to be FHS 3.0 compliant
The Filesystem Hierarchy Standard version 3.0* specifies that /run
should be used for runtime variables such as locks.

The rationale for switching to use /run instead of /var/run was
because /var might not be available at early boot. Since /run is
implemented as a tmpfs and doesn't require /var to be mounted first
it can be made available earlier.

*http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html

BUG=chromium:591366
BRANCH=none
TEST=none

Change-Id: Ic0b5ff336c1c258db8891c0a17c836497d9793c5
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/330123
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-02 18:03:45 -08:00
David Hendricks
d89301b036 Replace SysV semaphore lock with file lock
Some systems, such as Android, do not support SysV semaphore locks.
This implements an alternative file lock mechanism using flock().

flock() was chosen because it's pretty straight forward. It's known to
be broken when using NFS, but I doubt we'll ever store our lock on an
NFS volume.

CQ-DEPEND=CL:327407,CL:325609
BUG=chrome-os-partner:49527
BRANCH=none
TEST=tested on Smaug by running mosys and ectool while reading
firmware ROM with flashrom, all three utilities eventually
ran successfully.

Change-Id: Ic73fe0281fbc1dfaae1bb03e5683774a0c04ae5b
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329430
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-01 14:53:50 -08:00
David Hendricks
7b43197449 Add library for working with Android
This adds a couple of helper functions for working within Android:
- in_android(): Crude test that uses getenv() to see if an Android-
specific environment variable is defined.

- android_tmpdir_path(): Android doesn't have the usual locations for
temporary file storage such as /tmp or even /var/run/locks. And to
make matters worse, there isn't even a standard location for
temporary files so it must be determined at run time.

This will be used in a follow-up patch.

BUG=chrome-os-partner:49527
BRANCH=none
TEST=tested on smaug

Change-Id: Ifb5fb4067fffb7c8cb2d4350ca4a223e884d3aa5
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329299
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-29 18:20:07 -08:00