Commit Graph

9265 Commits

Author SHA1 Message Date
Jett Rink
9a80691c33 octopus: remove ADCs for VBUS
Hardware does not support ADCs for Vbus anymore for
all boards except bip. Make bip the same as other octopus
boards (i.e. not using ADCs for Vbus measurements).

BRANCH=none
BUG=b:109747036
TEST=CL stack works with current yorp

Change-Id: I96b82b70799e8b70bf5d479a1714524fc1652140
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1089199
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-07 13:11:40 -07:00
Wei-Han Chen
fa3fe9b903 drivers/touchpad_st.c: wait full initialize by re-calling deferred
Full panel initialization can take about 1.6 seconds.  If this is
called by hook_call_deferred, it will block other HOOKS.  Replace the
'while loop + sleep' by re-calling deferred every 100ms.

BRANCH=whiskers
BUG=b:109714732
TEST=sudo ./extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_update <fw>
TEST=sudo extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_debug=01
TEST=(EC console) touchpad_st calibrate
Signed-off-by: Wei-Han Chen <stimim@chromium.org>

Change-Id: I665169524a06a7c359303a4a3dceced4a141f9ae
Reviewed-on: https://chromium-review.googlesource.com/1086895
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-07 13:11:37 -07:00
Nicolas Boichat
af97a6046b power: Rename rockchip to rk3288
Get rid of a TODO.

BRANCH=none
BUG=b:35569119
TEST=make buildall -j

Change-Id: Ia918c90519220a348f8c65b6b6f14b6d3129a63a
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1090523
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-07 13:11:29 -07:00
Nicolas Boichat
eb480d50b0 power: Rename mediatek to mt817x
BRANCH=none
BUG=b:109850749
TEST=make buildall -j

Change-Id: I69538a210f9b2198614720537faa3ee75bc0600e
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1090522
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-07 13:11:29 -07:00
Aseda Aboagye
b3fbac369a nocturne: Change SYS_RST_L to open drain.
BUG=b:80500449
BRANCH=poppy
TEST=flash nocturne; verify that AP boots and chipset can be reset.

Change-Id: Icd195b6323bb4e94eb4184231860e755d40c0675
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1087547
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-07 08:36:11 -07:00
Philip Chen
77da1b6499 cheza: Read board version from GPIO pins
BUG=none
BRANCH=none
TEST='version' command on ec console shows correct board version

Change-Id: If52b3424f754cf470042909767eaff48a9b5483a
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1090370
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-06-07 08:35:58 -07:00
Daisuke Nojiri
ac3fd38394 Nami: Change battery config to AP15O5L for Akali
This patch adds a battery configuration (3 cell, AP15O5L) for Akali.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:78315380
BRANCH=none
TEST=Verify the followings on Nami:
1. Charging and discharging
2. Boot with battery disconnected
3. Software cutoff

Change-Id: Ibc6c9cb5ccaa1edc35f9ea6e37565dc41b537a63
Reviewed-on: https://chromium-review.googlesource.com/1080222
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-06-07 08:35:56 -07:00
Jett Rink
eebf6d9db7 phaser: update GPIO based on newest schematics
- Correct pin assignment for EN_USB_A1_5V and LED_3_L
- Add TABLET_MODE_L signal although not hooking up tablet mode
  functionality in this CL
- Remove unneeded USB-C PPC signal to port 1 since using TCPC to drive it
- Clean up formatting

BRANCH=none
BUG=b:109747361
TEST=builds

Change-Id: I40a59375c148a6d0666c71f6e5f401aba64ea95d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1087814
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-07 08:35:55 -07:00
Jett Rink
5390c49fde octopus: rename USB-C signal names
Simple rename of gpio based on newest schematics for yorp and phaser

BRANCH=none
BUG=b:109747036,b:109747361
TEST=build

Change-Id: I08d9010f16e623ca41bb66363d568c4b5bd687e8
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1089040
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-07 08:35:55 -07:00
Edward Hill
31815b74ff sn5s330: Track source enabled state locally
sn5s330_init() will turn off the PP1 (source) FET, but
sn5s330_is_sourcing_vbus() can be called before PPC init: by
usb_charger_init() and pd_power_supply_reset() from pd_task().

Keep track of the PP1 (source) FET state locally, and use this for
sn5s330_is_sourcing_vbus(), instead of reading the state from the PPC chip
over I2C every time.

