Commit Graph

98 Commits

Author SHA1 Message Date
Mulin Chao
9fdcfe00ca nuc:Using LRESET interrupt to re-initialize LPC settings after warm boot
Fixed bug during polling port 0x204 by BIOS.
We should set processing flag before reading command byte in ISR to prevent
EC_LPC_STATUS_FROM_HOST and EC_LPC_STATUS_PROCESSING bits are both low.

Modified drivers:
1. gpio.c: Add LRESET ISR.
2. lpc.c: Fixed bug during polling port 0x204 by BIOS.
3. flash_ec: Reset ec before flashing ec

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

Change-Id: I8e557f2e2be41a7a9d40c03c775313b12668f283
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/291210
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2015-08-12 18:12:27 +00:00
Alec Berg
756d7d3f84 lucid: add lucid support to flash_ec
BUG=chrome-os-partner:43619
BRANCH=none
TEST=none

Change-Id: I67699ff3904ee6d1196a812adc395d9d3ad7813f
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290437
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-05 01:32:47 +00:00
Myles Watson
050db0510e flash_ec: add support for SWD, nrf51, and hadoken
BUG=none
TEST=manual
BRANCH=none

flash_ec --board=hadoken
flash_ec --board=npcx_evb
flash_ec --board=samus

Use openocd in SWD mode to flash the nRF51 chip.

Use warm_reset to exit DEBUG mode.

Change-Id: Iaf2827d4ce5be6d61431a3de7ab4f86aa4adde02
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287039
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-08-04 19:22:12 +00:00
Tom Wai-Hong Tam
12495e2b40 flash_ec: Set a 10-minute timeout for flashing EC
The flash_ec script is called by the lab infrastructure to flash
the EC firmware of DUT. To prevent the EC flashing tool hanged
forever (may be caused by some bugs), set a 10-minute timeout to
force it to be killed.

BRANCH=none
BUG=chromium:514810
TEST=Patched the change to servo v3. Triggered flash_ec to flash EC
on Jerry. Set the timeout to a small value to force to kill itself.

test2:
  ./flash_ec --board=hadoken   # or samus, anything using openocd
  remove the USB cable half way through (openocd hangs)
  ps au | grep openocd

Change-Id: I39ad8659b41764fd0dba30a86eca301fbbc5243f
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289247
Commit-Queue: Myles Watson <mylesgw@chromium.org>
2015-08-04 19:21:57 +00:00
Myles Watson
2476e6c9a4 Pinky: Remove obsolete board
Jerry is being used for FAFT in the lab.  Remove Pinky instead.

BUG=chromium:511324
TEST=make buildall -j
BRANCH=none0
CQ-DEPEND=CL:288258

Change-Id: I03ddc74a4e72353f3408da8e374ad925baf00a35
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288237
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-07-25 17:45:22 +00:00
Tom Wai-Hong Tam
e5f7583cc6 flash_ec: Add a chip argument
The flash_ec uses the given board name to select a proper flashing
method. It keeps a mapping from board name to chip name.
This approach is not scalable if we want this script to work on
all supported board variants, like the pinky family which has many
boards: jerry, minnie, speedy, etc.

This change adds a new argument of chip name, such that we can only
keep the mapping of major boards. Other boards not listed can use
the chip argument to select a proper flashing method.

BRANCH=none
BUG=chromium:505003
TEST=Ran the script on Beaglebone/Servo v3 connected with Jerry:
$ flash_ec --chip stm32 --image ec.bin

Change-Id: I553ee68f82a7985a37548dfb6e89b364eaffd0f1
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287445
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Myles Watson <mylesgw@chromium.org>
2015-07-22 22:29:54 +00:00
Vincent Palatin
aaafd2da28 Remove ryu P4/P5 support
Remove ryu_p4p5 EC board code along the "splitted" Sensor hub board
(ryu_sh/ryu_sh_loader): It's time to get rid of oldies.

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

BRANCH=smaug
BUG=chrome-os-partner:38333
TEST=make buildall
CQ-DEPEND=*I6df51d7b4be2be7217604da60462b8c9d0cde1d2

