Commit Graph

2157 Commits

Author SHA1 Message Date
nagendra modadugu
a8473bf87d CR50: add a simple ASN.1 parser & certificate verifier
Add a certificate verifier, so that endorsement
certificates may be verified upon installation.
Doing so allows for catching certificate errors early.

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

Change-Id: I9339a6bc36e4d82ae875ce774e31848ae983fa1f
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/351031
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-06-12 04:38:01 -07:00
Vijay Hiremath
96fbb35687 amenia: reject charge port on init till battery is initialized
Ported from the below patch
  Change-Id: I981f9dbf3d84390550bb696e561f5fa51ffc573a
  Reviewed-on: https://chromium-review.googlesource.com/351224

BUG=chrome-os-partner:54058
BRANCH=none
TEST=Amenia system does not reboot before booting to OS.
     Active port is set once battery is available.

Change-Id: If8fd84f82f5a7fb7ca3736031a161d90e5e77c12
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/349853
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-11 02:46:52 -07:00
Furquan Shaikh
c12976b312 reef: Add internal pull-up on LID_OPEN gpio
LID_OPEN gpio is present on the daughter card and provided by the
EC. Add an internal pull-up on it for the cases when the daughter card
isn't plugged in.

This fix won't be required starting EVT.

BUG=chrome-os-partner:54143, chrome-os-partner:53566
BRANCH=None
TEST=Compiles successfully. "gpioget LID_OPEN" returns 1 without
daughter card.

Change-Id: Ieff281b489e4f3f8be184a55b7975fb2efcc1099
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/350460
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-06-10 15:46:32 -07:00
Shawn Nematbakhsh
e1eb211f31 charge_manager: Allow rejected 'Dont charge' request on init
If our battery isn't able to provide enough power to the EC on boot, we
should not cut off our input power, regardless of dual role
determination or other charging policy.

BUG=chrome-os-partner:54058
BRANCH=None
TEST=Manual on gru. Drain battery completely, attach USB-C charger,
verify that "Battery critical, don't disable charging" is seen on the
console and the EC doesn't brown out.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I981f9dbf3d84390550bb696e561f5fa51ffc573a
Reviewed-on: https://chromium-review.googlesource.com/351224
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: Vincent Palatin <vpalatin@chromium.org>
2016-06-10 00:18:05 -07:00
nagendra modadugu
a80d840509 CR50: add support for hardware modexp
This commit includes changes required for
supporting a hardware based montgomery
modexp (r = a ^ e mod N).

The function bn_is_bit_set() was previously
static, and now added to internal.h, as this
function is used by the hardware implementation.

Add function declarations for new functions
related to the hardware implementation to
chip/g/dcrypto/internal.h

BRANCH=none
CQ-DEPEND=CL:*260618,CL:*260895
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=all tests in test/tpm_test/tpmtest.py pass

Change-Id: I5fe4a6692678b64f27659f42a08d200b6fe6f0cc
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/347462
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-06-09 02:16:11 -07:00
Vijay Hiremath
07e4b2087f reef: Minimum battery voltage settings in no battery condition
In no battery condition set the battery minimum voltage to the
battery maximum voltage so that the charger voltage is set to the
battery maximum voltage. This adds more reliability for the system
and also avoids system reboot due to voltage drop on VBATA.

BUG=chrome-os-partner:53968
BRANCH=none
TEST=If battery is not present, EC console command 'charger'
     gives battery maximum value.

Change-Id: I1f7740977cbe7087c27de95036a0eb5c385c0a54
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/348942
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>
2016-06-08 19:17:56 -07:00
Vijay Hiremath
2225fbac6c reef: Enable BC1.2 support
BUG=chrome-os-partner:53688, chrome-os-partner:53721
BRANCH=none
TEST=Type-C, DCP & SDP chargers can negotiate to desired current
     & voltage. Battery can charge. USB3.0 & USB2.0 sync devices
     are detected by the Kernel.

Change-Id: I37890518c151ef94da2b2ade67a023f72d48fce6
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/346784
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>
2016-06-08 19:17:56 -07:00
Vijay Hiremath
4a6967951f Driver: BD99955: Use Charger interrupt to detect VBUS activity
Added support to enable the BD99955 charger interrupt to detect
the VBUS activity. With this approach GPIO USB_Cx_VBUS_DET_N pin
can be removed.