This solves the problem of sn5s330_is_sourcing_vbus() being called before
sn5s330_init(), and also avoids other problems caused by
sn5s330_is_sourcing_vbus() doing I2C communication:
crrev.com/c/969701/7/board/cheza/board.c#85

BUG=b:80203727
BRANCH=none
TEST=Reboot Grunt EC while one USB-C port is VBUS source.

Change-Id: Ie0fdd3d672bc747fcdbb746586149e194165fdac
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1086115
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-07 08:35:53 -07:00
Edward Hill
718b86e1d2 usb_charger: Always update VBUS charge supplier
usb_charger_init() did not call charge_manager_update_charge() if we are
sourcing VBUS. This means we can get stuck with charge_manager_is_seeded()
never returning true, and so charging never starts, and power-on is
prevented.

Change update_vbus_supplier() so it always calls
charge_manager_update_charge(), but with current = 0 when we are sourcing
VBUS.

BUG=b:80203727
BRANCH=none
TEST=Reboot Grunt EC while one USB-C port is VBUS source.

Change-Id: I24c29dc6b9ad9c50254181614a6440d2d055cd5a
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1086113
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-07 08:35:52 -07:00
Daisuke Nojiri
d7c2e435c0 Nami: Set PD_MAX_POWER_MW to 70W
This patch sets PD_MAX_POWER_MW to 70W. The max current is 3.5A and
the max voltage is 20V.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:74617335
BRANCH=none
TEST=make BOARD=nami

Change-Id: Iad811a08cbc72653a8618e3ed9bd9627315de6b4
Reviewed-on: https://chromium-review.googlesource.com/1060525
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-06 11:59:38 -07:00
Wei-Han Chen
f939638a0e driver/touchpad_st.c: fix a bug in st_tp_reset
In st_tp_reset, we should exit the function when we received a
controller ready event.  The "break" statement only breaks inner for
loop, not while loop.  Fix this bug.

BRANCH=whiskers
BUG=b:70482333
TEST=sudo ./extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_update <fw>
TEST=sudo extra/usb_updater/usb_updater2 -d 18d1:5030 --tp_debug=01
TEST=(EC console) touchpad_st calibrate
Signed-off-by: Wei-Han Chen <stimim@chromium.org>

Change-Id: I92f94cce33c32ab26924fb91b50cd192d179ba90
Reviewed-on: https://chromium-review.googlesource.com/1086894
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-06-06 05:00:58 -07:00
Nicolas Boichat
65d87bf9f0 whiskers: Expose a switch for tablet mode
With this, whiskers exposes a tablet mode switch to inform the
lid when the base is flipped around.

We take this opportunity to clean up a bit whiskers/keyboard
code:
 - Use tablet mode switch instead of lid switch
 - Refactor usb_hid_keyboard.c to accept either assistant key
   or tablet mode switch, or both.
 - Remove bit-field usage in HID report struct, and instead,
   generalize with an "extra" field that can be used for
   additional key/switches.

BRANCH=none
BUG=b:73133611
TEST=Flash whiskers, see that tablet mode events are sent when
     a magnet approaches the hall sensor.

Change-Id: Ibf43bb04fdc867d18d9f318388d1ebd17b49d47f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1077915
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
2018-06-06 05:00:49 -07:00
Dino Li
8290d879da it83xx: espi: enable eSPI_reset#
With this patch, EC will reset peripheral, OOB message,
virtual wire, and flash access channels to default settings
while the eSPI_reset# pin is asserted.

BUG=b:80250980
BRANCH=none
TEST=ran console command `hibernate` or 'apshutdown' during system boot
     to kernel and then wake system up by power button x 100.

Change-Id: Iceb7ddf1a045937c004f429fc46a7346578b0cce
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1074672
Tested-by: Stephanie Payton <stephie0128@gmail.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-06 01:16:12 -07:00
Dino Li
c06b391677 it83xx: espi: enable eSPI interrupt
This patch reconfigure virtual wire outputs for
each eSPI boot flow.

BUG=b:80250980
BRANCH=none
TEST=boot to kernel on bip.

