Commit Graph

5320 Commits

Author SHA1 Message Date
Wonjoon Lee
cd2ef5a5fa kevin: Add support for SPI_MASTER on kevin
Enabling SPI_MASTER on SPIP port in npcx

BUG=chrome-os-partner:52844
TEST=spixfer rlen 0 0 1 shows 0xd2 on kevin
BRANCH=None

Change-Id: I3fe333a7d69fe16c2c630c3c2487320a0d1c020b
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341577
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-06 00:25:15 -07:00
Wonjoon Lee
be930e3425 npcx: spi: disable all port from board struct
We have two port(as is FALSH_, ACCEL_) on SPI defines
Let's prevent build error so that We can use particular
enable/disable port

BUG=None
TEST=Buildall is OK

Change-Id: Ib6fe14c4edd91947bde0a2da1c889da31db291a4
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341576
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-06 00:25:15 -07:00
Shawn Nematbakhsh
2c162ddade test: host: Fix sbc_charging_v2 test failure
sb_i2c_xfer() assumes 'out' is a valid pointer, which is only true if
out_size is non-zero.

BUG=chrome-os-partner:51207
BRANCH=glados
TEST=`make buildall -j` w/
https://chromium-review.googlesource.com/#/c/342630/

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia22dcca2b5318b4d69c7afa49f5c8891ab329bd1
Reviewed-on: https://chromium-review.googlesource.com/342635
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2016-05-05 19:16:57 -07:00
Stefan Reinauer
8321eed87b common: Drop unused data structure
SHA256_digestinfo[] is never used but declared static and const.

Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
BRANCH=none
BUG=none
TEST=compile tested
Change-Id: I0bcf419bf63fac3e6eadd9efad10fc05b7be9158
Reviewed-on: https://chromium-review.googlesource.com/342484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-05-05 19:16:50 -07:00
Bill Richardson
9b815745fa Cr50: Lower all runlevel permissions to medium
Two permission registers are already lowered. This adds the
remaining two.

BUG=chrome-os-partner:52994
BRANCH=none
TEST=make buildall; run on Cr50

USB works, SPI works, sleep and deep sleep work, tpmtest.py works.

Change-Id: Ifb27d5be81f10537114f4702addb58c6d7e1630c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342455
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-05 15:10:24 -07:00
Shawn Nematbakhsh
b803590c27 hooks: Add relative HOOK_INIT priority for peripherals
Using HOOK_PRIO_DEFAULT for peripheral initialization necessitates using
HOOK_PRIO_DEFAULT+1 for board-level code. Instead, use a
higher-than-default relative priority for peripheral initialization
outside of board.

BUG=None
TEST=Verify PWM and ADC are functional on kevin.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia8e90a7a866bdb0a661099dd458e3dfcaaa3f6bb
Reviewed-on: https://chromium-review.googlesource.com/342171
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-05 01:12:25 -07:00
Wonjoon Lee
d6546857da charge_manager: Always set active charge port on first pass
Always call board_set_active_charge_port() on the first pass through
charge_manager_refresh(), in case actions must be taken once the
CHARGE_PORT_NONE selection is confirmed.

BUG=None
BRANCH=None
TEST=Attach unpowered peripheral without AC and powerbtn, make sure ap boot-up

Change-Id: I4bcf1d548d7a8c80f4395fc90ff499fce33c8373
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341076
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-05 01:12:24 -07:00
Bill Richardson
3ef613fa44 Cr50: Enable the USB SOF clock auto-calibration
The timer clock nominally requires no firmware settings. It is
tuned in manufacturing to be centered around 24MHz. However, it
will potentially migrate away from 24MHz based upon variations in
temperature and voltage. The variation is approximately
0.1-0.5MHz, based upon functional simulations, and backed up with
observations in the lab. This CL enables a hardware feature to
dynamically tune the timer clock if the device has an active USB
port, by monitoring the SOF (start of frame) USB packets that are
sent by the USB host every milllsecond with 500ppm accuracy.

