summaryrefslogtreecommitdiff
path: root/board/servo_v4
Commit message (Collapse)AuthorAgeFilesLines
* ec.tasklist: Consolidate duplicate commentsDaisuke Nojiri2019-04-081-11/+1
| | | | | | | | | | | | | | | | | | | | | | | It's simply a bad idea to describe a macro in multiple locations. It'll make it hard to change. It'll be difficult to keep all locations in sync. This patch replaces the comment duplicated in all ec.tasklist with a pointer to the CONFIG_TASK_LIST definition. The macro will be described in a single place (just like all/most other macros). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: Id658b9d68e742e4334c692b804d9c98c8de21313 Reviewed-on: https://chromium-review.googlesource.com/1551579 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* servo_v4: detect SBU more reliablyNick Sanders2019-03-281-104/+93
| | | | | | | | | | | | | | | | | | | | | SBU orientation was detected in a one-shot check, that didn't ensure that the line was idle. Change to detect SBU orientation independently of PD state, and only while it's disconnected from the host. Delete keepalive and ccd_enable as they aren't meaningful for the new mechanism. BUG=b:128646723, chromium:942130 BRANCH=servo TEST=unplug a lot of times, orientation always correct. Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I16c770b9d8d7a0c2d90aa214cb8cdec4c36a7303 Reviewed-on: https://chromium-review.googlesource.com/1529724 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Todd Broch <tbroch@chromium.org>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-261-2/+2
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-262-10/+10
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Revert "Servo v4: reduce RO flash size"Todd Broch2019-03-062-8/+2
| | | | | | | | | | | | | | | | | | | | | This reverts commit 590a45db85507787af77cf6bfc8ae63499cbf1cc. BRANCH=none BUG=b:124465253 TEST=manual, Running sudo servo_updater -b servo_v4 --force -f build/servo_v4/ec.bin sudo servo_updater -b servo_v4 --force -f build/servo_v4/ec.bin passes without failure, servo_updater.ServoUpdaterException: usb_updater2 exit with res = 3 Change-Id: Ied9939192c30342bb6314e6dccfcd56d950659ab Signed-off-by: Todd Broch <tbroch@google.com> Reviewed-on: https://chromium-review.googlesource.com/1497438 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* core/cortex-m*: always use coreboot-sdkPatrick Georgi2019-02-191-5/+0
| | | | | | | | | | | | | | | It creates smaller code. BUG=chromium:851727,b:65441143 BRANCH=none TEST=builds with the new compiler Change-Id: I569c6f75a595331fb489323d8b3f02d5dd2d5050 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1450713 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* servo_v4: Remove console commands to save flash spaceDaisuke Nojiri2019-02-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | This patch removes the following commands: CONFIG_CMD_ACCELSPOOF CONFIG_CMD_FASTCHARGE CONFIG_CMD_GETTIME CONFIG_CMD_MEM Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: Ic6e0bd4441f17636d77468874646e3aabe0d250b Reviewed-on: https://chromium-review.googlesource.com/1475770 Commit-Ready: Tony Zou <zoutao@huaqin.corp-partner.google.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* Servo v4: reduce RO flash sizeDiana Z2018-11-202-2/+8
| | | | | | | | | | | | | | | Currently, the servo_v4 build is within 48 bytes of exceeding its RO flash size. With this change to remove the USART3 code from the RO image, there should be just about 350 free bytes of space. BRANCH=None BUG=None TEST=builds, hey_flash_used in RO elf file shows 0x170 free bytes Change-Id: I7ee8f6c964eb3e0fb009fba61430bab656c03c2e Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1340545 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* servo_v4: update board_select_rp_valueNick Sanders2018-09-271-2/+24
| | | | | | | | | | | | | | | This function sets the default Rp value, but should not enable Rp if it's not already enabled. BRANCH=servo BUG=b:116630203 TEST=check CC lines after booting with/without charge through. Change-Id: Ie9709796940cf908b9af3701d2123f16596f04e0 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1244381 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* servo_v4: clear bbram PD state on rebootNick Sanders2018-08-251-0/+6
| | | | | | | | | | | | | | | Preserved bbram state causes failure to reinit on reboot. Clear on board init. BRANCH=None BUG=b:111573811 TEST=PD reinits on reboot. Change-Id: Ifdf98b5793cb99e2900ac5dc53263a86317b6b07 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1187883 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* build.mk: specify corebook_sdk by CROSS_COMPILE_corebook_sdk_*Wei-Han Chen2018-08-221-1/+4
| | | | | | | | | | | | | | | CQ-DEPEND=CL:1180950 BUG=chromium:851727,b:65441143 BRANCH=none TEST=cros_run_unit_tests --packages chromeos-ec TEST=make buildall -j Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I12ee0c9e0090212d1b4ca2ddb240439dea1c7f4b Reviewed-on: https://chromium-review.googlesource.com/1180951 Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Wei-Han Chen <stimim@chromium.org>
* Revert "**/build.mk: Set CROSS_COMPILE* to point to coreboot-sdk"Wei-Han Chen2018-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bcd6842fb861b99588039b0bb72fafd92853525e. Reason for revert: This breaks whiskers. Original change's description: > **/build.mk: Set CROSS_COMPILE* to point to coreboot-sdk > > board/servo_v4 used it already but doesn't need the override anymore, > nds32 also used it, therefore no change. > > BUG=chromium:851727,b:65441143 > BRANCH=none > TEST=builds with the new compiler > > Change-Id: I59a7181b87293da2a8515b158c17417b5ba05404 > Signed-off-by: Patrick Georgi <pgeorgi@google.com> > Reviewed-on: https://chromium-review.googlesource.com/1172974 > Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> > Tested-by: Patrick Georgi <pgeorgi@chromium.org> > Reviewed-by: Stefan Reinauer <reinauer@google.com> Bug: chromium:851727, b:65441143 Change-Id: If09eca04efc6461b951879ad528832bc50ca50d2 Reviewed-on: https://chromium-review.googlesource.com/1177221 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Wei-Han Chen <stimim@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* servo_v4: add per port dualrole settingNick Sanders2018-08-152-62/+150
| | | | | | | | | | | | | | | | | | | | | | | This adds support to configure dualrole setting per port, so that servo v4 can adjust charge and dut port separately. servo will detect charge capability on CHG port and choose source or sink as appropriate. Fix null dereference bug in genvif duel to dynamic src_pdo. "cc" command allows src, snk, srcdts, snkdts configurations. BRANCH=None BUG=b:72557427 TEST=charge through and also passive hub. Note Dru doesn't accept DTS hub. TEST=make buildall -j Change-Id: I19f1d1a5c37647fec72202191faa4821c06fb460 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1096654 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* **/build.mk: Set CROSS_COMPILE* to point to coreboot-sdkPatrick Georgi2018-08-151-2/+0
| | | | | | | | | | | | | | | | board/servo_v4 used it already but doesn't need the override anymore, nds32 also used it, therefore no change. BUG=chromium:851727,b:65441143 BRANCH=none TEST=builds with the new compiler Change-Id: I59a7181b87293da2a8515b158c17417b5ba05404 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1172974 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* servo_v4: use coreboot toolchainNick Sanders2018-06-051-0/+2
| | | | | | | | | | | | | | 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>
* test/build.mk: Allow boards to specify test listsNicolas Boichat2018-05-281-0/+3
| | | | | | | | | | | | | | | | | Some tests cannot be built on some boards (not enough SRAM, unusual configuration, etc.). Instead of the long list of exceptions in test/build.mk that we currently use, allow each board (or chip) build.mk to set test-list-y, and only use the default list if it is unset. BRANCH=poppy BUG=b:80167548 TEST=make buildalltests -j Change-Id: I803c691f419451aad4396529302a4805cbe3f9b5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1074572 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: add more stack for PDNick Sanders2018-05-141-1/+1
| | | | | | | | | | | | | | C0 PD would occasionally get stack overflow. Add venti stack. BRANCH=servo BUG=b:79266510 TEST=no more crash Change-Id: Id1d7174af954b5e5716ba402ae5b993e2971464d Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1056488 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* servo_v4: Remove `crash` command.Aseda Aboagye2018-04-251-0/+1
| | | | | | | | | | | | | | | Servo V4 is out of space, so remove the crash command to gain some back. BUG=None BRANCH=None TEST=make -j buildall Change-Id: I9e5617de2a41f12f60d1fab246acddbbcfa3bea2 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1022964 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* system: update board version to return an error if encounteredJett Rink2018-04-191-2/+1
| | | | | | | | | | | | | | | | | | | | Now that board version can come from CBI, we can have a real error reading it. We should pass that error to the console or to the AP on the host command and let the AP firmware (or user) decided how to handle that error case Also update the CONFIG_BOARD_VERSION to be derived instead of needed in most cases. BRANCH=none BUG=b:77972120 TEST=Error reported on EC console and AP console when CBI is invalid on yorp Change-Id: Ib8d80f610ea226265a61e68b61965150cdc9bb04 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1015776 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: extend pd task stackNick Sanders2018-04-021-1/+1
| | | | | | | | | | | | | | | | | This works around the occasional garbage packet storm found in coral, which causes a stack overflow. BUG=b:77336824 TEST=loop power_state:rec on coral 200x BRANCH=servo Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I08faf333cb0e7b7bb7016956de44f43621b950ea Reviewed-on: https://chromium-review.googlesource.com/989215 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* usbc: add config support for multiple (and no) vbus adc channelsJett Rink2018-03-091-2/+2
| | | | | | | | | | | | | | yorp measures each port's vbus separately on a deticated ADC. Also, add config to take care of ADV_VBUS -1 case too. BRANCH=none BUG=b:74127309 TEST=none Change-Id: I6f4df96caffc3b527b69e67358631dd448172cde Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956555 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb_i2c: Remove usb_i2c_board_enable/disableNicolas Boichat2017-11-201-2/+1
| | | | | | | | | | | | | | | | These functions are not used by usb_i2c.c on chip/stm32, let's move them to board/cr50 which is the only place where they are used. BRANCH=none BUG=None TEST=make buildall -j Change-Id: I8c1b292838b8dbee9a9001add9332e0add80c342 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/778749 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: disable USB3 interfaceNick Sanders2017-11-161-2/+5
| | | | | | | | | | | | | | | | This change switches the SS lines off in the main USB mux. There has been some general flakyness regarding USB3 peripherals and this change might address it. BUG=chromium:718075 BRANCH=None TEST=lsusb -t indicates 5000M before, 480M after. Change-Id: Id201fb20dc6489c4a071cb1c9c0624d7aa54652d Reviewed-on: https://chromium-review.googlesource.com/509130 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* servo_v4: remove gpio endpoint.Nick Sanders2017-11-042-58/+4
| | | | | | | | | | | | | | | | | | | | We have an ec3po gpio driver that also works. Let's save some flash space by using that instead, and deleting the gpio usb endpoint. Saves 448 bytes. BUG=None BRANCH=servo TEST=servod still runs. Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: If1c764c97fba4798f8501a0c0364d2690d2fd2f0 Reviewed-on: https://chromium-review.googlesource.com/750593 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charge_manager: Enter safe mode at bootShawn Nematbakhsh2017-11-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Charge port / current selection often needs to be significantly altered when a battery cannot provide sufficient charge, so have charge_manager initially enter safe mode. After a battery with sufficient capacity has been identified, charge manager will leave safe mode, and port / current selection will return to standard rules. BUG=chromium:777596 BRANCH=None TEST=Pass charge_manager unit tests. On kevin, remove battery, attach Apple PD charger, verify safe mode is not exited and device does not brown out. Hot-plug battery and verify safe mode is exited. Next, remove battery, attach to Samus, verify safe mode is not exited and device doesn't brown out. Hot-plug battery, verify that safe mode is exited and no active charge port, due to dual-role exclusion. Change-Id: I7784865750087a037aad8dbbac058b22c77ba6d4 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/733954 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Fix buffer overflowShawn Nematbakhsh2017-11-021-7/+3
| | | | | | | | | | | | | | | src_pdo_charge[] size may exceed 2, but remove it instead. BUG=None TEST=On servo_v4, verify DTS always works. BRANCH=servo Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I2a4e75a5939cab82d508408b961361bde9f207ea Reviewed-on: https://chromium-review.googlesource.com/748272 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* servo_v4: fix board version GPIO accessNick Sanders2017-11-022-15/+26
| | | | | | | | | | | | | | | Ensure GPIOs are inputs when read: Initialize GPIO direction on startup, and clean up register accesses using reg names rather than magic numbers. Add board version reporting with CONFIG_BOARD_SPECIFIC_VERSION. BUG=None BRANCH=servo TEST=version is correctly 3 Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: Ia04b01932fc36540af64b48b5e0bb6516f1529e2 Reviewed-on: https://chromium-review.googlesource.com/749693 Reviewed-by: Shawn N <shawnn@chromium.org>
* servo_v4: Advertise multiple >5V PDOs to DUTShawn Nematbakhsh2017-10-241-29/+47
| | | | | | | | | | | | | | | | | | | Select optimal PDOs from the charger at various discrete voltage limits and advertise them all to the DUT, in case the DUT does not support the "best" > 5V PDO due to voltage limits. BUG=chromium:776809 BRANCH=servo TEST=On {samus, scarlet, kevin}, with zinger attached to DUT port, verify DUT + CHG negotiate to max supported voltage. On 'black' servo_v4 board, verify scarlet negotiates to 12V. Change-Id: Iea174e4f6bc303d561e28281b9ff20afb3073c25 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/730877 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Add CHG / DUT port voltage synchronizationShawn Nematbakhsh2017-10-192-57/+112
| | | | | | | | | | | | | | | | | | | | | | The previous method of negotiating > 5V on CHG port followed by asynchronously negotiating > 5V on DUT port (and then switching DUT VBUS source from internal 5V to DUT) will often not function correctly due to VBUS glitching on the switchover. Instead, immediately switch VBUS source to CHG when detected, and negotiate > 5V on CHG only after DUT has requested a transition. BUG=chromium:775542 BRANCH=servo TEST=Attach {kevin, scarlet} to servo_v4, attach Apple charger to servo_v4, verify DUTs charge at 9V and consoles are reachable on scarlet. Change-Id: I1e53f1e74e5ab1cd32a252243c23faaa8fce107b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/724683 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Remove ACCESSORY statesShawn Nematbakhsh2017-10-193-5/+15
| | | | | | | | | | | | | | | | | | | According to the USB-C spec, when a debug accessory is identified, we may optionally establish USB PD communication over CC. Some DTS partners (eg. servo_v4) expect us to speak PD, so let's make it so. There is no need for special ACCESSORY states, these do not exist in the PD spec. BRANCH=servo BUG=chromium:737755,b:65837068 TEST=On scarlet, attach servo_v4 and verify scarlet charges. Also verify EC and cr50 consoles are available through servo_v4. Change-Id: I59d1ca50b4766509eccf38562cdf926578138585 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/693294 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Add "freeze" dual-role policyShawn Nematbakhsh2017-10-191-0/+4
| | | | | | | | | | | | | | | | | Add a new DRP policy to "freeze" the power role of each port, never toggling automatically, though manual role swaps may still occur. BUG=chromium:769895 BRANCH=servo TEST=On servo_v4, verify DUT port stays in SRC role and POWER port stays in SNK role while disconnected. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ibff3cd1ffaf0e884b030c231003763a57acbe02e Reviewed-on: https://chromium-review.googlesource.com/715276 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Use charge_manager for input port / ILIM selectionShawn Nematbakhsh2017-10-192-43/+28
| | | | | | | | | | | | | | | BUG=chromium:769895 BRANCH=servo TEST=On servo_v4, attach OEM Apple charger to power port and verify negotiation to 9V and port / ILIM selection from charge_manager. Attach samus to DUT port and verify 9V charging. Change-Id: Icf16f6e8c99af4fbb48a83b7a36f550c20f5fd69 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/713944 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* chip/stm32/usart: Add flags to usart_configNicolas Boichat2017-10-181-0/+2
| | | | | | | | | | | | | Allows setting TXINV/RXINV bits. BRANCH=none BUG=b:65697962 TEST=make BOARD=wand -j Change-Id: Ib1bb290cd9758c53b98c8fc1ca1a9369c8cff39e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/694561 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: add pd commandsNick Sanders2017-09-281-0/+1
| | | | | | | | | | | | | | Add CONFIG_CMD_PD into servo v4, to enable more console PD commands, BRANCH=None BUG=b:65497998 TEST=run the sommands. Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I85c3f585779ccd51cff48c564083fd42fe5c454b Reviewed-on: https://chromium-review.googlesource.com/663840 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* servo_v4: Add a CCD 'keepalive' console command.Aseda Aboagye2017-09-061-3/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | Servo v4 monitors the SBU lines on USB-C connects in order to determine which direction to set the orientation of the SBU mux. However, when there's traffic on the lines, for example when the EC is rebooting, it can lead to the wrong conclusions and terminate the USB connection. This commit adds a CCD keepalive console command. Additonally, when the Type-C cable is unplugged from the DUT for at least 900ms, the CCD keepalive will be cleared. This is such that if the cable is unplugged and then replugged in a different orientation, the detection will still work. BUG=b:64903997 BRANCH=servo TEST=Flash servo_v4; `keepalive enable`. Run `dut-control power_state:reset` > 100 times and verify that the USB connection stays alive. Change-Id: I5c8f9ab3361d4f52f906161ab5da471a36725a4e Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/647031 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* servo_v4: Tie data role preference to DTS mode settingScott Collyer2017-08-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | When servo_v4 acts as a debug test system (DTS) its expected use case is for triggering CCD mode and Faft testing. To that end, its desired default data role is to be a UFP so that the enet and USB port are accessible by the DUT. However, when servo is acting a regular SRC port, it makes more sense for the data role pairing to be consistent with a normal SRC port device which is SRC/DFP. BUG=b:64720447 BRANCH=servo TEST=Tested with Eve using twinkie USB PD analyzer. Verified that when DTS mode is enabled a data role swap request is sent to the DUT and when DTS mode is disabled that servo_v4 does not send a data role swap request. Change-Id: I071f85fc99f1c877d86ef48ec7fa38d6850d5679 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/615813 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* charge_manager: Consider port in source PDO.Aseda Aboagye2017-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT is defined for a board, as its name implies, the board can source a higher current if there is only one port acting as a source. This commit fixes an issue with selecting the right source capability message to advertise. charge_manager_get_source_pdo() was simply checking if there was more than one sink connected, instead of checking if there were any *other* sinks connected. In the event that a sink was connected to a different port, we would advertise the max source PDO. BUG=b:64037926, b:35577509 BRANCH=gru,eve,reef TEST=Connect sink to port 1. Connect a AMA to port 0 that claims that VBUS isn't necessary. Start sending source caps, verify that the max PDO is not being advertised in the source caps. Change-Id: Ie4145ecaf98d5b9070ad3e8b139e5653685fa801 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/610479 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* usb_i2c: Fail if board I2C bridge is disabledRandall Spangler2017-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add usb_i2c_board_is_enabled(). On Cr50, this is now also connected to the I2C CCD capability. The USB-I2C bridge can only be used when the capability is available. On other platforms (Servo V4, etc.) where usb_i2c_board_enable() is a no-op, add a dummy implementation which always returns true. See go/cr50-ccd-wp for more information. BUG=b:62537474 BRANCH=cr50 TEST=manual with CR50_DEV=1 Connect host PC to dev board USB port On host PC: sudo servod -c ccd_cr50.xml -c reef_r1_inas.xml dut-control pp3300_ec_shv_reg --> fail, error 0x8001 ccdoops --> reset I2C config ccd i2c disable --> I2C disabled On host PC: sudo servod -c ccd_cr50.xml -c reef_r1_inas.xml dut-control pp3300_ec_shv_reg --> fail, error 0x0006 ccd i2c enable --> I2C enabled ccdunlock --> I2C disabled ccdoops --> I2C enabled ccdset i2c unlesslocked ccdlock --> I2C disabled ccdunlock --> I2C enabled Change-Id: Ia3df32e239a5f7c5915bc6c7e408ce0dc8b26c89 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/590577 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* servo_v4: enable usb port by defaultNick Sanders2017-06-081-0/+12
| | | | | | | | | | | | | | | Set the USB mux and power enable to default to route the USB3 port to the DUT and enable VBUS. BUG=b:38391443 BRANCH=None TEST=ensure that blue port works on power on. Change-Id: Ie46e422bc083e435379470132159df32f6d644d3 Reviewed-on: https://chromium-review.googlesource.com/527992 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Added support for HW board ID and limit on VBUS voltageScott Collyer2017-05-182-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The first two versions of servo_v4 (red and blue) have the TPD2E001 ESD between VBUS and CC1/CC2. This part has a breakdown min voltage of 11V. Therefore for these versions of servo_v4, need to limit VBUS to less than the default 20V value. This CL adds support to read two board ID gpios attached to the gpio expansion part. The max VBUS voltage is limited to 9V for red/blue and allowed to be 20V for black. BUG=b:38351574 BRANCH=servo_v4 TEST=Manual Modified a servo_v4 to add the 2 new pullup resistors. Tested with this unit and with a unit that does not have the pullups. Verified that without the pullups the version ID reads a 0 and the max VBUS voltage that will be requested by the CHG port is 9V. Wih the modified servo_v4, verified that the version reads 3 and the CHG port will request up to 20V. Change-Id: Ic41fcbe3a5c000282552c7322b5ab18ebb203cd2 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/507027 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* common/update_fw: Remove board-specific rw_sectionsNicolas Boichat2017-04-151-20/+0
| | | | | | | | | | | | | | | | | | | | | | rw_sections is defined in the exact same way on all common code boards, let's remove it, and hard-code the values in update_fw.c instead. Take this as an opportunity to fold set_valid_section in fw_update_start (this will be useful later on, as we also want to return the inactive region version). BRANCH=none BUG=b:35587171 TEST=make buildall -j TEST=Can update hammer over USB using usb_updater2 Change-Id: I4dd3224f17f89c1851c379255f1195dc54528b3d Reviewed-on: https://chromium-review.googlesource.com/476451 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* servo_v4: Added dts_mode on/off control for DUT port connectionScott2017-04-073-70/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new static variable disable_dts_mode. By default, DUT port will attempt to connect as a DTS source. However, if disable_dts_mode is set via a console command, the DUT port will connect as a regular source device. Charging behavior is identical between the two modes. In DTS mode, Rp is presented on both CC lines. When it's disabled Rp is presented only on CC1. Added tables to support the appropriate VNC and RD voltage thresholds. BUG=b:36908939 BRANCH=servo TEST=Tested with new console command 'dts on|off'. If new mode equals the current mode, no action is taken. If the mode is different, then verified that DUT port connects as DTS following 'dts on' and regular SRC following 'dts off'. Verifed this when the command is issued when connected to the DUT or disconnected. Validated that the H1 console is present for DTS mode and not present when DTS mode is disabled. Change-Id: Ie649709d6b2bbe947708d05eac42fde61d2677a8 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/468447 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Don't disable SBU mux when TypeC detach occursScott2017-04-041-12/+12
| | | | | | | | | | | | | | | | | | | | | | | When a USB PD connection is made, servo_v4 senses the polarity of the SBU signals and sets the SBU mux for the deteted polarity. If the DUT is reset, the SBU mux needs to retain the same state so the H1 console USB endpoint is not disrupted. Modified the CCD_MODE_DISABLED case to no longer disable the SBU mux. In addition, removed the static variable ccd_mode as it was being set, but not ever being checked, so wasn't serving any purpose. BUG=b:36561120 BRANCH=servo_v4 TEST=Connect servo_v4 to Electro. On Electro EC console enter 'reboot' verify the H1 USB console remains connected. Change-Id: I4f0f5167221c04314ca5be063411f200896bbdf6 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/464068 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* servo_v4: Set desired data role for DUT port to UFPScott2017-03-261-10/+11
| | | | | | | | | | | | | | | | | | The default for servo_v4 DUT port is to be SRC to charge the DUT, but a UFP data role so that the DUT's usb mux gets connected. BUG=b:35586526 BRANCH=servo TEST=Connect to Electro and verify that servo_v4 data role is that of UFP and that electro is getting an IP address from the enet port on servo_v4. Change-Id: I8f2e4242777bf879598852004096f683d68c091c Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/452725 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: pd: Updated CC_NC and CC_RA macrosScott2017-03-262-3/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previous boards that implemented tcpc layer on chip didn't support variable Rp values. However, servo_v4 can present any of the 3 possible Rp values and therefore the voltage thresholds that are used to determine a no-connect or Ra attach status need a way to be set based on the Rp value that's current attached to a given CC line. - Added port and cc line selection to both the CC_NC and CC_RA macros and now check if they are already defined before being defined in usb_pd_tcpc.c. - Defined each of these macros in board.h to use a function that's able to select the threshold based on the current Rp configuration. BUG=b:35586526 BRANCH=servo TEST=Tested with servo_v4 against Electro and verified that it connects when a charger is and is not connected to CHG port which exercises the differnt Rp combinations that servo_v4 presents. Change-Id: I1a31e430c0f290486f0fa8a50bdafdddf20d23ca Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/451962 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Enable VBUS passthrough from CHG to DUT portScott2017-03-243-68/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds support for the DUT port to advertise different current levels via the Rp resistor selection. The default setting is USB (500 mA). The board_manage_chg_port function relies on the off->on transitions only occurring when the CHG port is in a steady state condition. When the charger being used supports PD messaging, the entry point pd_set_input_current_limit() which is called after receiving a PS_RDY message. For TypeC only chargers, the entry point is typec_set_input_current_limit() which is called from SNK_DISOVERY after only after the max number of hard reset attempts have been attempted. This is intended to prevent this entry point from being called when a USB PD charger is connected and the CHG port enters SNK_DISCOVERY. When the CHG port Vbus transitions from off->on, a src_pdo is updated to reflect the current contract on the CHG port and this src_pdo can then be used by the DUT port when either a new connection is done or to update it's existing contract. BUG=b:35586526 BRANCH=servo TEST=Manual Connected servo_v4 DUT port to Reef with no charger connected. Verified that it connects, and CCD mode in Reef is enabled (H1 console is available) and that only 500 mA charging current is advertised. Then connected a 20V and 15V USB PD charger to the CHG port. In each case verified that the DUT renegotiates to the 20 and 15V level respectively. Repated the test with Guppy and verifed that VBUS is at 5V 3A. When Guppy is removed, then the DUT connection reverts back to the host as the VBUS source. Change-Id: I1a5eb346bbe1f0d586cb8b7bb24d77ff713fbf3c Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/449954 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cr50: Have INAs and I2Cm enabled when rdd is attachedScott2017-02-061-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The INAs are only used for development and testing purposes. Therefore, the 3.3V rail to the INAs is off by default and the I2Cm module is not enabled. Enabling INA power and connecting the I2Cm module was done at the beginning of each USB to I2C request. The problem with this approach is that INA measurments didn't always succeed due to not enough time for the INAs to initialize. Rather than add some arbitrary delay, it is better to tie the INAs to when rdd is attached/detached. It is only when rdd is attached that the INAs will be accessed, so there is no need to enable/disable for each individual I2C transaction. This CL ties the enabling/disabling of the INA and I2Cm module to the rdd state. This change makes the previous use of usb_i2c_board_enable() and usb_i2c_board_disable() obslete. BRANCH=none BUG=chrome-os-partner:62375 TEST=manual Connect servo with suzyq connected: sudo servod -p 0x5014 -b eve -c eve_r0_inas.xml Then execute single INA reads dut-control pp3300_dx_edp_mv and verify that it returns meaningful numbers. Without this CL single reads via dut-control would always return 0. Change-Id: I799552bfd0701efd1828a0d720ac2a6cedee5ca1 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/436864 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* servo_v4: Support to enable Type C DTS modeScott2017-02-014-275/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Defined the config option CONFIG_USB_PD_DTS to board.h. - Added ccd_set_mode function in board.c - Removed ccd attach/detach functions from board.c as that function is - now integrated in the the usb_pd state machine. - Removed the fixed polarity that was being used in usb_pd_config.h so that the DUT port could connect as a SNK device. - Defined PD_ROLE_DEFAULT to override the value in usb_Pd.h so that CHG is SNK and DUT is SRC This set of changes allows servo_v4 to act like a suzyq. Hoever, PD messaging is still not supported. The CHG port can still connect as a SNK device, but VBUS on the DUT is only being provided by the host and not the CHG port. BUG=chrome-os-partner:61878 BRANCH=None TEST=Manual Connected zinger to CHG port and verifed via servo_v4 console that it reached SNK_READY. Connected DUT port to Reef and verified that it reached SRC_ACCESSORY state and that the correct SBU polarity was selected and that lsusb shows H1 as a USB device. Bus 003 Device 042: ID 18d1:5014 Google Inc. Change-Id: I4a0ab2468f383a3ba4db3a3236bb18df6a2c405a Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/428309 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Move PD_DEFAULT_STATE to a common define in usb_pd.hScott2017-01-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Servo_v4 requires the ability to have a different default state per port. In previous devices, the assumption was that each supported port had the same default usb pd state and power role. This CL moves the by the default power role which in turn is derived from CONFIG_USB_PD_DUAL_ROLE. In addiiton to moving the location, it now uses 'port' as argument so it can be port specific if required. PD_DEFAULT_STATE was a board.h specific config, but in practice each instance used to date was set to PD_STATE_SNK_DISCONNECTED if CONFIG_USB_PD_DUAL_ROLE was defined and set to PD_STATE_SRC_DISCONNECTED otherwise. BUG=chrome-os-partner:61878 BRANCH=servo TEST=Manual run 'make -j buildall' to verify that all instances of PD_DEFAULT_STATE were removed. Change-Id: Iaf40718668732f525485ed7942ee7fc246d3f75d Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/431787 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Added initial USB PD support for both CHG/DUT portsScott2017-01-097-11/+594
| | | | | | | | | | | | | | | | | | | | | | | - CHG port can connect as SNK at different voltage levels - DUT port presents as SNK only - DUT port uses fixed polarity since it has a fixed cable - Not supporting ALT or ALT_DP modes in terms of svdm messages at this point. - No support yet for USB mux. BUG=chromium:571476 BRANCH=None TEST=Manual CHG port: Tested with Zinger and Plankton and 5/12/20V VBUS levels. DUT port: Tested against Reef and verified that port reached SNK_READY. Change-Id: Ib645872790912f9e0a0d4adddc10345a59145d3e Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424413 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>