BUG=chrome-os-partner:53688
BRANCH=none
TEST=Manually tested on Amenia. Type-C, DCP & SDP chargers can
     negotiate to desired current & voltage. Battery can charge.
     USB3.0 & USB2.0 sync devices are detected by the Kernel.

Change-Id: I5470092c5cd43026aafc1a638ba446d0037c71e7
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/343650
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-06-08 19:17:56 -07:00
Vijay Hiremath
6e874dc7e7 BD99955: Add support to detect non-BC1.2 compliant chargers
If a non-BC1.2 compliant charger is attached and if the USB charge
port detection is success then setting the charger supplier type as
CHARGE_SUPPLIER_OTHER.

BUG=none
BRANCH=none
TEST=Manually tested on Amenia. Used Apple USB charger (5.1V & 2.1A)
     and few non-BC1.2 chargers (5V & 1A, 5V & 2.1A). Charger is
     detected as CHARGE_SUPPLIER_OTHER and the battery can charge.

Change-Id: I35458dc173505cea970afc37d8f9ffb3c4376fe2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/348060
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-06-08 17:14:52 -07:00
Nicolas Boichat
8b961f9c75 elm: Add support for pd_control command
BRANCH=none
BUG=chrome-os-partner:52433
TEST=ectool pdcontrol {suspend,resume,reset,disable}

Change-Id: I6a9ba3f9c1739bc35c6290dd317b43054b0b52f4
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347731
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-06-07 08:21:34 -07:00
David Hendricks
e37b18d7d1 reef: Initialize EC_PCH_PWROK low
The PCH_PWROK signal has a pull-up on the PCH side, so we really
want to drive this low.

BUG=none
BRANCH=none
TEST=none

Change-Id: Icb0702916671cfd632e67d036bfb865e968c102c
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/350201
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-07 02:31:18 -07:00
David Hendricks
32ee71f6e0 reef: Rename SMI/SCI GPIOs and enable CONFIG_SCI_GPIO
This updates SMI/SCI-related config options on Reef so that
SMIs and SCIs are generated correctly.

BUG=chrome-os-partner:53726
BRANCH=none
TEST=built and booted on Reef EC, firmware seemed more stable
(stayed up longer), but still see watchdog timesouts in task 13.

Change-Id: I6717f48a7655e49207fe34e6a166957eb34a05fd
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/349711
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-06 18:36:38 -07:00
David Hendricks
c59a51081d reef: Don't set LPC pins in gpio.inc
The default mode for the LPC pins is actually LPC. Setting the
altnerate function mode makes them GPIOs.

BUG=none
BRANCH=none
TEST=build and booted on Reef EC. Didn't seem to make much of a
difference on its own but with the follow-up things seemed more
stable.

Change-Id: Ibbc62d23d8d909be48a9bec90da8acebb9905b50
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347443
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-06 18:36:38 -07:00
Mary Ruthven
6672aa1be1 cr50: enable case closed debug
This change adds a ccd console command to control the usb endpoints.
The uart console command is moved into this command so 'ccd uart
[enable|disable]' controls the AP and EC TX signals instead of the
'uart' console command. CCD can be enabled using 'ccd enable'. This
switches the PHY used by the USB controller to be the external PHY.
Changing the PHY exposes the cr50, AP, and EC consoles as well as the
upgrading mechanisms for the AP, EC and cr50. The AP and EC consoles
will be read only until 'ccd uart enable' is called. Cr50 can be updated
using the usb upgrade endpoint. The EC and AP can be updated using the
USB SPI endpoint.

When CCD is disabled the usb controller will switch to using the AP PHY.
None of the endpoints will be visible to the host.

The USB SPI endpoint can be used to flash the EC or AP using
'flashrom -p raiden_debug_spi:target=[AP|EC]'. If CCD is not enabled
running flashrom using the raiden_debug_spi programmer will fail. Cr50
will not forward the commands to the external AP or EC ROM, so flashrom
will not be able to find the chip.

The UART TX signals are now controlled by the 'ccd uart' console
command instead of the 'uart' console command. The UART TX is enabled
separately from CCD, because we want to be able to enable CCD while
servo is connected, and having the cr50 UART TX pins wired directly to
the Servo TX lines could damage both devices. The AP and EC consoles
are be read only until 'ccd uart enable' is called. 'ccd uart disable'
disconnects the AP and EC TX pins from the UART peripheral.

