summaryrefslogtreecommitdiff
path: root/driver/gl3590.c
Commit message (Collapse)AuthorAgeFilesLines
* driver: Sort header filesJeremy Bettis2022-11-291-3/+2
| | | | | | | | | | | | | | | | | | | | | Sort all includes in driver with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I675e0db416b6b7cbcfce031c97fd24ad97b66f4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4052767 Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tree-wide: const-ify argv for console commandsCaveh Jalali2022-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This updates the API for console commands from "int cmd(int argc, char **argv)" to "int cmd(int argc, const char **argv)" which is more accurate and in line with common convention. BRANCH=none BUG=b:244387210 TEST="make buildall" passes TEST="zmake build -a" passes TEST="util/compare_build.sh -b all" passes TEST="./twister -v -T zephyr/test" passes Cq-Depend: chrome-internal:4960125 Cq-Depend: chrome-internal:4959932 Change-Id: I57de9f35b85b8f3c7119df36aefb2abf25d2625f Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863941 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* driver/gl3590.c: Format with clang-formatJack Rosenthal2022-07-011-23/+15
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I363f6247ed42c801225b6b7f57e05a580e4ffe6c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729978 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* gl3590: Add a delay to allow hub release i2c linesJan Dabros2021-04-221-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | GL3590 (USB3 hub) chip may drive I2C_SDA and I2C_SCL lines after being released from reset. Max time for such "activities" is 200ms. In order to ensure correct operations on the i2c bus, we need to delay all i2c transactions in the system by such value. Implementation is using hook with higher priority than I2C_INIT. This guarantees that: * SoC won't start i2c transactions before 200ms mark after GL3590's RESETJ# pin deassertion; * Original order of loading all generic modules (e.g. ioex_init, board_init) won't need to be changed; * Workaround applied only in platform-specific code. BUG=b:181930164 BRANCH=main TEST=build and flash new servo_v4p1 firmware Plug in CHG and DUT cables. _Then_ plug in HOST cable and verify that green diode is lit on servo_v4p1 board indicating proper pass-through charging. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I32971d421eb541c788a87701ce5e8c62a8b35777 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829770 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add retry algorithm for port enabling procedureJan Dabros2021-02-091-4/+32
| | | | | | | | | | | | | | | | | To improve reliability of gl3590 driver, add verification for success of previous enable/disable port command. BUG=b:178125550 BRANCH=main TEST=Flash FW6410 to GL3590 hub, verify error messages correctness on port enable/disable events. Flash FW6411 to GL3590 hub, verify that all commands executed silently which means success. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I5599c350c88c2596a4bb2a2ba310d44c08e0717f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674002 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add init functionJan Dabros2021-02-091-0/+45
| | | | | | | | | | | | | | | | Add a way to verify whether I2C interface of the hub is ready and initialize it. BUG=b:178125550 BRANCH=main TEST=With consecutive patches applied, verify host hub functionality on servo_v4p1 board. All USB ports should be usable. Check console logs for any possible error messages. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I9a4ad484d07b50e0c497f56bfaf111b47b3b0576 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674001 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add proper delays between i2c transactionsJan Dabros2021-02-091-2/+16
| | | | | | | | | | | | | | | | | Requirement for extra delay was obtained directly from Genesis PoC. This is also documented in I2C Application Note v080. This delay should improve reliability of I2C interface. BUG=b:178125550 BRANCH=main TEST=Verify host hub functionality on servo_v4p1 board. All USB ports should be usable. Check console logs for any possible error messages. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I4b4507f1b10f46f7398cc2f1099286e360f4f450 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674000 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add CLI for managing USB hubJan Dabros2021-01-151-0/+32
| | | | | | | | | | | | | | | | | | | | | Initially `gl3590` command allows only for enabling/disabling downstream facing ports. BUG=177295270 BRANCH=main TEST=On servo_v4p1 verify that ports power may be enabled/disabled via gl3590 command. In order to disable USB3.0 port on top (A0): gl3590 disable 0x2 In order to enable USB3.0 port at the bottom (A1): gl3590 enable 0x1 In order to disable uServo port: gl3590 disable 0x8 Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: Id9f82454fc9309e56c76215bce7058de776a806d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624471 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add API for per-port power managementJan Dabros2021-01-141-0/+17
| | | | | | | | | | | | | | | | | GL3590 USB3.0 hub has support for enabling/disabling power to its downstream facing ports via I2C interface. New API allows to enable or disable bunch of ports at a time in order to limit number of issued I2C transactions. BUG=b:177295270 BRANCH=main TEST=With consecutive patch applied, one may verify new API with usage of `gl3590` command on servo_v4p1 and enabling/disabling ports. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I979fb2034e176f1603407be5ba46a528a14ec53c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624470 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add method for querying UFP connection power capabilitiesJan Dabros2021-01-141-5/+56
| | | | | | | | | | | | | | | | | | GL3590's registers allow to gather information about host connection, e.g. available power. This may be used by platforms which are powered by hub's UFP. Add missing license headers. BUG=b:144776402 BRANCH=main TEST=With consecutive patch applied, verify that available input power reported by servo_v4p1 is correct. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I6a9881fe844b293800653f141c418257c6ebc4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606237 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add initial support for USB HUB I2C interfaceJan Dabros2020-12-071-0/+144
GL3590 is a USB hub with support for out-of-band transactions via I2C. Set of additional registers allow to disable/enable ports, query port status (including power-related information), handle over-current events and others. This initial driver implements method for reading and writing from/to GL3590 registers as well as event handler to parse asynchronous messages from hub. BUG:b:150323106,b:169929627 BRANCH:master TEST:buildall. Functionality can be tested on servo_v4p1 with a consecutive commit applied. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I385ff4790ddc367d07b7e588f4e10aeb83e9f1c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2563686 Reviewed-by: Brian Nemec <bnemec@chromium.org>