Commit Graph

1128 Commits

Author SHA1 Message Date
ZhengShunQian
3c780a915c Speedy: add initial speedy support
Copy from Jerry for now.

BUG=chrome-os-partner:33269
TEST=emerge-veyron_speedy chromeos-ec
BRANCH=None

Change-Id: I8375e1e23de5dbae0d1c579770d88e81223debce
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/233795
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-12-08 09:51:14 +00:00
Vincent Palatin
d097e25bf4 g: add watchdog driver
Implement a driver to trigger a watchdog reboot if we are stuck
somewhere. Also display a nice warning when we reach half of the
watchdog period.

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

BRANCH=none
BUG=none
TEST=On the console, type "waitms 500" and see nothing,
type "waitms 2000" and see the watchdog warning.
Type "waitms 4000" and see the warning, the platform rebooting.

Change-Id: Iac5d0100febd5eab1ae6cfac5a47ff728ebda3a6
Reviewed-on: https://chromium-review.googlesource.com/233430
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2014-12-06 01:11:34 +00:00
Todd Broch
7014afec76 pd: dingdong/hoho: Increment device ID minor rev.
Incrementing minor from 0 -> 1 to signify devices with this firmware
are field updateable.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual

  # on dingdong
  ectool --name cros_pd infopddev 1
  Port:1 DevId:3.1 ...

  # on hoho
  ectool --name cros_pd infopddev 1
  Port:1 DevId:4.1 ...

Change-Id: I2e55b4371131c39a22e917c02d43a26977ea3a93
Reviewed-on: https://chromium-review.googlesource.com/233270
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-12-05 10:06:30 +00:00
Todd Broch
bc16903667 pd: Re-factor common flash vdms.
CL to migrate the flashing VDMs from zinger's custom vdm to
common/usb_pd_flash.c such that other updateable type-C devices can
share.

Additionally adds gaskets to call standard runtime flashing facilities
for USB-PD devices using it.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual,

Try following:
    1. From samus_pd console w/ zinger in port 1

    pd 1 flash version
    pd 1 flash reboot
    pd 1 flash info

    2. From samus linux prompt  w/ zinger in port 1

    ectool --name cros_pd flashpd 1 1 <zinger RW payload>

    Reading 16384 bytes from
    /usr/local/zinger_v1.1.2528-d809e42.ec.RW.bin...
    Erasing expected RW hash
    Rebooting
    Erasing RW flash
    Writing RW flash
    Rebooting PD into new RW
    Complete

    3. Repeat 1&2 above on hoho & dingdong.

Change-Id: I018055fa9de128f937c57debdc21dea026137bcf
Reviewed-on: https://chromium-review.googlesource.com/231835
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-12-05 10:06:25 +00:00
Todd Broch
b5557217aa pd: dingdong/hoho: Fix hard reset recovery timeout.
dingdong/hoho have no capability to measure VBUS which is advantageous
in determining what timeouts to honor.  Previously we simply assumed
vbus was on and that made things happy until,

  e0c80ac pd: on hard reset go to a hard reset recovery state

which introduced proper handling around sink & source reset recovery.

With VBUS assumed 'on' this leads to short timeouts chosen
(PD_T_SAFE_0V) which in turn causes sink to resend hard resets before
source has had time (PD_T_SRC_RECOVER) to handle request.

This change creates config CONFIG_USB_PD_NO_VBUS_DETECT for devices
without the capability to account for lack of VBUS detect.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:34090
TEST=manual
from samus_pd 'pd 1 flash reboot' is successful

Change-Id: I9ef9b0115c7be6c56c64556d2ce8c296f95c614e
Reviewed-on: https://chromium-review.googlesource.com/233024
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2014-12-05 10:06:19 +00:00
Todd Broch
2bc0b68c86 pd: move get_info to common file.
get_info command needs to be used by all type-C accessories that would
entertain being updated in the field.  This CL migrates function to
common/usb_pd_protocol.c for other boards to use.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual,

Using
  ectool --name=cros_pd infopddev <0|1>