When RDD becomes reliable on cr50, ccd_set_mode will select the PHY
being used by the g chip USB controller.

BUG=chrome-os-partner:49960,chrome-os-partner:52281
BRANCH=none
TEST=manual
	TEST SERVO
	power cycle the DUT

	connect servo and check that the AP and EC consoles still work
	check that both the AP and EC can be flashed using servo.

	TEST SUZY Q
	Attach Suzy Q

	Connect to the all three consoles. Check that the cr50 console
	is in read-write mode and the EC and AP consoles are read only.

	Attach Servo.

	Verify all of the servo functionality described above still
	works with suzy q attached and ccd enabled.

	Disconnect Servo.

	run 'ccd uart enable' on the cr50 console and check both the AP
	and EC consoles can be written to.

	Check that the AP and EC can be programmed using the
	raiden_debug_spi programmer.

Change-Id: I96db2a72fc95086871c9e4c778c19ebd01efb851
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342563
2016-06-03 20:14:59 -07:00
Mary Ruthven
767b615215 g: implement EC/AP flash access via CCD
While in CCD, cr50 can be used to flash the AP and EC through USB. This
change adds an endpoint that can be used to read, erase, and write to
the AP and EC spi rom.

Currently CCD is not enabled on cr50, so usb_spi access has to be
enabled manually through the cr50 console.

BUG=chrome-os-partner:50701
BRANCH=none
TEST=manual
	On EC console run 'flash_tristate true'
	On cr50 console run 'usb_spi enable'
	Use 'flashrom -p raiden_debug_spi:target=EC' and
	'flashrom -p raiden_debug_spi:target=AP' to interact with
	the AP and EC flash
CQ-DEPEND=CL:342144

Change-Id: I9c31dab252a8bfbc498eaf64ac5c2f53ec9dde30
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342511
2016-06-03 20:14:58 -07:00
Kevin K Wong
a5a4181d29 reef: add trackpad power control
BUG=chrome-os-partner:53746
BRANCH=none
TEST=Trackpad is working on reef.

Change-Id: I6c97f3991c1f02575f8bbc94db0b47069e3d7323
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/348321
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>
2016-06-03 13:18:09 -07:00
Shawn Nematbakhsh
98d7bc87df kevin: Add USB charger tasks
BUG=chrome-os-partner:53777
BRANCH=None
TEST=Manual on Kevin. Enable USB charger tasks, verify that VBUS is
properly detected on no-battery case. Verify USB-C / PD charger
detection continues to function.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I268bc6ec6b8a6a9b7340a5cb2b0d651b1b1659ce
Reviewed-on: https://chromium-review.googlesource.com/349242
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-06-03 03:00:09 -07:00
David Hendricks
d5f676953e reef: really disable USB-A in S3 -> S5
BUG=none
BRANCH=none
TEST=built and booted EC image on reef

Change-Id: Ic20416dac03eb3d52806fa7e2f53008db5580c3f
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347096
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-06-03 03:00:08 -07:00
David Hendricks
82c803d93b reef: Move PP3300 and PMIC enable to occur together
Update power sequencing as per Rachel's recommendation. We currently
wait for PP5000_PG and PP3300_PG before enabling the PMIC. This changes
the order so that we don't wait for PP3300_PG before setting the PMIC
enable.

BUG=chrome-os-partner:51323
BRANCH=none
TEST=see scope shots mentioned in the BUG

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I022a9ab21c1bcb70dc72f358dbf89acb656851b8
Reviewed-on: https://chromium-review.googlesource.com/349291
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-06-03 03:00:07 -07:00
David Hendricks
de4abe07f7 reef: sleep for 10ms when re-enabling USB_TCPC_PWR
This just fixes a bad timeout value.

BUG=chrome-os-partner:53673
BRANCH=none
TEST=built and booted EC firmware on reef

Change-Id: If7676c85f082e390e363c8d26cc8bc97fb81e8c4
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347067
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-06-03 02:59:58 -07:00
Kevin K Wong
e4c9e101e2 reef: enable WiFi power control support
add a new config flag to support active low power control signal

BUG=chrome-os-partner:53665
BRANCH=none
TEST=Use multimeter to check for voltage present on the WiFi slot.
     Use gpioget to check GPIO state in S0 (on) and S5 (off).