Change-Id: Iebc4022267afccb5057c856d624e56a850ecbd70
Reviewed-on: https://chromium-review.googlesource.com/286780
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-20 23:35:44 +00:00
Myles Watson
aaff361011 flash_ec: split interface config from chip configs
rename setup_openocd -> flash_openocd
refactor so that flash_npcx and flash_lm4 set OCD_CMDS and call flash_openocd

BRANCH=none
BUG=chrome-os-partner:22990
TEST=run flash_ec before and after and compare the sequence of calls to
dut-control and the command-line args to openocd

tested with ryu (non-lm4), samus, link, npcx_evb, and peppy

Change-Id: I7a05e3219d4b324bcf19a20f86b149f8e3377465
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273907
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-07-09 01:17:57 +00:00
Dan Shi
d6a6c92724 Add jerry to the list of BOARDS_STM32 as a short-term fix
Board jerry was removed from the list in CL 276524. The board share the same
overlay as pinky. So ideally user can call flash_ec with board set to pinky.
This applies to other veyron boards in BUG 505003 as well.

However, servo in the lab runs on ToT, and it only updates firmware of the dut
by calling flash_ec with board name retrieved from the overlay file. Also, lab
has a tool to check the servod's board and the dut's board. That is, if we
change servod to return board name pinky for servo connected to a jerry dut,
the lab script will raise a warning that the servod is running with a wrong
board.

Before we have a good design to really address the issue, I'd like to add jerry
back to flash_ec so the board can run FAFT in the lab.

BUG=chromium:505003
BRANCH=None
TEST=None

Change-Id: I155e79710f2731701af0acdfeab6089701cf52a8
Reviewed-on: https://chromium-review.googlesource.com/283494
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
2015-07-08 01:44:13 +00:00
Kevin K Wong
882da45900 flash_ec: Add support for kunimitsu, kunimitsu_pd, and strago_pd
BUG=none
TEST=Verified EC and PD is able to flash on kunimitsu and strago
BRANCH=none

Change-Id: I31b9ed57d4cd7a1c09cedbf9c873e76770abd3c8
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282000
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-06-30 12:22:13 +00:00
Ian Chao
957638c78c nuc: Add SHI driver for arm-based platform in chip folder.
Add npcx_evb_arm board-level driver for arm-based platform.
Add header.c: for booting from NPCX5M5G A3 Booter.
Remove lfw folder due to those functionalitie have been replaced with Booter

Modified drivers for
Patch Set 1:
1. flash.c: Implement UMA lock, tri-state and selection register lock functionalities
2. hwtimer.c: Add ITIM32 for hwtimer
3. lpc.c: Add checking for LRESET
4. system.c: Modified CODERAM_ARCH functions for NPCX5M5G A3 Booter.
5. uart.c: Add support for module 2
Patch Set 2:
6. lpc.c: Modified lpc_get_pltrst_asserted() func
Patch Set 3:
7. minimize the changes for CONFIG_CODERAM_ARCH in common layer
8. comments of Patch Set1/2
Patch Set 4:
9. Modified CONFIG_RO_MEM_OFF point to ro image and keep header as a part of ec.RO.flat.
10. Fixed RO_FRID and RW_FRID issues which caused by CONFIG_CODERAM_ARCH.
Patch Set 5:
11. Modified system.c in common folder for supporting *_STORAGE_OFF.
12. Use *_STORAGE_OFF in firmware_image.lds.S to indicate flat file layout in flash.
Patch Set 6:
13. rebase to newest version
14. system.c: Modified for the newest include/system.h
Patch Set 7:
15. Merge from version 0625

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

Change-Id: Ifd7c10b81b5781ccd75bb2558dc236486976e8ed
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/272034
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
2015-06-26 18:57:32 +00:00
Myles Watson
19cd951027 flash_ec: remove unused USB and unprotect options
There is no need for the usb flag, remove it.
There is no need for the unprotect flag, remove it.

BRANCH=none
BUG=chrome-os-partner:22990
TEST=run flash_ec before and after

Change-Id: I201bad7f5be63a90bb8168e21baef2c6fa8d85b4
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273904
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-18 17:31:04 +00:00
Todd Broch
9941f088d7 mec1322: Add servo serialname to flash_ec's flashrom call.
If host running flash_ec has multiple servo's connected it must use
the USB serialname to identify the proper FTDI device to run flashrom
on correctly.  CL adds serial param to flashrom call to do just that.

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