Port:1 Devid 1.1 Hash:  0x00ec9619 0x811f3e68 0x4b90c8e9 0xd5b98fa8 0xfd373777
Port:1 Devid 3.0 Hash:  0x682fd366 0x7213f55e 0xddefb802 0xbedfec42 0x5cdcc226
Port:0 Devid 4.0 Hash:  0x57b1e4e0 0x7204075f 0x65c0fa72 0xdcca15ed 0xf3231237

Change-Id: Iffa8699056351f62cf90fdecbc7ef5cee81e67bb
Reviewed-on: https://chromium-review.googlesource.com/226891
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-05 01:09:39 +00:00
Gwendal Grignou
0e03ff4ad8 ryu_sh: Add Makefile in board directory.
To match other boards, add a link to Makefile in board/ryu_sh.

BRANCH=ToT
TEST=compile
BUG=None

Change-Id: I19c58e2fd221ddf2e607f6a732e2e6229daedd1f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231983
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-12-03 21:29:09 +00:00
Shawn Nematbakhsh
f512b0c659 samus_pd: Add workaround for unwanted pericom resets
Our pericom charge detectors can reset themselves on rapid charger plug
/ unplug, which resets the interrupt enable to the power-on default
(off). Work around this problem by re-enabling pericom interrupts from
the VBUS interrupt.

BUG=chrome-os-partner:33823
TEST=Manual on samus. Rapidly plug + unplug charger, verify that Pericom
continues to trigger interrupts.
BRANCH=Samus

Change-Id: I7370525e28c59bdde3765e52523d5158d1d6175d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231700
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-12-03 07:13:55 +00:00
Aaron Durbin
16eef671c2 ryu: disable LOW_POWER_IDLE
When the EC goes idle it can no longer communicate over i2c.
Therefore, disable this feature.

BUG=chrome-os-partner:34230
BRANCH=None
TEST=Furquan verified on a proto2 board that no more hangs occur.

Change-Id: Icc2d45c0f279aef02fe91242ad5838a80fd35c15
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/232771
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
2014-12-03 01:13:28 +00:00
Todd Broch
975cb11ca1 dingdong/hoho: Add GFU alternate mode.
Per USB PD specification even custom VDMs should fall under the
alternate mode discovery policy.

CL lays ground work for GFU (Google Flash Update) alternate mode.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual,

See samus_pd console correctly discover another SVID & subsequent
mode.

(0) == Discover identity w/ two SVIDs 0xff01 & 0x11d1
(1) == Discover mode for 0xff01
(2) == Discover mode for 0x18d1

console output
--------------
    SVDM/5 [1] ff008041 2c0018d1 00000000 50110001 1100000b
    [4070.286120 DONE]
(0) SVDM/2 [2] ff008042 ff0118d1 00000000
    [4070.289353 DONE]
(1) SVDM/2 [3] ff018043 00001085
    [4070.292575 DONE]
(2) SVDM/2 [3] 18d18043 00000001
    [4070.295798 DONE]
    SVDM/1 [4] ff018144
    [4070.298844 DONE]
    SVDM/2 [16] ff018150 00000002
    [4070.302261 DONE]
    SVDM/1 [17] ff018151

> pe 0 dump
IDENT:
        [ID Header] 2c0018d1 :: AMA, VID:18d1
        [Cert Stat] 00000000
        [2] 50110001    [3] 1100000b
SVID[0]: ff01 MODES: [1] 00001085
SVID[1]: 18d1 MODES: [1] 00000001
MODE[1]: svid:ff01 caps:00001085

Change-Id: Ifab79a6fc6770a6f4bd7690ca8e6723503264137
Reviewed-on: https://chromium-review.googlesource.com/231833
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-02 01:57:26 +00:00
Todd Broch
01047f6524 pd: ectool: Expose device id major & minor.
Also unifies other console output of same field.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:32650
TEST=manual

  # connect zinger to port 1 on samus
  ectool --name cros_pd infopddev 1

Before:
  Port:1 Device:1025 Hash:  0x3f34bc13  0xf8d15d12  0xf81f03cf  0xba3a3db6  0x0152a520
  Port:1 ptype:5 vid:0x18d1 pid:0x5012

