summaryrefslogtreecommitdiff
path: root/util/comm-host.h
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-103/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util/comm-i2c: Add switch to specify I2C busHarry Cutts2019-10-041-1/+2
| | | | | | | | | | | | | | | | | | | | Currently, devices running CrOS EC that aren't actually the embedded controller (such as touchpad or fingerprint MCUs) can only be contacted over I2C if they are in the device tree. To avoid having to recompile the Kernel, Coreboot, or `ectool`, the `--i2c_bus` switch allows `ectool` to be used for testing as-is. BRANCH=none BUG=none TEST=Checked various commands (hello, version, inventory...) with `--i2c_bus=7`, connecting to a MAX32660. Verified that a contradictory `--interface` switch is rejected. Checked that invalid bus numbers (≥32) are rejected. Change-Id: I92f3307bbbdf88978b9f8271610a3ae222279767 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828064 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-4/+4
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ectool: Don't acquire lock when dev interface is usedDaisuke Nojiri2019-01-051-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The /dev/cros_ec interface has a built-in mutex, thus we do not need to use /run/lock to arbitrate access since we can assume other tools (mosys, flashrom) also use the dev interface. $ generate_logs ... feedback/cbi_info ... $ cat feedback/cbi_info [0] As integer: 1 (0x1) As binary: 01 02 [1] As integer: 3 (0x3) As binary: 03 [2] As integer: 103 (0x67) As binary: 67 3a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:849399 BRANCH=none TEST=Verify 'ectool version' runs on Nami. Verify lock is acquired when '--interface=lpc' is specified. Verify debugd can run cbi_info. Change-Id: Id94317472917a974218bb137bda11fe5618a4b88 Reviewed-on: https://chromium-review.googlesource.com/1393729 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ectool: use poll interfaceVincent Palatin2018-01-231-0/+10
| | | | | | | | | | | | | | | | | | | Test polling for MKBP events through the kernel cros_ec/pd/fp/.. driver node. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:69460856 TEST=run on Eve EVT: ectool --name=cros_fp fpmode fingerdown && \ ectool --name=cros_fp waitevent 5 10000 Change-Id: Ibdec137a3b646cf017a29afcf24ff5bbfb731198 Reviewed-on: https://chromium-review.googlesource.com/806167 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* ectool: add servo v2 spi supportVincent Palatin2018-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new transport for ectool to send host command V3 over the Servo v2 SPI interface using libftdi. Build this new communication mechanism only for the 'build' architecture as it has a dependency on libftdi, the new ectool binary is called ectool_servo. Fix the 'build' tools build if they don't have a source file matching their binary name. The serial number of the servo board can be passed in the 'name' parameter, e.g. : sudo ectool_servo --name=905537-00474 version Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:70320279 TEST=with ZerbleBarn connected to a servo V2, run: sudo ectool_servo version Change-Id: Ia7067d465a42f76695fed5932f32fac9a6d0988e Reviewed-on: https://chromium-review.googlesource.com/864164 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* ectool: Revert "ectool: Remove CROS_EC_DEV_IOCRDMEM"Gwendal Grignou2016-04-221-11/+0
| | | | | | | | | | | | | | | | | CROS_EC_DEV_IOCRDMEM must be used on architecture where legacy IO mapped registers are accessed inderectly via EMI. The kernel is taking care of the translation. TEST=Check on reks that we need to use the IOCTL. BUG=chrome-os-partner:52550,chromium:602832 BRANCH=none This reverts commit de45353bbdf0 ("ectool: Remove CROS_EC_DEV_IOCRDMEM"). Change-Id: I8efad56df90c58c25bdc9ccd70a508547e629a77 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340348 Reviewed-by: Shawn N <shawnn@chromium.org>
* ectool: Remove CROS_EC_DEV_IOCRDMEMGwendal Grignou2016-04-151-0/+11
| | | | | | | | | | | | | | | | | On !LPC EC, we can read memory via CROS_EC_DEV_IOCXCMD ioctl, using command EC_CMD_READ_MEMMAP. On platform that supports direct memory access (lpc), we access the memory directly, bypassing the ioctl. BUG=chromium:602832 TEST=On gnawty and veyron, check 'ectool battery' works. Verify that gnawty use io mapped registers. BRANCH=none Change-Id: I9bfcddcf450bf8df63ead78e1df97dd7392289e6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338853 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: fix all the header guardsBill Richardson2015-06-181-3/+3
| | | | | | | | | | | | | | | This unifies all the EC header files to use __CROS_EC_FILENAME_H as the include guard. Well, except for test/ util/ and extra/ which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively. BUG=chromium:496895 BRANCH=none TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029 Reviewed-on: https://chromium-review.googlesource.com/278121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: add new parameter to identify proper EC.Gwendal Grignou2014-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add parameter name to identify which EC to talk to. Superseed --dev parameter, removed soon. --name cros_ec (the default): send commands to /dev/cros_ec. --name cros_pd: send commands to /dev/cros_pd. ... BUG=chrome-os-partner:31513 TEST=Tested on samus: check ectool --name cros_pd version returns proper data: ectool --name=cros_pd version RO version: samus_pd_v1.1.2079-8e4f9fc-dirt .... CQ-DEPEND=CL:217297 BRANCH=ToT Change-Id: Ie8b5c6c184d73a89b4445e88d6f104169176b9f3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217311 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: add options for device passthru and interfaceRandall Spangler2014-07-161-5/+31
| | | | | | | | | | | | | | | | | | | | | | This allows sending host commands to the PD chip through the EC. The --interface option allows forcing a particular host interface. This is necessary at present because the crosec device driver doesn't support host protocol v3 so only has 8-bit command numbers. BUG=chrome-os-partner:30079 BRANCH=none TEST=from EC console, ectool version -> prints EC version ectool --interface=lpc --dev=0 version -> prints EC version ectool --interface=lpc --dev=1 version -> prints PD version ectool --interface=lpc --dev=2 version -> prints error ectool --interface=i2c version -> can't find EC ectool --interface=dev version -> prints EC version Change-Id: I9dd10578dac77e3e104d19e2f37759814eec6ca2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207948
* ectool: Return non-success exit code on bad EC status.Shawn Nematbakhsh2013-08-071-0/+3
| | | | | | | | | | | | | | | | When running certain ectool commands, our ioctl may succeed, yet our command may not be successful for a variety of reasons (see ec_status enum). In this case, we should return a non-success exit code so that we can easily detect such failures in scripts. BUG=chrome-os-partner:21171. TEST=Pass FAFT suite on Peppy. Pass factory tests on Peppy. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162 Reviewed-on: https://gerrit.chromium.org/gerrit/64686 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Comm interface now provides max I/O sizes and preallocated buffersRandall Spangler2013-07-011-3/+14
| | | | | | | | | | | | | | | | | | | | The maximum packet / param size differs depending on interface and protocol version. Commands can now ask the comm interface what the limits are, and can use preallocated buffers to avoid needless malloc/free. BUG=chrome-os-partner:20571 BRANCH=none TEST=the following all work on link burn_my_ec ectool version ectool chargedump ectool console ectool i2cxfer 5 0x41 2 Change-Id: Ib847994da3f79721e7fb4e347231b9147a3f485f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60275
* ectool prefers /dev/cros_ec, then falls back to i2c, lpcBill Richardson2013-06-051-15/+12
| | | | | | | | | | | | | | | This is preparation for the common userspace EC interface. If/when that appears, this will be ready. BUG=chromium:239197 BRANCH=all TEST=manual Build, install, run it. Shouldn't be any change. Change-Id: I9fa78515ec5443ba659f10a66bbaadcb7f4802b0 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56131
* Support new-style LPC command interface in EC, ectoolRandall Spangler2012-07-121-1/+1
| | | | | | | | | | | | | | | | | | Both EC and ectool are still backwards-compatible to the old interface. BUG=chrome-os-partner:11275 TEST=manual From U-boot prompt: mkbp hash // test old host talking to new EC From root shell: ectool echash // test new host talking to new EC You can also update just the OS and use an old EC, and verify that 'ectool echash' still works, which tests a new host talking to an old EC. Change-Id: I2afbb208cb16836f842ba119b74b1ab6a38ce5d5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27313
* Add memory-mapped data support for I2C and SPI protocolsRandall Spangler2012-07-071-0/+5
| | | | | | | | | | | | | | | And fix returning memory-mapped string length on LPC as well. BUG=chrome-os-partner:11090 TEST=manual from EC, 'hostevent set 0x40000' from host, 'ectool eventget' --> should print 0x40000 Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I9edbd0a1468b5d4160ce67c471332226e51fa868 Reviewed-on: https://gerrit.chromium.org/gerrit/26719 Reviewed-by: Simon Glass <sjg@chromium.org>
* Tidy util headers and make ec_commands.h not include other headersRandall Spangler2012-06-291-1/+2
| | | | | | | | | | | | | In preparation for being able to copy ec_commands.h to u-boot, which is itself in preparation for u-boot picking it up from /usr/src/ec/ BUG=none TEST=make link, snow, bds Change-Id: If256434b6722ff0787ce21a8ed4c7035c28024a8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26451 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* Change ec_command() to return negative values for errorsRandall Spangler2012-06-291-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is more compatible with kernel and u-boot, and will make it easier to share code between the ec project and those. BUG=none TEST=manual: ectool version -> should work normally on ec, do 'hostevent set 0x40000'. Then at root shell ectool queryec EC returned error result code 19 ectool flashread 0x100000 16 foo Reading 16 bytes at offset 1048576... EC returned error result code 2 Read error at offset 0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I5e2a85f96c874d0730c14e1438a533649cd594f8 Reviewed-on: https://gerrit.chromium.org/gerrit/26359 Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Split communication functions from host toolsVincent Palatin2012-05-241-0/+29
Preparatory work to re-use the tools on ARM boards using I2C communications. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=make BOARD=link && make BOARD=bds && make BOard=DAISY Change-Id: I31d41f30c3231a4a9349b939bf6bba871ed4c383