BUG=chrome-os-partner:50800
BRANCH=none
TEST=make buildall; run on Cr50 hardware

Verified that deep sleep, USB suspend/resume, etc continue to
work with this enabled. Not too surprising, since I've never
encountered a problem without it.

In addition, I monitored XO_CLK_TIMER_CURRENT to see that the
timer adjustments are being made while connecting and
disconnecting from USB, entering andleaving sleep and deep sleep,
etc. They are.

Change-Id: I328b6416bc40ef8718815c5e09cf91ec1c6646f0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342145
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-04 16:15:02 -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
Shawn Nematbakhsh
15ac27daa1 rk3399: Set power state based on input signals
Use input signals to verify power state and determine power state after
sysjump.

BUG=chrome-os-partner:52878
BRANCH=None
TEST=Manual on kevin.
- Verify AP powers up on 'powerbtn'.
- AP shuts down on 'apshutdown'.
- AP re-powers / resets on 'powerbtn' + 'apreset'.
- AP doesn't shutdown on 'sysjump rw' while in S0.

Change-Id: Id24feb0f8490aa7cb73c46178085ff2e46f8d0a6
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341704
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-04 16:15:02 -07:00
Kevin K Wong
25a4f355e8 npcx: add device id for npcx586g/npcx576g
BUG=none
BRANCH=none
TEST=version command shows the correct chip device id

Change-Id: I312b343f97a99b3ff5ae7d6ec3606cff291b2b55
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/342130
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-05-04 02:42:21 -07:00
Dino Li
32bf8ecb77 board: rename it8380dev to it83xx_evb
Unified board name for IT83-series.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST="make BOARD=it83xx_evb -j" and "make buildall -j"

Change-Id: Ic96d0132fb31fcc8715d0dd810f8bd340035a640
Reviewed-on: https://chromium-review.googlesource.com/341843
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-03 22:00:49 -07:00
Kevin K Wong
e83c06bf90 apollolake: ignore PLTRST# from SOC unless RSMRST# is deasserted
add optional chipset specific function to check if PLTRST# is valid

BUG=chrome-os-partner:52656
BRANCH=none
TEST=make buildall, able to boot to OS on amenia

Change-Id: I7a2747c4f77f50393c3250c2ab0e1625e64e5a41
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/341732
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-03 15:40:46 -07:00
Bill Richardson
b6ad3710c4 Cr50: Enable jittery clock
BUG=chrome-os-partner:52576
BRANCH=none
TEST=make buildall; try on Cr50

I manually tested both highsec and highperf variants, as well as
forcing the bootrom init to run. All the bank registers were
loaded with meaningful values, and none of the SPI or USB
functionality showed any problems.

Change-Id: Ia91ba98ef4c667aec74195c4a7bbf72a5d1c8b2d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342030
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 15:40:44 -07:00
nagendra modadugu
97ba687605 CR50: fix issue in ecc parameter endian conversion
Only convert parameters that aren't NULL.

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

Change-Id: I7d8133a0068ba50dc47ead7b4ce002d96d868dbe
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/341846
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 15:40:43 -07:00
Nicolas Boichat
427b8f9cd9 elm: Set USB_DP_HPD as input
This makes all board_typec_*dp* functions irrelevant: remove them.

BRANCH=none
BUG=chrome-os-partner:52352
TEST=USB_DP_HPD_C from AP side indicates which output is currently
     in use (native HDMI or ANX7688)

Change-Id: Id60ab97ee9ce987ec4e36e5fd9be9a20908edbfe
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/338868
Commit-Ready: Koro Chen <koro.chen@mediatek.com>
Tested-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-05-03 05:03:08 -07:00
nagendra modadugu
3d030e6409 CR50: remove checks on RSA key buffer size
Remove buffer size checks in _cpri__GenerateKeyRSA().

The TPM stack passes in TPM2B buffers that
may have the size field uninitialized.
Callees are expected to assume that the
buffer size is sufficient for the requested
operation.

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