Change-Id: Ia36cf3e582982f8d7c2fd7179e56909f0f80efd8
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1078827
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-06 01:16:11 -07:00
Nick Sanders
ef25dff82a servo_v4: use coreboot toolchain
This defaults servo_v4 to use the more compact coreboot
toolchain, as the flash is full.

BUG=b:80261180
BRANCH=None
TEST=still works

Change-Id: Ifb970c4a22439e0c53420cfff2464a658331c799
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072745
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2018-06-05 21:28:45 -07:00
Jonathan Brandmeyer
0776ebfbbf stoney: Rename GPIO_PCH_RCIN_L to GPIO_SYS_RESET_L
Pin rename only; no functional changes.  See also b/72426192 for
earlier functional changes.

BUG=b:77301519
TEST=make -j buildall
BRANCH=none

Change-Id: I18e71118e584a5b36ba001bac24951929d2c93ff
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1087207
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-06-05 15:59:33 -07:00
Daisuke Nojiri
0988c5875f Nami: Toggle Anx7447 reset line at start-up
This patch configures the GPIO pin connected to the reset pin of
Anx7447 as push-pull low. When the EC start up from reset, it
pulls it high, waits for 1 msec, then pulls it low. This allows the
tcpc to recover from a hang and guarantees it to start from a known
state.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:79868559
BRANCH=none
TEST=Verify Anx7447 port charges on Nami with a rework.

Change-Id: Ib7683e20160edf0f320a8c6af25f5f74d4f74538
Reviewed-on: https://chromium-review.googlesource.com/1077015
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-05 02:15:32 -07:00
Caveh Jalali
8f21950cc0 atlas: config PCH_PWR_BTN as push-pull
we don't have a pullup on PCH_PWR_BTN, so just configure it as
push-pull.

BUG=b:78309559
BRANCH=none
TEST=able to power down/up the AP

Change-Id: I791bfe3fb1c168ac72762f748f744cfbe771169b
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1086470
Commit-Ready: caveh jalali <caveh@chromium.org>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Caveh Jalali <caveh@google.com>
2018-06-05 02:15:30 -07:00
Caveh Jalali
2e49341d31 atlas: fix GPIOC2/PWM1 function
we do not need to configure alt function on GPIOC2 to get PWM1
functionality.  alt function here actually means I2C6_SCL0 and that
also affects the function of GPIOC1/I2C6_SDA0 which is definitely not
what we want.

BUG=b:94613023
BRANCH=none
TEST=able to power-off the AP

Change-Id: I68abfb7e8c64faffbe0cea0a2cc8ca6a4a620ba3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1086469
Commit-Ready: caveh jalali <caveh@chromium.org>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-06-05 02:15:29 -07:00
Jonathan Brandmeyer
ee1861e9ed stoney: strip unused forcing_coldreset path.
This is just a dead code elimination; no functional changes.  See also
b/72426192 for functional changes.

BUG=b:77301519
TEST=power cycle on grunt EVT
BRANCH=none

Change-Id: Id9f60d14eb2a7df9013f779b05a54638ad62971f
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1083317
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-06-04 17:23:44 -07:00
Vincent Palatin
eee7778fcf stm32: use D-cache on STM32H7
Enable the D-cache on STM32H7.
Use the ahb4 RAM region as uncached memory for DMA buffers.
Mark the serial, SPI and fingerprint DMA buffers as uncached for proper
operations.

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

BRANCH=poppy
BUG=b:78535052, b:75068419
TEST=On ZerbleBarn, run fingerprint match.
CQ-DEPEND=CL:*616448

Change-Id: Ia33496ebde3508d3427e522cc7ba060829f8f3fd
Reviewed-on: https://chromium-review.googlesource.com/1065822
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-06-04 17:23:27 -07:00
Vijay Hiremath
b49d5872e9 bq25703: Report actual input current limit
IIN_DPM register reflects the actual input current limit programmed
in the register, either from host or from ICO. After ICO, the current
limit used by DPM regulation may differ from the IIN_HOST register
settings.

BUG=b:80279932
BRANCH=none
TEST=Manually tested on BIP
     Used BC1.2 DCP charger 'charger' command yield 900mA while
     charge ramp set to 2.4A.

Change-Id: I6389205bd70d7729e9dd810fef3dfbf83a7d8c65
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1080343
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-04 13:31:21 -07:00
Vincent Palatin
edbfb3a43b cortex-m: add D-cache support
Add support to enable the architectural D-cache on ARMv7-M CPU
supporting it.
Update the MPU code in order to be able to declare an 'uncached' RAM
region (e.g. to store the DMA buffer).

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