BRANCH=none
BUG=none
TEST=manual, successfully write glados EC w/ multiple servo V2's
connected to the same host.

Change-Id: I35c7d170f9bb80e96f69efae634cf70893eeef63
Reviewed-on: https://chromium-review.googlesource.com/276761
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-11 18:27:30 +00:00
Randall Spangler
fe9e3bf565 Remove obsolete board-specific code
Now that we've removed boards from ToT, also delete board-specific
code used only by the removed boards.

There are still more things to remove (unused charging chips, LED
drivers, COMx support).  More CLs coming.

BUG=chromium:493866
BRANCH=none
TEST=make buildall -j

Change-Id: Ie6bdeaf96e61cadd77e3f6336c73b9b54ff4eabb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276524
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 18:24:05 +00:00
Rong Chang
a585141db0 stm32: switch to ec_boot_mode servo control
hdctools adds an alias ec_boot_mode and remaps spi1_vref with onoff
control. This change switches ARM systems with STM32 EC from
spi1_vref:pp3300 to ec_boot_mode:on.

CQ-DEPEND=CL:275251
BRANCH=none
BUG=chrome-os-partner:40479
TEST=manual
  cd ~/trunk/platform/ec
  util/flash_ec --board oak --image oak_ec.bin
  util/flash_ec --board oak_pd --image oak_pd.bin

Change-Id: I0f3a74eaa7fc937d1372cd51124c6b3d23351581
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274770
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
2015-06-10 14:19:29 +00:00
Todd Broch
339fe7245d mec1322: bugfix for flash_ec dut-control call.
Direct call to shell command 'dut-control' wouldn't account for port
argument in script.  Change to function 'dut_control' within script
that does.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: Id4f77dedb57ce8097059c33371b5cd697fdbdb0d
Reviewed-on: https://chromium-review.googlesource.com/276534
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-06-10 05:04:01 +00:00
Shawn Nematbakhsh
e216906c93 flash_ec: Add support for glados and glados_pd
BUG=None
BRANCH=None
TEST=`flash_ec --board=glados`

Change-Id: I8a23cbd0324d9a321a07bdfd182c996efac79f4c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273359
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-05-27 03:58:11 +00:00
Rong Chang
91b9c336ee oak: Add oak EC and PD flash_ec support
flash_ec script supports stm32 ec and usbpd. This change adds new board
name and MCU map.

BUG=none
TEST=manual
  flash_ec --board oak --image ec.bin
  flash_ec --board oak_pd --image pd.bin

Change-Id: I51a4a22b5188dda35d7b8c34a0115997f374f413
Reviewed-on: https://chromium-review.googlesource.com/267042
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Commit-Queue: Rong Chang <rongchang@chromium.org>
2015-05-15 10:32:40 +00:00
Vincent Palatin
13b555dc63 ryu: fork P4/P5 support
In preparation for Proto 6 board support which won't be backward
compatible, fork the EC for Proto 4 and Proto 5 for people who need to
support older boards.

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

BRANCH=none
BUG=chrome-os-partner:39202
TEST=make buildall

Change-Id: I520bbf146cc1c1dc04e55283be57807ec19ebaa1
Reviewed-on: https://chromium-review.googlesource.com/266064
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-05-02 16:49:05 +00:00
Divya Jyothi
9aea3710b2 mec1322: lfw loader + RO/RW architecture
mec1322 only has 96KB program memory, vs 256KB
flash space on lm4.We no longer have enough program
memory to load both RO and RW at boot. We'll want to
implement a small loader program that will load either
RO or RW from flash, and then jump to the loaded image.

CONFIG_FW_INCLUDE_RO is enabled to include RO image into
the build.

pack.py script is altered to load the (lfw + R)O on boot.

Software sync is not added.Distinguish between
RO/RW is yet to be added.

flash_ec is altered to support padding 0xFFs to 256k ec.bin
to match the size of the SPI flash of the board.