After:
  Port:1 DevId:1.1 Hash: 0x3f34bc13 0xf8d15d12 0xf81f03cf 0xba3a3db6 0x0152a520
  Port:1 ptype:5 vid:0x18d1 pid:0x5012

Change-Id: I4e7ac56354e92ea3bc54a2c6ab5746399abdefe5
Reviewed-on: https://chromium-review.googlesource.com/231832
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-02 01:57:18 +00:00
Todd Broch
f6e45879d7 dingdong: enable RW firmware signature verification
Check RSA signature of the RW firmware and jump to it if it is valid.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chrome-os-partner:31193
TEST=flash on dingdong and boot with both bad and good RW firmware and
see it jump to RW only on the latter.

Change-Id: Ife8d1f9bcc16d796b9005a9761610119e456dd63
Reviewed-on: https://chromium-review.googlesource.com/231830
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-01 20:30:54 +00:00
Vincent Palatin
a745993639 hoho: enable RW firmware signature verification
Check RSA signature of the RW firmware and jump to it if it is valid.

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

BRANCH=none
BUG=chrome-os-partner:31192
TEST=flash on Fruitpie and boot with both bad and good RW firmware and
see it jump to RW only on the latter.

Change-Id: Ieda4ff495145c300ec0dcf5763a3600b3e092982
Reviewed-on: https://chromium-review.googlesource.com/229595
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-01 20:30:50 +00:00
Alec Berg
afc9090d7e samus: add active charge port to EC<->PD status exchange
Add active charge port for the PD status exchange so that EC
knows which port we are currently charging from.

BUG=chromo-os-partner:32227
BRANCH=samus
TEST=load onto samus. use "pdcmd 0x100 0 0"
from EC console to read the active charge port and
verify that it matches which port we are charging from.

Change-Id: I419befef8f0a14ca2da237be1a4944fd08733b83
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231349
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
2014-11-22 09:34:20 +00:00
Alec Berg
bebce8dca1 samus_pd: remove host event commands module to save flash space
Remove host_event_commands.c from build to save flash space. The
PD MCU does not use host event infrastructure and instead has a
simple gpio line it uses to notify EC that it has info to share.

BUG=none
BRANCH=samus
TEST=make buildall. view the .map file and see we save about 700
bytes of flash.

Change-Id: I71b8a4e32b9ecb57eb1a57f6d28652476ee6afe6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231444
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-22 09:33:40 +00:00
Alec Berg
446002d2f8 zinger: change product type to undefined
Change zinger/minimuffin product type from AMA to
undefined.

BUG=none
BRANCH=samus
TEST=make buildall. load onto zinger, plug in samus, see:
SVDM/4 [1] ff008041 040018d1 00000000 50120001
[19.163111 DONE]

Verify ID header, 2nd word, bits 27-29 are product type,
where 0 is undefined.
Also verify that product VDO is present, 4th word.

Change-Id: I34a70d9356b5a8ee7ad64a4e8f072d7748aa916e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231172
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2014-11-22 00:13:06 +00:00
Alec Berg
881e9cce86 plankton: remove dualrole power capable flag
Remove dualrole power capable flag from source/sink cap packets
so that samus/ryu default to drawing power from plankton.

BUG=none
BRANCH=samus
TEST=load on plankton. select 20V to DUT, attach samus or ryu
and see that it charges

Change-Id: I3d31b14f65ee8dfa4d817d47598c505b0f6d7479
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231342
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
2014-11-22 00:13:01 +00:00
Vic Yang
984b18a331 ryu: Remove workaround for PI3USB9281
For P3, we'll use PI3USB9281A, which fixes the I2C clock problem. Let's
remove the workaround and leave the clock enabled all the time.

BRANCH=Ryu
BUG=chrome-os-partner:31526
TEST=Boot on Ryu

Signed-off-by: Vic Yang <victoryang@chromium.org>
Change-Id: I05a3ebbff82282b69e3c5573608e500a34d370c0
Reviewed-on: https://chromium-review.googlesource.com/231180
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-21 06:23:21 +00:00
Vincent Palatin
911e21ccc1 pd: wait tSnkTransition after ACCEPT to change voltage
Ensure that the PD source changes the output voltage after
tSnkTransition delay after having sent the ACCEPT message
(rather than before).

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