BRANCH=poppy
BUG=b:78535052, b:75068419
TEST=with the following CL, on ZerbleBarn, boot and capture a finger
image.

Change-Id: I275445e7c0b558cedc3e7d6fc6840ff9b4b76285
Reviewed-on: https://chromium-review.googlesource.com/1032776
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-06-04 10:09:42 -07:00
Vincent Palatin
a6c9a3cd21 stm32: fix ignoring bus fault on M7
With the Cortex-M7 core on STM32H7, the imprecise bus abort triggered by
the flash permission check might be propagated rather than ignored as we
might have gone through the ignore_bus_fault(0) before the exception
actually happens.
Add a barrier to avoid this case.

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

BRANCH=poppy
BUG=b:75068419
TEST=On ZerbleBarn with MPU on and caches enabled, verify that the
flash_set_protect() in rwsig_jump_now() no longer triggers an imprecise
abort.

Change-Id: I8ed4f13cb7a379964919bf389542221517a34c17
Reviewed-on: https://chromium-review.googlesource.com/1080809
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-06-04 10:09:42 -07:00
Vincent Palatin
87387cc741 meowth_fp: update AP interrupt configuration
Set the GPIO output driving the PCH interrupt as push-pull as the other
side has a 100K pull-down.
No longer modify the GPIO config in S3, the PCH doesn't seem to work
this way, but needs to be confirmed.

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

BRANCH=poppy
BUG=b:78613978
TEST=On Meowth, monitor /proc/interrupts before and after suspend/resume
cycle, no more interrupt storm on Int 46 / chromeos-ec.

Change-Id: I6198412d791ed9810ffa208fffbb8f378421decd
Reviewed-on: https://chromium-review.googlesource.com/1032775
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-06-04 10:09:41 -07:00
Wai-Hong Tam
4a0bd0ceda cheza: Switch USB port-0 HS to the hub
It matches the SS path, in which both port-0 and port-1 connect to the
hub.

BRANCH=none
BUG=b:74395451
TEST=Tried plugging USB 2.0 disk to port-0 and port-1, both bootable.

Change-Id: Ic0264657fbe126242a419ef33ce07bc2599375ee
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1082981
Reviewed-by: Douglas Anderson <dianders@chromium.org>
2018-06-01 21:43:33 -07:00
Aseda Aboagye
884500ad51 nocturne: Add NVMe power enable controls.
The EC needs to enable/disable the NVMe power rails on bootup and
shutdown.  This commit just adds these controls in during chipset
startup and shutdown.

BUG=b:73258414
BRANCH=poppy
TEST=Flash nocturne, verify that rails come up on boot up and are turned
off on shutdown.

Change-Id: I3dc8c17255294c0bbf8638ea3ee3fcfaa321929b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1067947
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2018-06-01 17:44:50 -07:00
Caveh Jalali
37987e1e7d atlas: board version 1 support
these changes reflect the hardware changes made between version 0 and
version 1 of the atlas board.

note: these changes are not backward compatible - version 0 of atlas
is no longer supported.

BUG=b:78309559
BRANCH=none
TEST=works fine on atlas version 1

Change-Id: Ia519f161c66066e02e9ddce7560a8fe2b7e74882
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1045730
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-06-01 17:44:42 -07:00
Aseda Aboagye
32255f2989 chgstv2: Fix manual control via EC console.
There was a recent change to save the manual setting of charge current
and voltage, however it was done so assuming that the parameters were
set via the host command interface. (CL:922069) However, there are times
where the charge voltage/current would like to be manipulated without
booting the AP.  This commit simply makes the EC console command work
again.

BUG=None
BRANCH=None
TEST=make -j buildall
TEST=Flash nocturne, `chgstate idle on; charger current 256; charger
voltage 7400`; verify that the charge voltage and current is actually
changed.

Change-Id: Id250d9704f8509162518495556603950248fb267
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1081120
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-06-01 17:44:41 -07:00
Daisuke Nojiri
a011b79bfb Nami: Blink power LED in sleep for Pantheon
Currently, the power LED pulses in sleep state on Pantheon. This patch
makes it blink with 25% duty. That is, the LED turns on for 1 sec then
turns off for 3 sec.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:79733195
BRANCH=none
TEST=make BOARD=nami