BUG=chromium:37510
BRANCH=None
TEST=Make -j buildall,Verified ec.bin to be 256k.
Verified RW image at offset 0h and (lfw + RO) at offset 2000h.
On boot sysjump to lfw. lfw checks in shared SRAM (currently RO)
and jumps to RO image.

Change-Id: Ib9b114e2f24a615d5e5bd8b3803be621d1e5bd17
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/265807
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com>
2015-04-23 07:04:41 +00:00
Vincent Palatin
72ca4cc9f9 util: workaround warm_reset issue in flash_ec
The warm_reset_l signal is an open drain output on the servo side and
its input value can be read back as on (level 0) when the AP power rails
are off on the DUT side and not pulling it up.

So the current mechanism of reading the warm_reset input value with
dut-control at the beginning, then restoring it at the end is sometimes
broken because when the AP is OFF, we are reading input == on (while we
had actually set output to "off" but we have no pull-up) and then
restoring a "hard" on (drive low on the servo side).

In this workaround, just assume we don't want to pull warm_reset after
flashing the EC and restore it to off.
A better solution might be to have a mechanism in dut-control to read
the output register rather than the input value for GPIO, so we can save
and restore them safely.

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

BRANCH=none
BUG=chrome-os-partner:30738
TEST=On Ryu P5 with the AP off, run ./util/flash_ec --board=ryu
then boot the AP properly with the power button.

Change-Id: I96e65c2fec5e6d604445af3fe26fce73678b1d3b
Reviewed-on: https://chromium-review.googlesource.com/265223
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-04-11 00:36:08 +00:00
Scott Collyer
23716f05aa honeybuns: Initial /board files
Modified version of /board/fruitpie.
Attempted to capture GPIO definitions. Other changes
consisted of modifying functions to enable compilation.
No real functionality as of yet.

TEST=Serial console and I2C functions have been verified
BUG=chrome-os-partner:37078
BRANCH=samus

Change-Id: Iedfc724a058e4220176193ef0f66e5bf45eabbd9
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/252426
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-03-12 03:42:12 +00:00
Bernie Thompson
e93d91558f flash_ec: add support for strago and cyan
BUG=None
BRANCH=None
TEST=`flash_ec --board=strago --image /ec.bin`
`flash_ec --board=cyan --image /ec.bin`
Verify flashing success.

Change-Id: I10b93f5e646687ac1f299b12ff5a91aedfdd3d75
Signed-off-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/255950
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-03-06 08:49:07 +00:00
Vic Yang
accd0da789 Remove ryu_p1 board
P1 boards are not used anymore. We haven't built ryu_p1 EC for a while.
Let's get rid of it.

BRANCH=None
BUG=chrome-os-partner:35138
TEST=make buildall

Change-Id: Ie0c0b91ce0af99a0975050935af920503ca7383a
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/252340
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-02-24 03:07:59 +00:00
Julius Werner
672d37789f flash_ec: Add --no-ns-pid check and freeze instead of kill PTY clients
The switch to PID namespaces inside the chroot broke flash_ec's ability
to detect (and then kill) other processes that use the EC serial PTY
(leading to potential flashing failures). After a long discussion we
decided that users who need features like this should be forced to run
their chroot without PID namespacing (using cros_sdk --no-ns-pid). This
patch adds a hard check for this to flash_ec, so that using it in an
unsafe way becomes impossible.

In addition, this ports the more advanced SIGSTOP/SIGCONT logic to
flash_ec that was pioneered in fwgdb. With this, other processes
accessing that PTY will just freeze and become available again after
flash_ec finished.

BRANCH=none
BUG=chromium:444931
TEST=Ran on a Jerry with and without --no-ns-pid, with and without
an open EC terminal, all results as expected.

Change-Id: I45ffc3ec6cfe9c25a0b82b4d5288a41485c326c4
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/249835
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-02-17 19:32:52 +00:00
Ben Lok
a9ae00b101 llama: add llama board support
This is to add llama board support:
  - new files in board/llama folder, including battery.c and led.c
  - new file power/mediatek.c, which is mostly based on power/tegra.c
  - modified flash_ec for llama board
  - disable tests for llama board.

BRANCH=none
BUG=none
TEST=make BOARD=llama

