Commit Graph

5863 Commits

Author SHA1 Message Date
Gwendal Grignou
9f0d4e9760 test: motion_lid: Use new sensor frame
Update motion_lid to use Android/HTML5 vector frame for sensor.

BUG=none
BRANCH=none
TEST=Test motion_lid passes.

Change-Id: Ic4484e716b678b8399b058ade2bc13480f6cf393
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373724
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-24 17:40:30 -07:00
Gwendal Grignou
71c9cc6f3f driver: l3gd20h: remove unnecessary test.
rotate by identity matrix is fast.

BRANCH=none
BUG=none
TEST=compile

Change-Id: Ia9fccb81ebc4c0be7c9d80823b3c2f76aa2275d0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373723
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-24 17:40:29 -07:00
Gwendal Grignou
3218e89542 math_util: Fix rotation by identity.
Rotation by identity matrix from a to b fails if a != b.

BUG=none
BRANCH=none
TEST=Use identity matrix in test motion_lid.c, check test passes.

Change-Id: I852132ee8cd67063921077cd0b7d848d10a730e0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373722
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-24 17:40:27 -07:00
Bill Richardson
bb15561db5 cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args
Since pretty much always, we've declared console commands to take
a "longhelp" argument with detailed explanations of what the
command does. But since almost as long, we've never actually used
that argument for anything - we just silently throw it away in
the macro. There's only one command (usbchargemode) that even
thinks it defines that argument.

We're never going to use this, let's just get rid of it.

BUG=none
BRANCH=none
CQ-DEPEND=CL:*279060
CQ-DEPEND=CL:*279158
CQ-DEPEND=CL:*279037
TEST=make buildall; tested on Cr50 hardware

Everything builds. Since we never used this arg anyway, there had
better not be any difference in the result.

Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374163
Reviewed-by: Myles Watson <mylesgw@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-24 16:30:10 +00:00
Vijay Hiremath
f322e32a3e apollolake: Do not power-on AP till sufficient power is provided
Do not power-on the AP unless battery can provide sufficient power
or the charger is negotiated to sufficient power.

BUG=chrome-os-partner:56494
BRANCH=none
TEST=Manually tested on Reef. Device can boot to OS without the
     battery & cut-off battery.

Change-Id: Ib22bad81a29ccbb2fecc8e835148b627dd722988
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/374023
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-08-24 02:15:09 -07:00
Shawn Nematbakhsh
748b5bad9f rk3399: Remove useless calls to wireless_set_state()
rk3399 doesn't use AP-controlled wireless power state and
CONFIG_WIRELESS isn't defined, so wireless_set_set() is in fact an empty
useless function.

BUG=None
BRANCH=None
TEST=Verify basic EC functionality on Kevin.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6e3631012ca1f356555a847793050ebdef8eee52
Reviewed-on: https://chromium-review.googlesource.com/373643
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-24 02:14:46 -07:00
Shawn Nematbakhsh
65f1652aa0 power: rk3399: Implement latest power sequencing
BUG=chrome-os-partner:55981,chrome-os-partner:56105
BRANCH=None
TEST=Verify kevin rev5 sequences up from S5, down to S3, and back to S0.

Change-Id: I65b73e4a0a46c631c6e40f154cf92810f5aabb72
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366951
Commit-Ready: Derek Basehore <dbasehore@chromium.org>
Tested-by: Catherine Xu <caxu@google.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
2016-08-24 02:14:44 -07:00
Gwendal Grignou
4523735dc1 kevin: Add FIFO for ARC++ support.
Add Sensor FIFO, set the sensors in force mode since we haven't enabled
their FIFO.

BRANCH=kevin
BUG=b:27849483
TEST=Check kernel load cros-ec-ring.
Check ARC++ get accel info with AIDA64.

Change-Id: I1c4d5c1291d2c778fdabd8b8f4e6b6a370f37b04
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373140
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-23 21:00:28 -07:00
Martin Roth
681284ca22 npcx/i2c.c: Verify that controller value is not negative before using it
The function i2c_port_to_controller() returns a negative value if
the port value was out of range.  This wasn't being checked before the
controller value was getting used which could lead to using an invalid
value as a pointer to a structure.

