summaryrefslogtreecommitdiff
path: root/common/host_command_master.c
Commit message (Collapse)AuthorAgeFilesLines
* common: host_command_master: Add buf to .bss.slow.Aseda Aboagye2015-11-091-2/+2
| | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:46056 BUG=chrome-os-partner:46063 BRANCH=None TEST=Enable CONFIG_REPLACE_LOADER_WITH_BSS_SLOW on GLaDOS. Build, flash, and verify that AP and EC boot. TEST=make -j buildall tests CQ-DEPEND=CL:311209 Change-Id: Idb078b537addd0439f71f99489c27a6d1303ec5a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/311426 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: Add timeout for HC flash commands.Todd Broch2015-01-071-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For flash commands add timeout so if VDM doesn't return properly host can receive error message. Note, for flash erase its performed by page at a cost of 20-40ms according to datasheet. For hoho/dingdong that leaves maximum erase time at 40ms * 32 =< 1280ms which is above the host command timeout. Increasing the host command delay (i2c bus pending) is not an option and since the erase will complete and subsequent erases will be much faster do to early out in physical_flash_erase this solution should be acceptable. Future CLs could alternatively push the burden of command latency to host altogether and return EC_RES_SUCCESS in similar fashion to reboot command. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:33947 TEST=manual, if VDM doesn't return by timeout HC command is properly returned EC_RES_TIMEOUT error code. Change-Id: I33c515200c2999dd97fdd690a7e900c5548b2d47 Reviewed-on: https://chromium-review.googlesource.com/238290 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* samus: add automatic retries for host commands from EC to PDAlec Berg2014-09-171-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add three retries for EC to PD host commands. With this change, removed retry mechanism in host_command_pd.c which was a retry only for the specific EC_CMD_PD_EXCHANGE_STATUS host command. BUG=chrome-os-partner:32006 BRANCH=none TEST=Loaded EC code onto samus. Added the following code for testing failed host commands to samus_pd common/host_command.c host_command_task(): if ((evt & TASK_EVENT_CMD_PENDING) && pending_args) { if (i++ != 4) pending_args->result = host_command_process(pending_args); else { pending_args->result = -7; i = 0; } host_send_response(pending_args); } This test code on samus_pd drops one in every five host commands. With this code, from the EC, I send "pdcmd 0 0", and verified that 1 out of 5 times the EC prints a host command failed code, but then retries successfully. Change-Id: Ibf43feefbfc7d791c45c6689b82c66f5d71046ab Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217461 Reviewed-by: Todd Broch <tbroch@chromium.org>
* samus: add host commands for flashing zinger RWAlec Berg2014-08-261-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new host commmand for sending RW updates to PD devices. The host command has a variety of sub-commands for performing the update, including: erase RW, reboot, write new hash, write flash. To program zinger RW, you should send host commands in this order: write new hash to all 0's reboot (zinger boots into RO since RW hash doesn't match) erase RW write flash write new hash to match contents of RW reboot This also adds an ectool command to write a new RW. Just pass it the RW .flat or .bin file. BUG=chrome-os-partner:31361 BRANCH=none TEST=ectool --dev=1 --interface=lpc flashpd 0 0 zinger.RW.flat Change-Id: Ia81615001b83ad7ee69b1af2bf1d7059177cde04 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213239 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Hold I2C lock through entire PD read transactionShawn Nematbakhsh2014-08-091-2/+5
| | | | | | | | | | | | | | | | | | | I2C reads from the PD happen in two separate transactions, but no stop condition is set after the first transcation. Therefore, it is necessary to lock the I2C bus across both transactions to prevent other tasks from using the bus in between. BUG=chrome-os-partner:29839 TEST=Manual on Samus. Boot to recovery screen, plug + unplug power supply, verify that no I2C error messages are printed to console. Then repeat 100x. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ie441637f499980a349022e281379ad2cc825b1aa Reviewed-on: https://chromium-review.googlesource.com/211649 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Use mutex for EC->PD host commandsRandall Spangler2014-07-301-6/+28
| | | | | | | | | | | | | | | | Host commands can be generated by either the PDCMD task (in response to PD interrupts), or the HOSTCMD task (in response to passthru requests). Use a mutex to serialize access to the EC->PD interface. BUG=chrome-os-partner:30079 BRANCH=none TEST=Boot samus Change-Id: If65d5eb4bbef91e6c811a06ea2e1487e17143dc7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210401 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* i2c: add support for timeout configuration at runtimeRandall Spangler2014-07-301-0/+6
| | | | | | | | | | | | | | | | | When the EC sends longer commands to the PD chip (such as flash erase/write over the passthru from AP), allow it to take a second instead of the default 100ms timeout. BUG=chrome-os-partner:30935 BRANCH=none TEST=samus boots battery command works from EC console ectool passthru of flash erase to PD works (requires hacked ectool) Change-Id: I08ff94f7ac6aee351aa73c9d28b5fd715d463b3a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/209936 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: Add EC <-> PD i2c interface using host commandsAlec Berg2014-06-051-0/+185
Initial support for EC to PD communication using host command interface over i2c. BUG=chrome-os-partner:28351, chrome-os-partner:28352 BRANCH=none TEST=on EC console send hello host command: > pdcmd 0x01 0 0xa0 0xb0 0xc0 0xd0 Host command 0x01, returned 4 a4 b3 c2 d1 Change-Id: I0969808f455574ee456d6db8a60ce9b1204a0739 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200786 Reviewed-by: Randall Spangler <rspangler@chromium.org>