Change-Id: Ie1ae068c1a402f08e1449668b1be8f31105bb804
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/243510
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: lok.ben ben.mtk <ben.lok.mtk@gmail.com>
Commit-Queue: lok.ben ben.mtk <ben.lok.mtk@gmail.com>
2015-02-10 08:46:06 +00:00
Vic Yang
d73e8cb9c9 Assert warm reset while flashing STM32 parts
The STM32 bootloader reacts to the first command it sees and then sticks
to that interface. On some devices, the AP is connected to I2C or UART
on the EC, and if the AP talks when we are trying to flash the EC, the
EC sticks to that interface and ignores requests from the servo board.
Fix this by holding warm_reset so that the AP is down.

BRANCH=None
BUG=None
TEST=Flash Ryu several times.
TEST=Flash Plankton to make sure it doesn't break devices without
warm_reset.

Change-Id: I860fc65ba7fdaf0cbc9a0be641148b5095de394b
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/247360
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@google.com>
Commit-Queue: Vic Yang <victoryang@chromium.org>
2015-02-09 03:35:57 +00:00
Vic Yang
0fc37f1291 Add flash_ec support for Glower
Just so that we can program the EC more conveniently.

BRANCH=None
BUG=chrome-os-partner:35308
TEST=Program a Glower.

Change-Id: Iaba0839c4a5b8dee805f7d31e4049198ce43918f
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/247142
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
2015-02-09 02:13:56 +00:00
Shelley Chen
7e9fc466b0 flash_ec: fixing servo v3 support for beaglebone
Adding setup_openocd function to take care of setup of either servo v2 and or
servo v3 setup (setting up OCD_PATH and OCD_CFG variables).  Have modified
flash_link, flash_lm4, and flash_npcx functions to use setup_openocd function.

BUG=chromium:412249
BRANCH=None
TEST=made sure that outputted flash_ec command lines prior/after change on host
     are identical for link and peppy.  Also made sure that flash_ec command
     works on peppy with updated image on beaglebone.  Also ran "make runtests".

Change-Id: Iacf42fae1f175d6acd08bbd16352afb8f3bd21b0
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/242043
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-01-23 00:28:49 +00:00
Ian Chao
4ee50837a0 nuc: Add all IC specific drivers of NPCX5M5G
Add npcx_evb in board folder for testing
Add shared-spi arch support in common layer.

Modified drivers for
1. Fan.c: console command “pwmduty”.
2. Pwm.c: for the issue when set duty to 0.
3. System.c: for hw reset only during system reset.
4. Flash.c: Fixed access denied bug of the flash driver for host command.
5. Comments from Patch Set 1
6. Comments from Patch Set 3 (except sha256.c)
7. Add openocd and flash_ec support for npcx_evb
8. Add little FW and spi-flash upload FW in chip folder
9. Add optional make rules for PROJECT_EXTRA
10.Replace CONFIG_SHRSPI_ARCH with CONFIG_CODERAM_ARCH and remove changes
   in common layer sources for shared-spi arch. (except sysjump)
11.Find the root cause of JTAG issue and use workaround method
   with SUPPORT_JTAG in clock.c
12 Execute hibernate in low power RAM for better power consumption
13 Add workaround method for version console command
14 Modified coding style issues by checkpatch.pl tool

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

Change-Id: I5e383420642de1643e2bead837a55c8c58481786
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233742
2015-01-14 03:16:10 +00:00
Vincent Palatin
cca794d2fe pd: dingdong/hoho: Enable flash write-protection
These USB type-C accessories don't have a write-protect GPIO.
Add a configure flag (CONFIG_WP_ALWAYS) to force the flash
write-protection on the dongles.

Also set the read protection (by elevating RDP to level 1),
so trying to unprotect the flash will trigger a full erase.

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

BRANCH=samus
BUG=chrome-os-partner:35088
TEST=boot Hoho,
check the flash OBR and WRPR registers:
"rw 0x4002201c" / "rw 0x40022020"
and the option bytes write-protect bits: "rw 0x1FFFF808"
dump the logical state with "flashinfo" command.
> rw 0x4002201c
read 0x40022020 = 0xffff0002
> rw 0x40022020
read 0x40022020 = 0xffff0000
> rw 0x1FFFF808
read 0x1ffff808 = 0xff00ff00
> flashinfo
Physical: 128 KB
Usable:   128 KB
Write:      2 B (ideal 2 B)
Erase:   2048 B (to 1-bits)
Protect: 4096 B
Flags:   wp_gpio_asserted ro_at_boot ro_now
Protected now:
    YYYYYYYY YYYYYYYY ........ ........

