Commit Graph

5289 Commits

Author SHA1 Message Date
nagendra modadugu
b2280c24b4 CR50: point multiply should check point for curve membership
_cpri__EccPointMultiply should check whether the provided
point is on the curve prior to doing a multiply.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=TCG test CPCTPM_TC2_4_13_01_01 passes

Change-Id: Ia92494070c62f7e03b395975138c0c8446a7284d
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/341112
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-30 02:43:22 -07:00
Mary Ruthven
61e0653261 cr50: add basic rbox support
This change modifies the behavior of RBOX by blocking the key0 and key1
output, when the power button is pressed. It also adds support for
printing debug statements when various RBOX interrupts are triggered.

BUG=none
BRANCH=none
TEST=On cr50 test board verify key0 and key1 out are not asserted unless
the power button is pressed.

Change-Id: I67a3c1b8009279015bdc87bcf0995cffa9ab6f03
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341470
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-29 16:07:13 -07:00
Shawn Nematbakhsh
43a0c70346 kevin: Decode board version
Decode board version from analog voltage on BOARD_ID.

BUG=chrome-os-partner:52642
BRANCH=None
TEST=Verify 'ver' shows "Board: 0" on proto 1 board.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ifdbdd2e975e463ab45d81ee6eaa4ba017a2f29c0
Reviewed-on: https://chromium-review.googlesource.com/340241
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-29 14:38:06 -07:00
Shawn Nematbakhsh
90145968b2 kevin: GPIO changes for new proto build
BUG=chrome-os-partner:52171
TEST=Verify old kevin boards still boot + power sequence.
BRANCH=None

Change-Id: Iacc02beba05ef3e80ffa59aa7fc5718c12bae20c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338043
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-29 14:38:06 -07:00
Mary Ruthven
9eafb5b9dd cr50: set SYS_RST_L as an input
Setitng SYS_RST_L as an output contends with the EC setting it as an
output. We will only drive the pin when necessary.

BUG=none
BRANCH=none
TEST=power on kevin and make sure the AP is able to boot.

Change-Id: Ie40cc4932ff92d20b021765c3aa356d8902f20e1
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341326
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-29 11:02:03 -07:00
Bill Richardson
c5dd305dff Cr50: Move board-specific rdd stuff out of chip/g/
Poking GPIOs is something that belongs in board/ not chip/

BUG=none
BRANCH=none
TEST=make buildall; test on Kevin

Change-Id: I798053c3760415ed787800d37eb81c765b826399
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341065
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-29 07:34:53 -07:00
Daisuke Nojiri
38c93a26f3 STM32: Add HSE and PLL to clock source selection
This patch adds HSE and PLL as a system clock oscillator for STM32L4.
This allows us to drive the chip at a higher frequency (up to 80 MHz),
which is necessary to big-bang GPIO ports accurately.

BUG=none
BRANCH=tot
TEST=make buildall. Verified console works on STM32L476G-Eval using HSE,
PLL-HSE, PLL-HSI, PLL-MSI as an oscillator. Verified console runs soundly
with different frequencies from 20 Mhz to 80 Mhz. Verified frequencies
using oscilloscope on MCO (Microcontroller Clock Output) port up to 50 MHz.

Change-Id: I493cdb6c323eb4e6a1560f6d030935c1950b1a2a
Reviewed-on: https://chromium-review.googlesource.com/341275
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-04-29 07:34:52 -07:00
Daisuke Nojiri
2b79492093 STM32: Set UART clock sources to SYSCLK
Since uart_freq_change assumes we drive UARTs at system clock, we need to
set UARTs clock sources accordingly. This will allow us to clock up the
chip without worrying about prescaler values set for HCLK and PCLK or the
on/off status of HSI.

BUG=none
BRANCH=tot
TEST=make buildall. Verified LPUART on stm32l476g-eval.

Change-Id: I02898921e31b68cacbc2235a29c47a212c350afe
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341260
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-04-29 07:34:52 -07:00
nagendra modadugu
66473502c9 CR50: remove unused config option CONFIG_RSA, some cleanup
CR50 does not depend on the rsa implementation
in common  This change removes the corresponding
config option.

