Commit Graph

2334 Commits

Author SHA1 Message Date
Gwendal Grignou
98ec487dff kevin: Set Forced Mode for lid accel only
Addition to 4523735d: We can use the BMI160 internal FIFO, so set only
the Lid accel in forced mode.
Set EC rate for BMI160 accel as needed.

BRANCH=kevin
BUG=b:27849483
TEST=Check sensor parameters with accelrate. Check rotation is working.

Change-Id: I86f50e019db25837894036c4f27b255a65d2f894
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374918
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-25 21:59:14 -07:00
Vadim Bendebury
87a0b0a878 Revert "cr50: remove internal pull up on DIOM0"
This reverts commit d0383d8814.

Change-Id: I76cac7902b0cd25300393efcf205cdbe9ade82c0
Reviewed-on: https://chromium-review.googlesource.com/376132
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-26 04:18:31 +00:00
Vincent Palatin
e880402f74 pd: select dynamically Rp value
Add API to switch the Rp pull-up value on CC dynamically at runtime.
This is a preparatory work for boards having a more complex maximum
source current policy (eg 2 ports sharing a common pool of power).

For fusb302, update the voltage thresholds for open/Rd/Ra as they depend
on the Rp (was missing from the previous change).

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

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

Change-Id: Id3c24a31a16217075a398ec21ef58ee07187a882
Reviewed-on: https://chromium-review.googlesource.com/373501
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-25 07:32:31 -07:00
Mary Ruthven
613be38789 cr50: connect to AP phy on reef when not in ccd
Cr50 needs to connect to the AP phy when not in ccd so cr50 can be
updated and used as a gnubby. This change uses the strapping options
to detect when it is on reef and modifies the ccd behavior to
initialize usb on the AP phy when ccd is disabled. On gru the cr50
behavior is unchanged.

In RDD this change removes the checks that the current_map is the
correct one based on the detected debug state. rdd_init calls
rdd_interrupt to set up the usb and ccd state correctly. Having that
check prevents that initial rdd_interrupt from calling rdd_detached.
Before rdd_detached just disabled usb and we knew during init it
would already be disabled. Now we want to make sure it is called if a
debug accessory is not attached to initialize usb on the AP PHY.

BUG=chrome-os-partner:56098
BRANCH=none
TEST=manual
	verify ccd still works on gru

	disconnect suzyq and reset reef.

	run lsusb on the AP and verify it shows cr50 as a device.

	connect suzyq and check that the AP no longer sees cr50.

	disconnect suzyq and verify the AP sees it again

Change-Id: I3c1ccc54895835bce12302f3ea43fc2e751b4c97
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/372920
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-25 01:46:39 -07:00
nagendra modadugu
9c69337050 CR50: add tests for AES CBC, CFB and OFB
Add tests for CBC, CFB and OFB AES modes.

Also convert tests to use word unligned
input parameters, to ensure that the api's
are unalignment agnostic.

Also add the program used for generating
test vectors.

BRANCH=none
BUG=chrome-os-partner:56413
TEST=tpmtest.py passes

Change-Id: I92c9ffece797aa7134d9cdad6ea32e6fe50feef1
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/374663
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2016-08-25 01:46:12 -07:00
Vincent Palatin
7e4564a87e tcpm: workaround TCPC takes longer time to update CC status
when TCPC takes a longer time to update its CC status upon
connection, a legacy C-to-A charger or certain Type-C charger
that presents 5V VBUS by default, TCPM could be mistaken the
charger as a debug accessory.

BUG=chrome-os-partner:55980
BRANCH=none
TEST=Manually tested on Reef. PD, Type-C, BC1.2, non-BC1.2,
     DP, HDMI are working on both C-ports.

Change-Id: Ic3b0ecd3d14109239d8c0ff0064476595b7f93a0
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/367950
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-25 01:46:06 -07:00
David Hendricks
68eb480a88 reef: Drive PMU_RSTBTN_N manually for proto boards
Due to what appaers to be a leakage issue, this patch drives the
SYS_RST_ODL (aka PMU_RSTBTN_N) pin low for 1sec while the power
state transitions from S3 to S0.

This is a workaround for a proto board issue that prevents the SoC
from booting.

BUG=chrome-os-partner:53791
BRANCH=none
TEST=SoC boots with CL:347754 applied on proto and EVT boards