Change-Id: I3d9bc2475b82dfaa9ed1d2617b1c333ff4df409d
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340883
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-03 01:42:52 -07:00
David Schneider
45d9f6afeb Add the lock key to the keyboard mask on kevin
TEST=confirm lock key scancode shows up in matrix
BUG=none
BRANCH=none

Change-Id: I51ef44017ea57abd3cbbc69c55f3d9da7afff42b
Signed-off-by: David Schneider <dnschneid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341469
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-02 21:30:13 -07:00
Shawn Nematbakhsh
8aa04ea278 npcx: Reduce system stack size
Reduce system stack size to 1K to match other recent chips.

BUG=None
TEST=Build + boot on kevin.
BRANCH=None

Change-Id: I0be6e865ca03f4eef2ee7a99856df8257d7269d9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341850
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-05-02 21:30:13 -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
Vadim Bendebury
3b1c3ba36f usb_updater: retransmit upgrade blocks if target does not reply
When the target is running upgrade protocol version 2, it is capable
of processing multiple transfer attempts of the same block.

This patch allows timeouts when expecting the target acknowledges. If
the acknowledge does not arrive in time, the host reports the timeout
on the console and retransmits the same block to the target.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=it is now possible to successfully upgrade cr50 on Kevin in one go:
      $  ./extra/usb_updater/usb_updater build/cr50/ec.bin
      read 0x80000 bytes from build/cr50/ec.bin
      open_device 18d1:5014
      found interface 4 endpoint 5, chunk_len 64
      READY
      -------
      erase
      Target running protocol version 2
      Updating at offset 0x00004000
      sending 0x29620/0x3c000 bytes
      Timeout!
      Timeout!
      Timeout!
      Timeout!
      -------
      update complete
      reboot
      bye

Change-Id: Ib1c3179cb3a02c0ae6e5e949476553ae28b6a295
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341583
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
acaec88101 g: enhance upgrade protocol to allow upgrade block restarts
With this new protocol version the target watches the size of the
received messages while reassembling an upgrade block.

If a message of the header size arrives and it is not the last message
of the block, the target considers it a re-start of the block transfer
by the host (presumably because a chunk was lost and the host did not
receive a confirmation of the block transfer in the preceding block
transfer attempt.)

BRANCH=none
BUG=chrome-os-partner:52586
TEST=the upgrade command on the host reports target running protocol
     version 2, upgrades on B1 board still run smoothly.

Change-Id: I2e16c1be5135c0b5a4f09ea293f09ecabf59ecb3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341630
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
de3a96c471 g: verify that first message of each upgrade block is right
When a new upgrade block starts, the host sends first a 12 byte
message including the block size and header.

The target must verify that the message is of the proper size and the
contents make sense (the header is not all zeros). It also should
drain the USB queue completely in case it holds a message of a
different size.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=upgrade still works fine on B1

Change-Id: I80538a3a1a5d507a84bd21b868a3db626bc6a4b0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341619
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:46 -07:00
Vadim Bendebury
2b326b4461 g: upgrade - improve verification of the first upgrade message
When an upgrade transfer starts, the target expects to receive a 12
byte transfer start message from the host, carrying an empty payload
of all zeros.

The target and host can be out of sync for whatever reason, so when
the target is expecting a transfer start message, the host can be
sending a chunk of a code block instead. In this case the target pulls
just 12 bytes off the receive queue, leaving the rest of the chunk
there, which even more complicates error recovery.

This patch makes sure that when expecting the upgrade transfer start
message the target extracts all receive data from the queue, no matter
how many bytes have been received, and then verifies that the size
matches the expected size, and that the payload is all zeros, to
confirm that the message is indeed the transfer start message.

BRANCH=none
BUG=chrome-os-partner:52586
TEST=cr50 firmware upgrade still works fine on B1

Change-Id: If5ec86d0385f97f0f361635b3903cea3a962b707
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341618
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
b81afce806 g: introduce versioning and backwards compatibility of usb_upgrade
The original version of usb_upgrade does not provide for any error
recovery and also does not support any protocol version notion.