Also remove a duplicate CONFIG_SHA256 option, and add a
comment regarding CONFIG_SPS_TEST.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=compilation succeeds

Change-Id: Ie01439899042c5fa981f884a01b83eb0b3eb6e32
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340539
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-27 23:58:06 -07:00
Bill Richardson
8a2423c054 Tell git to ignore all private subdirectories
Internal builds may have private*/ subdirectories cloned from
repositories that we're not (yet) allowed to share
publicly (boo). Tell git not to complain about them every time I
run "git status".

BUG=none
BRANCH=none
TEST=manual

  mkdir private-foo
  touch private-foo/bar.txt
  git status

Observe the lack of complaints about private-foo

Change-Id: I5281e3a533f9b1a548ced6f6716a388152c58776
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341032
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-04-27 23:58:06 -07:00
Shawn Nematbakhsh
0970c2d795 chell: Keep KB light PWM active during low-power idle
BUG=chrome-os-partner:52783
BRANCH=glados
TEST=Enable CONFIG_LOW_POWER_S0 on chell. Verify KB backlight does not
flicker during idle.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib7cbaf955654cbb22a7beb7dc536468b532a769d
Reviewed-on: https://chromium-review.googlesource.com/341003
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-04-27 23:58:04 -07:00
Shawn Nematbakhsh
ab27f42f56 pwm: Add PWM_CONFIG_DSLEEP config flag
Add PWM_CONFIG_DSLEEP PWM config flag, which can be set to keep a
channel active during low-power idle / deep sleep. Currently it's
supported by npcx and mec1322.

BUG=chrome-os-partner:52783
BRANCH=glados
TEST=Manual on chell w/ subsequent commit + CONFIG_LOW_POWER_S0. Verify
KB backlight does not flicker during idle.

Change-Id: Ib9df5879aaa7dfa5764de1583496de84d40d2bb5
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341002
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-04-27 23:58:04 -07:00
Nick Sanders
8d742588ad servo_v4: add initial servo_v4 build
Add initial servo_v4 build, GPIOs, etc.
Supports most features other than PD passthrough.

BUG=chromium:571476
BRANCH=None
TEST=updated servod is able to control gpio, gpio extender on servo v4

Change-Id: I71c9cb2bf24b732dd6a2e101d7b1c849c9f88af8
Signed-off-by: Nick Sanders <nsanders@google.com>
Reviewed-on: https://chromium-review.googlesource.com/332803
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-04-27 18:12:32 -07:00
Shawn Nematbakhsh
2aadcea461 fusb302: Delay after enabling CC measurement switches
Delay after enabling CC measurements, before checking CC levels, in
order to improve accuracy.

BUG=None
TEST=Manual on Kevin. Verify CC levels are consistent with a specific
charger.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib9abab2abd68b071fb22200bcac36bea6e361d67
Reviewed-on: https://chromium-review.googlesource.com/340885
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Joe Bauman <joe.bauman@fairchildsemi.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-27 18:12:28 -07:00
Vadim Bendebury
88caf3bc72 g: i2c slave driver
A fairly detailed description of the driver is included in the
comments in the file.

As of this submission the setup is fairly brittle, as clock stretching
is not yet enabled, and there is no guarantee that the slave will
prepare the data for the master in time.

More testing will be required and enhancements will be added in the
future.

BRANCH=None
BUG=chrome-os-partner:40397
TEST=with the rest of the patches applied, an i2c app running on the
     desktop allows read and write TPM registers using the
     USB-FTDI-I2C cable connected to the B1 board.

Change-Id: I46b13d360ca92271702268f9088193b5ada583be
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340519
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-27 18:12:25 -07:00
Vadim Bendebury
3093a8da7f tpm_regs: clean up debug messages
Some debug messages were a bit ambiguous, and some just wrong, this
patch fixes the wrong one and disambiguates the other two.

BRANCH=none
BUG=none
TEST=observed the new generated message.