BRANCH=samus
BUG=chrome-os-partner:33684
TEST=connect Zinger to a PD power sink and monitor VBUS and CC while
doing a 20V to 5V transition.

Change-Id: If86f59eec67630491f4e8dc13a52015ac2de918a
Reviewed-on: https://chromium-review.googlesource.com/230805
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-21 02:44:56 +00:00
Vincent Palatin
7ac1e44477 cr50: always generate the .hex file
Extends the default rule to generate the .hex file as we need it on
this platform.

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

BRANCH=none
BUG=none
TEST="make BOARD=cr50" and see the .hex file is generated.

Change-Id: I9dea886f0d54d840767bae2c344114c3a4c143a5
Reviewed-on: https://chromium-review.googlesource.com/231128
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-21 02:44:13 +00:00
Divya Jyothi
ad0069268f Strago: Spi support added on Private SPI lines
BUG=None
TEST=Tested on Braswell Reference Design
BRANCH=None

Change-Id: Idc064e1af837e5e6a1bf4174885bd10624f463d2
Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/226297
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Divya Jyothi <zdivyajyothi@gmail.com>
Tested-by: Divya Jyothi <zdivyajyothi@gmail.com>
2014-11-20 23:03:49 +00:00
Vic Yang
1291eb4b1d plankton: reset USB hub on cable plug
If USB hub is connected to the type-C port, we need to reset the hub
whenever a cable plugs in. Otherwise, USB3.0 may fail to enumerate.

BRANCH=None
BUG=None
TEST=Plug/unplug cable and measure hub reset signal.

Change-Id: I60f67c83653d532971ee156914fe6ae0ecdb8d3a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229490
Reviewed-by: Pin-chih Lin <johnylin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-20 09:53:12 +00:00
Katie Roberts-Hoffman
c420bf1922 Add initial mighty support
Essentially a copy of jerry for now.

BUG=chrome-os-partner:33269
TEST=make BOARD=jerry

Change-Id: I696919455f4752ebe43b616bdace6ac0820f8fe5
Reviewed-on: https://chromium-review.googlesource.com/230917
Reviewed-by: Alexandru Stan <amstan@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-11-20 05:09:09 +00:00
Bernard Shyu
1e9491e07d usb_pd: SVDM DP protocol definition errors
The role of hoho & dingdong is UFP, and the corresponding protocol
fields in VDO (vdo_idh) should reflect it.

Fix error in IDH_PTYPE definitions of SVDM Identity Header, it's reversed

Adds more legible names to protocol field constants

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Idac9327bf3e8e9597221654bce80bb311b3304af
Reviewed-on: https://chromium-review.googlesource.com/230657
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Bernard Shyu <bernard_shyu@bizlinktech.com>
Tested-by: Bernard Shyu <bernard_shyu@bizlinktech.com>
2014-11-19 23:17:44 +00:00
Alec Berg
6be0040bbe samus: add backboost detect GPIO
Add backboost detect GPIO. Don't do anything with it for now.

BUG=none
BRANCH=samus
TEST=make buildall

Change-Id: If688b5e719071650fa295f288b97915a81af2d87
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/230247
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-11-19 20:54:02 +00:00
Vincent Palatin
c8d7462fcf Twinkie: add packet injection capability
Add commands to send PD packets and to tweak individual parameters (TX
clock frequency, RX detection threshold, resistors on CCx).

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

BRANCH=none
BUG=chrome-os-partner:28337
TEST=verify that the PD sniffing is still working by dumping traffic
between Zinger and Samus.
Connect Twinkie to Zinger, set Rd by using "tw res NONE RD" and see VBUS
going to 5V (reading it using "ina 0").
Send a BIST mode 2 request using the following command :
tw send 2 0x1043 50000000
and see the other end starting sending BIST.