Change-Id: Ibeca88d16f39eadd7f29589cd3cd15aeef0dd524
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347085
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-06-03 02:59:56 -07:00
Shawn Nematbakhsh
5426122466 cleanup: pd: Define VBUS detection source
Previously CONFIG_USB_PD_TCPM_VBUS had two uses which were independent:

- When operating as a TCPC, it indicated that the VBUS level should be
  tracked (through GPIO inputs) and sent to the external TCPM when
  appropriate.
- When operating as a TCPM, it indicated that the VBUS level should be
  obtained by querying the TCPC.

These two independent uses have been split into
CONFIG_USB_PD_TCPC_TRACK_VBUS and CONFIG_USB_PD_VBUS_DETECT_TCPC, which
sould be more clear.

In addition, CONFIG_USB_PD_VBUS_DETECT_* CONFIGs have been added for
other means of VBUS detection.

BUG=chromium:616580
BRANCH=None
TEST=Verify kevin continues to boot + charge.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I936821481d6577e17e3e9c61ff97c037574d6923
Reviewed-on: https://chromium-review.googlesource.com/348950
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-02 14:06:53 -07:00
Ryan Zhang
f6a53e9917 COMMON: move precharge time to config.h
move PRECHARGE_TIMEOUT to config.h so that we can customize precharge time to
meet client's spec.

BUG=none
BRANCH=master
TEST=`make -j buildall`, precharge time is set to 300s in elm.

Change-Id: I5c3bf0d5c5240b9c087e6cdb7c6e97301efa9f84
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/348151
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-06-01 20:37:08 -07:00
nagendra modadugu
1242805ba5 CR50: add tests for 1024-bit RSA.
Add tests for RSA-1024, and created partner CRBUG/53893
to track issue discovered with 1024-bit modinv.

1024-bit RSA support being added in preparation
for a forthcoming hardware based implementation.

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

Change-Id: I6b5aaeffc9df1cbbe403535fd21cdd377b42c38e
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/348490
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-06-01 15:50:49 -07:00
nagendra modadugu
aca616c551 CR50: port dcrypto/cr50 code to depend on third_party/cryptoc
Port SHA and P256 code to depend on third_party/cryptoc.
Remove config options CONFIG_SHA1, and CONFIG_SHA256 as
these are provided by third_party/cryptoc.

Also remove unused config options CONFIG_SHA384, CONFIG_SHA512.

Crypto functions prefixed by dcrypto_ (declared in internal.h ),
DCRYPTO_ (declared in dcrypto.h)  are implemented under
chip/g/dcrypto, and otherwise are implemented under third_party/cryptoc.

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

Change-Id: If7da02849aba9703573559370af5fae721d594fc
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340853
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-31 23:58:31 -07:00
YH Huang
abe2a55191 elm: get VBUS statue from GPIO
GPIO_USB_C0_VBUS_WAKE_L is used to show VBUS status on elm.
If VBUS is present, pd sends soft reset on boot.
So it can boot without battery.

BUG=chrome-os-partner:53496
BRANCH=none
TEST=test on elm.
Remove battery and boot up successfully only with AC.
Use "sysjump rw" command and ec won't reboot by pd hard reset.

Change-Id: I1cdb12894c7b6bc41d7a16802b8c0ef14e2aa426
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/346261
Tested-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-31 22:15:49 -07:00
Vadim Bendebury
d9f0c13447 nvmem: provide a function to wipe out nvmem contents
It is important to be able to wipe out the non-volatile memory for
various reasons. This patch adds this ability for both when NV memory
is kept in SRAM and in flash.

Also a minor clean up to eliminate some code duplication and to have
normal flow messages printed out with time stamps.

BRANCH=none
BUG=chrome-os-partner:44745
TEST=just makeall at this time.

Change-Id: I59c1909669aeaa9e8ffb3d8ef81b02fa0facb6ab
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/348291
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-05-31 19:38:20 -07:00
Nick Sanders
723f703fd4 servo_v4: add serial number and gpio commands
This change enables configs for:
CONFIG_USB_SERIALNO: a programmable serial number for servo_v4
CONFIG_CMD_GPIO_EXTENDED: ability to change GPIO functions on the command line.

BUG=chromium:571476
BRANCH=None
TEST=serialno set abcdef; serialno load; reboot; gpioget/gpioset