Change-Id: I0ebd2778b9b6551f2313ea8f8648c69324e02368
Reviewed-on: https://chromium-review.googlesource.com/1069337
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-01 17:44:37 -07:00
Edward Hill
9734ec2d6b battery: Move fuel gauge code to common
Move fuel gauge code to common to avoid duplication in octopus and
grunt baseboards.

BUG=b:79704826,b:74018100
BRANCH=none
TEST=make -j buildall

Change-Id: I58a615c9ed7906cb19b49c2baa36aaa619838cf1
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072637
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-01 17:44:20 -07:00
Edward Hill
f30bb2839f grunt: Board specific battery info
Split battery info between baseboard and board, following the
Octopus example. This will allow Grunt and Careena to define their
own lists of supported battery types.

This also adds CONFIG_BATTERY_REVIVE_DISCONNECT support, and
checks the charge/discharge FET status.

BUG=b:79704826,b:74018100
BRANCH=none
TEST=Grunt still boots ok.

Change-Id: I6e82ac5e48f9aabf59b63add253108513f0a6b60
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072039
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-06-01 17:44:19 -07:00
Daisuke Nojiri
31fbb6889e Nami: Fix battery_is_present detection
This patch applies CL:776024 to Nami.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:69329874,b:70157960
BRANCH=none
TEST=Verify the followings on Nami:
1. Charging and discharging
2. Boot with battery disconnected
3. Software cutoff

Change-Id: I74ae31e349c12b25fdaf1e3958e62ca43b79c567
Reviewed-on: https://chromium-review.googlesource.com/844875
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-01 10:04:21 -07:00
Ryan Zhang
179ee5fbed Nami: Enable board specific battery detection logic
This patch defines CONFIG_BATTERY_PRESENT_CUSTOM, which allows Nami
to use its own battery detection logic.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:78315380
BRANCH=none
TEST=Verify charging and discharging on Nami.

Change-Id: Ib0ffb735eedcf8a35ae3e5e17352d078274476ee
Reviewed-on: https://chromium-review.googlesource.com/862169
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-06-01 10:04:21 -07:00
Jade Philipoom
607691568f g: add documentation pointing to p256 modular reduction verification in Coq
Added a markdown file with some explanation and links to Coq code in a
public GitHub repository.

BUG=none
BRANCH=cr50
TEST=none

Change-Id: I4b40a94ce8686e5115b6b09825dfde0894d67a50
Signed-off-by: Jade Philipoom <jadep@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1080795
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-06-01 06:26:28 -07:00
Aseda Aboagye
bdc27c3085 nocturne: Set V085A output voltage to 0.85V.
The default setting of the ROP PMIC's V085A output voltage is incorrect
for our application.  This commit changes the output voltage to actually
be 0.85V.

BUG=b:80271678
BRANCH=poppy
TEST=Flash nocturne and verify that V085A is ~0.85V.

Change-Id: I3c6c7396bc8b896620aab7e4719f8a14b4a46e4a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1077085
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-31 16:22:56 -07:00
Scott Collyer
bbc34f225e charger: bq25703: Exit low power mode prior to reading ADC
An ADC conversion requires ~10 msec. However, if the bq25703 is in low
power mode, then this conversion time jumps to ~55 msec. This CL adds
a method to exit/enter low power mode and adds a call to exit low
power mode prior to starting the ADC conversion. Following the
conversion, low power mode is entered again.

BRANCH=none
BUG=b:79771760
TEST=Connected AC power and verified that EC console error message
'Could not read input current limit ADC' is no longer shown. In
addition, had instrumented this the ADC conversion with GPIO signals
and verified the conversion times before/after exiting low power mode.

Change-Id: I13f36e6261e219adbc8624f71bf7916bbc631b10
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1069768
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-31 16:22:45 -07:00
Mary Ruthven
b14614b60c gsctool: add factory mode command
We added a cr50 vendor command to control factory mode. This change adds
gsctool support for using the command.

gsctool -F [enable|disable] can be used to set factory mode. You can't
use it to get the factory mode setting, because factory mode is
indistinguishable from other forms of ccd. The regular ccd info can be
used instead gsctool -I.

BUG=b:77543904
BRANCH=cr50
TEST=none