Change-Id: I3c8ddf858435ac1c17a43f59351bbaa69603a209
Reviewed-on: https://chromium-review.googlesource.com/227778
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-18 18:18:34 +00:00
Vincent Palatin
bacd096372 zinger: optimize idle current
Force enabling STOP mode when we have a power contract etablished but
the sink is consuming a low current (<500mA).
As a side effect, when the STOP mode is on,  the fast OCP is no longer
reacting fast because the analog watchdog ADC conversion will only
happen on the next wake-up (dozens of milliseconds).

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

BRANCH=samus
BUG=none
TEST=run on Zinger with the UART RX used as debug GPIO to record STOP
mode entry/exit.

Change-Id: If78b2651862782cee45cfcdb22425b94f1eee678
Reviewed-on: https://chromium-review.googlesource.com/230341
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-18 09:10:47 +00:00
Vincent Palatin
45b4eda877 Zinger: honor disable_sleep()
Extend the Zinger runtime to take into account the disable_sleep()
issued by the USB protocol stack and avoid going into deep-sleep while
connected.

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

BRANCH=samus
BUG=none
TEST=connect Zinger to a PD power sink (Twinkie) and monitor the stop
mode entry/exit on a GPIO.

Change-Id: I04e35fdd65f3be3da7a4304dc1a92e6268930888
Reviewed-on: https://chromium-review.googlesource.com/230340
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-18 09:10:42 +00:00
Alec Berg
2ff6a30c47 samus: enable bq learn mode to avoid backboosting
For samus, use learn mode on BQ24773 to avoid the soft start that
causes backboosting on some boards.

BUG=chrome-os-partner:33644
BRANCH=samus
TEST=tested in EE lab on a board that was backboosting reliable.
this fixes backboosting at 5V, and also on 20V to 5V transitions.

Change-Id: I97c52a55ba07662d444e67bfbc9ca488b530f423
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229282
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-11-18 05:21:28 +00:00
Alec Berg
7e7e82f2c1 zinger: fix task_wait_event() to only exit on event received
Fix task_wait_event() so that it only wakes when an event is received
or on timeout. Currently it wakes up on any interrupt, which can cause
subtle timing issues with PD communication.

BUG=none
BRANCH=samus
TEST=load onto samus, see it negotiate for 20V a few times

Change-Id: Ia1268a1ac902433433949269d779ef11403eeae3
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226811
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-18 05:20:46 +00:00
Gwendal Grignou
d64324ad4d ryu: Add LSM6DS0 support.
Add Code to setup LSM6DS0 gyro/accell in sensor hub.

BUG=chrome-os-partner:31071
BRANCH=ToT
TEST=See the compass and gyro.

Message at boot:
[0.007142 hash start 0x00010000 0x000096dd]
[0.007293 Inits done]
[0.007506 power state 2 = S3, in 0x0000]
[0.007765 power state 3 = S0, in 0x0000]
[0.007908 event set 0x00002000]
[0.008021 hostcmd init 0x2000]
[0.111195 Accel: MS Done Init type:0x1 range:2 odr:119000]
[0.116751 Gyro: MS Done Init type:0x2 range:2000 odr:119000]
[0.146870 hash done
f87d7824b439db923d270df016af5aabec51b73505b7c4faa6e40c16b12dd392]

Check '/usr/sbin/ectool --name=cros_sh motionsense' works.

Change-Id: I7ca87faf92803486d8d2d51c7ffe4c6d8c9efef2
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226882
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-18 05:20:15 +00:00
Gwendal Grignou
3bdd18d246 ryu: add a dummy power module for controlling sensors.
With this change we can use power event to configure sensors
and trigger motion detection in suspend.

BUG=chrome-os-partner:31071
BRANCH=ToT
TEST=Check power states. Check power up messages and commands are
present at the console.

Message at boot:
[0.007142 hash start 0x00010000 0x000096dd]
[0.007293 Inits done]
[0.007506 power state 2 = S3, in 0x0000]
[0.007765 power state 3 = S0, in 0x0000]
[0.007908 event set 0x00002000]
[0.008021 hostcmd init 0x2000]
[0.146870 hash done
f87d7824b439db923d270df016af5aabec51b73505b7c4faa6e40c16b12dd392]