Change-Id: I0e871d256e41022d3bb9985e590864a6c4cdf6a4
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/348391
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-05-31 17:51:08 -07:00
Wonjoon Lee
85120f5bee kevin: Add bma255 sensor for lid accelometer
BUG=chrome-os-partner:52877
TEST="accelread 2" is working on kevin, also check accelrate,
accelrange can set proper value on IC

Change-Id: I3258b497b06a6ceaedb1e20ac1a0f4bd74e03718
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/347723
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-31 14:14:44 -07:00
Shawn Nematbakhsh
8f2c7d7f76 jerry: Free up flash space
Remove console command help strings to free flash space.

BUG=None
TEST=Build for jerry, verify free flash space goes from ~40 bytes to
~2500 bytes.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I3e250c86420978446ae0b348ded7646b13272486
Reviewed-on: https://chromium-review.googlesource.com/348073
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-31 16:16:38 +00:00
Koro Chen
af0bc62e67 elm: set SPI2 interface to low in S5
BUG=chrome-os-partner:51708
BRANCH=none
TEST=poweroff elm, measure PP3300 and voltage is ~ 0.05V.

Change-Id: I17088bf15a97eb7337abbe773897eaf298086752
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/344492
Reviewed-by: Rong Chang <rongchang@chromium.org>
2016-05-30 03:55:24 -07:00
Vijay Hiremath
dc3de2c826 reef: Initialize charge suppliers after change manager is initialized
Initialize the charge suppliers after change manager is initialized,
otherwise charge supplier current & voltage values will be overwritten
to -1 by the charge manager ini function.

BUG=chrome-os-partner:53788
BRANCH=None
TEST=Observed there are no "CL: p(port) s(supplier) i-1 v-1" prints
     on the EC console.

Change-Id: Id0212c502d5833c016ac79ee15d21304d6d7ceb2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347896
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-05-28 00:08:38 -07:00
Vijay Hiremath
52fdd95321 BD99955: Get the VBUS provided status from individual ports
BUG=chrome-os-partner:53786
BRANCH=none
TEST=Manually tested on Amenia. VBUS provide status is updated
     properly for inividual ports.

Change-Id: I59c41988438543033db2322029169f405f347869
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347895
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-05-28 00:08:38 -07:00
David Hendricks
0c5782495d reef: Re-factor PP5000 and PP3300 enable/disable
This moves PP5000 and PP3300 enable early into board_init() and
increases priority of board_init() so that it runs before any TCPC
or PD init hooks which communicate with the TCPCs via I2C.

This hack also makes it so we don't shut off PP3300 for the time
being, at least until we get the proper sequence down and can avoid
I2C errors.

This probably is not the permanent solution, but for now it prevents
a lot of I2C errors from occurring.

BUG=chrome-os-partner:53549
BRANCH=none
TEST=booted on reef, no longer see I2C wedge error messages

Change-Id: I87e2e99aa3e1152cd10a2bfdd749d6e0dbd981a8
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346633
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-05-27 19:47:20 -07:00
Kevin K Wong
3026836a59 apollolake: modify PMIC_EN and RSMRST_N handling
Move power rail and pmic enable control to be handled at
board level due to specific board design.

Modify rsmrst where assertion is pass-through at all time
and de-assertion is only pass-through at power up.

BUG=chrome-os-partner:53666
BRANCH=none
TEST=amenia is able to handle apreset warm/cold, pmic shutdown,
     soc reset/shutdown.

Change-Id: I7ff819d88d0e194073bee8f02b1e3fa70ca44ba7
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347370
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Divya Jyothi <divya.jyothi@intel.com>
2016-05-27 19:47:20 -07:00
Mary Ruthven
8f886b40f4 lucid: Add battery temp to temp_sensors list
BUG=none
BRANCH=none
TEST=verify "ectool temps 0" displays the battery temperature

Change-Id: If8f58886f84b2aaffd8a517bf85633c34c9b7ca2
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347990
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-27 18:08:51 -07:00
Mary Ruthven
9139071b71 cr50: disable UART peripheral when the device is powered off.
When the AP or EC is off, the RX line is low. Holding the UART RX line
low causes an interrupt storm. This change disables the UART TX and RX
on the peripheral when the device is powered off so the interrupts wont
be triggered.

BUG=chrome-os-partner:53514,b:28885578
BRANCH=none
TEST=run taskinfo on cr50 and make sure the IRQ count for 181 is a
reasonable number.