Change-Id: I2b58ec050816ecdfe4b20dd8410910569767830d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340536
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-27 18:12:25 -07:00
Nick Sanders
4e52ae607c servo_micro: add gpio mode get and set
GPIO console commands currently only show input voltage level,
and can only set level on predefined outputs.

This change allows GPIOs to be cycled between output, input,
and alternate function, as well as displaying the mode and
asserted level (if any) in gpioget.

This change creates CONFIG_CMD_GPIO_EXTENDED
as the internal gpio interface needs to be changed to support
this, and I can't test the other architectures. It may be
worthwhile to add this for all, or not.

This change is also necessary also for servo micro JTAG and PD
UART support, as several pins are tied together on the flex
and stm32 outputs need to be variously active or in high-z
depending on mode.

BUG=chromium:571477
TEST=gpioget <0|1|IN|A|ALT>; gpioget;
BRANCH=None

Change-Id: Iba32992db6244ee1e654db840d1c9c11dd2a0993
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338885
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-27 14:04:07 -07:00
Vadim Bendebury
d18cb0e81f checkpatch: do not consider split text strings a problem
The checkpatch complaints about both lines longer than 80 characters
AND character strings split between lines. Damn if you do, damn if you
don't. With this addition split character strings are not a problem
any more.

BRANCH=none
BUG=none
TEST=split character strings are not reported as a violation by the
     pre-upload script.

Change-Id: I8b5919f086f8c19fe4e6e3a4b99a816111882f0d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340535
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-27 14:04:06 -07:00
Anton Staaf
7a78cc918c UART: Remove X-on/X-off flow control
This doesn't appear to be used anymore, and the EC3PO replacement
console doesn't support this yet.  This also makes changing the UART
driver API more difficult, so let's remove it.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

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

Change-Id: Ia6d9cf4c89e34683f38169dbec612a417c6ba630
Reviewed-on: https://chromium-review.googlesource.com/340842
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-27 10:10:02 -07:00
Anton Staaf
307b8e5453 UART: Remove enable/disable interrupt functions
These were not being used and complicate changes to the UART API.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

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

Change-Id: I73e256f09f7ea72f0cc4831cc7ce391a7125e555
Reviewed-on: https://chromium-review.googlesource.com/340841
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-27 10:10:02 -07:00
Mary Ruthven
2cab8b2081 cr50: enable AP and EC flash access
The cr50 SPI master can control the external AP and EC SPI ROM. This
change adds support for doing spi_transactions, but does not use the SPI
transactions for anything except console commands. This support will be
used for flashing the AP and EC through CCD. For now AP and EC flash
select must be done manually using the spi_flash_select console command.
Flash select should be disabled after use, because it will prevent the
system from booting.

BUG=chrome-os-partner:50701
BRANCH=none
TEST=Enable spi_flash commands. Select AP ROM and verify spi_flashinfo,
read, erase, and write commands work properly. Select EC ROM and verify
the same commands.

Change-Id: I16c55015794f8513effe0fa5712488a84bed2627
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339844
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-26 14:21:00 -07:00
Shawn Nematbakhsh
539e261d72 pd: Fix port enable check for low power idle
BUG=chrome-os-partner:52734
BRANCH=glados
TEST=Plug 2 PD chargers on sentry, remove the first, verify that
SLEEP_MASK_USB_PD is not briefly cleared.

Change-Id: I62309194d8b5a694487282434fc63b5f39301ba3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340564
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-25 21:04:41 -07:00
Daisuke Nojiri
dd5bea954b STM32: Support LPUART console
This patch adds support for console on LPUART (low power UART).
It is wired to the USB type B port on the board, which is also one of the
power sources. So, using LPUART simplifies the set up.

BUG=none
BRANCH=tot
TEST=Verified console works on stm32l476g-eval. make buildall

Change-Id: Iccf697cfabdcb7e1362d8453708eb79610d2e0cb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340101
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-25 16:49:02 -07:00
Daisuke Nojiri
40c02e3ff2 Bring up STM32L476G-Eval
This patch adds initial set of files to bring up STM32L476G-Eval board.