This returns an error where it makes sense, and just ignores the
incorrect value otherwise.

TEST=Build
BUG=None
BRANCH=None

Change-Id: Ie8967bc4db87d3dd1863a2e36e35ac87e6161132
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371400
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-08-23 15:37:13 -07:00
Aaron Durbin
aee8407f4e reef: ensure board can boot again after entring G3 after SW sync
When SW sync is enabled and the board enters G3 after being up
there was no way to boot the board again because the
system_jumped_to_this_image() check disallowed the pmic startup
sequence. One needs to check if the pmic is also already on
before bailing on the pmic startup sequence.

BUG=chrome-os-partner:56530
BRANCH=None
TEST=Booted. Jumped to RW EC. Shutdown system. Can boot again once
     G3 entered.

Change-Id: I71670ceee09536a282479d1eca6a3ce264f0f5d3
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374080
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2016-08-23 15:37:10 -07:00
Mary Ruthven
d0383d8814 cr50: remove internal pull up on DIOM0
There is leakage on SYS_RST_ODL from the internal pullup cr50 has on
DIOM0. This change removes the internal pullup.

Without the internal pull up SYS_RST_ODL is not pulled up whenever the
EC is off. I changed how sys_rst_asserted is handled so it will ignore
the sys_rst interrupt whenever rbox asserts EC_RST to make sure cr50
doesn't reset itself every time it resets the EC. If the EC resets
itself and sys_rst_l is no longer pulled up, it is fine if cr50 resets.

BUG=chrome-os-partner:53544
BRANCH=none
TEST=manual
	'rw 0x40550010 1' causes the EC to reset but not cr50

	On the development board verify DIOM0 is not pulled up.

	Test cr50 boots normally on reef and gru

Change-Id: Ic1d4d160ddb0d69081cb1f194d50939dac6fc5c2
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373838
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-08-23 15:36:59 -07:00
Levi Oliver
1e2148249a btle: Accepts and maintains connections
Can now accept and maintain a single connection indefinitely by
sending empty packets at every connection interval to keep the
connection alive.

TEST=BTLE dongle sending connect requests and connecting to NRF51
running this code. Connection was established and ran for at least
48 hours until manual termination.
BUG=None
BRANCH=None

Change-Id: Iad4bd434ecd1edd6c5c8dfe8b72ca41fd82d0bb4
Signed-off-by: Levi Oliver <levio@google.com>
Reviewed-on: https://chromium-review.googlesource.com/370839
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-23 15:36:55 -07:00
Martin Roth
6e866962a0 charger/bd99955: only print data if read was successful
In console_command_bd99955(), because the return value wasn't being
checked before displaying the data variable, it could be printed without
being initialized.

TEST=Build
BUG=None
BRANCH=None

Change-Id: I03e0aae6fee33e32f648d952d6f2906e71f67ea2
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371398
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-23 15:36:52 -07:00
Martin Roth
866add68ed npcx/flash.c: Init return value for success
In flash_physical_erase(), if the area being erased was already
cleared, the return value would never be set, and would be returned
without being defined.  Initialize the value so that if the area
being erased is clear, we return success.

TEST=Build
BUG=None
BRANCH=None

Change-Id: Ib13e0be0ad1d3ad23c065b407c35e7b5c4db8487
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371399
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-08-23 15:36:48 -07:00
Mulin Chao
862a325fa0 npcx: gpio: Enable wake GPIO interrupts prior to hibernate
This is necessary after the pending patch to not enable all GPIO
interrupts by default.

BRANCH=None
BUG=chrome-os-partner:56486
TEST=Manual on kevin, run 'hibernate', attach AC and verify wake occurs.

Change-Id: I04d2c6edf9fb32b1a6a7e6a5ed4d2c53895e00f0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374179
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-23 15:36:32 -07:00
Shawn Nematbakhsh
072d333f10 npcx: shi: Properly disable interrupts throughout sending of HC response
Expand interrupt disable to include checking of our SHI state in case
preemption occurs immediately afterward.