Change-Id: I88c3ccf18280acf5dfe3b99f99483dc4e4e27873
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/372044
Reviewed-by: Martin Roth <martinroth@chromium.org>
2016-08-24 17:41:10 -07:00
David Hendricks
9342bb62d7 reef: Enable PMIC after 3.3V
This changes the ordering of rail/PMIC init slightly so that the
3.3V rail comes up before the PMIC, which follows the ordering
in the PMIC datasheet for cold booting.

The way we did it earlier was to avoid interrupt storms caused by
powering the SoC's GPIO block with SLP signals before powering the
PMIC. However the PMIC ignores the SLP signals when it's first
enabled, so while the suprious interrupts were visible on the scope
it's unlikely that the software was affected. OTOH, as Kevin pointed
out in CL:358913 enabling the PMIC before the 3.3V causes a race
condition whereby the PMIC may fault.

BUG=chrome-os-partner:51323
BRANCH=none
TEST=built and booted on EVT

Signed-off-by: Rachel Nancollas <rachelsn@chromium.org>
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I6eb734f0600daa5de0d970ce228cf3e7ec97d01d
Reviewed-on: https://chromium-review.googlesource.com/372344
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-24 17:41:09 -07:00
Bill Richardson
862644b9bb Cr50: Tweak some comments about UART0_RX
Just adding a TODO comment to the gpio.inc file.

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

Change-Id: I5fa1a765232fd31b03d8825324a3a6a964504b5a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374619
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-24 17:41:00 -07:00
Sam Hurst
c5bd6d98b9 charger: Send host event after charge info is updated.
When the charger is detached, the host event would sometimes be
sent before the charge info was updated, resulting in the host
thinking that the charger was still connected.

BUG=chrome-os-partner:55584
BRANCH=none
TEST=Connected charger to kevin 15 times and verified that the
icon was removed in 2-seconds or less.
Change-Id: I1a4e4e0f7cc23010210570fc261da8308d8e8070
Reviewed-on: https://chromium-review.googlesource.com/367809
Commit-Ready: Wonjoon Lee <woojoo.lee@samsung.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-24 17:40:38 -07:00
Vijay Hiremath
0dd5175c85 reef: By default disable unwanted host command debug messages
BUG=chrome-os-partner:56549
BRANCH=none
TEST=Unwanted host command debug messages are not observed

Change-Id: I384fa779fe849484ddbb3174dbcbff651fbd565a
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/374700
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-24 17:40:36 -07:00
Divya Sasidharan
1bebf37965 barometer: Add barometer driver for BMP280 in EC
BMP280 driver API is designed to work with motion
sensor task. The sensor sampling parameters are
configured optimally for handheld device in accordance
with BMP280 spec recommendation.

BUG=None
BRANCH=master
TEST=Tested on amenia; with appropriate .odr in board file
     test command "accelread 4" returns raw pressure
     value in Pa; accelinfo on 4000 shows Pa value.

Change-Id: I3f4c0c33a77dd317aa1425624d3cc7f4ec6b45a1
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/351660
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-08-24 17:40:34 -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
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
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
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
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
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
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
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
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
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
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
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
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
b53a0f5d5e kevin: usb_pd: Accept VCONN swap only when 5V is available
BUG=chrome-os-partner:56247
BRANCH=None
TEST=Connect kevin to samus, run "pd 0 swap vconn", verify vconn state
shown by "pd 0 state" toggles. Also verify swaps instigated by samus
toggle vconn state on kevin.

Change-Id: Ieb8b7fe8b5e56a0d6fd29deba91efb2686c41ea4
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371378
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-20 22:01:07 +00:00
Nick Sanders
65ba93af93 sweetberry: add build target for sweetberry
sweetberry is an stm32f446 based power monitoring
board, with 48 channels of INA current sense chips

BUG=chromium:608039
TEST=boots
BRANCH=none

Change-Id: If263bcee3a648ba3605f991999d481b7a0e2a1db
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/370718
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-08-19 14:21:19 -07:00
Victor Prupis
a56aabfc65 Standard locations for board specific battery code
Moved battery code for samus and ryu from driver tree to board tree.

BUG=chrome-os-partner:42486
BRANCH=master
TEST=none