BUG=none
BRANCH=tot
TEST=Tested console. make buildall && make tests

Change-Id: I0c0f73f31e84099746fced4214c5ed7f45468cef
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340100
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-25 16:49:02 -07:00
Daisuke Nojiri
cb0d8108e5 STM32: Add dma_select_channel
dma_select_channel selects which stream (peripheral) to be used on a
specific channel. Some STM32 chips simply logically OR requests, thus
do not require this selection.

BUG=none
BRANCH=tot
TEST=make buildall && make tests. Verified on stm32l476g-eval.

Change-Id: I7b64b78bdec80658992f58cb4c94ade972a1081c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340107
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-04-25 16:49:01 -07:00
Shawn Nematbakhsh
a1fc785977 snoball: GPIO changes for proto 1
BUG=chrome-os-partner:52690
BRANCH=None
TEST=`make buildall -j`

Change-Id: I787e8bc2fb5ca04a0879eeec7a8d7169e36b7661
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340445
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-25 12:56:42 -07:00
Koro Chen
37c577cbfb elm: modifications for EVT
This add modifications for EVT, including:
  - Use SPI for KX022 motion sensor on the daughterboard
  - remove TMP432
  - Use PF2 to control the external power of ANX7688

BRANCH=none
BUG=chrome-os-partner:52245
TEST=make BOARD=elm -j

Change-Id: I7d4021746bc8a2be0028076a5c3aeefd8736c1b0
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/337338
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-04-25 09:01:36 -07:00
nagendra modadugu
28827163c5 Move include/byteorder.h -> builtin/endian.h
Move endian routines to builtin/ so that portable third_party
code may build without glibc.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=none

Change-Id: Icb900d1e9c56dc68ec1ef4b536ebc9dcf6ebcd69
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340432
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-04-22 20:40:03 -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
nagendra modadugu
1546b4de0b Add the memmove() function prototype to builtin/string.h
Add memmove() to builtin/string.h so that portable third_party
code may build without glibc.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=none

Change-Id: I8c165d71d9c01d2f869329b3600aac0970f41e71
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340293
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2016-04-22 12:02:30 -07:00
David Huang
4f0ab31184 elm: Modify battery cutoff command
Modify battery cutoff command for EVT

BRANCH=elm
BUG=chrome-os-partner:52548
TEST=Use "ectool batterycutoff" to check battery enter shipmode.

Change-Id: Ia0c620f95d6e94ec658f92c5b56cbab3ae964848
Signed-off-by: David Huang <David.Huang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/340168
Commit-Ready: 志偉 黃 <David.Huang@quantatw.com>
Tested-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-21 19:46:41 -07:00
nagendra modadugu
c65700730d Add the memcmp() function prototype to builtin/string.h
Add memcmp() to builtin/string.h so that portable third_party
code may build without glibc.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=none
Signed-off-by: nagendra modadugu <ngm@google.com>

Change-Id: Id52c9c76fceac94bf1998958b43f42ad5d5298d3
Reviewed-on: https://chromium-review.googlesource.com/339878
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
2016-04-21 03:08:16 -07:00
Daisuke Nojiri
671621b4c4 nucleo-f072rb: Add initial set of board files
This change adds files to support nucleo-f072rb. This board can be used as
a DUT to test STM32F072.

BUG=none
BRANCH=tot
TEST=Verified EC console works. Flashed the board by 'make flash'. User LED
brinks periodically and when user button is pressed.
make buildall && make tests

Change-Id: I628f229b62c4b06d19d8245121f79a13e17bc2e9
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338461
2016-04-20 21:56:06 -07:00
Shawn Nematbakhsh
ba27af2315 kevin: Fix test build
BUG=None
TEST=`cros_workon-kevin start chromeos-ec; emerge-kevin chromeos-ec`
BRANCH=None

Change-Id: Ia2916a9c97f9d981954cdc0506bffb0ee239b256
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339745
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-20 18:43:07 -07:00
nagendra modadugu
045a593203 CR50: add support for RSA key generation
Prime generation uses a sieve to amortize division
with small primes.  Otherwise this a standard
Miller-Rabin implementation.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpm2 pass