Change-Id: I715e296c323be20bab0b54a2f94a380b61f74cd2
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1069370
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-31 16:22:35 -07:00
Mary Ruthven
37fadc39b5 cr50: add command for factory reset
The factory reset command can be used to enable ccd factory mode. The
command can open ccd if write protect is removed and ccd hasn't been
restricted. Right now we check FWMP and the ccd password before allowing
factory reset. Factory reset cannot be used to get around anything that
disables ccd.

This adds 72 bytes.

BUG=b:77543904
BRANCH=cr50
TEST=Try enabling factory mode using factory reset. Verify setting write
protect, setting the FWMP disable ccd bit, or setting a ccd password
prevents factory reset from enabling factory mode.

Change-Id: I6e203bf6068250f009881aa95c13bc56cb2aa9e7
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1069369
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-31 16:22:35 -07:00
Philip Chen
a5f6726587 scarlet: Don't disable idle mode in S3
I heard we only want to disable idle mode in S5, when battery is full.

BUG=b:78792296
BRANCH=scarlet
TEST=manually test on scarlet, and confirm when battery is full,
idle mode is disabled in S5 but not in S3.

Change-Id: I5809da581dd3fc3d382f606168a88263740256c0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1077496
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
(cherry picked from commit 8746200bb7c71bdee057580447c78ffb53520fae)
Reviewed-on: https://chromium-review.googlesource.com/1079732
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2018-05-31 03:50:24 -07:00
Nicolas Boichat
3dff02fa73 console: Do not flush the console in console_init
Currently, console_init calls cflush() twice, once before
"Console is enabled" string is printed, once afterwards.

The reason is that firmware_ECBootTime looks for that string,
and it may get corrupted/interleaved with others if the EC
is busy during initialization.

The problem here is that the CONSOLE task may have higher
priority than other tasks (for good reasons), but, on boot,
there are other more critical tasks that need to run (e.g.
RW image verification), rather than busy-looping waiting for
the console to be flushed.

By fixing firmware_ECBootTime to not look for the string anymore,
we do not need those 2 console flush.

BRANCH=poppy
BUG=b:35647963
BUG=chromium:687228
CQ-DEPEND=CL:1075832
TEST=Flash staff, see that RW verification starts at 0.001037
     instead of 0.028087 (=> 27 ms faster).
TEST=test_that -b $BOARD $IP firmware_ECBootTime

Change-Id: I794e48eb69cc647c4595fd80265adee4a434d566
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1073180
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-31 03:50:20 -07:00
Mary Ruthven
f730193824 console_output: make chan a safe command
We need to control the console channels for cr50 testing, so we need
access to chan even if the console is restricted. Make chan a safe
command so it is always accessible.

BUG=b:80319784
BRANCH=cr50
TEST=on cr50 make sure the command is accessible no matter the console
state

Change-Id: Ia392f32c319c1acf9bb97b97d7f72c7e56427ce3
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1079452
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-31 00:19:29 -07:00
Daisuke Nojiri
e5eb7709d0 Nami: Use standard LED pattern for Sona
This patch makes Sona follow the standard LED pattern for single LED
systems. Sona has two LEDs but both are connected to the same pin.
This increases userbility because LEDs are visible from each side
and users don't have to learn two different sets of patterns (i.e.
one for left LED and onother for right LED).

* Charging               Amber on (S0/S3/S5)
* Charging (full)        White on (S0/S3/S5)
* Discharge in S0        White on
* Discharge in S3/S0ix   Alternate pulse (up-down-off-off)
* Discharge in S5        Off
* Battery Error          Amber on 1sec off 1sec

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:80135370,b:74940319
BRANCH=none
TEST=Verified LED behaviors in S3, S0, charge, discharge on Sona

Change-Id: I1bd53c7c60529a8b813eabc338876af6d089ec82
Reviewed-on: https://chromium-review.googlesource.com/1074226
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jack Huang <jachuang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-30 20:38:56 -07:00
Edward Hill
cd5e7cbeb1 grunt: Reduce USB-C source current to 1.5A
Grunt and Careena hardware does not support sourcing 3A over USB-C
so reduce what we advertise to 1.5A.

BUG=b:78908554
BRANCH=none
TEST=Grunt advertises 1.5A Source Cap on both ports