Change-Id: I9c56fe5203506462f0820bbc8a5fe4528f6805ac
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226881
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-18 05:19:47 +00:00
Gwendal Grignou
4b154c6f95 motion: Add decoding for MOTION_CMD_DUMP v1 command
MOTIONSENSE_CMD_DUMP is deprecated, replaced with MOTIONSENSE_CMD_GET_DATA
Also use vector_3_t instead of x,y,z

ectool motionsense commands only work with newer firmware, to
handle a dynamic number of sensors.
- The host sends the number of sensor it has allocated space for.
- If 0, the EC just sends the number of sensors available
- Otherwise returns sensor information up to the limit imposed by the host.

Remove MOTIONSENSE_GET_STATUS: not needed. It is only useful for LPC,
to guarantee atomicity of the data.
Remove MOTIONSENSE_GET_DATA: not needed since we increase the version
number of MOTIONSENSE command.

BUG=chrome-os-partner:31071,chromium:430792
BRANCH=ToT
TEST=Compile. On a firmware that support the new command:
/usr/sbin/ectool --name=cros_sh motionsense
Motion sensing active
Sensor 0: 92    15      1030
Sensor 1: -94   -63     718
/usr/sbin/ectool --name=cros_sh motionsense active
0
On a machine with older firmware (samus), check these
functions are not working anymore.

Change-Id: I64b62afff96670fb93457760d43d4e64e26e029f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226880
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-18 05:19:08 +00:00
Chris Zhong
1d4c619a0a Jerry: modify the power led polarity
the power led polarity is wrong, so reverse it

BRANCH=None
BUG=chrome-os-partner:33269 chrome-os-partner:32782
TEST=power led is works correctly

Change-Id: I4e91ea185ee5cb1f5b5202832a967244313062b4
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/230170
Reviewed-by: Lin Huang <hl@rock-chips.com>
Tested-by: Lin Huang <hl@rock-chips.com>
Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
Commit-Queue: Lin Huang <hl@rock-chips.com>
2014-11-17 16:34:09 +00:00
Alec Berg
f0d573b3da zinger: change minor revision back to 1
The minor revision was accidentally set back to 0 in CL:229622. Restoring
back to 1.

BUG=none
BRANCH=samus
TEST=load onto zinger, make sure minor revision is set to 1

Signed-off-by: Alec Berg <alecaberg@chromium.org>
Change-Id: Ia934e4a6f1674f666defe9e4337dee45cd7ab7bd
Reviewed-on: https://chromium-review.googlesource.com/229985
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-17 16:34:04 +00:00
Alec Berg
c44bd8b3a3 pd: zinger: add firmware update alternate mode to zinger
Add a Google Firmware Update alternate mode to zinger. This mode must
be entered in order to allow the unstructured VDMs that we use for
sending a new firmware.

BUG=chrome-os-partner:33754
BRANCH=samus
TEST=load on samus and zinger. see that "GFU" is printed on zinger console
to represent that it entered GFU mode. use twinkie to see that samus
sent discover identity, discover svids, discover modes, enter mode, and
then read info. See on samus pd console that we received result of read
info. from samus pd console with zinger attached:
> pe 1 dump
IDENT:
        [ID Header] 2c0018d1 :: AMA, VID:18d1
        [Cert Stat] 00000000
        [2] 50100001    [3] 00000003    [4] 52136b91    [5] 0401137d
SVID[0]: 18d1 MODES: [1] 00000000
MODE[1]: svid:18d1 caps:00000000

Also, use a samus with cros_pd_update running in kernel, and see that zinger
auto-updates when plugged in. Performed 10 updates with no failures.

Change-Id: I8d4d38e4a9f649fe0889f688f262630ef55106ee
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229622
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-15 06:57:32 +00:00
Alec Berg
56bbd902ab samus: lower the minimum input current limit
Lower the minimum input current limit on samus by 64mA to 448mA
to have the ability to limit input current to something below
500mA.

BUG=none
BRANCH=samus
TEST=load onto samus, and use charger console command to verify
input current limit is 448mA.