Change-Id: I9f84d1f9c911f6146e4bd80296f75157a191552d
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/335222
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-04-20 03:14:30 -07:00
Koro Chen
f00d4621a4 elm: kionix: allow dynamic selection of SPI or I2C transport
This CL ports c9832e04f1 to Kionix accel driver. And also enables SPI
access of Elm's base kx022.

BUG=none
BRANCH=none
TEST=manual

Change-Id: I0c1de028c82fc62a124bb5b930a3882c4b368d71
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/331851
Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
2016-04-20 01:40:00 -07:00
nagendra modadugu
ee5d09823f CR50: add support for P256-ECIES (hybrid encryption)
Add support for P256 based hybrid encryption, and
corresponding tests.  Where hybrid encryption is:
P256 based DH + AES128 + HMAC-SHA256.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
CQ-DEPEND=CL:336091,CL:339561
TEST=ECIES tests in test/tpm/tpmtest.py pass

Change-Id: Ie091e278df72185a6896af0e498925e56404f87e
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/337340
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-19 22:47:36 -07:00
nagendra modadugu
acc9226910 CR50: remove DCRYPTO_p256_points_mul, add DCRYPTO_p256_point_mul
points_mul (variable time) is only necessary for
ECDSA verification, and is not required as part of
the public dcrypto API.  Replaced wih (constant time)
point_mul, and add corresponding parameter checks to
the tpm2 interface call _cpri__EccPointMultiply.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests in test/tpm/tpmtest.py pass

Change-Id: I4ec885c147755e8a645c51b9a461b81c3a3b310f
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/338851
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-19 22:47:36 -07:00
nagendra modadugu
c864a97858 CR50: add support for RSA key "testing"
Implement _cpri__TestKeyRSA, which computes
the modulus and private exponent given a
pair of primes, or computes the second prime
and private exponent given the modulus and
one prime.

The _cpri__TestKeyRSA call is used to determine
whether the components of an RSA key match each other.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests in test/tpm/tpmtest.py pass

Change-Id: I2c68d844f4bab207588cbda5c962b09078519a1a
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/330466
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-19 21:13:07 -07:00
nagendra modadugu
7e9245fde4 CR50: move AES CTR implementation to dcrypto
AES CTR will be necessary to implement hybrid encryption
and hence needs to be a part of the dcrypto library.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests in test/tpm/tpmtest.py pass

Change-Id: I5dffe5d3a15748614db36aebdbcd50bde31bfdb2
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/339561
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-19 21:13:04 -07:00
Shawn Nematbakhsh
b94c4eb99d snoball: Add support for proto 0.9 board
This board uses a different stm32f0 MCU and has significant
architectural changes.

BUG=chrome-os-partner:50549
BRANCH=None
TEST=`make buildall -j`, verify snoball boots to console

Change-Id: I842a3efc5e179b33bbf0441e8d4ea07fa006e3fe
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329439
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-19 19:19:10 -07:00
Shawn Nematbakhsh
cfca3ff970 npcx: shi: Remove excessively verbose prints
Remove verbose prints (most of which are printed in ISRs) by default to
eliminate SHI console spam.

BUG=chrome-os-partner:52372
BRANCH=None
TEST=Verify console isn't spammy while SHI is in use on kevin.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I0dbd43e01f37980bc0e9d14fa6349a7ecb8c6f47
Reviewed-on: https://chromium-review.googlesource.com/339493
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-04-19 13:56:45 -07:00
Shawn Nematbakhsh
9360bff011 npcx: shi: Remove support for V2 host protocol
BUG=chrome-os-partner:52372
BRANCH=None
TEST=Verify V3 host command interface is still functional.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I75e684f3fbce764965ddac47b8314ed298086d74
Reviewed-on: https://chromium-review.googlesource.com/339472
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-19 13:56:45 -07:00
Shawn Nematbakhsh
50b198bcc1 npcx: shi: Don't enable GPIO_SHI_CS_L GPIO interrupt until S0
Prior to going to S0, GPIO_SHI_CS_L may be low, which can cause glitches
in the SHI HW unit. Enable the GPIO interrupt in S0, and disable it when
leaving S0.