Change-Id: I45bbc0bce40ecc174b6b8a1ebacf4f53d2fd372d
Reviewed-on: https://chromium-review.googlesource.com/238893
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-01-08 00:38:17 +00:00
Vincent Palatin
9ce66a98b2 zinger: enable RO partition write-protection
Check the flash protection at startup, if the RDP is still at level 0
(no read protection) or if the RO partition is not write protected :
- set the write protection on the first 16KB of flash (4 LSB of WRP0)
- push the RDP to level 1, so SWD/serial monitor needs to fully erase
  the part before re-writing the code or the write-protection.

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

BRANCH=samus
BUG=chrome-os-partner:34935
TEST=dump the content of the option bytes.

Change-Id: I11af64365a6fbc34327b2e463eb8e2d369ffacd2
Reviewed-on: https://chromium-review.googlesource.com/238262
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-01-05 19:10:27 +00:00
ZhengShunQian
3c780a915c Speedy: add initial speedy support
Copy from Jerry for now.

BUG=chrome-os-partner:33269
TEST=emerge-veyron_speedy chromeos-ec
BRANCH=None

Change-Id: I8375e1e23de5dbae0d1c579770d88e81223debce
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/233795
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-12-08 09:51:14 +00:00
Katie Roberts-Hoffman
c420bf1922 Add initial mighty support
Essentially a copy of jerry for now.

BUG=chrome-os-partner:33269
TEST=make BOARD=jerry

Change-Id: I696919455f4752ebe43b616bdace6ac0820f8fe5
Reviewed-on: https://chromium-review.googlesource.com/230917
Reviewed-by: Alexandru Stan <amstan@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-11-20 05:09:09 +00:00
Vic Yang
3bcc5673c9 ryu: switch default firmware to use STM32F373
This simply renames ryu to ryu_p1, and ryu_p2 to ryu. 'ryu_p1' will be
kept for a while and will be decommisioned when most developers make
switch to the new boards.

BRANCH=None
BUG=chrome-os-partner:33583
TEST=Build ryu and boot on P2 board.

Change-Id: Ief61c64c6aefdaeae76ac7b86e0ea28131810aa1
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229291
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-12 23:08:12 +00:00
Katie Roberts-Hoffman
908b3f559b Add initial support for jerry
BUG=chrome-os-partner:33269
TEST=make BOARD=jerry; ./util/flash_ec BOARD=jerry
(on a pinky rev2 as a sanity)

Change-Id: I2c54e4044a65a0014adb32dd46f74bf5ed11b02d
Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225300
Reviewed-by: Alexandru Stan <amstan@chromium.org>
2014-10-25 08:14:16 +00:00
Ken Chang
89a28fd464 flash_ec: Add support for kitty
Make board kitty to use flash_stm32.

BUG=chrome-os-partner:33035
BRANCH=None
TEST=Run util/flash_ec on kitty, verify flashing
complete successfully.

Change-Id: I302cfc85bfe5fa36fdf1a61d59b4dc21b36cc06a
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/224231
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-23 09:06:12 +00:00
Vic Yang
00551f7331 Add new build target ryu_p2 for Ryu P2 boards
The new build target ryu_p2 is mostly based on ryu. On ryu_p2, we have a
new EC chip with bigger flash, so make the corresponding changes:
  - Pinout changes
  - HW Timer: TIM5
  - USB PD Tx Timer: TIM3_CH4
  - USB PD Rx Timer: TIM2_CH4
  - Use UART2 for EC console
  - Disable UART Tx DMA as it conflicts with USB PD Tx DMA
  - Use 24MHz HSE x2 = 48MHz for SYSCLK

BRANCH=None
BUG=chrome-os-partner:32660
TEST=Sanity check on a new board:
       - i2cscan
       - PD negotiation
       - UART console
       - gettime