Change-Id: I05bcacce707faddd3addee50356d85281466e146
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229281
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-11-15 06:00:06 +00:00
Alec Berg
9de2ef515f pd: allow policy layer to ask for PR/DR_swap on new contract
Allow policy layer to request a PR or DR swap upon formation of
a power contract. Zinger always asks for a data swap so it can
be a UFP, and Samus asks for a data swap only if it is a UFP to
become a DFP.

BUG=chrome-os-partner:33754, chrome-os-partner:31195
BRANCH=samus
TEST=load onto samus and zinger and make sure they swap roles
upon connect with no collisions

Change-Id: I275c9669549c26f25c58f80845daad8edab11313
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229327
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-15 05:59:55 +00:00
Bill Richardson
f154a8b95d cr50: Update TODO comments with new bug numbers
Just changing comments, no code.

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

Change-Id: Ibffda40bff23a8c685feaef30a85e19157566245
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229860
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-11-14 23:56:44 +00:00
Vic Yang
399a810103 ryu: Disable USB D+ pull-up on boot
The pull-up on USB D+ is by default enabled, as needed by DFU mode. In
normal operation, we should disable it unless case-closed debugging is
enabled.

BRANCH=None
BUG=chrome-os-partner:33544
TEST=Build ryu

Change-Id: I18d216d8fff61640e4fbc3ce259209b3f149abf1
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229797
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-14 22:47:01 +00:00
Alec Berg
8e024350d3 pd: add data role swap
Add support for DR_swap, data role swap command.

BUG=chrome-os-partner:33686, chrome-os-partner:28343
BRANCH=samus
TEST=test with samus and zinger. use "pd 1 swap data" command
and verify data role swaps by using twinkie and "pd 1 state".

Change-Id: I410309199cdeecb26847a6bf217523fdfe688cba
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229192
2014-11-14 04:24:29 +00:00
Vincent Palatin
aad897775a zinger: (re-)enable the flash prefetch buffer
At 48Mhz, due to the flash accessing requiring 1 Wait-State, we need to
enable the flash prefetch buffer to get the full CPU execution speed.

The bit used to enable flash prefetching was fixed :
crosreview.com/219921 , but the change was overriden by the CL enabling
the STOP mode : crosreview.com/219933

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

BRANCH=samus
BUG=chrome-os-partner:28335
TEST=plug Zinger into a PD power sink, with the Twinkie protocol
analyzer observe how long Zinger takes to send back GoodCRC after the
Request and SinkCap messages. With the patch, the average delay is going
from 160us to 50us.

Change-Id: I9de1bc10e14485919046c841eea16de3c3b3c800
Reviewed-on: https://chromium-review.googlesource.com/229671
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-11-14 03:03:39 +00:00
Alec Berg
afd993b1bd ryu: disable pd console command
Disable most of the pd console command to save space. The command
can still be used with subcommands "state" and "dump" to get state
information and change debug level.

BUG=none
BRANCH=none
TEST=make buildall with CONFIG_CMD_PD defined and undefined. Also
undefined the config option and loaded onto samus and verified that
the pd 0 state command still works.

Change-Id: Ie41bad53122a1e2a9ef4bad6423b9cdc85f53742
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229420
Reviewed-by: Vic Yang <victoryang@chromium.org>
2014-11-13 16:13:22 +00:00
Johny Lin
f2aeae1efd plankton: modify request_voltage after redundant 5V-PDO removal
After removing redundant 5V source PDO for plankton, the index of
request_voltage need to minus 1.

BUG=chrome-os-partner:33737
BRANCH=samus
TEST=make BOARD=plankton, and test 5V/12V/20V buttons on plankton
board

Change-Id: I82f3f8ef72ce54221fb31027b10ff428f2440c9f
Reviewed-on: https://chromium-review.googlesource.com/229255
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Pin-chih Lin <johnylin@chromium.org>
Tested-by: Pin-chih Lin <johnylin@chromium.org>
2014-11-13 05:32:08 +00:00
Chris Zhong
208f28fac1 Jerry: modify gpio config, hibernate
Added hibernate wakeup pin(EC_WAKE) that covers both AC_PRESENT and LID_OPEN. It pulses a
rising edge when either of them have a rising edge.