Change-Id: Iaad1456323f85e5852d8aa8e3e2d453b26e2d452
Signed-off-by: Victor Prupis <vprupis@google.com>
Reviewed-on: https://chromium-review.googlesource.com/371402
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2016-08-19 14:21:17 -07:00
Shawn Nematbakhsh
1fd2427b3c kevin / gru: Enable VBUS discharge when swapping out of source role
Enable our 5v discharge circuit (for at least 50ms) when power swapping
out of source.

BUG=chrome-os-partner:54923
BRANCH=None
TEST=Verify power swap succeeds on kevin when connected to Samus.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I3d060be8a657ef9fab3d7dda3a676c2705d2b283
Reviewed-on: https://chromium-review.googlesource.com/362761
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-19 14:21:08 -07:00
Bill Richardson
f895e32b0f Cr50: Remove unused AP_WP_L GPIO
DIOM3 is no longer used. Remove it from gpio.inc

BUG=chrome-os-partner:55895,chrome-os-partner:55896
BRANCH=none
TEST=make buildall; test on Cr50 hardware

Change-Id: I1f7aeab8135fa97aab04945b6a450e32903e2e84
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/372405
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-19 17:49:33 +00:00
Ravi Chandra Sadineni
5f86e73e7f Correct mv values for the thermal sensors.
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>

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

Change-Id: I1abbe22585eb6220c627036c537153ce8bd088fb
Reviewed-on: https://chromium-review.googlesource.com/370800
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-17 22:15:37 -07:00
Shamile Khan
01732ed87c reef: Add internal pull-up for TCPC1 INT# by default.
Previously this was only done when the board version is EVT or less
and when daughter card is inserted. However board version can not
be determined at this stage of power up since the function
board_get_version() relies on reading Board ID ADC and ADCs have not
yet been initialized.

This pull up can be removed in future board versions in which the
daughter card will always be in place and an internal pull-up will
no longer be needed.

BUG=chrome-os-partner:55488 chrome-os-partner:56039
BRANCH=none
TEST=verify board has no watchdog reset when daughter baord
     is not connected. Also verify from EC log timestamps that
     there is no delay of approximately 1 second between
     "Inits done"and "KB init state"

Change-Id: I68eff923dd795b7b2f23f88028ee14d1e845b401
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/370958
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-17 19:17:28 -07:00
Rachel Nancollas
2d96f851ab Reef: Turns off correct power rails when entering G3
Turn off PP3300_A, PP5000_A, and PMIC when chipset_do_shutdown is called.

BUG=chromium:54962
TEST=Press power button for 9 seconds and confirm that PP3300_A, PP5000_A,
and PPVAR_VNN are at 0 volts. Also verify that system boots from G3 when
power button is pressed.
BRANCH=None

Change-Id: Ib8347873728e3940fd588599403c94d0f264f64c
Signed-off-by: Rachel Nancollas <rachelsn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371340
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Rachel Nancollas <rachelsn@google.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-17 19:17:13 -07:00
David Hendricks
0713fff57d reef: make corrections to I2C GPIOs in gpio.inc
There were a few things wrong with the way I2C pins were originally
set up:
- EC_I2C_SENSOR_SCL was moved from GPIOA0 to GPIO92.
- EC_I2C_GYRO_SCL/SDA and EC_I2C_POWER_SCL/SDA were swapped.

BUG=chrome-os-partner:53791
BRANCH=none
TEST=Motion sensors work now.

Change-Id: Id867c56b625da27e8ad82b503ae11173d7f855cc
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347754
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2016-08-17 19:16:39 -07:00
Nick Sanders
6fcd163da5 stm32f446e-eval: add support for stm32f446
This adds basic support for the stm32f446.
This consists of:
* New DMA model for stm32f4
* New clock domain support.
* MCO oscillator gpio export support.
* Flash support for irregular blocks.

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

Change-Id: I1c5cf6ddca09009c9dac60da8a3d0c5ceedfcf4d
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/363992
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-08-17 16:19:07 -07:00
ite01580
7317e1f165 board: it83xx_evb: fix build error
Fix error: CC_USBPD undeclared

BRANCH=None
BUG=None
TEST=Do check by "make BOARD=it83xx_evb -j"