Change-Id: I4ef6b53a928a2777721e3874032aeb0e6b2b4c92
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221404
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-22 00:30:42 +00:00
Todd Broch
c1714dac12 dingdong: Initial board and USB PD support.
Allows dingdong to receive initial USB PD communication (source
capabilities payload) and with some manual manipulation (see 'TEST=')
drive DPout.

CL is based heavily off hoho dongle where all files were copied from
   board/hoho:
     7b1e58c ectool: Add host command support to set fan RPM for each
             fan separately

   Files gpio.inc, board.h & board.c were modified but others should
   be identical.

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

When attaching dingdong to samus_pd and configured via
  'pd dualrole source'

I see following on samus_pd console:
    C1 st9
    Switch to 5000 V 900 mA (for 900/900 mA)
    C1 st10
    C1 st11
    C1 st12

showing power constract and transition to SRC_RDY:
    > pd 1 state
    Port C1, Enabled - Role: SRC Polarity: CC1 State: SRC_READY

    > typec 1 dp

Also if I connect in CC1 configuration and get access to dingdong
console I can
   > gpioset PD_SBU_ENABLE 1

And see dingdong drive external monitor

Change-Id: I30ef6f8503a3fb015cfb8806bc36fb98f5150e40
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221913
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-10-08 05:07:29 +00:00
Alexandru M Stan
c5b30aa9f2 Renaming board veyron -> pinky
Seems that all previous boards used the subvariant specific name, and had an
alias from emerge-variant_subvariant to the ec subvariant folder.

BUG=chrome-os-partner:32331
BRANCH=None
TEST=cd board/pinky; make clean && make -j && ../../util/flash_ec --board=pinky

Change-Id: Ie6e0c977b6659687357a1b5aa2915cf0e40a5da7
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221904
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2014-10-08 02:51:13 +00:00
Alec Berg
0330d9adf2 zinger: minimuffin: add board support for minimuffin
Minimuffin is identical to zinger, same MCU, same gpio, same
circuitry aroundt the MCU with two differences:
- Rated current is 2.25A instead of 3A
- USB PD hardware device ID needs to be different so that host
can differentiate between the two.

Due to the similarity between the two, minimuffin is defined
as a symlink to the zinger board.

BUG=none
BRANCH=samus
TEST=make BOARD=minimuffin
load onto a zinger and verify that samus reads device ID correctly
and limits input current limit to 2.25mA.

Change-Id: Ie39ec43262c7d14663eb68abff073bfeec451a24
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220689
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-02 20:51:10 +00:00
Vincent Palatin
1ec56e8546 stm32mon: add option to read firmware image from stdin
Add a command-line option to ask stm32mon to read the EC firmware image
to flash from the standard input when the filename is replaced by a "-".

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

BRANCH=none
BUG=chromium:398165 chromium:396233
TEST=use the following flashing commands:
cat build/fruitpie/ec.bin | ./util/flash_ec --board=fruitpie --image=-
./util/flash_ec --board=fruitpie
./util/flash_ec --board=fruitpie --image=build/fruitpie/ec.RO.flat
and check the content of the flash.

Change-Id: I8039ecb6910f912161a7f59c5f5e2fc80447ce7b
Reviewed-on: https://chromium-review.googlesource.com/220842
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-10-02 07:02:54 +00:00
Alec Berg
b16cda06a8 plankton: add flag for prog_en to flash_ec
Add setting of new GPIO, prog_en, to flash_ec to be able to program
new plankton boards. This pin must be on for boot0 and nrst to be
connected from the FTDI to the MCU.

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

sudo servod -c plankton.xml
util/flash_ec --board=plankton

CQ-DEPEND=CL:216160

Change-Id: I29f882856e24147a7af283c5e82298c7736b8662
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/216161
Reviewed-by: Todd Broch <tbroch@chromium.org>
2014-09-10 14:01:46 +00:00
Mohammed Habibulla
df13541440 Auron: Initial EC commit
Clone of Peppy with only string changes

BUG=chrome-os-partner:31285
TEST=emerge-auron chromeos-ec
BRANCH=none