BUG=chrome-os-partner:52222,chrome-os-partner:52217
BRANCH=None
TEST=Manual on kevin. Verify 'ectool version' succeeds with subsequent
kernel / ectool patches.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie3494122c2486429d3f648ab9220daf5dd34f812
Reviewed-on: https://chromium-review.googlesource.com/338857
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-19 13:56:45 -07:00
Anton Staaf
95858f385c Deferred: Remove hard coded number of deferreds
Previously the maximum number of deferred routines was specified by the
the default maximum number of deferred routines you had to override
this, and if you wanted fewer, you still payed the price of having the
defer_until array statically allocated to be the maximum size.

This change removes that define and instead creates the RAM state of
the deferred routine (the time to wait until to call the deferred) when
the deferred is declared.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     manually test on discovery-stm32f072

Change-Id: Id3db84ee1795226b7818c57f68c1f637567831dc
Reviewed-on: https://chromium-review.googlesource.com/335597
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-19 12:23:52 -07:00
Dino Li
69668a0443 chip: it83xx: add USBPD module
Add USBPD module for it8320 emulation board

BRANCH=none
BUG=none
TEST=manual
     plug zinger adapter, connect uart console and type commands:
       pd 1 dev [20|12|5]
       pd 1 charger
       pd 1 swap power
     and check PD states

Change-Id: I9ca1822deeb4b4dce1279a09490ed4175890cf3a
Signed-off-by: Leon-Lee <leon.lee@ite.com.tw>
Signed-off-by: Dino Li <dino.li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/326230
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-18 17:32:41 -07:00
Anton Staaf
068cd08506 Deferred: Use deferred_data instead of function pointer
Previously calls to hook_call_deferred were passed the function to call,
which was then looked up in the .rodata.deferred section with a linear
search.  This linear search can be replaced with a subtract by passing
the pointer to the deferred_data object created when DECLARE_DEFERRED
was invoked.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
CQ-DEPEND=CL:*255812
TEST=make buildall -j

Change-Id: I951dd1541302875b102dd086154cf05591694440
Reviewed-on: https://chromium-review.googlesource.com/334315
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-18 17:32:40 -07:00
Vadim Bendebury
1e7c280491 g: fix usb console LF handling
It was observed that when connecting to the CR50 console over USB,
there the line feed (LF) characters are not supplemented by carriage
return (CR), which causes weird console output.

Detailed examination has shown that uart_putc() does not do the right
thing itself and also bypasses __tx_char() used by uart_puts(), which
does the right thing.

The simplest solution is to have uart_putc() re-use all the smarts of
uart_puts().

BRANCH=none
BUG=none
TEST=verified that usb console output does not suffer from the "lost
     CR" syndrome any more.

Change-Id: I2a1f84b2524c41eb6e84186141b0b9ac55e87ee0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339217
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-04-18 11:30:19 -07:00
Kevin K Wong
b10d12f1c9 tcpm: update code to support multiple tcpm driver
BUG=chromium:593822
BRANCH=none
TEST=make buildall

Change-Id: Ic30c1b890da7639aa80a53040ecc5bebfb4be2e8
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/336030
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-17 12:23:07 -07:00
Bill Richardson
096dec1adb Cr50: Change SYS_RST output to SYS_RST_L inout
This signal should be active low, not active high. In addition,
not only can we pull it low but so can other components. If
something else asserts it, we need to react.

This changes the polarity and sets up the interrupt handler. A
future CL will be needed to make the handler do something useful.

BUG=chrome-os-partner:52366
BRANCH=none
TEST=make buildall; test on Cr50

On the test board, short M0 to ground to trigger the interrupt.
Watch the input value with

  gpioget

You can drive the output (and trigger the interrupt) with

  gpioset SYS_RST_L_OUT 0
  gpioset SYS_RST_L_OUT 1

Change-Id: I3556963859601f43f990fc83f26d2cea919383c6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339214
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-16 12:00:21 -07:00