BUG=chrome-os-partner:55795
BRANCH=None
TEST=Manual on kevin, verify no errors through 700+ sysjumps.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Icb8a5bdd03dbf87f6a25b4175f73c932d48db726
Reviewed-on: https://chromium-review.googlesource.com/374021
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-08-23 15:36:31 -07:00
Shawn Nematbakhsh
8fd12a56f1 npcx: Don't enable GPIO interrupts by default
GPIO interrupts must first be enabled with a call to
gpio_enable_interrupt() to prevent ISRs from being run before
prerequiste modules are initialized.

BUG=chrome-os-partner:56486
BRANCH=None
TEST=Manual on kevin, stress test sysjump for ~1 hour (~700 sysjumps)
without failure.

Change-Id: Ia4006ef1b0c3218dfe5c92fde6713c10b0d22d2a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374020
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-08-23 15:36:30 -07:00
Vincent Palatin
40a4bd1d63 reef: remove DEFERRABLE_MAX_COUNT
DEFERRABLE_MAX_COUNT is no longer used and has been removed from other
boards.
Reef was probably in-flight at that time, clean up board.h

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

BRANCH=none
BUG=none
TEST=make buildall

Change-Id: Iee11b0519d647be3beb0c164a5a82bbb1edb54c4
Reviewed-on: https://chromium-review.googlesource.com/373778
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-23 11:05:47 -07:00
Nicolas Boichat
bef904ea91 kevin: Increase UART TX buffer size to 4kb
We have enough memory for that, and it makes it possible to poll the
logs from AP much more unfrequently.

BRANCH=none
BUG=chrome-os-partner:56460
TEST=make buildall -j
TEST=Boot kevin, cat /sys/kernel/debug/cros_ec/console_log does not
     miss any data.