Change-Id: I1f7288e44cdc5ff1caa41de5ee299dbfa3411fa1
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212971
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-08-20 02:12:53 +00:00
Todd Broch
e1ff1a3cae hoho: Initial board configuration.
Create necessary boiler plate files for USB type-C to HDMI dongle.

BRANCH=none
BUG=chrome-os-partner:31192
TEST=manual
1. Compiles & can program via fruitpie.
2. Can access uart (w/ rework for tx/rx).
3. Can drive HDMI capable monitor.

test details ...

Programming:
------------
   # connect fruitpie + fruitpie std-adapter(red) with u-USB (CN3) & type-A
   # (CN1) both to host that will run servod.
   FPIE_PORT=9993
   sudo servod -p 0x5009 --port $FPIE_PORT

   dut-control --port $FPIE_PORT "ec_uart_cmd:gpioset USB_C_5V_EN 1"
   dut-control --port $FPIE_PORT "ec_uart_cmd:usbmux usb"
   util/flash_ec --board=hoho

Configuring samus for DPout on both ports:
------------------------------------------

    sudo servod -b samus

    for port 0 1; do
        dut-control "usbpd_uart_cmd:pd ${PORT} dualrole off"
        dut-control "usbpd_uart_cmd:gpioset USB_C${PORT}_CHARGE_EN_L 1"
        dut-control "usbpd_uart_cmd:typec ${PORT} dp"
        dut-control "usbpd_uart_cmd:gpioset USB_C${PORT}_5V_EN 1"
        dut-control "usbpd_uart_cmd:typec ${PORT}"
    done
Change-Id: I39bbe1e347d1cfd777b68f3fdac6c5c6dd22800d
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212523
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-08-16 05:26:40 +00:00
Dominic Chen
67281b9807 flash_ec: add support for closed-case debugging
Passing the "--usb" argument will now utilized case-closed
debugging for flashing the EC. Currently this is only supported
for the samus LM4-based board.

BRANCH=none
BUG=none
TEST=verify that when the case-closed debugging flag is set, the
alternate openocd config file is used for samus, and an error is
thrown for all other boards

Change-Id: I0642bc2e9c2657cd8dbd83ee6e282365275d665a
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211744
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-08-15 21:07:35 +00:00
Dominic Chen
fd9eed96fd openocd: update configuration files
1. use ftdi interface driver instead of deprecated ft2232
2. remove custom target config and use upstream stellaris target
3. replaced deprecated servo_v2.cfg with servo_v2_slower.cfg
4. deprecated openocd.cfg

BUG=none
BRANCH=none
TEST=flash samus works
CQ-DEPEND=CL:210778

Change-Id: I572a717613eedc3afc44009a0f1aba1f1d36d7f7
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210920
Reviewed-by: Todd Broch <tbroch@chromium.org>
2014-08-15 21:07:31 +00:00
Vic Yang
9bc0a4c152 Fix LM4 flashing in flash_ec
This fixes the bug that SRC_ROOT is not set. This should be the last fix
for flash_ec. DEFAULT_BOARD is intentionally left as is. For developers
who don't want to use --board option every time, they need to set
DEFAULT_BOARD in their environment variables.

BUG=chromium:397202
TEST=util/flash_ec --board=link
BRANCH=None

Change-Id: If23f73adbd37f2a79cb5176e3665562e278f46db
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210523
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2014-08-04 03:14:45 +00:00
ChromeOS Developer
dbf62710f7 Make board names in flash_ec less prone to conflicts
BUG=None
BRANCH=None
TEST=Run util/flash_ec on peppy, spring, link. Verify flashing
complete successfully.

Change-Id: Ib388af6800ae208934d5b026a63f0567d31ef86e
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191304
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-07-31 02:17:06 +00:00
Vic Yang
68dd21c560 Fix flash_ec so that it finds stm32mon
If chromeos-ec package hasn't been built, flash_ec tries to find
stm32mon in local build/ directory. However, this is broken in the last
CL when we move away from crosutils. Let's fix it.

BUG=chromium:397202
TEST=Flash samus_pd
BRANCH=None

Change-Id: I05395a727fa965032a24f51c07deaebf2d7c7e51
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210419
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-07-30 23:42:32 +00:00