summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-fizz-10139.94.BBrian Norris2021-09-112-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155169 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* stm32: Fix manual interrupt clearing functionCraig Hesling2020-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | | This fixes a bug in gpio_clear_pending_interrupt, where all pending interrupts are unintentionally cleared. This is not in the code path for normal gpio interrupt handlers, since the normal interrupt clearing occurs in gpio_interrupt (right below this function). BRANCH=none BUG=chromium:1059520 TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I4d6fe7947f4d76cf3b57dfbf3bb926e41851c80c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2101208 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> (cherry picked from commit c2c2c083fef813e3e3c70f8c13a1418717ba682d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2106630
* vboot: Don't invalidate cached hash for EXEC_IN_RAM boardsDaisuke Nojiri2018-07-121-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a cached hash is invalidated on flash erase or write. This causes the hash to be (unintentionally) equal to the one expected by the AP after flashrom updates EC-RW directly on EXEC_IN_RAM devices. This patch makes EC skip invalidation of the cached hash if the board supports EXEC_IN_RAM. At the next AP reboot, AP will catch the hash mismatch and triggers software sync to resolve the mismatch. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:78285812,b:80143039 BRANCH=none TEST=Verify EC-RO/RW versions are updated on a dogfood Akali as follows: 1. emerge-nami chromeos-firmware-nami to build chromeos-firmwareupdate 2. Replace bios.bin and ec.bin in chromeos-firmwareupdate with new images 4. Run 'chromeos-firmwareupdate -m autoupdate' on DUT 5. Run reboot command on AP Change-Id: Ie5f80e4784814569c14d4cf2a03ddb9d1257cfd5 Reviewed-on: https://chromium-review.googlesource.com/1130552 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 65d6c6abbc2093067486e3e080adb4f24fc19acb) Reviewed-on: https://chromium-review.googlesource.com/1135228 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* npcx: CEC: Change input back to GPIO when disabling CECStefan Adolfsson2018-06-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The factory tests relies on being able to read CEC_IN through the GPIO API. When it is configured as TA1, it can't be read as a GPIO. With this change, the pin will be a reconfigured as a GPIO at boot or when CEC is runtime disabled using "ectool cec set enable 0" Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:79842676 BRANCH=none TEST=Test that "ectool cec read" still works with CEC on, and that "ectool gpioget CEC_IN" reflects the incoming voltage when CEC is off. Reviewed-on: https://chromium-review.googlesource.com/1064110 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Change-Id: I3b17d6551612a156897d95ea2473e4fbcbd70e39 Reviewed-on: https://chromium-review.googlesource.com/1070068 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Fix issues with pushing to incoming bufferStefan Adolfsson2018-06-191-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pushing to the circular buffer, the read-offset mutex is no longer taken, so don't unlock the mutex. Don't allow writing to the last byte of the buffer. In that case, the read and write pointers will become equal and the buffer will be treated as empty. Add handling for pushing messages of invalid size. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Turn on/off TV: ectool cec write 0x40 0x36 ectool cec write 0x04 0x40 Verify that incoming messages still works when turning off TV: ectool cec read -- -1 Reviewed-on: https://chromium-review.googlesource.com/1068945 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id207c442fac573430aac0c744ec07fa203074228 Reviewed-on: https://chromium-review.googlesource.com/1070067 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Allow unregistration of logical addressStefan Adolfsson2018-06-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | The kernel CEC API unregisters logical address by setting it to 255. From that point, we don't receive any direct messages since a CEC address is only 4 bits on the bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Verify that "cec-ctl --unregistered" sets logical address to 255. Reviewed-on: https://chromium-review.googlesource.com/1059674 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Change-Id: I365151d11a0462e50e9274ace8ee35184e1433b8 Reviewed-on: https://chromium-review.googlesource.com/1064051 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Send CEC message in mkbp eventStefan Adolfsson2018-06-194-57/+73
| | | | | | | | | | | | | | | | | | | | | | Instead of fetching incoming CEC messages using a specific read command, extend the standard mkbp event so the CEC message can be delivered directly inside the event. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST="ectool cec read" still working with a kernel that has support for the increased mkbp size. CQ-DEPEND=CL:1046186,CL:1051085 Reviewed-on: https://chromium-review.googlesource.com/1051105 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id9d944be86ba85084b979d1df9057f7f3e7a1fd0 Reviewed-on: https://chromium-review.googlesource.com/1055833 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add unit suffixesStefan Adolfsson2018-06-191-78/+86
| | | | | | | | | | | | | | | | | | | | Add unit suffixes to all timing constants and variables so it is clear that it is ticks, not usec we are dealing with. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=emerge chromeos-ec CQ-DEPEND=CL:1030371 Reviewed-on: https://chromium-review.googlesource.com/1046186 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I02883108b6f844a7a2d8f0fcd75edaecbbb8e403 Reviewed-on: https://chromium-review.googlesource.com/1055832 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Group ectool subcommands under "ectool cec"Stefan Adolfsson2018-06-191-33/+67
| | | | | | | | | | | | | | | | | Instead of e.g. "ectool cecwrite", use "ectool cec write" to not clutter the command list. BUG=b:76467407 BRANCH=none TEST=Run "cec read/write/get/set" and make sure they still work. CQ-DEPEND=CL:1030218 Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1046185 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Id515782f5a5ff0861fb95ab63c45dc8ab153f0bb Reviewed-on: https://chromium-review.googlesource.com/1055831
* npcx: CEC: Respect the present initiator free-timeStefan Adolfsson2018-06-191-3/+17
| | | | | | | | | | | | | | | | | | | | | When sending multiple frames, the free-time is a bit higher to make it easier for other senders to get a chance to send. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030370 Reviewed-on: https://chromium-review.googlesource.com/1030371 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I19e510ec0b6e987e0d8477fa5549e0b29ef594ee Reviewed-on: https://chromium-review.googlesource.com/1055830 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Get/set logical addressStefan Adolfsson2018-06-191-2/+17
| | | | | | | | | | | | | | | | | | | | | Logical address selection is best done from the AP since it depends on what kind of CEC device type we want to be. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Set address to different values and verify that it only receives messages on that address (or broadcast) CQ-DEPEND=CL:1030229 Reviewed-on: https://chromium-review.googlesource.com/1030370 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia5ef182b22f2345831caaa7f29cc9f009f932c99 Reviewed-on: https://chromium-review.googlesource.com/1055829 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add software debouncingStefan Adolfsson2018-06-191-0/+29
| | | | | | | | | | | | | | | | | | | | | If pulses shorter than the CEC specification allows are detected, ignore the bus for a while. This avoids CPU stress if there is a misbehaving device sending short pulses on the CEC bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030228 Reviewed-on: https://chromium-review.googlesource.com/1030229 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I55819f9437a00799718e235c30f256508465bf4c Reviewed-on: https://chromium-review.googlesource.com/1055828 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Improve pulse-width measurementsStefan Adolfsson2018-06-191-2/+15
| | | | | | | | | | | | | | | | | | | | Take into account the time from the interrupt is triggered until the timer is set when recharging the timer. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using temprorary debug-prints. CQ-DEPEND=CL:1030227 Reviewed-on: https://chromium-review.googlesource.com/1030228 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia36bd73ff5efcff719db7b7915212f30a8e555f3 Reviewed-on: https://chromium-review.googlesource.com/1055827 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Event-handling for incoming messagesStefan Adolfsson2018-06-192-5/+164
| | | | | | | | | | | | | | | | | | | | | | | When an incoming message is complete, store it in a internal circular buffer and notify the AP so the message can be read out. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Write different type of messages from one EC to another EC using ectool. Also use ectool on the second EC to verify that they are received correctly. CQ-DEPEND=CL:1030226 Reviewed-on: https://chromium-review.googlesource.com/1030227 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ie4370b0c954befe81a055cd5dff7d7f13dbefbd0 Reviewed-on: https://chromium-review.googlesource.com/1055526 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Handle incoming CEC messagesStefan Adolfsson2018-06-191-5/+323
| | | | | | | | | | | | | | | | | | | | | | | | | Adds handling of incoming messages: * Start-bit detection * ACK incoming messages * Broadcast handling * Pulse-width validation * EOM detection Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Tested in later CL when messages are plumbed all the way back to the AP. CQ-DEPEND=CL:1030225 Reviewed-on: https://chromium-review.googlesource.com/1030226 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I541072b8afa3d911b310628f09f0b665f11a0a15 Reviewed-on: https://chromium-review.googlesource.com/1055525 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecset/cecget to ectoolStefan Adolfsson2018-06-191-0/+74
| | | | | | | | | | | | | | | | | | | | Set and get CEC parameters. Currently supported parameters are "enable" and "address" Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, set values and read them back. CQ-DEPEND=CL:1030217 Reviewed-on: https://chromium-review.googlesource.com/1030218 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I429710f5d8897b23c5b5e54bd10cbf38d1830811 Reviewed-on: https://chromium-review.googlesource.com/1055517 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecread command to ectoolStefan Adolfsson2018-06-191-17/+69
| | | | | | | | | | | | | | | | | | | | | Wait for a CEC event and read out the new message. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support: ectool cecread -- -1 Turn on TV, cecread says the same as logical analyzer CQ-DEPEND=CL:1030216 Reviewed-on: https://chromium-review.googlesource.com/1030217 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Iadd2fcfad0dc647aaaa9bd8a04c5c0f582259af5 Reviewed-on: https://chromium-review.googlesource.com/1055516 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Wait for send-event after cec writes in ectoolStefan Adolfsson2018-06-191-2/+27
| | | | | | | | | | | | | | | | | | | | | For factory testing purposes, make the cecwrite return-value depend on whether it got an ACK from the sink. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, ectool cecwrite with and without sink CQ-DEPEND=CL:1030215 Reviewed-on: https://chromium-review.googlesource.com/1030216 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I681243f74e4745796ac8d50e60dc0f7f9c087335 Reviewed-on: https://chromium-review.googlesource.com/1055515 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecwrite command to ectoolStefan Adolfsson2018-06-191-0/+33
| | | | | | | | | | | | | | | | | | | | | cecwrite can be used to write a sequence of bytes on the CEC bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, turn on/off TV: ectool cecwrite 0x40 0x04 ectool cecwrite 0x40 0x36 CQ-DEPEND=CL:1030214 Reviewed-on: https://chromium-review.googlesource.com/1030215 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I5bc1efcaaf6ea4c7f92d3654d6e0fcc8717ab757 Reviewed-on: https://chromium-review.googlesource.com/1055689 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add bus-contention handlingStefan Adolfsson2018-06-191-8/+95
| | | | | | | | | | | | | | | | | | | | | If low-impedance is detected during the time from free-time until the end of the initiator address, the current send is postponed until the bus is free again. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030224 Reviewed-on: https://chromium-review.googlesource.com/1030225 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: If4b9ed43306cf2e38770085603f7fa83a1f76ddc Reviewed-on: https://chromium-review.googlesource.com/1055524 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Handle enable/disable commandStefan Adolfsson2018-06-191-8/+87
| | | | | | | | | | | | | | | | | | | | | | The Linux kernel has enable/disable hooks in the CEC driver API. Make it possible to use those calls on the EC CEC implementation. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Verify with logical analyzer that nothing happens on the bus in disable mode and it still works in enable mode. CQ-DEPEND=CL:1030223 Reviewed-on: https://chromium-review.googlesource.com/1030224 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ib5255d76427f288862740cd2e3299ba47f39d998 Reviewed-on: https://chromium-review.googlesource.com/1055523 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Notify AP of CEC send resultStefan Adolfsson2018-06-191-0/+22
| | | | | | | | | | | | | | | | | | Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=ectool cecwrite with and without sink. Reports success if there is a sink, else it fails. CQ-DEPEND=CL:1030222 Reviewed-on: https://chromium-review.googlesource.com/1030223 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I28f12fd8e226e1e261efaeeefe60f257c0afadf9 Reviewed-on: https://chromium-review.googlesource.com/1055522 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add resend-logic to CEC driverStefan Adolfsson2018-06-191-4/+24
| | | | | | | | | | | | | | | | | | | | | | According to the CEC specification, a resend must be attempted at least once and up to five times after NAK. This fix does it five times. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Write CEC message without sink. Verify with logical analyzer that it resends 5 times. CQ-DEPEND=CL:1030221 Reviewed-on: https://chromium-review.googlesource.com/1030222 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id296e12b6657b9e7ca0453a2deb06e8aaf17f839 Reviewed-on: https://chromium-review.googlesource.com/1055521 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Write messages on the CEC busStefan Adolfsson2018-06-193-11/+399
| | | | | | | | | | | | | | | | | | | | | | | | | Add hooks that ectool or AP will use to send CEC messages. Messages are sent by setting a timer and flipping a GPIO in the timer interrupt. The timer is then recharged in inside that interrupt depending on where it is in the CEC state-machine. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Switched on and off a TV: ectool cecwrite 0x40 0x04 ectool cecwrite 0x40 0x36 CQ-DEPEND=CL:1030220 Reviewed-on: https://chromium-review.googlesource.com/1030221 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia640d0d035bcee9be88863046e88402c7a63c19f Reviewed-on: https://chromium-review.googlesource.com/1055520 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add stub implementation of CECStefan Adolfsson2018-06-194-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Add CEC stub implementation and enable it for Fizz. All it does is print a message when the driver is initialized. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Check that "CEC initialized" is printed on the console when the EC boots. CQ-DEPEND=CL:1030219 Reviewed-on: https://chromium-review.googlesource.com/1030220 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Conflicts: chip/npcx/registers.h Change-Id: I1cf674e664e091354e344e0c08a69bd09f415904 Reviewed-on: https://chromium-review.googlesource.com/1055519 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add CONFIG_CECStefan Adolfsson2018-06-193-0/+10
| | | | | | | | | | | | | | | | | | | | Turning on CONFIG_CEC enables the CEC feature code and the CEC console. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Build ec-utils and chromeos-ec with CONFIG_CEC set CQ-DEPEND=CL:995440 Reviewed-on: https://chromium-review.googlesource.com/1030214 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I23bb50d9456a07de7a9e7ea8bfc71f42c5e52778 Reviewed-on: https://chromium-review.googlesource.com/1055688 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add CEC APIStefan Adolfsson2018-06-192-0/+71
| | | | | | | | | | | | | | | | | | | Add HDMI CEC commands and events. Will be used by npcx CEC implementation. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Build ec-utils and chromeos-ec Reviewed-on: https://chromium-review.googlesource.com/995440 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I9008eb77179c296d6d07d321f48ba24585323607 Reviewed-on: https://chromium-review.googlesource.com/1055687 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* usb_port_power: Use same name for mode set functionEmil Lundmark2018-06-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Dumb USB ports do not have the same notion of charge mode as smart ports. However, the header common/usb_charge.h declares a function for changing charge mode that the dumb USB port power implementation does not define. Instead, it defines a similar function with a different name, albeit with other allowed values for its second parameter. This patch makes the names the same so the function can be used by simply including the aforementioned header file. BUG=none BRANCH=fizz TEST=emerge-fizz chromeos-ec Change-Id: I87863f87f32f538cc1c723d9299afcc7353e1852 Signed-off-by: Emil Lundmark <lndmrk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1069272 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit cc7889bfaec9243ff35b6a366f6f2c7c65c33a13) Reviewed-on: https://chromium-review.googlesource.com/1096935 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* acpi: Add map for controlling USB port powerEmil Lundmark2018-06-132-0/+64
| | | | | | | | | | | | | | | | | | | | | | Some devices have GPIO pins that control USB port power connected to the EC, so they cannot be toggled by ACPI. This patch adds a memory map between the EC and ACPI that can be used on such devices. It can hold the power state of up to 8 USB ports. Currently, only dumb power ports are supported. BUG=chromium:833436 BRANCH=fizz TEST=On a fizz that runs BIOS with EC_ACPI_MEM_USB_PORT_POWER mapped, check that both reads and writes are propagated. Change-Id: I413defcb9e4d234fea7f54d46b6b8a1a10efa31e Signed-off-by: Emil Lundmark <lndmrk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1069273 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit aca6cb220c1aab9debf0fd604a6f3502d29122ec) Reviewed-on: https://chromium-review.googlesource.com/1096936 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* npcx: Enable PWM when starting to spin fansDaisuke Nojiri2018-06-131-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | Currently, the EC disables PWM for the fan with PWM=0 but it doesn't enable PWM when PWM goes up. This patch ensures the corresponding PWM channel is enabled when the EC starts spinnning a fan. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:109951096 BRANCH=none TEST=Verify the followings on Teemo: 1. Fan stops when RPM=0 2. Fan starts spinning when RPM goes up from 0 3. Fan stops when entering S3/S5 4. Fan starts spinning when leaving S3. Change-Id: I49654df81953dc22eb1e6f34cb6534886fee6343 Reviewed-on: https://chromium-review.googlesource.com/1096547 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fizz: Add Wukong for BJ configurationDaisuke Nojiri2018-06-072-5/+9
| | | | | | | | | | | | | | Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:71524814 BRANCH=none TEST=None Change-Id: I70deadb6f8c01c36d13f186e95244dc7a317fcbb Reviewed-on: https://chromium-review.googlesource.com/1090326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Add Bleemo for BJ configurationDaisuke Nojiri2018-06-071-0/+1
| | | | | | | | | | | | | | | Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80482240 BRANCH=none TEST=None Change-Id: I50187f58346fe4e6fa88d6a1e07e1dcf72214f07 Reviewed-on: https://chromium-review.googlesource.com/1089329 Reviewed-by: Daniel Johansson <dajo@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: Daniel Johansson <dajo@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Move BJ adapter spec table to ECDaisuke Nojiri2018-06-072-43/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the BIOS carries the table which maps (OEM,SKU) to barrel jack adapter spec. This patch moves this table to the EC. Then, the EC will independently manage the max voltage and current for BJ. This would remove the dependency on AP-EC communication, thus improves the stability This patch also corrects the mapping between SKUs and BJ wattages. SKU BJ(W) * KBL-R i7 8550U 4 90 * KBL-R i5 8250U 5 90 * KBL-R i3 8130U 6 90 * KBL-U i7 7600 3 65 * KBL-U i5 7500 2 65 * KBL-U i3 7100 1 65 * KBL-U Celeron 3965 7 65 * KBL-U Celeron 3865 0 65 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:109762580 CQ-DEPEND=CL:1089370 BRANCH=none TEST=Verify BJ adapter is set expectedly on Teemo. Change-Id: I70c8987670e7495a32fdcbc572779fdc9362e22f Reviewed-on: https://chromium-review.googlesource.com/1089328 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: Pass struct charge_port_info as constDaisuke Nojiri2018-06-072-3/+3
| | | | | | | | | | | | | | | | | This patch changes the prototype of charge_manager_update_charge to mark 'struct charge_port_info *' as const. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I36211e75a51009d7f507897be85745f4ffbe797e Reviewed-on: https://chromium-review.googlesource.com/1089530 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Add fan table for BleemoDaisuke Nojiri2018-06-062-0/+2
| | | | | | | | | | | | | | Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80482240 BRANCH=none TEST=Verify fan speed follow temperature change on Teemo. Change-Id: Ie8ae7febc1a1c1753a4ce26b6c8ff119e277852b Reviewed-on: https://chromium-review.googlesource.com/1083934 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fizz: Add fan for WukongRyan.Zhang2018-06-062-34/+82
| | | | | | | | | | | | | | | | | | This patch also makes EC print board version, OEM ID, SKU ID on console. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:70294260 BRANCH=none TEST=Verify fan speed follows temperature changes on Teemo. Verify CBI is read correctly on start-up. Change-Id: I45a767adbb437005b0f18ff34b4e9d6b0450a0e0 Reviewed-on: https://chromium-review.googlesource.com/1083933 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* fan: Allow board to configure fans at run timeDaisuke Nojiri2018-06-0414-181/+262
| | | | | | | | | | | | | | | | This patch splits struct fan_t into two parts: base configuration and RPM configuration. RPMs are expected to be different from model to model while a base configuration is most likely shared. BUG=b:73720175 BRANCH=none TEST=make buildall Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949382 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1083932
* Revert "fizz: Enable optimized SHA256/RSA in RO only"Daisuke Nojiri2018-06-011-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0cf09d21ed76a48e1295f16d456e48893fd802ae. Reason for revert: <INSERT REASONING HERE> Original change's description: > fizz: Enable optimized SHA256/RSA in RO only > > Decreases verification time from 923ms to 785ms. > > Optimized version do not really help in RW, as they just increase > the image size (which also increases verification time). > > BRANCH=fizz > BUG=b:77608104 > TEST=make BOARD=fizz -j, flash fizz, check timing. > > Change-Id: Ia8c36c35c0321c1995dc1cede7b27f7636037795 > Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/1075908 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > (cherry picked from commit 3c4a912e67ad0f0635c77ef4a30f07397fb06be7) > Reviewed-on: https://chromium-review.googlesource.com/1079470 > Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> > Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Bug: b:77608104 Change-Id: Idebbfc5735d1d52e23d08a1ca5c14b866f312126 Reviewed-on: https://chromium-review.googlesource.com/1081973 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* fizz: Enable optimized SHA256/RSA in RO onlyNicolas Boichat2018-05-311-0/+6
| | | | | | | | | | | | | | | | | | | | Decreases verification time from 923ms to 785ms. Optimized version do not really help in RW, as they just increase the image size (which also increases verification time). BRANCH=fizz BUG=b:77608104 TEST=make BOARD=fizz -j, flash fizz, check timing. Change-Id: Ia8c36c35c0321c1995dc1cede7b27f7636037795 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1075908 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 3c4a912e67ad0f0635c77ef4a30f07397fb06be7) Reviewed-on: https://chromium-review.googlesource.com/1079470 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: add host cmd to get port countFabien Parent2018-05-292-0/+24
| | | | | | | | | | | | | | | | | | | | | The kernel is only able to know the number of USB PD port through EC_CMD_USB_PD_PORTS, but the kernel needs also to be able to know that there is a dedicated port. Add a host command that will return the total number of charge port (USB PD + BJ). BRANCH=None BUG=chromium:841944 TEST=Called command from kernel driver and checked that the port count was the expected value. Change-Id: I6ccd8a2dee35bbe8bb66dfbe09d1cc09c54b73a0 Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1046593 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 7034d8b711398d5627fab5fe787fc33e24d76c48) Reviewed-on: https://chromium-review.googlesource.com/1072288 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: handle gracefully dedicated portFabien Parent2018-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | charge_manager_fill_power_info can be called to fill the power info of the dedicated port. This function might call charge_manager_get_source_current with the dedicated port, we don't want to use assert in that case, but just fail gracefully by returning 0. BRANCH=None BUG=chromium:841944 TEST=Check that the function returns 0 for dedicated and not 0 for USB. Change-Id: I357c056647e01bdb0e77a08a6c6b492aa3dbb503 Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1059248 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit cd89b400a22702ab327b6fd261cd7d5c53b421e3) Reviewed-on: https://chromium-review.googlesource.com/1072290 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: fix possible out of bound read accessFabien Parent2018-05-291-0/+3
| | | | | | | | | | | | | | The port id given by the kernel is never checked and out-of-bound read accesses can be made on available_charge. Fix it. Change-Id: I06ed3d28c30db77d8256e9af808484a7cbdc901e Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1046592 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit e4b718df7a3fbf320fc867844699e60e908d6c20) Reviewed-on: https://chromium-review.googlesource.com/1072289 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Increase VR3 voltage to avoid boot failureDaisuke Nojiri2018-05-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | When V3P3A_EC is higher than V3P3A_DSW + 0.07V, system 3.3V rail is powered by V3P3A_EC. V3P3A_EC LDO will shut down when PU27 triggers OTP. This patch increases VR3 voltage by 3%, which gives us 3.399. This is more than the maximum voltage PU27 can provide, thus, V3P3A_DSW will win the voltage race (against V3P3A_EC). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80114849 BRANCH=Fizz TEST=Boot Fizz Change-Id: Ieb6fbc4ad056a79dc1eef5eae7a91385575bac0b Reviewed-on: https://chromium-review.googlesource.com/1069594 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Add GPIOs used for CECStefan Adolfsson2018-05-172-0/+7
| | | | | | | | | | | | | | | | | | | | | | | The Fizz hardware has three pins for CEC. One GPIO is used as a pull-up. It is always an output and always high. The second GPIO is a data output. The third GPIO is the data input that can also be configured as a timer input (TA1). Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Read and write the newly added GPIOs using ectool Change-Id: Ia33b36a0cdaa40fd1a4f7aa66a092b5833bf5cf8 Reviewed-on: https://chromium-review.googlesource.com/1030219 Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit bdc8b025280acd724fe8a0dfe9376fe94306d342) Reviewed-on: https://chromium-review.googlesource.com/1055518 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: add CONFIG_BOARD_HAS_RTC_RESETRyan Zhang2018-05-164-3/+14
| | | | | | | | | | | | | | | | | | | This patch resets the RTC of the SoC when the system doesn't leave S5. If it fails 5 times, the system will go back to and stay in G3. BUG=b:79323716 BRANCH=fizz TEST=Boot Fizz differently: 1. AC plug-in 2. Power button press 3. reboot EC command 4. servo reset button 5. Recovery mode Change-Id: I728c99c342fb888600599acbe25f72a478ccf948 Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1020583
* Features: Add EXEC_IN_RAMDaisuke Nojiri2018-04-053-0/+9
| | | | | | | | | | | | | | | | This patch adds execution-in-ram, opposite of XIP: execution-in-place (a.k.a. XIP) to the EC features. It can be currently implied by CONFIG_EXTERNAL_STORAGE. BUG=b:77306460 BRANCH=none TEST=Verify ectool prints EXEC_IN_RAM on Fizz. Change-Id: I4a7fb3b267864debe59fd211956371eceac57613 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/995968 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/998763
* flash: Allow currently active regions to be modifiedDaisuke Nojiri2018-04-051-0/+4
| | | | | | | | | | | | | | | | | This patch allows chips which run code in RAM to erase or write regions even if they're active. BUG=b:77306460 BRANCH=none TEST=flashrom -p ec -w /tmp/ec.bin on Fizz Change-Id: Ib536b250dde78283513acb942507c67da0a6f622 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/997022 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 75e0015cc16d287724ef353c5d7f50c1287db2cb) Reviewed-on: https://chromium-review.googlesource.com/998974
* EFS: Clarify vboot_main entry logicDaisuke Nojiri2018-04-051-12/+17
| | | | | | | | | | | | | | | | This patch clarifies the logic which determines whether we perform EFS or not and print different messages for each case. BUG=none BRANCH=none TEST=buildall Change-Id: I5588018a3594be2bcad84a2f74f805b76a195f85 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/996398 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 660fb6a57022e0514c607633a5b0458aced026da) Reviewed-on: https://chromium-review.googlesource.com/998973
* USB-PD: Avoid discovering identity twice on bootDaisuke Nojiri2018-03-211-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some monitors do not like the same mode to be entered twice. They refuse to show any picture when it happens. This patch makes the TCPM check whether the port is a UFP or not before setting PD_FLAGS_CHECK_IDENTITY flag when transitioning from S5 to S3. If not (port is a DFP), it skips setting the flag. Key observations are: - Setting CHECK_IDENTITY there was useful for the following reasons: * In S5 we are in FORCE_SINK. So we might not be able to discover mode (due to the fact that we are a UFP initially when being a SINK). * Once we start, we want to discover the full capabilities. - The use case above is not true if we are a DFP (since we can discover mode immediately) - So it's useful IFF we are a UFP at transition. BUG=b:75958206 BRANCH=none TEST=Verified with a reworked Fizz on USB-C monitor/adapter (LG 27UD88, HP S240n, Dingdong, Hoho) as follows: 1. Plug-in boot 2. Manual recovery 3. Servo reset 4. EC reboot command 5. Warm reboot 6. Power button boot from S5 7. Suspend / resume Change-Id: I97a3fa671582552c029f7da140b55e7724b56ecc Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/963844
* Fizz: Log DP mode entry and exitDaisuke Nojiri2018-03-201-0/+4
| | | | | | | | | | | | | | | | | This helps us tell whether a monitor lost picture because the EC exited the DisplayPort mode or other reason. BUG=b:75288273 BRANCH=none TEST=boot Fizz Change-Id: I2da6a27c66f03ef780a0ed6f60a597a01f248942 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966993 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit b5fddbbe26ed27f1ade7d89e6acbeebaf15b315e) Reviewed-on: https://chromium-review.googlesource.com/966892