Change-Id: Ifd3ddf45445ae69c5988dee4f66f21056b4b0f96
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1077096
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-30 20:38:54 -07:00
Mary Ruthven
5a23e3f49a cr50: refactor rma mode into factory mode
We're doing a bit of refactoring to break out factory mode into its own
file. Now factory reset and rma reset will be two methods of entering
factory mode. Factory mode can be disabled with the disable_factory
vendor command.

Factory mode means all ccd capabilities are set to Always and WP is
permanently disabled. When factory mode is disabled, all capabilities
are reset to Default and WP is reset to follow battery presence.

This adds 56 bytes.

BUG=none
BRANCH=cr50
TEST=verify rma reset will enable factory mode.

Change-Id: I21c6f7b4341e3a18e213e438bbd17c67739b85fa
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1069789
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-30 20:38:53 -07:00
Vadim Bendebury
7b00185216 cr50: move RMA challenge-response to P256
Using the p256 curve is beneficial, because RMA feature is currently
the only user of the x25519 curve in Cr50, whereas p256 support is
required by other subsystems and its implementation is based on
dcrypto.

The p256 public key is 65 bytes in size, appropriate adjustments are
being made for the structure storing the server public key and the key
ID.

The compact representation of the p256 public key requires 33 bytes,
including the X coordinate and one extra byte used to communicate if
the omitted Y coordinate is odd or even.

The challenge structure communicated to the RMA server allows exactly
32 bytes for the public key. To comply, the generated ephemeral public
key is used in compressed form (only the X coordinate is used).

For the server to properly uncompress the public key one extra bit is
required, to indicate if the original key's Y coordinate is odd or
even. Since there is no room for the extra bit in the challenge
structure, a convention is used where the generated ephemeral public
key is guaranteed to have an odd Y coordinate.

When generating the ephemeral key, the Y coordinate is checked, and if
it is even, generation attempt is repeated.

Some clean up is also included: even with debug enabled, generated
challenge is displayed only once as a long string, convenient for
copying and pasting.

The new feature is not yet enabled, p256 support on the RMA server
side is not yet available.

Enabling p256 curve for RMA authentication saves 5336 bytes of the
flash space.

BRANCH=cr50, cr50-mp
BUG=b:73296606
TEST=enabled CONFIG_RMA_AUTH_USE_P256 in board.h, generated challenge
     and verified matching auth code generated by the rma_reset
     utility.

Change-Id: I857543c89a7c33c6fc2dc00e142fe9fa6fc642cf
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1074743
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-30 20:38:52 -07:00
Philip Chen
815251b070 scarlet: Disable idle mode in a special case
When AC is plugged, battery is full and AP is off,
there is a small chance that rt946x would be damaged.
I'm told that consuming more current in this case would
mitigate the issue. So let's disable idle mode in this case.

BUG=b:78792296
BRANCH=scarlet
TEST=manually test on scarlet and confirm idle mode is disabled
in the described special case

Change-Id: Idc3a3165ebaa2f99bdd5df56675c3945eaeae9fa
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1071124
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
(cherry picked from commit 37168486d3f5543b5dd7a8e5d819c68c4c68c5b0)
Reviewed-on: https://chromium-review.googlesource.com/1076709
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2018-05-30 20:38:47 -07:00
paris_yeh
e8f009b64b keyboard_scan: Add option to support keyboards with language ID
ID pins are considered additional KSOs while keycode scanning works
for the existing KSI0 ~ KSI7. While diriving ID pins, the state of
interconnection between ID pins and KSI pins could be used for
identifiers to tell keyboard itself. (e.g. US, Japan,and UK keyboard)

BRANCH=master
BUG=b:80168723
TEST="make -j buildall"
TEST=Verified 5 distinct keyboard samples w/ different Language ID values
     on the same reworked Coral, which VOL_UP and VOL_DOWN were reworked
     for ID pins. crrev.com/c/1053617 is my experimental patch on top of
     this for further verification

Change-Id: I1d6e647df74c50d60bc1264c045b2587d0bf23d8
Signed-off-by: paris_yeh <pyeh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1068951
Commit-Ready: Paris Yeh <pyeh@chromium.org>
Tested-by: Paris Yeh <pyeh@chromium.org>
Reviewed-by: Paris Yeh <pyeh@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-05-30 12:50:39 -07:00