Real life experience has shown that error recovery is essential, it
needs to be introduced as a protocol enhancement. We want to stay
backwards compatible though, so there is a need for protocol
versioning.

In the original version of the protocol target response is always the
same: a 4 byte number which is the error code (and zero means no
error). This patch modifies response to the very first packet from the
host, the startup packet. The startup response is 8 bytes long. The
first 4 bytes is still the same as before, the second 4 bytes carry
the protocol version supported by the target, an integer in network
byte order.

Thus, receiving a 4 byte reply to the startup message tells the host
that the target is running protocol version zero, 8 byte reply carries
the actual version number in the last 4 bytes.

The USB transfer function on the host is enhanced to accept responses
shorter then expected, when allowed.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=usb_updater can successfully update both old and new cr50 images,
     properly reporting protocol version as 0 or 1 respectively.

Change-Id: I9920d2708b21f29615282161fc0eb027018f9378
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341617
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
65118b7f7a g: drop: always start with USB facing external port
We want to be able to communicate with the chip no matter what the
hardware conditions are, otherwise it is easy to lose the ability to
re-program it from the external connector.

With this patch the chip always comes up with the USB interface
exposed and will stay in this mode until debug cable is pulled out.
After that it will honor subsequent cable plug ins/pull out events as
designed.

BRANCH=none
BUG=chrome-os-partner:52281,chrome-os-partner:50700
TEST=Suzy-q reliably creates serial interfaces when the chip is
     programmed with the code including this patch.

Change-Id: I608fb1912f1b2e88f7a207cbfff145760da1a4e4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341580
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
d37d508325 usb_updater: shut down on errors more gracefully and simplify APIs
It might not matter much, but it is a good practice to explicitly
release USB resources when terminating the app which used them.

Also, make function signatures around the file simpler by introducing
a structure to carry common USB endpoint properties: device handle,
endpoint number and chunk size.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=no change in functionality, upgrades on B1 still work fine,
     upgrades on Kevin still very unreliable

Change-Id: I9157774a2f5591c70701ba822f20db6ba02e7029
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341616
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
455767f08f g: fix debug messages not to include two newlines
The CPRITS() macro adds newline to all strings, there is no need to
explicitly add newlines.

BRANCH=none
BUG=none
TEST=usb upgrade debug messages do not span two lines any more

Change-Id: I1991214ddaa5945bedba861d67b392973f6a3d0f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341615
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:45 -07:00
Vadim Bendebury
42662f2214 g: recover from usb_upgrade interruptions
The usb upgrade protocol is very fragile, any error while transferring
data causes the state machine on the target to lock up, and the only
way to resume the upgrade is to power cycle the device.

With this patch USB callbacks which happen more than 5 seconds since
the previous callback would be considered a start of new transfer,
thus allowing to attempt a new upgrade without the power cycle.

BRANCH=none
BUG=chrome-os-partner:52856
TEST=the following script allows to upgrade successfully:
    $ while not  ./extra/usb_updater/usb_updater build/cr50/ec.bin; do sleep 6; done

Change-Id: Ibe1078cf62073ce89a31416522b0d6917bc923b9
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341572
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-02 17:35:44 -07:00
Wonjoon Lee
c8e38a9314 kevin: Add support 3 color LED
When system on
 .always blue
When system is off
 .discharging : off
 .charging : red
 .full-charged : green
Error : red - green switching

BUG=None
TEST=See LED behavier on kevin

Change-Id: I93f0dbb503c68999825c455c8dc81b6bdaf397b4
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/341113
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-01 20:06:01 -07:00
David Schneider
c5d5ae7f1c Invert KSO2 on Kevin
TEST=confirm column 2 keys work
BUG=none
BRANCH=none

Change-Id: Ib474a46ac723657b96970735dc4e3a1d0c8a8505
Signed-off-by: David Schneider <dnschneid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341581
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-30 13:26:20 -07:00
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