summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* usb_updater: always reboot cr50 in the end of the updatestabilize-8872.70.Bstabilize-8872.6.Bstabilize-8872.40.Bstabilize-8872.15.Brelease-R55-8872.BVadim Bendebury2016-10-061-2/+2
| | | | | | | | | | | | | | | | | | | With the recent modification of the tpm reset processing the only way to get the cr50 restart is to reset it internally. Make sure that usb_updater triggers the cr50 reset in the end of the update. BRANCH=none BUG=none TEST=with the corresponding init script changes the update on reef happens as expected. Change-Id: Ib49b81c4ef6d12d0b877a8a63493cf4d6d5aaeb0 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/394255 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* usb_updater: add missing help message sectionVadim Bendebury2016-10-061-0/+2
| | | | | | | | | | | | | | | The previously added '-b' command line option was left out from the help message. This patch fixes it. BRANCH=none BUG=none TEST=verified that -b command line option description is included in the help message. Change-Id: I71117a8653ae5094fd0bf3909c8715d6ec25259d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/394254 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cr50: bump up minor RW version fieldVadim Bendebury2016-10-061-1/+1
| | | | | | | | | | | | | | | In preparation to the new CR50 image release one more bump up the minor version number is required. BRANCH=none BUG=none TEST=none Change-Id: I7d998fc80bd4a45cfc12c003d056a36c93dcc1d3 Reviewed-on: https://chromium-review.googlesource.com/394253 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* tpm: do not try running endorsement commands before nvram is availableVadim Bendebury2016-10-061-2/+3
| | | | | | | | | | | | | | | | | | | | Recent tpm2 repository changes introduced more strict checks of the NV RAM operations' return status. The problem is that in case TPM is not manufactured tpm_endorse() is invoked before nvram is declared available, and this causes endorsement operation failure. Make sure NVRAM initialization is complete before endorsement is attempted. BRANCH=none BUG=none TEST=tpm manufacturing now succeeds again. Change-Id: I2217f33915ab8b4d872a9498def6d6862f4b1913 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/394129 Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org>
* cr50: add console commands to have parity with servoMary Ruthven2016-10-053-0/+105
| | | | | | | | | | | | | | | | | | | | | | This change adds apreset, ecreset, ec_rst, sys_rst and powerbtn options to the ccd console command. BUG=chrome-os-partner:58123 BUG=chrome-os-partner:56835 BRANCH=none TEST=manual sysrst resets the AP sysrst on/off controls SYS_RST_L ecrst resets the ec ecrst on/off controls EC_RST_L powerbtn 500 will simulate a power button press for 500 ms Change-Id: I89adc88eb407730c9d57811a07bfef8fcf63c5b9 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393809 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Enable spi_flash_read to read > SPI_FLASH_MAX_READ_SIZEphilipchen2016-10-052-24/+22
| | | | | | | | | | | | BUG=chromium:542789 BRANCH=none TEST=make buildall Change-Id: I55bf5bdb09b10be1c522ea4d843690abcc45abb2 Reviewed-on: https://chromium-review.googlesource.com/391867 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cts: Add I2C tests for read8/16/32 and write8/16/32Daisuke Nojiri2016-10-0512-5/+359
| | | | | | | | | | | | | | This patch adds tests for i2c_read8/16/32 and i2c_write8/16/32. BUG=chromium:653183 BRANCH=none TEST=make buildall. Run cts.py -m i2c for 100kHz with 10k ohms pull-up registers on SCL and SDA. TH=stm32l476g-eval DUT=nucleo-f072rb. Change-Id: I8121b1c5dc7542da45141543e35036ef41364c38 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393331 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Add a return code indicating timeoutDaisuke Nojiri2016-10-051-0/+1
| | | | | | | | | | | | | | This patch adds CTS_RC_TIMEOUT, which is returned when test encounters some sort of timeout. BUG=none BRANCH=none TEST=Run cts.py -m i2c. Make buildall Change-Id: I6d5cbcdde40f24e797e795f30f002da7621d089e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393330 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* stm32l4: Add i2c driverDaisuke Nojiri2016-10-053-2/+484
| | | | | | | | | | | | | | This patch adds master and slave drivers for stm32l4 family. Only slave functionality is tested. BUG=none BRANCH=none TEST=Run cts.py -m i2c. Make buildall. Change-Id: Ied77081ca0333ab3fec055cd4f0fcbdf8a79d388 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393329 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* reef: Enable CONFIG_HOSTCMD_FLASH_SPI_INFODavid Hendricks2016-10-051-0/+1
| | | | | | | | | | | | BUG=none (similar to chrome-os-partner:56765, though) BRANCH=none TEST=flashrom's "--flash-name" shows SPI chip info instead of EC info on reef Change-Id: I1090dd5d4079ff94201fce9fd3e03a384eb3cb7b Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/392349 Reviewed-by: Shawn N <shawnn@chromium.org>
* i2c: Move I2C_MAX_HOST_PACKET_SIZE to i2c.hDaisuke Nojiri2016-10-053-29/+35
| | | | | | | | | | | | | | | This patch moves I2C_MAX_HOST_PACKET_SIZE to include/i2c.h. It's currently used only by i2c-stm32*.c but should be commonly available for other chips. It also moves i2c_get_protocol_info to common/i2c.c for the same reason. BUG=none BRANCH=none TEST=make runtest Change-Id: I28d8bca0167bb7b2ce99574601a6efb62fc20eca Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393328 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Fix error message for uart port being occupiedDaisuke Nojiri2016-10-052-6/+6
| | | | | | | | | | | | | This patch fixes the error messages displayed when a UART port connected to DUT or TH is being occupied. BUG=none BRANCH=none TEST=run cts.py -m i2c Change-Id: I3fbb4068e8ee3af7a1b04f70ae70b3d870a19d2e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393327
* cts: Fail script when build or flash failsDaisuke Nojiri2016-10-052-7/+11
| | | | | | | | | | | | | | This change makes cts.py fail when building or flashing a module for DUT or TH fails. BUG=none BRANCH=none TEST=Made cts.py fail by injecting build and flash error Change-Id: Iec1e11f4a8c261eb4c989b118df218e86cb6f5f1 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393326 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util: Fix fifo_info when lost vectors are presentGwendal Grignou2016-10-051-3/+14
| | | | | | | | | | | | | | | | | | | Due to an error in ms_command_sizes, fifo_info command would fail when lost vectors are present: packet too long (16 bytes, expected 10) Reorder ms_command_sizes commands properly. Get the number of sensors present before printing the number of lost vectors per sensor. BUG=none BRANCH=none TEST=On cave (with broken MKBP support), check fifo_info is returning the lost vectors count. Change-Id: Ic745eb762563705372d8a670ce34eab15e188bf9 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/391887 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* i2c_passthru: Return NAK when battery not present.Aseda Aboagye2016-10-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual_battery_read() returns a cached value for some of the supported smart battery parameters. If a value isn't supported, it calls out to the actual battery. In the case of a battery that's not present, but a supported battery parameter is queried, we would still return _something_. This seems to confuse powerd and causes slow boot. This commit changes the i2c passthru command to return a NAK when the virtual battery is enabled but the battery is not present. BUG=chrome-os-partner:55954 BRANCH=gru TEST=Build and flash kevin. Unplug battery. Verify boot is nice and quick. Change-Id: Ib3ab768504c29904f01b91e6194a9689bfdb1e1e Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/392926 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit b5eb2d93820c9e1a162cb1b390b3563bf9effcd5) Reviewed-on: https://chromium-review.googlesource.com/393187 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* spi: Add lock around spi_transactionShawn Nematbakhsh2016-10-043-0/+9
| | | | | | | | | | | | | | | | | | | | | | spi_transaction() can be called from motionsense, hooks, hostcmd, console, and chipset tasks, so add a mutex to ensure an in-process transaction isn't preempted by another transaction. BUG=chrome-os-partner:57912 BRANCH=gru TEST=On kevin, run "while true; do ectool motionsense odr 0 0; sleep 1; ectool motionsense odr 0 1000000; sleep 1; done", verify watchdog crash not encountered after 20 minutes. Change-Id: I7ec495bab295dc03ce02372c20e5c7c5c196715d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/391892 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit eabdea443775fab834aaabbb7afae871306c7530) Reviewed-on: https://chromium-review.googlesource.com/392226 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Cr50: Removed Reef EVT workaroundsScott2016-10-044-63/+13
| | | | | | | | | | | | | | | | | | | | | | - changed the pad assignment for plt_rst_l from DIOA13 to DIOM3; - removed the board property used to keep uart rx disabled, Uart0 is now enabled by default on Cr50. - removed resetting fallback counter on USB updates for reef boards, they are going to use the same mechanism as kevin and gru. BRANCH=none BUG=chrome-os-partner:56540 TEST=Tested on Reef Board ID 1 and Gru Board ID 1. Verfied that plt_rst_l signal is being detected and that there are no interrupt storms related to not having a pullup resistor on the uart rx line. Verified that both platforms successfully boot into chrome OS using cr50 TPM. Change-Id: I300a0c75e60acbecf93500b46aced303955a192a Signed-off-by: Scott <scollyer@chromium.org> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/391140 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cr50: bump up minor RW version fieldVadim Bendebury2016-10-041-1/+1
| | | | | | | | | | | | | In preparation to the new CR50 image release bump up the minor version number to trigger autoupdate on the devices in the field. BRANCH=none BUG=none TEST=none Change-Id: I7744b8cb8436d9134ee5900b352487a1cdddcd28 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/392447
* i2cs: reset local variables when reinitializing.Vadim Bendebury2016-10-041-0/+17
| | | | | | | | | | | | | | | | | | | | | When tpm is reset the i2c slave interface initialization function is called, but it does not quite re-initialize the interface. This patch adds both a hardware pulse to make sure that the i2c slave interface state machine is set into the initial state, and code to zero static variables of the driver. BRANCH=none BUG=none TEST=with the change on the AP firmware side which prevents losing i2c ready interrupts early in the process tpm reset became much more reliable. Resetting from EC, AP of cr50 consoles reliably restarts reef without any TPM communications problems. Change-Id: I604607c32d4dfc554b245d3d3d82b9ad38271962 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/392306 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* Cr50: lock down the console a bit moreBill Richardson2016-10-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This removes some console commands that shouldn't be present in production builds, even when the console is unlocked. BUG=chrome-os-partner:57408 BRANCH=none CQ-DEPEND=CL:391045 CQ-DEPEND=CL:391188 CQ-DEPEND=CL:391244 CQ-DEPEND=CL:391314 CQ-DEPEND=CL:391611 CQ-DEPEND=CL:391612 CQ-DEPEND=CL:391613 CQ-DEPEND=CL:391614 CQ-DEPEND=CL:391127 TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Ic5034a87ba032b14a7e613e6debdbb635a7c1c9a Reviewed-on: https://chromium-review.googlesource.com/391046 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Cr50: fix CR50_DEV=1 overrideBill Richardson2016-10-021-1/+1
| | | | | | | | | | | | | | | | Commit 9e7c12b added a command-line option to "make" to build development versions of the Cr50 board. This makes the symbol definition useful in makefiles and not just C code. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Id0719d63263b00e192a2e4866dbe1551ae49e23c Reviewed-on: https://chromium-review.googlesource.com/391127 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* g: CONFIG_FLASH should be optionalBill Richardson2016-10-0212-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | The application may need to read/write/erase the flash memory, but we not want console users to do so. This CL adds CONFIG_FLASH_PHYSICAL, which allows the higher-level CONFIG_FLASH to be undefined while still providing the chip-specific flash_physical_* accessor functions. There aren't many board.h files that needed changes, since CONFIG_FLASH_PHYSICAL is enabled by default, just like CONFIG_FLASH. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 See that it still boots, updates, wipes, restores, etc. without linking common/flash.o in the production image; and that the flash commands are still there in the dev build. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I7eb1bbcb414b1c70ee427c4fcb5cea899dbb9e93 Reviewed-on: https://chromium-review.googlesource.com/391188 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Add more CONFIG_CMD_* options for console commandsBill Richardson2016-10-014-1/+11
| | | | | | | | | | | | | | | We have a large number of config.h options to enable/disable specific console commands. This adds a few more that we will want to control. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Change-Id: Id41f0e9f44fc77feaf56853f357a6b33bb685b0c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/391614 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Sort CONFIG_CMD_* options in config.hBill Richardson2016-10-011-49/+49
| | | | | | | | | | | | | | We have a bunch of options to enable/disable individual console commands, but they're not quite sorted. Now they are. BUG=none BRANCH=none TEST=make buildall Change-Id: I186b9f82dc40c2f9fc66f493b4b6cccda020224c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/391613 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* g: The hid command is only useful for debuggingBill Richardson2016-10-011-0/+3
| | | | | | | | | | | | | | | And even that's a bit of a stretch. This entire endpoint will probably be deactivated until it's more useful. In the meantime, we can just leave the one little debug command for debug builds. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Id4c185fe66d52fa49fcbee6a549df41d297c41af Reviewed-on: https://chromium-review.googlesource.com/391045 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* g: Remove the test_rdd commandBill Richardson2016-10-011-8/+0
| | | | | | | | | | | | | | The rdd features are working (and it's better to test with hardware anyway), so just delete this command. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Ifcfc8c8a0e61a9fe31d28f0c96bcb50c3e2b93b5 Reviewed-on: https://chromium-review.googlesource.com/391314 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Cr50: The panicinfo command is not safeBill Richardson2016-10-011-3/+3
| | | | | | | | | | | | | It's possible the register values could be sensitive. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Id3d4df3aaca116a638332f092d4727accd0cbbcd Reviewed-on: https://chromium-review.googlesource.com/391612 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Cr50: The devices command is safe.Bill Richardson2016-10-011-3/+3
| | | | | | | | | | | | | All it does is show the AP/EC/Servo state BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I375be8e4d9c6f01aa90d0830da1927732740ed92 Reviewed-on: https://chromium-review.googlesource.com/391611 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Cr50: The chan command is not safe.Bill Richardson2016-10-011-3/+3
| | | | | | | | | | | | | It could be used to sniff TPM commands. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Ia2e11fb8e01002c2cf5e53b175e3e8b2741e4585 Reviewed-on: https://chromium-review.googlesource.com/391244 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* power: rk3399: Enable PP900_PCIE earlier to prevent leakageShawn Nematbakhsh2016-09-301-2/+2
| | | | | | | | | | | | | | | | | | Enable PP90_PCIE along with PPVAR_LOGIC and PP900_AP to avoid leakage. BUG=chrome-os-partner:57952 BRANCH=Gru TEST=Verify kevin powers up / down successfully. Change-Id: I6fa47edcdde482d3fa2f249cfdff6e060a445f42 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390896 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit b41006ba84bc86e453c241296309fadf9a864032) Reviewed-on: https://chromium-review.googlesource.com/391037 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* ec: Remove fusb302 rev.A supportSam Hurst2016-09-291-102/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | We're using fusb302 rev. >= B now, so let's remove rev. A support. BUG=chrome-os-partner:57492 BRANCH=none TEST=Manuel - plug USBC->DP cable into TV then into kevin localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - plug USBC->DP cable into kevin then into TV localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - unplug USBC->DP cable from TV Port 0: OPEN INV - plug USBC->ETHERNET into kevin and verified that network displayed ethernet Change-Id: Ia84dc2480c1a8b003ab8dfdcdaa9f82f6d429e4b Reviewed-on: https://chromium-review.googlesource.com/388925 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* npcx: pwm: Fix prescaler calculationSam Hurst2016-09-291-15/+32
| | | | | | | | | | | | | | | | | | | | The pwm prescaler wasn't being calculated properly when used with the 32 Khz clock. BUG=chrome-os-partner:57526 BRANCH=none TEST=Manuel - With PWM frequency set to 100Hz, I verified on the scope that the duty cycle changed from 0 to 100% in 10% increments. - Verified on the scope that PWM frequency could be set to 100Hz, 200Hz, 300Hz, 400Hz, and 2600Hz. Change-Id: Idf8ffb6b20d469c9ea58e5a34e944f79d475eb15 Reviewed-on: https://chromium-review.googlesource.com/388814 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: bd9995x: Reset map command set on failed set operationShawn Nematbakhsh2016-09-281-4/+6
| | | | | | | | | | | | | | | | | | | If BD9995X_CMD_MAP_SET fails, the charger's internal map command set may be the old set (if the charger failed to process the command) or the new set (if the EC failed to receive the response). Therefore, reset the EC's known map command state on failure, so that it will always be re-set on the next transaction. BUG=None TEST=Build + boot kevin. BRANCH=Kevin Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Id16273ccf2e39b5aae7776d626aae8863e713df5 Reviewed-on: https://chromium-review.googlesource.com/390318 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* util/signer/gnubby.c: set home dir correctlyMartin Roth2016-09-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | If HOME is not set in the environment, the variable 'home' was getting looked up, but not set. This sets the variable. From https://scan.coverity.com/projects/chromium-ec : CID61407: Dereference after null check BUG=chromium:632768 TEST=Built all boards BRANCH=None Previously fixed in commit 4f6f505900a Change-Id: I77614ed96b5247fc7c6b08d810ea87150ff3adfd Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390411 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* nvmem: fix partition number assignment in nvmem.cVadim Bendebury2016-09-281-2/+3
| | | | | | | | | | | | | Partition number must be set before partition lock is attempted. BRANCH=none BUG=none TEST=the cert installation image does not crash on gru any more Change-Id: Ibc81e2e741fafb75f4e4bb5dbfc0dae32d354646 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390416 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* stm32: Fixed bugs with stm32l4 register masksChris Chen2016-09-272-10/+74
| | | | | | | | | | | | | | | Also filled out rest of CCIPR register defs for stm32l4 chip family BRANCH=None BUG=None TEST=make buildall Change-Id: Ic9d1f966068915e304a0994c49fa9bbafec6cdf4 Reviewed-on: https://chromium-review.googlesource.com/367830 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* kevin: hotplugging DP not workingSam Hurst2016-09-271-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Type-C to DP adapters generate two or more HPD events while others generate only one HPD event. Currently hotplugging only works with the former adapter. Now hotplugging is triggered on one or more HPD events. BUG=chrome-os-partner:57198 BRANCH=none TEST=Manuel - plug USBC->DP cable into TV then into kevin localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - plug USBC->DP cable into kevin then into TV localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - unplug USBC->DP cable from TV Port 0: OPEN INV Change-Id: Ied30f1eb3e1186b52067ffc9a37ed22a9012b457 Reviewed-on: https://chromium-review.googlesource.com/388737 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388531 Commit-Ready: Shawn N <shawnn@chromium.org>
* npcx: watchdog: Log watchdog panic informationShawn Nematbakhsh2016-09-271-0/+8
| | | | | | | | | | | | | | | | | | | | On EC panic events such as assertion fail, watchdog, etc. log the EC state to our persistent panic log so that it can be retrieved later. BUG=chrome-os-partner:57794 BRANCH=Kevin TEST=Run `crash watchdog` on kevin, then `panicinfo` on subsequent boot. Verify saved panic log matches watchdog dump. Change-Id: I06414f986458af1426b9b9720025144cd38a7a59 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389591 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389957 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* cr50: tpm: ignore sys_rst_l/plt_rst_l when TPM reset is in progressVadim Bendebury2016-09-273-3/+19
| | | | | | | | | | | | | | | | | | | | | | There is no point in invoking TPM reset while the current invocation is in progress. One of the cases when this is happening is early start up on Kevin/Gru: the device starts booting, the EC comes around to pulsing sys_rst_l when TPM is already busy installing endorsement certificates. There is no point in issuing another reset at that point, just let the process continue. BRANCH=none BUG=chrome-os-partner:52366 TEST=firmware_TPMKernelVersion firmware_TPMExtend autotests still pass on kevin. Certificate installation during startup does not get interrupted any more. Change-Id: Ibdface9f7a76186e210ef0f4111cd5fe9905bba9 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389811 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* bd9995x: Disable fast/pre-charging watchdog timerphilipchen2016-09-261-2/+2
| | | | | | | | | | | | | BUG=chrome-os-partner:55771 BRANCH=none TEST=make -j buildall TEST=bd9995x r 0x0f 1; verify 0x00. Change-Id: Ibfca44599b8a6d631215b2c9a50e810312559f3a Reviewed-on: https://chromium-review.googlesource.com/388819 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* tpm: reset communications channels when resetting TPMVadim Bendebury2016-09-266-42/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | TPM resets happen asynchronously, conceivably there is some interface (i2cs or sps) activity under way when TPM is reset. Sps driver provides a means of disconnecting the client of the driver, while the i2cs driver does not. Come to think of it, there is no real need to provide a special function to disconnect a client, this makes API simpler and allows to add driver initialization to the client registration function. To make tpm_registers.c more flexible - allow to register a callback for interface initialization, this way when TPM is reset, the interface can be also re-initialized and is guaranteed to start from scratch after reset. BRANCH=none BUG=chrome-os-partner:52366 TEST=both firmware_TPMExtend and firmware_TPMKernelVersion autotests pass Change-Id: I212166a23f9cd512d8f75315377d1f5620aea070 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388886 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* tpm: fix TPM resetVincent Palatin2016-09-261-1/+3
| | | | | | | | | | | | | | | | | | use the right prototype for the memset() clearing the TPM .bss space on reset, use addresses of variables instead of their values, and do not clear tpm_resisters.c .bss section, tpm_init() does the right thing. BRANCH=gru BUG=chrome-os-partner:52366 TEST=make buildall Change-Id: I4c8c0ae61a0e70c9fc211420bbf44bbc7d8de3ed Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389331 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* kevin: bd99955: Enable power save mode.Vincent Palatin2016-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The bug with USB data connection when the BD9995x power save mode is enabled has been solved. We can re-enable the low power mode to save energy. BRANCH=gru BUG=chrome-os-partner:57310, chrome-os-partner:57671 TEST=check that usb ethernet works after booting on kevin Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/384833 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 55e3f995bd603842ca304b02f5be32c61a271137) Change-Id: I7a58a339166ab01514b72a65f619d642f9eb057e Reviewed-on: https://chromium-review.googlesource.com/388807 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* power: common: Prevent console spam.Aseda Aboagye2016-09-261-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | The power state driver would print out the current power state along with its signals everytime a power signal interrupt was fired. On some systems, a signal may briefly go low and then come back before our chipset module has a chance to notice. This causes what appears to be duplicate prints. This commit tries to only print out the current power state when something has actually changed. If the input power signals or state differs from the last time it checked, then the information will be printed. BUG=None BRANCH=gru TEST=Find a kevin where PGOOD goes away quite frequently. Build and flash; Verify that significantly less "power state S0" console spam is emitted. TEST=Verify that all state transitions are still printed. Change-Id: I9d66c04e2ed79ab203c54f0a8dad82f32856bbf0 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/388761 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cr50: I2CS TPM: Prevent sleep when I2CS is activestabilize-8838.BScott2016-09-253-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the TPM SPI interface, added code to disable sleep an I2CS interrupt is received. Enabling sleep follwoing a 1 second delay when the TPM fifo register has been read by the host. The I2CS TPM layer doesn't know when a command has finished, but the one second delay is more than enough delay since sleep will be disabled again when the next I2CS interrupt is received. BRANCH=none BUG=chrome-os-partner:40397 TEST=manual Tested without these changes first. Shortened sleep delay to 30 seconds, and disconnected suzyq. Waited 30 seconds then issued the command on the AP console: tpmc read 0x1007 0xa [ 59.796813] tpm tpm0: tpm_transmit: tpm_send: error -16 ERROR: write failure to TPM device: Device or resource busy In addition, using logic analyzer verifed that there was activity on SDA/SCL but no response from Cr50. With this CL in place, ran the test and got the following: tpmc read 0x1007 0xa 2 0 1 0 1 0 0 0 0 4f With the logic analyzer I was able to confirm that there was no activity from the host on the I2CS bus until the command was issued. Change-Id: If07573ae8f72b983bca57979d53c22660b91b95e Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/387910 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* Cr50: I2CS: Fixed i2cs word aligned fifo write functionScott2016-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed an issue with word aligned write to fifo routine. There were two errors. In the top section, the fifo was being read always from the beginning word or the hw fito, but the updated word was written back to the proper location. The same error was in the section that dealt with the last < 4 bytes. Both have been corrected. The error in the top section would in practice be invisible because flow control prevents TPM fifo reads from happening while one is in progress. The error in the bottom section was responsible for the problem as described in chrome-os-partner:57782. BRANCH=none BUG=chrome-os-partner:57782 TEST=manual Used special AP fw build that supports a 'tpm_raw' command to initiate the Cr50 TPM fifo write/read. 'tpm_raw 0x80 0x01 0x00 0x00 0x00 0x16 0x00 0x00 0x01 0x7a 0x00 0x00 0x00 0x06 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x7f' Without this CL, the 1st two bytes were incorrect ~50% of the time. With the fix in place, verified that the first two bytes returned were always correct. Change-Id: Iff7620561eee463d599abfa6c07455c56bb5a5a6 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388785 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cr50: make sure board resets when cr50 resetsVadim Bendebury2016-09-241-0/+10
| | | | | | | | | | | | | | | | | | | | cr50 should pretty much never reset, but when it does, for whatever reason, the device it is running on must reset as well. This patch makes every cr50 reset (be it command line induced, or caused by an exception) a hard reset, such that it re-initializes the R-box, which in turn causes reset of the entire platform. CQ-DEPEND=CL:361680 BRANCH=none BUG=chrome-os-partner:55948 TEST=verified that running commands like 'reset' or 'md 0xf0000' (which triggers an exception) causes the entire chromebook to reboot. Change-Id: Ifa160450b9b4c5ef25e512caf1ffdced9c97acd6 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388007 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Cr50: Lock console by default, with long timeoutBill Richardson2016-09-241-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This locks the Cr50 console by default, and makes the unlock process take the full 5 minutes unless the battery is removed. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; test on Gru & Reef Build the image with make buildall or make BOARD=cr50 Put it on Gru & Reef, and confirm that the console is locked, by running "lock" or "help". Try to unlock it with "lock off" and observe that you have to poke the power button for five minutes before it unlocks. Remove the battery and confirm that "lock off" now only requires a single power button press to take effect. Build the image with CR50_DEV=1 make BOARD=cr50 and now the behavior is back to the way it was before this CL. Change-Id: I9f2cc67a1dd63f260221a8711a8591070018be3b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389238 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cr50: Unlock console quickly when battery is unpluggedBill Richardson2016-09-241-25/+56
| | | | | | | | | | | | | | | | | | | | | | The assumption is that removing the cover and disconnecting the battery is sufficiently obvious and time-consuming that it's not necessary to sit there poking the power button repeatedly. We still erase the NVMEM completely before unlocking, of course. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall; test on Gru Toggle the Cr50 console with "lock on", then "lock off". Confirm that the 5-minute process only requires one poke when the battery cable is disconnected. Also confirm that both ways abort if you don't press the button at all. Change-Id: Iaa0f5eb102b914c95f3a34002438cbe80affcfb5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388879 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cr50: Clear NVMEM before unlocking the consoleBill Richardson2016-09-244-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | The Cr50 console provides access to all sorts of dangerous commands. To protect user secrets, we must erase the persistent storage before unlocking the console. Note that this will not powerwash the AP, leaving you with the impression that you've just forgotten your password. You'll have to manually powerwash (Ctrl+Alt+Shift+R) afterwards. That will be addressed in a future CL. BUG=chrome-os-partner:55728 BRANCH=none TEST=make buildall, test on Gru Lock the console if it's not already ("lock enable"), then unlock it with "lock disable". Confirm that the NVMEM region is erased following a successful unlock process. Change-Id: Iebcd69c9f757f5ab5d496218f065197d3f1f746c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/382666 Reviewed-by: Randall Spangler <rspangler@chromium.org>