Change-Id: I42c779253860a2b1dd27ab41fb7097c887cc23ff
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347355
2016-05-27 18:08:51 -07:00
Mary Ruthven
f89b5a9b5b cr50: dont drive UART output if servo is connected
Use the power and servo connection states to enable and disable the
EC and AP UART output. Contention between the cr50 and servo
can prevent either uart from working, and possibly damage kevin or
servo. If both UARTs are enabled, then cr50 cant know if servo is
connected, so it is best if the UARTs are disabled before connecting
servo.

If servo is connected or if a device is not powered on then the UART
output wont be enabled. The two UARTs are enabled separately and one can
be enabled without the other. Any disabled UART will be monitored for a
servo connection. If servo is detected, then all UARTs will be disabled.

BUG=chrome-os-partner:52056,chrome-os-partner:52322
BRANCH=none
TEST=manual
	Power on the EC only. Check only the EC UART is enabled.
	Without disabling the uarts power on the AP and verify both are
	now enabled.
	Turn of the AP. run 'uart enable. Verify only the EC UART is
	enabled. Then attach servo and check that the AP and EC UART
	are disabled.

Change-Id: Ife27c9360e91b07f86ff8bfcec7f4fd423c31d25
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/342828
2016-05-27 18:08:51 -07:00
Mary Ruthven
1d7984ad20 cr50: monitor the state of Servo, the EC, and AP
There are a couple of issues that cr50 has when it cannot know the state
of servo, the EC, and the AP. This change adds support so we can detect
when the AP or EC has been powered on and when servo has been connected.
It uses the UART RX signals to monitor the power state of the AP and EC.
The TX signals are used to monitor the state of servo.

BUG=chrome-os-partner:52056,chrome-os-partner:52322
BRANCH=none
TEST=verify device states are correct when the AP and EC are powered on
	or off and when Servo is attached or detached

Change-Id: Id0a2281b65cb367ecc8d0ca2f9a576672318a5fb
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/344019
2016-05-27 18:08:50 -07:00
Scott
7184144012 Cr50: NvMem: Connected function stubs in /board/tpm2/NVMem.c
Used #define CONFIG_FLASH_NVMEM to have functions in
/board/tpm2/NVMem.c utlitize on chip Nvmem functions.
On chip NV Memory availability is tied to an internal nvmem
error state which itself only depends on finding at least one
valid partition.

Added nvmem_is_different and nvmem_move functions which were
needed to complete the tpm2 platform interface. In addition,
added unit tests to support these two new functions.

BUG=chrome-os-partner:44745
BRANCH=none
TEST=manual
make runtests TEST_LIST_HOST=nvmem and verify that all tests pass.
Tested with tcg_test utility to test reads/writes using the
command "build/test-tpm2/install/bin/compliance --ntpm
localhost:9883 --select CPCTPM_TC2_3_33_07_01".

Change-Id: I475fdd1331e28ede00f9b674c7bee1536fa9ea48
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346236
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-05-26 18:08:57 -07:00
Scott
df35737d63 Cr50: Enabling NvMem in board.c and board.h
Enabled CONFIG_FLASH_NVMEM and its associated configs. Added
user definitions along with buffer lengths. Added board
specific functions for sha computation and getting user
buffer lengths required by the NvMem module.

This CL does not include calls from cr50/board/tpm2/NVMem.c.
Those calls will be modified in a subsequent CL.

BUG=chrome-os-partner:44745
BRANCH=none
TEST=manual
The only call to any NvMem functions is nvmem_init().
Loaded code and verified via console that it boots
up properly. Also executed 'make runtests', but
that really only tests regression and not the new
board specific changes.

Change-Id: Iddc8d05703707247d26a8f22dca3ac9cc3c6ad1e
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/345633
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-05-26 18:08:57 -07:00
Nick Sanders
56ee8aefc3 servo_micro: add programmable serial number
This change provides a console command for setting,
and loading a usb serial number from flash. This
feature adds CONFIG_USB_SERIALNO, and currently only
has a useful implementation when PSTATE is present.

BUG=chromium:571477
TEST=serialno set abcdef; serialno load; reboot
BRANCH=none