Change-Id: I7dc880a27d34f97746a8fde00e49d8d08ed85b9d
Reviewed-on: https://chromium-review.googlesource.com/373285
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-23 02:08:55 -07:00
Bill Richardson
8f080f795b Cr50: Use parse_bool() for boolean args
The parse_bool() function exists so we don't have to litter our
console commands with stuff like this:

  if (!strncasecmp(argv[1], "on") ||
     !strncasecmp(argv[1], "enable" ||
     !strncasecmp(argv[1], "true" ||
     [...]

This CL uses parse_bool instead of that kind of thing so I don't
have to remember which commands use "enable" and which use "on"
and so forth.

I only changed the commands that Cr50 uses.

BUG=none
BRANCH=none
TEST=make buildall; test on Cr50 hardware

I tested all the affected commands to ensure that they still work
correctly: usb, ccd, flashwp (which doesn't do anything anyway).

Change-Id: I7d875ab22934fb4b500e3d0f62ebe3e04101272d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373658
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-22 23:27:24 -07:00
Vadim Bendebury
bccd2f94f1 g: implement firmware upgrade protocol version 3
This patch modifies CR50 code to switch to firmware update protocol
version 3. In this version both SPI and USB updates use exactly the
same messages (apart from the size field added by USB to help
reassembly of the fragmented frames).

Bot unused RO and RW sections can be now programmed.

BRANCH=none
BUG=chrome-os-partner:55789
TEST=on a Kevin running the existing cr50 image programmed the new
     cr50 image, restarted the device, programmed the cr50 image again
     (this time using version 3), restarted the device, then
     programmed both RO and RW images and restarted the device. Each
     time verified that the proper image is running.

Change-Id: I0cf196ec6de1786510433f8252164a33ccdc6dec
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371941
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-08-22 23:27:23 -07:00
Kevin K Wong
c439b33cdd reef: use only CONFIG_USB_PD_VBUS_DETECT_CHARGER
BUG=chrome-os-partner:56392
BRANCH=none
TEST=Both C-Ports are able to detect any kind of chargers

Change-Id: I6f6dbb93746d33a5750442c1b3bbe381cfd3a434
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/373659
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-22 23:27:19 -07:00
Martin Roth
56cf05339f chip/g/sps: Initialize received_data pointer to NULL
I don't think that the received_data pointer in sps_rx_interrupt can
actually be used without initialization in the current code flow, but
GCC 5.3 thinks that it can, and throws an error.

sps_check_rx() always sets the pointer or returns 0.  In either case
we should be ok, but initializing it to null here won't hurt anything
since it's not masking an actual error.

BUG=None
BRANCH=None
TEST=Build all boards successfully.

Change-Id: Idaea7efd1af3067c492a3ade4c89104e975f4c1d
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/370663
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-08-22 23:27:18 -07:00
Vijay Hiremath
61c45fb33e BD99955: Map PD port number to charge port number
Charger port number may differ from PD port number hence added
a macro to select appropriate port numbers during compilation.

BUG=chrome-os-partner:54970
BRANCH=none
TEST=Reef can negotiate on both the ports.

Change-Id: Id3b4b639a5f8698c27341be037bb09370910cac5
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/357836
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-22 23:27:16 -07:00
Bill Richardson
82e4ac67ac Cr50: Add "wp" console command to control EC_WP_L
BUG=chrome-os-partner:49959
BRANCH=none
TEST=manual

On the Cr50 console, use the "wp" command to get/set the desired
state. On the EC console, use "gpioget wp_l" to watch it change.

Change-Id: I5978e6116ad0a07a7a61a8356dc1daf79e2397d0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373618
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-22 23:27:07 -07:00
Dino Li
f729672b66 it83xx: lpc: add support 'CONFIG_KEYBOARD_IRQ_GPIO' and fix lpc_init()
1. To assert keyboard IRQ GPIO pin instead of SERIRQ if keyboard data
   ready to send.
2. Clear STATUS_PROCESSING bit in lpc_init() to avoid host waiting after
   a sysjump.
3. Save and restore event masks while doing a sysjump.

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

BRANCH=none
BUG=none
TEST=1. keyboard work normally if host support this keyboard interrupt.
     2. Software sync done and jumping to RW and boot to kernel.
     3. EC generate SCI normally after a sysjump.

Change-Id: Ib0d9785106d4d4d21f8e9a6d1f0548f187fa7976
Reviewed-on: https://chromium-review.googlesource.com/372499
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-22 23:27:05 -07:00
Bill Richardson
0913208116 Cr50: Disable spstest command.
This command was used for early testing of the SPI slave
interface. It's no longer needed, so disable it to save space.

BUG=none
BRANCH=none
TEST=make buildall; test on Cr50 hardware

Change-Id: If730f909c7361b1179e23b2bf1d07c9d51aa6e8f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373619
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-22 23:27:00 -07:00
Shawn Nematbakhsh
99e95dd3c3 charger: bd99955: Prevent truncated console command output
"bd99955_dump" output may be larger than our UART output buffer, so
flush our buffer in between prints.

BUG=None
TEST=Run 'bd99955_dump' on kevin, verify full output is seen.
BRANCH=None

Change-Id: I5816e0ce0c000bf63bc09502888e5acc9c4728ae
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373660
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-22 14:52:41 -07:00
Shawn Nematbakhsh
383ee4260b kevin: Save and restore display backlight PWM duty across sysjump
Display backlight going down for an extended period of time is
a major user annoyance, so save the duty prior to sysjump and restore it
upon init.

BUG=chrome-os-partner:56390
BRANCH=None
TEST=On kevin, run "sysjump rw" from recovery screen, verify backlight
goes black for a fraction of a second and comes back to previous level.

Change-Id: I98f12ace9b933874ba9088a790b9efa0941050ed
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373621
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-22 14:52:32 -07:00
Bill Richardson
9a59b5ea9c g: Remove unused CONFIG_RBOX_DEBUG feature
This feature is not enabled, is awkwardly written, and shouldn't
be left lying around to use as a bad example. This CL doesn't
change any compiled code.

A followup CL will add a working RBOX interrupt handler.

BUG=none
BRANCH=none
TEST=make buildall; test on Cr50 hardware

Change-Id: I5d0701f55ab9521bf1f29e7ec18994c4401d68fb
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373600
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-22 14:52:26 -07:00
Kevin Cheng
0f5f4862e2 flash_ec: Add check for servo_has_cold_reset.
When flashing a servo v4, the function will try to initiate a cold_reset
but that interface does not exist for a servo v4. Add in a check for
cold_reset before trying an ec_reset to prevent printing the useless
error message 'No control named "cold_reset"'.

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

Change-Id: I6086883f002b4961807ae0663b0ee32aea4c63d8
Reviewed-on: https://chromium-review.googlesource.com/365151
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2016-08-22 14:52:24 -07:00
Mulin Chao
746eb2c600 npcx: Apply deep idle bypass for hibernate
Although probability is small, we still have chance to encounter the same
symptom which CPU's behavior is abnormal after wake-up from deep idle.
Apply the same bypass in task.c but not enable interrupt to solve it.

Modified sources:
1. system.c: Apply deep idle bypass for hibernate.

BRANCH=none
BUG=chrome-os-partner:34346
TEST=make buildall; test "hibernate"&"hibernate 10" on wheatley.

Change-Id: Ib00b9932ac34414d6a177d60668664ab31284a79
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/373300
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Amit Maoz <Amit.Maoz@nuvoton.com>
2016-08-22 14:52:22 -07:00
Bill Richardson
d614eaf1bf g: Remove obsolete spstpm command
At one time we could switch between TPM and HC protocols on the
SPI slave bus. We disabled the HC protocol long ago with commit
e4690f6152. This CL removes the spstpm command, since there's
no longer any point to having a console command to disable the
TPM protocol too (which would leave us with nothing listening to
incoming traffic on the SPI bus).

BUG=none
BRANCH=none
TEST=make buildall; test on Cr50 hardware

Change-Id: Ic5028dfc1631fab4ddf2584635cb48be50d05d4d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373638
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-22 14:52:14 -07:00
Nicolas Boichat
c522f55115 kevin: Disable hostcommand debugging
kevin EC console output is very spammy, as EC_CMD_MOTION_SENSE_CMD
is called every 100ms. Even when hcdebug is set to off, we still
get command errors.

BRANCH=none
BUG=chrome-os-partner:56460
TEST=make buildall -j
TEST=Flash kevin EC, see that output is fairly quiet.

Change-Id: Iad974c463c8dd91960e872ec977fe0e653696701
Reviewed-on: https://chromium-review.googlesource.com/373284
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-22 05:03:28 -07:00
Vincent Palatin
1b9096116c pd: support Rp/Rp debug accessories
Support Rp/Rp debug accessories in the USB PD state machine
including detecting the polarity and the available type-C current.

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

BRANCH=none
BUG=chrome-os-partner:52592
TEST=manual, plug a Suzy-Q reworked with Rp3A0/Rp1A5 resistors
on a Kevin, and see the PD state machine is going to
PD_STATE_SNK_ACCESSORY (and leaving it on unplug).
Re-verify a few existing accessories (Rd/Rd SuzyQ, legacy RpUSB cable,
Rp3A0 power supply).

Change-Id: Icef6c90027105d7c633f2785210ab9dae74fc33c
Reviewed-on: https://chromium-review.googlesource.com/368700
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-22 05:03:26 -07:00
Dino Li
ecd98091c1 it83xx: add reset cause of reset pin
If reset was caused by reset pin, we need this reset cause
for next sequence(recovery key).

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

BRANCH=none
BUG=none
TEST=To assert EC WRST pin and we will get the reset cause for
     both power-on and reset-pin.

Change-Id: I0361091680a148df07cbbb8f4e53635dbf48fdee
Reviewed-on: https://chromium-review.googlesource.com/371798
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-22 02:37:54 -07:00
Dino Li
8d8f2401a2 TCPM: it83xx: support Rp 1.5/3.0A pullup configuration
Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=chrome-os-partner:54452
TEST=1. To check appropriate register setting.
     2. Measure the CC voltage by connecting USB-C to DP cable to EVB.
        Default                  : 433mV
        CONFIG_USB_PD_PULLUP_1_5A: 951mV
        CONFIG_USB_PD_PULLUP_3A  : 1.72V

Change-Id: Id5a36ded94121db4343c48ecea19a5a533244f43
Reviewed-on: https://chromium-review.googlesource.com/371020
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-22 00:11:59 -07:00
Dino Li
81fd1393fa it83xx: fix i2c module
1. If one i2c transaction includes timeout and done events
   at the same time, the transaction result will be timeout.
   Fixed: The transaction is succeed instead of timeout.

2. The interrupt of i2c will not be enabled if an i2c write transaction
   is split into two or more xfer.

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

BRANCH=none
BUG=none
TEST=1. Console commands:'i2cscan', 'i2cxfer', and 'battery'.
     2. Use two or more i2c_xfer(the first with flag 'I2C_XFER_START'
        and the last with flag 'I2C_XFER_STOP') to do a i2c write
        transaction and no error.

Change-Id: Ieb2cb229748ac9504cf1636a2826bbb3097aa55c
Reviewed-on: https://chromium-review.googlesource.com/360762
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-22 00:11:58 -07:00
Nicolas Boichat
e3297d7255 anx7688: Add custom vbus function
On ANX7688, POWER_STATUS.VBusPresent is averaged 16 times, so its
value may not be set to 1 quickly enough during power role swap.
Therefore, we use a proprietary register to read the unfiltered VBus
value.

BRANCH=oak
BUG=chrome-os-partner:55221
TEST=LG monitor works over type-C, power role swap looks good

Change-Id: I68572c34440be65882f431bb892ed032da05bd0a
Reviewed-on: https://chromium-review.googlesource.com/364351
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-21 22:03:34 -07:00
Jongpil Jung
b387bdf40e kevin: Keep LED test status with ectool led.
With "ectool led power blue=0 green=100 red=100", LED color is changed.
But LED will turn off immediately.
To keep color with "ectool led", we need remove led turn off when
"Battery/Power LED" auto control are not enabled.

BUG=chrome-os-partner:56179
BRANCH=none
TEST=manual, run ectool command on user space.
     ectool led power blue=0 red=100 green=100
     ectool led power blue=100 red=0 green=100
     ectool led power blue=100 red=100 green=0
     ectool led power auto

Change-Id: Ifa6b426443ca800f34ba7c61cea6e2e49694fb0e
Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/368586
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-21 19:52:33 -07:00
Vadim Bendebury
665fa8bc05 tpm: limit the length of the string reported through TPM_FW_VER
The version string reported through TPM_FW_VER register has become way
too long, it takes too much time to transmit at startup, especially at
i2c speeds.

Let's limit it to the essentials: header versions and hashes of the
active RO and RW sections.

BRANCH=none
BUG=chrome-os-partner:49954
TEST=verified version in the firmware log
  localhost ~ # grep cr50 /sys/firmware/log
  Firmware version: B2:0 RO_A:0.0.1/84e2dde7 RW_A:0.0.3/cr50_v1.1.5106-f7349c9+

Change-Id: Ic391f90673fe21c0100b776944f6efc080213ff3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/372380
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2016-08-21 15:52:12 -07:00
li feng
a7c6942f73 reef: add power led behavior
There is only one set LED in reef, so with charger attached, LED behave as
charging LED; without charger, as power LED.

BUG=chrome-os-partner:55492
BRANCH=none
TEST=on reef proto, verified power led behavior is correct in s0/s3/g3

Change-Id: If6b83c46fc4b8b455531698177f559ca319d241a
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/366102
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-21 15:52:11 -07:00
Kevin K Wong
46dc172711 npcx: set the BUSY bit while handling ACPI command write.
BUG=chrome-os-partner:55583
BRANCH=none
TEST=verified OBF status is cleared during idle without event which
     means kernel driver waited for the BUSY bit and read the data.

Change-Id: I79357fea5483fe7a175c60f54235926e105ec832
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/373043
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-08-21 15:52:09 -07:00
Nick Sanders
cc68693cda sweetberry: add i2c support
stm32f446 has two types of i2c blocks, the traditional
stm i2c, and "fast mode plus" i2c, which need different drivers.

This commit adds both, muxed in i2c-stm32f4, as the ec
codebase doesn't really support multiple types of the same interface.

BUG=chromium:608039
TEST=i2c works on all 4 channels
BRANCH=None

Change-Id: I6a9ac632f44142bd809ffee5782a192ae47af1f0
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/368358
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-21 04:11:10 -07:00
Vadim Bendebury
153c2cf49c usb_updater: host side support protocol version 3
This patch introduces support for the cr50 firmware update protocol
version 3. It is described in more details in the comment in the
patch, the bottom line is that both RO and RW updates are supported,
and SPI and USB modes use the same protocol now.

The notions of PDU (protocol data unit) passed between the host and
the programming function on the CR50 is introduced, and USB mode
framing is described.

BRANCH=none
BUG=chrome-os-partner:55789
TEST=verified that version 1 and 2 updates still work. Version 3 mode
      was tested later, when the device side patches were applied.

Change-Id: If51854b6a0b140730e85853bc42039233550fe8c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371509
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-08-21 04:10:38 -07:00
Vadim Bendebury
46b7763cb7 Change transfer_endpoint to transfer_descriptor
In preparation to cr50 update protocol enhancements allowing to update
both RO and RW sections this patch is changing the name of the
structure containing communications endpoint information.

In the upcoming patches more fields are going to be added to this
structure, it is cleaner to change its name and existing use before
adding new features.

BRANCH=none
BUG=chrome-os-partner:55789
TEST=make -C extra/usb_updater

Change-Id: I5ca0b6da75067a4f01ea80b6a6ca49a50e1136ab
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371508
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-08-21 04:10:37 -07:00
Vadim Bendebury
4c553d0480 g: usb_updater: add command line option to allow updating the RO section
This just adds the new command line option and a help message for it.

This option will be used to signal that the RO section update is
required along with the RW section update when invoking usb_updater.

The flag indicating presence of the option will be saved in the
endpoint structure so it is available at different layers of the code.

BRANCH=none
BUG=chrome-os-partner:55789
TEST=built usb_updater and invoked it with --help option, observed the
     new option showing up in the output.

Change-Id: Ief35a553651d29ca39c42c5af7294d3aba223b02
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/369160
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-08-21 04:10:35 -07:00
Vadim Bendebury
44930bef40 g: usb_updater: clean up update protocol handling
In preparation of introducing new update protocol version this patch
cleans up the existing implementation.

The receive and transmit PDU headers are separated into their own
structures and are now shared between the server and client sides.

Some comments have been added to better explain different protocol
versions' details.

BRANCH=none
BUG=chrome-os-partner:55789
TEST=verified that it is still possible to update RW_A and RW_B on a
     Kevin CR50, works using both USB and SPI.

Change-Id: Ied65b2c2a7800bae045f1d2dd64e58dd5e793d27
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/368989
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-08-21 04:10:33 -07:00
Andrey Pronin
76d1d89600 Fix AES CFB encryption for non-divisible-by-16 lengths
BRANCH=none
BUG=chrome-os-partner:56284
TEST=login as new user, check in log that TPM2_Create is
     unmarshaled without TPM_RC_INSUFFICIENT errors.

Change-Id: Ie0c0aeb2486b21eaffccf6565f68f4d96f2121bf
Signed-off-by: Andrey Pronin <apronin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/373100
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-20 20:04:29 -07:00
Shawn Nematbakhsh
152dd753e0 Revert "shi: Enable SHI interrupt from CS interrupt"
This reverts commit 77ae58a3a3. Host
command interface still getting wedged.

BUG=chrome-os-partner:55710,chrome-os-partner:55795,chrome-os-partner:56254
BRANCH=None
TEST=None

Change-Id: I2a4d39d222ebfd9aa78cc9f5231c38ebd50e80ce
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373739
2016-08-21 00:27:56 +00:00