Change-Id: Idc2e8e608c767bcea1221204a0d66417e82ff216
Signed-off-by: ite01580 <yanis.wang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/371019
Commit-Ready: Yanis Wang <yanis.wang@ite.com.tw>
Tested-by: Yanis Wang <yanis.wang@ite.com.tw>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-17 10:00:27 -07:00
Vijay Hiremath
490ceb734f Reef: Enable smart power control to the device's USB ports
BUG=chrome-os-partner:55377
BRANCH=none
TEST=From the Kernel console, using 'ectool usbchargemode' & 'lsusb'
     commands verified that the USB devices are able to connect and
     disconnect from the system.

Change-Id: I45059d9e4a4995ae87eb24459c66f0110cfb20ce
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/361403
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-16 14:04:36 -07:00
Vincent Palatin
81421ba013 fusb302: enable setting Rp value
Configure the FUSB302 current source used for Rp according to the
CONFIG_USB_PD_PULLUP_xxx value.

Set the default Rp for Kevin to 1.5A.

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

BRANCH=none
BUG=chrome-os-partner:54452 chrome-os-partner:56110
TEST=manual: plug to Samus, enable charging on the Samus side,
measure the CC voltage with Twinkie, get 950mV instead of 450mV.

Change-Id: I98faf18132a097e49e9c0fa8e1395d230608ee9e
Reviewed-on: https://chromium-review.googlesource.com/369190
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-16 00:58:14 -07:00
Mary Ruthven
e7bdf36f34 cr50: delay sleep for 3 minutes after resuming from sleep or after init
Disable sleep for the first 3 minutes after initializing cr50 and
disable sleep for 3 minutes after a wakepin interrupt has been received.

BUG=none
BRANCH=none
TEST=manual
	on a development board pull up dioa3 and dioa12 then verify cr50
	does goes to sleep after 3 minutes.

	on gru see sleep is delayed by 3 minutes when the wakeup
	interrupt is called.

	enable deep sleep and check cr50 does not go to sleep for 3
	minutes after resuming.

Change-Id: I28ec3c2f5f86326b926d403ad52ffb4fc108e7ec
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/367880
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-14 02:03:21 -07:00
Shawn Nematbakhsh
de4d25964d mkbp_event: Allow host to report sleep state for non-wake event skipping
Allow the host to self-report its sleep state through
EC_CMD_HOST_SLEEP_EVENT, which will typically be sent with SUSPEND
param when the host begins its sleep process. While the host has
self-reported that it is in SUSPEND, don't assert the interrupt
line, except for designated wake events.

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

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I74288465587ccf7185cec717f7c1810602361b8c
Reviewed-on: https://chromium-review.googlesource.com/368391
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-12 13:45:35 -07:00
Mulin Chao
0558a242bb wheatley: Modified board level drivers for eSPI POC on wheatley.
Modified board level drivers for eSPI POC on wheatley. By adding CONFIG_ESPI
definition, ec can support espi protocols for host interface on x86 based
platform such as skylake and so on. CONFIG_VW_SIGNALS will be used in the
future for saving GPIOs during power sequence.

Modified sources:
1. wheatley/board.h: Enable/disable espi driver.
2, wheatley/board.c: Add VW signals in power signal list.
3. wheatley/gpio.inc: Save GPIOs if CONFIG_VW_SIGNALS is defined.

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

Change-Id: I0e8a951de6eacd4f8be65ffaac242f38079375d5
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/366520
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-12 05:24:34 -07:00
Tang Zhentian1
2e738c72fd Analogix: Present configured Rp pull-up.
ANX was using 36K Rp detection as default detect value.
ANX fix google issue google charger
BUG=chrome-os-partner:54452
BRANCH=master
TEST=On Reef: With twinkie tested CC voltage change for
      1.5A Rp pull up meets the spec values.

Change-Id: I3af20e5c437218b83befc899a7c62b019b2c9dee
Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/366461
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-11 16:52:02 -07:00
Divya Sasidharan
6b6ed79a56 Amenia/Reef: Present 1.5A Pullup
Enable config to choose the Rp pullup
strength to advertise the desired current
from USB-C while providing power.

BUG=chrome-os-partner:54452
BRANCH=none
TEST=Boot and check appropriate register
     settings in Reef.
     For Parade: i2cxfer r 1 0x16 0x1A -> 0x15

Change-Id: I5c1b7a45bf483333d7b411aad402fc95e4fa05de
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/353038
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-11 16:52:00 -07:00