Change-Id: I3b24cfa2d52d54118bc3fd54b276e3d95412d245
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/337359
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-26 16:17:26 -07:00
Kevin K Wong
4fa3b1e80c amenia: update TCPC0 reset/power down assertion time
BUG=none
BRANCH=none
TEST=system is able to establish PD contract

Change-Id: Iadbe5e9824ce31a314c0cd3e27fa53ac33bf9a21
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347241
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-26 03:22:33 -07:00
nagendra modadugu
4c8359f4fa CR50: increment prime generation counter
The counter used for prime generation should be
incremented after each success / failure.  Not doing
so results in duplicate primes being picked when
a label is explicitly specified.

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

Change-Id: Ib2fd0e7fa6255b04946e6d2808e8c67a2199fb55
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/346056
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-05-26 03:22:25 -07:00
Shawn Nematbakhsh
879231cbce reef: Initialize VBUS + BC1.2 charge_manager suppliers
These must be initialized in order for charge_manager to select a port +
input current limit.

BUG=chrome-os-partner:53578
BRANCH=None
TEST=Attach 5V USB-C charger on Reef, verify "New chg" print is seen
along with "CL: p0 s1 i3000 v5000]" print.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia6139d9e9c6acd17ac587b32280f11927741672d
Reviewed-on: https://chromium-review.googlesource.com/347043
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-05-24 19:23:28 -07:00
Nicolas Boichat
a22ba25483 elm: Add support for I2C tunnel protection
When I2C tunnel connected to ANX7688 is protected, we only allow
access to I2C address 0x2c (TCPC).

BRANCH=none
BUG=chrome-os-partner:52431
TEST=Book elm-rev1

Change-Id: Ic68f1665cf7b01d3392fe0308bd199a85f43d493
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/345762
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@google.com>
2016-05-24 19:23:28 -07:00
Aaron Durbin
90b934d4e9 reef: keep analogix pd chip in reset
The gpio settings for the USB_PD_RST_ODL signal had the default
state high while the power enable, EN_USB_TCPC_PWR, was low. This
is combination of settings is invalid for the part. Therefore,
keep USB_PD_RST_ODL low until board_set_tcpc_power_mode() is called
to bring the pd chip online.

BUG=chrome-os-partner:53035
BRANCH=None
TEST=Rachel confirmed things still working.

Change-Id: I8b6b54a474c00165a4d0af944fb60f2923b9ef5c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347000
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-24 15:46:02 -07:00
Aaron Durbin
c8a4948417 reef: change USB_C0_PD_INT voltage tolerance
The USB_C0_PD_INT signal is actually at 3.3V levels. Don't mark
the voltage sensitivity to 1.8V.

BUG=chrome-os-partner:53035
BRANCH=None
TEST=Rachel ran with resulting image. Nothing bad observed.

Change-Id: I36bc3f911b715dc967cc8f23dfc70c3d0e5023d2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346734
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-24 15:46:02 -07:00
Aaron Durbin
58b9c3ef17 reef: don't reset analogix pd chip out of band of driver
board_reset_pd_mcu() was provided to ensure a microcontroller USB PD
implmenetation was reset. However, performing this sequence without
coordinating with the analogix driver results in a mismatch of
expectations regarding the internal polarity. The driver already
sets the expected interrupt polarity, but performing this reset
in chipset_pre_init() changes the expected setting which results
in occasional power sequence state machine hangs since
tcpc_get_alert_status() was always returning true. Lastly, added
comment to board_reset_pd_mcu() indicating how that sequence is likely
not needed if it's only invoked in the EC reset path.

Getting the analogix chip out of reset works in conjunction with the
default gpio settings for USB_PD_RST_ODL as well as the implementation
of board_set_tcpc_power_mode().

BUG=chrome-os-partner:53035
BRANCH=None
TEST=Rachel tested with change. Consistent power sequencing completes
     without any hangs.

Change-Id: I9ffabaf85f33d6a361caef631e3e6d86c4cf8081
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346733
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-24 15:46:02 -07:00
Vijay Hiremath
313355302b Driver: BD99955: Enable BC1.2 support
BUG=none
BRANCH=none
TEST=Manually tested on Amenia.
     Connected Zinger, Type-C, DCP & CDP chargers. Device can negotiate
     to desired current & voltage and the battery can charge.
     USB2.0 sync device is detected by Kernel.

Change-Id: I58cb69289eef9a966e06bef8fe31d35beaec5e27
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/341030
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-24 15:46:01 -07:00