The power button was also inverted to handle hibernation better, now it's low
except when pressed it temporarly goes high.

BRANCH=None
BUG=chrome-os-partner:33269 chrome-os-partner:32782
TEST=make BOARD=jerry
Try hibernating, all wakeup sources should work, it shouldn't stay hibernated.
All signals(AC, lid, power button) should work equally well as in pinky.

Change-Id: I894135bdfd5600919296f7510dc9cd1acd567ddc
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/228763
2014-11-13 04:23:22 +00:00
Anton Staaf
48b8c34aed ryu: Enable PD/EC console over USB
This enables forwarding of the local PD/EC console
over debug USB.  It gates the console functionality
based on the CCD mode that is set.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Enable partial CCD mode on ryu and verify that it is
     enumerated by the host correctly, but doesn't respond
     to console input, and doesn't generate output.
     Enable full CCD mode on ryu and verify that it is
     enumerated and that the console works as expected.
     Verify that the console still works by default on the
     discovery-stm32f072 board.

Change-Id: I0325ce9689486c41387d6075330be1d7d42f1d42
Reviewed-on: https://chromium-review.googlesource.com/229342
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2014-11-13 03:14:37 +00:00
Anton Staaf
8e25d9e1fc ryu: Add minimal Case Closed Debug support
This provides a framework for additional work.  It
exposes an API (ccd_set_mode) that can be used by the
PD code to enable Case Closed Debug.  Enabling CCD will
result in the USB 2.0 lines on Ryu (proto 2) to be
disconnected from the AP and for the USB peripheral to
be enabled and connected to the host.  The result is
an enumerated device with no interfaces.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Enable CCD ryu_p2 and verify that it is enumerated
     by the host correctly.  This requires a reworked
     Ryu (proto 2 with pullup).

Change-Id: I1fbecdd5f94a61519cfc18c5e087892c6bd77fde
Reviewed-on: https://chromium-review.googlesource.com/229139
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2014-11-13 03:14:32 +00:00
Anton Staaf
079742b1ff USB: Enable finer grain control over init process
Previously enabling USB would automatically (using an
init hook) initialize the USB peripheral.  This would
take over the GPIO lines assigned to the USB module.
This is not OK on Ryu for Case Closed Debug because it
interferes with the AP's access to the USB 2.0 lines
even when not in Case Close Debug mode.

This change adds a configuration option to inhibit this
default initialization of the USB peripheral.  It also
renames the existing CONFIG_USB_INHIBIT to
CONFIG_USB_INHIBIT_CONNECT now that there are two
possible inhibitions.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Enable console on ryu_p2 and discovery-stm32f072 board
     Verify that it works on both

Change-Id: I6734357131b4356e3d4164349d6c74deac196ce5
Reviewed-on: https://chromium-review.googlesource.com/229138
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2014-11-13 03:14:26 +00:00
Shawn Nematbakhsh
cf48a3640c charge_manager: Add unit tests
Add unit tests for the charge_manager module.

BUG=chrome-os-partner:32003
TEST=`make buildall -j`
BRANCH=Samus

Change-Id: I31962588ca7360e2ffde6b83459505872e2128b9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/227620
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-13 00:29:58 +00:00
Shawn Nematbakhsh
06fb4fe0f2 usb_pd: Negotiate minimum power for unused ports
When a PD charger is detected, gets its max charge capability, but
initially negotiate for its minimum charge mode. If we later determine
that the port will be the one active charge port, re-negotiate for the
max charge capability.

BUG=chrome-os-partner:32003
TEST=Manual on Samus. Plug in Zinger, verify that current limit is
initially set to 500 mA, then switches to 3000 mA shortly after. Plug in
two Zingers, verify that one provides 3000 mA current while the other
negotiates to 500 mA. Verify that the 500 mA charger bumps up to a high
current once becoming active.
BRANCH=Samus

Change-Id: Ifa562b72d763642fc8bd62bc7f5aaa4eda1ef950
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225922
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-11-13 00:29:52 +00:00