summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* kohaku: Add support for Dyna batteryScott Collyer2019-05-172-39/+10
| | | | | | | | | | | | | | | | | | | This CL adds support for the battery that's currently being used with Kohaku systems. Without this support the AP won't be powered on automatically when only on battery power. BUG=b:132272081 BRANCH=none TEST=Verifed that 'battery found' message is in EC console log and that AP boots automatically when AC power is not connected. Change-Id: I2f9e0f09cf3d2caad33ed62e2b8f42a609b34fc3 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1603470 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* kohaku: Fix the GPIO pin assignment for USB_C0_BC12_CHG_DET_LScott Collyer2019-05-171-1/+1
| | | | | | | | | | | | | | | | This was misread as GPO06, but it is connected to GPOD6. BUG=b:130197995 BRANCH=none TEST=make -j BOARD=kohaku Change-Id: Ia780306b655898718e131de7fd4452a26bb07423 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1582966 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* flash_ec: expand the list of directories where npcx_monitor.bin can be foundPaul Fagerburg2019-05-171-9/+16
| | | | | | | | | | | | | | | | | | | | | Add the dirs for LOCAL_BUILD or EMERGE_BUILD to the list of directories to search for npcx_monitor.bin. Prioritize the directory where the EC binary is located (which could be specified with the --image parameter). BUG=b:132350402 BRANCH=none TEST=Build with 'sudo emerge ec-devutils' Test with and without an --image parameter: flash_ec --board=kohaku flash_ec --board=kohaku --image=build/kohaku/ec.bin Verify that flash_ec is able to locate npcx_monitor.bin in both cases. Change-Id: I5a679d1bc215cc0383f60e02aa702db79cd968b3 Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1613437 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* board: arcada: Fix magnetometer axis rotationYuval Peress2019-05-161-1/+1
| | | | | | | | | | | | | Fix the rotation of the magnetometer measurements. BRANCH=None BUG=b:128619310 TEST=Compare raw magnetometer data with pixel 3 Change-Id: I3fa407dd4dcc825cc521c8e49a63a635e45f9081 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1612256 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* ish: fix reading current interrupt vectorHyungwoo Yang2019-05-162-4/+5
| | | | | | | | | | | | | | | | | When we switched to using REG32 macros for registers, we made a mistake in using address of LAPIC's ISR. The original CL that changed this was CL:1586458 BRANCH=none BUG=none TEST=Tested on Arcada platform Change-Id: Ia64806a4cb0fa5d150b41407b0f6c9f34f0168e8 Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1611746 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* i2c: add i2clookup host commandJett Rink2019-05-163-1/+110
| | | | | | | | | | | | | | | Add a new host command that will allow you to lookup a well known device on the EC. This is useful for FAFT tests that want to talk directly with i2c devices but don't know the physical address for each platform. BRANCH=octopus BUG=b:119065537 TEST=Used this with new faft test in CL:1601300 Change-Id: I82c2d5462fcb4edbc92ea60765971190fed7ae81 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1601060 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tcpci/usb_pd_fuzz: Avoid using unitialized data in payloadNicolas Boichat2019-05-162-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Found with MSAN fuzzer: usb_pd_protocol.c may use payload data that is not initialized. Fix the test by copying over the whole payload, which is what tcpci.c's version does. Also, in tcpci.c, clear cached_messages head before using get_message_raw to fill it up, to make sure that we do not accidentally use older data in the queue. BRANCH=none BUG=chromium:963076 TEST=make TEST_MSAN=y host-usb_pd_fuzz -j MSAN_OPTIONS=log_path=stderr:exitcode=0 \ build/host/usb_pd_fuzz/usb_pd_fuzz.exe \ clusterfuzz-testcase-minimized-ec_usb_pd_fuzzer-5716775969357824 Change-Id: I74c38538440cb5a01d1714657b9e2d63e5b80cea Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610163 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* FIXUP: driver: lis2mdl: add standalone supportGwendal Grignou2019-05-161-2/+2
| | | | | | | | | | | | | | Fix constant used when LIS2MDL is behind LSM6DSM. BUG=b:128619310,b:124085261 BRANCH=none TEST=meep board compile. Change-Id: I35ec3659dfedceedfa52400c37972fcf387f6375 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610315 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Yuval Peress <peress@chromium.org>
* ish: save and restore reset flags across resetJack Rosenthal2019-05-162-8/+28
| | | | | | | | | | | | | | | | | In order to implement watchdog reset counter, we need to be saving and restoring reset flags. b:132457636 explains the details of the memory layout chosen for the soft-register. BUG=b:132366384,b:132457636 BRANCH=none TEST=reset arcada_ish using: `reboot' command, watchdog expiration, and cold-reset, observed the correct value for "reset cause" printed during boot Change-Id: I84b965803d37703fac6494fb55a97c674ce64b89 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1606074 Reviewed-by: Jett Rink <jettrink@chromium.org>
* ish: move panic data into AON ROMJack Rosenthal2019-05-161-4/+7
| | | | | | | | | | | | | | | | Currently the panic data is placed in a region that conflicts with the aontaskfw stack. With the extended ROM space, we can put the panic data in a safer location. BUG=b:132457636 BRANCH=none TEST=ran 'crash divzero', observed the panic data copy across reset without any issues Change-Id: I876f3f071e000017c8f2ee744838711da928857c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610998 Reviewed-by: Jett Rink <jettrink@chromium.org>
* ish: increase AON ROM size by 256 bytesJack Rosenthal2019-05-163-5/+9
| | | | | | | | | | | | | | | | | | | | We need to reserve some space in AON persistent memory not to be used by the shim loader. This memory will be used for panic data, reset flags, and watchdog reset counter. We can reduce the size of the panic data for further soft-registers, as needed. Each of these things will be moved into the reserved section in a child CL. BUG=b:132457636 BRANCH=none TEST=entered d0i0, d0i1, d0i2, d0i3, and rebooted to test aontaskfw is working Change-Id: I41f39d28a6b5a3424f1c89b0e0884e72df04225f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610997 Reviewed-by: Jett Rink <jettrink@chromium.org>
* ec: common: Make IS_ENABLED fail on unknown valuesRaul E Rangel2019-05-1510-19/+175
| | | | | | | | | | | | | | | | | If IS_ENABLED is called with any unknown values, a compiler error will be thrown. This change requires that the optimizer always be enabled, otherwise errors will be thrown when a value is not defined. BUG=none BRANCH=none TEST=make runtests TEST_LIST_HOST="is_enabled_error is_enabled" Change-Id: I1b166311f81d07e48b3665f4bc0e9502d2ccc4c6 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1592728 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: Revisit charge supplier priority.stabilize-12206.BYilun Lin2019-05-144-19/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to USB-C spec 1.3 Table 4-17 "Precedence of power source usage", the supplier's priority should be: USB-C 3.0A/1.5A > BC1.2 > USB-C under 1.5A. This CL propose to raise the BC1.2 priority to fix that charge_manager won't choose BC1.2 when the port reports it can supply both TYPEC 500ma and BC1.2 supplier. According to the spec mentioned aboved, we should prefer BC1.2 rather than TYPEC. Besdies, charge_manager is able to pick the supplier which provides the higheste power. The CL simplifies the supplier priority a bit by taking advantage of the feature. TEST=Charge kukui with 5V/2A charger and see it can drain 1.34A (DCP current bound of mt6370 is 1.5A) rather than 0.5A. TEST=Charge kukui with Type-C 5V3A/CDP/DCP/SDP/PD charger randomly and see that the current it drains is reasonable. TEST=Charge soraka with 'A', and plug another port with 'B', and see it can transist the sinking port from A to B. Here (A, B) are: 1. (SDP 5V0.5A, Type-C 5V3A) 2. (CDP 5V1.5A, PD) 3. (SDP 5V0.5A, CDP 5V1.5A) 4. (CDP 5V1.5A, Type-C 5V3A) 5. (Type-C 5V3A, PD) BUG=b:131126720 BRANCH=None Change-Id: I46384e09d764aa926129358657d0593fca4923c2 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1581859 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ish: fix GPIO interrupt enabling and statusHyungwoo Yang2019-05-141-0/+5
| | | | | | | | | | | | | | | | | | | | currently the GPIO interrupt mask register and status register are not initialized on warm reset. so some interrupts can be enabled even before corresponding things are ready. this patch disables all GPIO interrupts and clears pending interrupts during gpio initialization(gpio_pre_init()). BRANCH=ish BUG=b:130717887 TEST=tested on Arcada platform Change-Id: I01c237f667c7a3b6d1eb63d81c9ab604a6213453 Reviewed-on: https://chromium-review.googlesource.com/1611749 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* retimer: Add driver support for Intel Burnside Bridge retimerVijay Hiremath2019-05-148-0/+429
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Burnside Bridge is a Type-C multi-protocol retimer to be used in on-board applications. Burnside Bridge offers the ability to latch protocol signals into on-chip memory before retransmitting them onwards. It can be used to extend the physical length of the system without increasing high frequency jitter. Burnside Bridge supports spec compliant retimer of following protocols: 1. Display Port: four unidirectional DP lanes 2. USB3.1 Gen1/2: one bi-directional USB lane 3. Thunderbolt: two bi-directional CIO lanes 4. Multifunction Display (MFD): two unidirectional lanes of DP and one bi-directional lane of USB3.1 Gen1/2 Note: Only item 1, 2 & 4 are supported in this CL. Item 3 support will be added in follow on CLs. BUG=b:127623438 BRANCH=none TEST=Manually verified on ICLRVP, able to configure the registers Change-Id: I2d60dbcaf8fe7a1503f09a2f16007409f059f54e Signed-off-by: Ayushee <ayushee.shah@intel.com> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1594170 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
* host: Fix test breakageRaul E Rangel2019-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There seems to be a breakage on ToT: BUILD host-cr50_fuzz VERSION ec_version.h make obj=/mnt/host/source/src/platform/ec/build/host/cr50_fuzz/cryptoc SUPPORT_UNALIGNED=1 \ CONFIG_UPTO_SHA512=y -C /mnt/host/source/src/third_party/cryptoc make[2]: '/mnt/host/source/src/platform/ec/build/host/cr50_fuzz/cryptoc/libcryptoc.a' is up to date. CC RO/chip/host/dcrypto/aes.o In file included from chip/host/dcrypto/aes.c:8: In file included from board/host/dcrypto.h:24: In file included from ./chip/g/dcrypto/dcrypto.h:22: In file included from ./chip/g/dcrypto/internal.h:13: include/util.h:82:16: error: attribute declaration must precede definition [-Werror,-Wignored-attributes] __attribute__((visibility("hidden"))) int atoi(const char *nptr); ^ /usr/include/stdlib.h:361:32: note: previous definition is here __attribute__ ((__nothrow__ )) atoi (const char *__nptr) ^ 1 error generated. make[1]: *** [Makefile.rules:480: build/host/cr50_fuzz/RO/chip/host/dcrypto/aes.o] Error 1 make: *** [Makefile.rules:281: host-cr50_fuzz] Error 2 BUG=none BRANCH=none TEST=make runtests -j Change-Id: Idf2c901a0c12fa4ebfabdf7d1205430153b8de9f Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1605511 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ish: set firmware status to running during pre-initJack Rosenthal2019-05-141-0/+3
| | | | | | | | | | | | | | This adds a firmware status update to FWSTS_FW_IS_RUNNING during boot. BUG=b:132060059 BRANCH=none TEST=Observed firmware status is 7 (IS_RUNNING) during boot before HECI ready. Change-Id: If41c86838a956023754be960472b8c641416b7c9 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1597674 Reviewed-by: Jett Rink <jettrink@chromium.org>
* queue.h: Check at compile time if queue size is power of 2Nicolas Boichat2019-05-142-2/+1
| | | | | | | | | | | | | | | | | Replace the runtime assertion with a compile time one, saves a bit of space (~64 bytes on many boards), and warn users earlier of potential issues. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I7df70b7166dd447a8b1dd8e10710c8bc7ab213e3 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600943 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
* Align behavior of strtoi() and strtoul() to match Linux manpage description ↵Jes Klinke2019-05-142-28/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | of strtol(). Behavior changes: 1) Initial '+' character is tolerated. 2) Hexadecimal strings prefixed with "0x" are rejected, if given base parameter is anything other than 16 or 0, rather than parsed as hex, diregarding the given base. 3) If given base is 0, strings starting with leading zero will be parsed as octal, rather than decimal. 4) Initial '-' character allowed before "0x" on hexadecimal numbers. (Note: This is my first time using git or gerrit, please let me know if there is some policy or customs that I am not properly adhering to.) BRANCH=none TEST=make run-utils_str V=1 Bug: 940329 Change-Id: I71654471b77f0df071a58ff6bed7028f00cd46b5 Signed-off-by: Jes Bodi Klinke <jbk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1577750 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* baseboard: hatch: Limit printf on serial consoleGwendal Grignou2019-05-141-0/+8
| | | | | | | | | | | | | | | | | Once Sensors are enabled, there is a lot of host command traffic. Change chan mask to prevent printf overload. BUG=None BRANCH=master TEST=Less printf on the console. Change-Id: I5462e1220949821034fa4001bb5cd11942d48c70 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1593952 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* kukui: Enable interrupts from hall sensor.Yilun Lin2019-05-143-8/+4
| | | | | | | | | | | | | | | | Support hall covering/uncovering over lid close/open. TEST=Emulate hall cover and see system goes down. TEST=Emulate hall uncover and see system goes up. BUG=b:111378000 BRANCH=None. Change-Id: I56c0b45ba8b005c98877c2830e2320368788f04a Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1388236 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* kukui: Loose charging 5V limitation strategy.Yilun Lin2019-05-141-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The charging limitation strategy is too conservative: it turns the charging voltage to 5V once the battery SOC hits 86 percent. However, this will make the battery SOC bouncing between 85 and 86 percent if connected to a external powered hub which can only do 500mA at 5V (2.5W) and that is not enough to charge the device. This CL looses the charging limitation strategy by taking IBAT into consideration. The strategy is proposed by vendor. When the battery is almost fully charged, IBAT will become smaller and smaller. This CL sets the IBAT limit to 1A, which is still quite large current, but is enough to charge battery SOC closing to 99 percent. It fixes: Battery SOC won't stuck at 85 percent with such hub, now it can reach 99 percent without damaging the chip. BRANCH=None BUG=b:128364884 TEST=- Charge krane with PD charger and see the PD voltage will be limited to 5V when SOC > 85% and IBAT <= 1A. - When PD voltage been limited to 5V, unplug charger, and wait for the SOC drops a little (95 -> 94) then plug a PD charger, and see the PD voltage limit been changed to 12.85V. Change-Id: I7bbdf242ff1568e3595252346eb0a3d7b3ac57ff Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1560811 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ish: add more explanations comments for reset flow in aontaskJett Rink2019-05-141-3/+29
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=ISH still reset properly on arcada Change-Id: I08a5935c5e8d1728e2984cbc70d75e380eb66f55 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1601349 Reviewed-by: Hebo Hu <hebo.hu@intel.corp-partner.google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* ish: fix lapic table readJett Rink2019-05-142-5/+9
| | | | | | | | | | | | | | | | | When we switched to using REG32 macros for registers, we also changed the math for the offset of the lapic. Fixing the pointer math. The original CL that changed this was CL:1586458 BRANCH=ish BUG=none TEST=ISH runs normally Change-Id: I1beea99ede496a2eee2adf96adeec21b3f1e1fd4 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1600158 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* ish: update firmware statusHyungwoo Yang2019-05-142-0/+5
| | | | | | | | | | | | | | | Currently we missed some FW status updates that are used by host in taking critical action. BUG=b:132060059 BRANCH=none TEST=tested on Arcada platform Change-Id: I7ad607869f821eae99e37704ab3d6567d180aadd Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1601780 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* ish: fix bugs in fwst check functionsHyungwoo Yang2019-05-141-2/+2
| | | | | | | | | | | | | | | currently functions to check the status of ilup(IPC link up) and hup(HECI up) are changing values of FW status which is bug. BRANCH=none BUG=none TEST=tested on Arcada platform Change-Id: I1839304af619a3ee5a0856fe83560aa21a99e60a Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1601779 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* iteflash: use serial number to find the ccd deviceMary Ruthven2019-05-141-9/+4
| | | | | | | | | | | | | | | There may be multiple ccd devices connected to the host. Use the serial number to choose the correct device. BUG=none BRANCH=none TEST=try to flash ampton with two CCD devices connected to the host Change-Id: I1554e94f31b5582955ea25c19da2c3da98012e46 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600502 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* ish: correct gpio voltage to 3.3Vstabilize-12202.BJett Rink2019-05-131-1/+1
| | | | | | | | | | | | | | The sensor interrupt signal is 3.3V not 1.8V and ISH GPIO does not support 3.3V away. This was benign but incorrect. BUG=none BRANCH=none TEST=sensor still work Change-Id: I0335c5c65f8d6a52f4c7df4018133b46d98bca39 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1602491 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ish/ish5: fixed both-edge triggered gpio configuration blocking D0ix issueHu, Hebo2019-05-122-42/+97
| | | | | | | | | | | | | | | | | | | | | | | | | ISH PMU does not support both-edge interrupt triggered gpio configuration. If both edges are configured, then the ISH can't stay in low power mode because it will exit immediately. As a W/A, we scan all gpio pins which have been configured as both-edge triggered, and then temporarily set each gpio pin to the single edge trigger that is opposite of its value, then restore the both-edge trigger configuration immediately after exiting low power mode. BUG=b:132001235 BRANCH=none TEST= tested on arcada platform, console should freeze after entered low power mode Change-Id: I83a43d9fbee6cfd1a6820bdb44c1446f109ffb32 Signed-off-by: Hu, Hebo <hebo.hu@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1600310 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Hebo Hu <hebo.hu@intel.corp-partner.google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ccd doc: link to suzyq instructions in cr50 setupMary Ruthven2019-05-121-2/+4
| | | | | | | | | | | | | | | Plugging in suzyq and finding the cr50 console requires some knowledge about how CCD works. Link to the specific instructions from the main CCD doc, so people can find out how to do it. BUG=none BRANCH=none TEST=none Change-Id: I49ee6d8d937f61599f8b18378e5775eb78bacfcf Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1599682 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* USB-PD: Fix null-pointer dereference for svdm_rsp.amodeDaisuke Nojiri2019-05-121-2/+4
| | | | | | | | | | | | | | | | | | | This patch fixes null-pointer dereference for svdm_rsp.amode. Some boards set svdm_rsp.amode to NULL. This patch will make TCPM on those boards return NACK instead of crash. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: Ifdeacbe4e164c5f1f7679ed4bb19a91053936ac6 Reviewed-on: https://chromium-review.googlesource.com/1599729 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common/usb_pd_protocol: Avoid unitialized use of port flagsNicolas Boichat2019-05-121-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On reset, when pd_partner_port_reset is called, if, for any reason pd_get_saved_port_flags fails to get the saved port status, we would risk using unitialized flags from the stack. The function logic was a little complicated, and can be simplified quite a bit by returning early if no contract is in place (or if we fail to read flags from BBRAM). This should not be a problem on real boards, as the stored value should be readable from BBRAM. In any case, the first time we used the flag if (explicit_contract_in_place && pd_comm_is_enabled(port)) only applies to unlocked RO images, so this never happens in production (where RO images are locked). The second case is a little tricker, and we may end up (not) applying Rp where we should (not): /* If we just lost power, don't apply Rp. */ if (!explicit_contract_in_place || system_get_reset_flags() & (RESET_FLAG_BROWNOUT | RESET_FLAG_POWER_ON)) return; Presumably, the worst case here is that a charger may not work after a brownout/power on. BRANCH=none BUG=chromium:958510 TEST=setup_board --board=amd64-generic --profile=msan-fuzzer cros_fuzz --board=amd64-generic reproduce --fuzzer \ chromeos_ec_usb_pd_fuzzer --testcase \ ./clusterfuzz-testcase-minimized-ec_usb_pd_fuzzer-5086219896225792 \ --package chromeos-ec --build-type msan => No more MemorySanitizer error. Change-Id: I40fb87b68dbe5244e8a2ae136508b431db7f96a8 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600935 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* krane: Reverse BC12 OE in order to fix USBAlexandru M Stan2019-05-121-1/+1
| | | | | | | | | | | | | | | While we're trying to enable BC12 with CL:1575050, we should unblock a few people from using USB by reversing this pin. TEST=USB works (both kernel and firmware) without "gpioset BC12_DET_EN 0" BUG=b:122866184 BRANCH=None Change-Id: Ie54be2351908c2b60b998c5666b39c6d465b358c Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1603476 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Yilun Lin <yllin@chromium.org>
* charger/rt946x: Mask out display bias interrupt.Yilun Lin2019-05-121-0/+2
| | | | | | | | | | | | | | | | | Though there is display bias interrupt from mt6370, we don't need to handle this. Mask out the event. TEST=Connect a display and boot to AP, and see the BC1.2 work as expected. BUG=b:132401501 BRANCH=None Change-Id: I7e5eeb6b65890f65f67e535f0848ca289f452962 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1605665 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* charger/rt946x,krane: Enable backlight power.Yilun Lin2019-05-124-0/+36
| | | | | | | | | | | | | | | Krane's backlight power and PWM is controlled by mt6370. TEST=See the backlight is enabled on krane. BUG=b:131125903 BRANCH=None Change-Id: I9276a73d1a36e6b1eb64b39d7e9e988cda164ada Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1575051 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* gsctool: use the usb serial number to find the usb deviceMary Ruthven2019-05-121-3/+19
| | | | | | | | | | | | | | | | | Add a serial number arg that can be used to specify which CCD device to use. If there are multiple CCD devices, you can use this arg to pick which device to update. BUG=none BRANCH=none TEST='gsctool -f -n $SERIAL' can be used to get the cr50 version from two chromebooks connected to the same machine. 'gsctool -f' still works too. Change-Id: I91cbfdc7d62bee2623919e4dded62f92ba7adb19 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600501 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* usb_if: use the device with the matching serial numberMary Ruthven2019-05-124-14/+75
| | | | | | | | | | | | | | There might be multiple devices with the same VID:PID connected to the host. Use the serial number to find the correct device if it is given. BUG=none BRANCH=none TEST=none Change-Id: I96f31e8e7ceb0dd2c3c643771b38752da88a2a9e Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600500 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* stm32: Decouple printf logic from directly calling USB console driverWai-Hong Tam2019-05-112-56/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling printf functions, it was to call the USB console driver directly, i.e. copying all the bytes to USB package buffer and enabling the transmission. If the next printf is called immediately before the USB transmission is done, it will wait (polling the EP_TX_VALID status). This implementation limited each printf function can only transmit 64 bytes, i.e. the USB max package size. The remaining bytes will be dropped silently. To fix this issue, this CL puts a queue between the printf logic and the driver. The size of the queue is 2048-byte (no overflow happened on a normal boot and console commands). The printf logic now fills the queue and schedules a deferred hook to handle the transmission. When the transmission is done, an interrupt will be triggered that schedules the deferred hook again to check any remaining bytes need to be transmitted. For the incoming bytes, replace the circular buffer to a queue structure for better reusability. No major logic changes. BRANCH=servo BUG=b:129423678 TEST=Manually added a printf call to show >64 bytes and verified it. TEST=Manually added a printf call to show >2048 bytes and the bytes after the 2048-th dropped silently. Change-Id: Icb2310421d7bcbbff8d7cd753c732390acc43ab8 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1597960 Commit-Ready: Todd Broch <tbroch@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* Revert "octopus: Support keypad function on Bobba"Justin TerAvest2019-05-103-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 73312c0f227d0b21d5ffa788caa4579c82c78731. Reason for revert: broke build Original change's description: > octopus: Support keypad function on Bobba > > 1. Using CONFIG_KEYBOARD_KEYPAD to choose actual_key_mask w or w/o keypad. > 2. Enable keypad function on Bobba. > 3. Disable scan KSO13 & 14 and modify actual_key_mask for SKU w/o keypad on > Bobba. > > BUG=b:131095327 > BRANCH=octopus > TEST=make buildall > > Change-Id: I33ea85ec3966b4bba64b2a5aa11f186b5b92c52b > Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1600944 > Reviewed-by: Marco Chen <marcochen@chromium.org> > Reviewed-by: Diana Z <dzigterman@chromium.org> Bug: b:131095327 Change-Id: Ic5228fb5047b6c3a6a05b9e8ce9e47677758c2e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1606072 Reviewed-by: Justin TerAvest <teravest@chromium.org> Commit-Queue: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org>
* ccd doc: add more to information about using ccdMary Ruthven2019-05-101-12/+25
| | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: I5776c16032863a2a0f8d5c82f148c80822379dec Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1599681 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cr50: rebuild board image if essential make variables changeVadim Bendebury2019-05-104-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When building Cr50 board image, some make variables get converted into compilation flags, which affect image composition. Changes of these variables go unnoticed as they do not directly affect make dependencies. Let's define the set of essential variables in ENV_VARS, and save the state of these variables at build time in a generated .h file, updating it only if any of the variables' values changed since the previous make run. The generated .h file is included in board.h, which guarantees that files dependent on board.h are recompiled if the generated .h file changes. BRANCH=cr50 BUG=none TEST=verified that changing of CR50_DEV and/or H1_RED_BOARD or CR50_SQA values triggers full rebuild of the Cr50 image. Verified that 'emerge-atlas ec-utils' also succeeds. Change-Id: Id0589a3b6a66fe4da90a9aea894bc83eb6337c8c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/707915 Reviewed-by: Keith Short <keithshort@chromium.org>
* cleanup: fix cros_sh to cros_ish typoJett Rink2019-05-101-1/+1
| | | | | | | | | | | | | Update command line usage help string for ectool to specify cros_ish instead of cros_sh. BRANCH=none BUG=none TEST=see usage string update Change-Id: I52f36b88598af980788eec8a1ed15160ba0f1175 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1605219
* octopus: Support keypad function on BobbaSue Chen2019-05-103-0/+29
| | | | | | | | | | | | | | | | | 1. Using CONFIG_KEYBOARD_KEYPAD to choose actual_key_mask w or w/o keypad. 2. Enable keypad function on Bobba. 3. Disable scan KSO13 & 14 and modify actual_key_mask for SKU w/o keypad on Bobba. BUG=b:131095327 BRANCH=octopus TEST=make buildall Change-Id: I33ea85ec3966b4bba64b2a5aa11f186b5b92c52b Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1600944 Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* tcs3400: rename tcs3400_drv_data_t to als_drv_data_tNick Vaccaro2019-05-094-37/+46
| | | | | | | | | | | | | | | | | | | - rename tsc3400_drv_data_t to als_drv_data_t - change tcs3400 driver to use common als_drv_data_t - change flapjack config to use common als_drv_data_t - rename TSC3400_SCALE() macro to ALS_CHANNEL_SCALE() - create and use new I2C_PORT_ALS definition - fix a couple nits BUG=b:124512628 BRANCH=master TEST=build and flash to flapjack, verify ALS and RGB still work. Change-Id: I9a45d255ff77794ef34026406c9b702a04e09c11 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/1601052 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* board: atlas: Remove BMI160 supportGwendal Grignou2019-05-093-50/+1
| | | | | | | | | | | | | | | | | | | Atlas may ship without IMU. hardware_features.xml indicates no IMU support (CL:*1168651 and CL:*1138132) Prevent EC to report IMU even if present. BUG=b:129078548 TEST=Compile BRANCH=atlas Change-Id: I600ef7268d7cea50164bf2e9fe7dd54d00329437 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1582609 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Caveh Jalali <caveh@google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Caveh Jalali <caveh@google.com>
* Flapjack: Enable full model of MAX17055YH Lin2019-05-092-4/+53
| | | | | | | | | | | | | | | | | This patch enables full model of MAX17055. BUG=b:130804959 BRANCH=none TEST=The simple test steps which we used are as follows: 1. using DCP charger to complete two charge cycles. 2. Connect the serial cable to machaine, and collecting data of the ec-command "battery 20000 10000" 3. Convert #2 battery log to excel form, and analyze test results Change-Id: If07d7919142b4fcfb1f69972de70efc3d213bae3 Signed-off-by: YH Lin <yueherngl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1575558 Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* bloog: add SKU IDsDevin Lu2019-05-091-5/+6
| | | | | | | | | | | | BUG=b:132037233 BRANCH=octopus TEST=make buildall -j Change-Id: Ifd2d9fdc8c9e9a8a003564d4fb0fa561d3668c5c Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/1598388 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Marco Chen <marcochen@chromium.org>
* ccd doc: link cr50 doc in main ccd docMary Ruthven2019-05-091-3/+4
| | | | | | | | | | | | | BUG=none BRANCH=none TEST=verify link works Change-Id: I774a0dc1c0965f3655c46b09ff9bdd3e12f21200 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1599680 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Kevin Shelton <kmshelton@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ish: combine watchdog expiration and panic handlerJack Rosenthal2019-05-093-37/+30
| | | | | | | | | | | | | | | | | | watchdog_warning implements similar functionality to exception_panic, but worse, as the value it prints for EIP is wrong, and it does not have the no-double-panic logic of the panic handler. This commit removes watchdog_warning and integrates the relevant functionality into exception_panic. BUG=b:129983997 BRANCH=none TEST=observed watchdog reset with 'waitms 10500' Change-Id: I78375337aa85be5424850e29a8204c409384d019 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1599732 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* ish/ish5: remove watchdog disable during D0ixHu, Hebo2019-05-093-26/+3
| | | | | | | | | | | | | | | | | | | | | | ECOS will reload watchdog in hook task for every HOOK_TICK_INTERVAL time, and this will make HPET timer 1 wakeup ish. Therefore, we do not need to disable watchdog during D0ix. D3 and reset prep flow still need disable watchdog. BUG=b:132112137 BRANCH=none TEST='waitms 10500' console command can trigger watchdog timeout and ish reboot Change-Id: I11aad5ece0ce96bc53738512290c1e42bf175479 Signed-off-by: Hu, Hebo <hebo.hu@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1598713 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Hebo Hu <hebo.hu@intel.corp-partner.google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>