summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* Remove board 'wolf' from master/ToT branch.stabilize-falco-4537.91.Bstabilize-4537.147.Bstabilize-4537.118.Brelease-R30-4537.BDave Parker2013-08-121-1/+1
| | | | | | | | | | | | | | Firmware development for this board is happening on the firmware-wolf-4389.24.B branch. BUG=chrome-os-partner:21815 BRANCH=None TEST=Run util/make_all.sh. Verify all is made. Change-Id: I4b58a982a87562231453f3f201024b809c6a24fb Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65514 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: Return non-success exit code on bad EC status.Shawn Nematbakhsh2013-08-072-0/+4
| | | | | | | | | | | | | | | | 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>
* Peppy ectool led commandDave Parker2013-08-071-11/+36
| | | | | | | | | | | | | | | | | | | | | Glue between the existing ectool led command and the led control logic. BUG=chrome-os-partner:20776 BRANCH=peppy TEST=Manual. Run "ectool led" commands: Should pass: ectool led power blue|yellow|off|auto|blue=1 yellow=1 ectool led battery blue|yellow|off|auto|blue=1 yellow=1 Should fail: ectool led adapter <color> ectool led power|battery red|green|white Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I2540940baa553866760dd9ae62278b6b845793ef Reviewed-on: https://gerrit.chromium.org/gerrit/64627
* Pass command line arguments to make from make_all.shVic Yang2013-08-011-1/+1
| | | | | | | | | | | | | | | | This would allow us to do something like: util/make_all.sh -j32 util/make_all.sh V=1 BUG=None TEST=util/make_all.sh -j TEST=util/make_all.sh V=1 BRANCH=None Change-Id: Ifed0baf6c94fbe8b0296cbdc70ba84f92f04b75b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64268 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ectool: fix console commandAaron Durbin2013-07-261-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few issues with console output: 1. The EC was returning more bytes than the message's insize. The reason stems from a refacotring that the set the global ec_max_insize variables to 'EC_PROTO2_MAX_PARAM_SIZE - 8'. It really should be EC_PROTO2_MAX_PARAM_SIZE to cover the maximum packet size returned from the EC. 2. A change was made to handle EAGAIN returning from the EC kernel driver's ioctl() interface. That change prevented 0 bytes received from being returned properly. The first issue occurs because the EC console is always larger than what the original ec_max_insize was set to. This caused no console messages to be displayed. The second issue causes the console command to potentially loop forever because the drain of the EC console is never indicated because 0 could never be returned. BUG=chrome-os-partner:21165 BRANCH=falco,peppy TEST=Built and can now read 'ectool console' output as well as not including gargabe. Change-Id: I3114594f0020a5198532aa78ce126f4da6caf09a Reviewed-on: https://gerrit.chromium.org/gerrit/63445 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Aaron Durbin <adurbin@chromium.org> Tested-by: Aaron Durbin <adurbin@chromium.org>
* Reboot emulator with execv()Vic Yang2013-07-241-11/+2
| | | | | | | | | | | | | | | | With this, the emulator is able to reboot itself without the help of run_host_test script. This makes it easier for development and also speeds up the test. BUG=chrome-os-partner:19235 TEST=Pass all tests BRANCH=None Change-Id: Ifa510442de19256c671ab91b6bc75fe9e8b9dc7b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62969 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add a script to build all platforms and run host-based unit testsRandall Spangler2013-07-241-0/+17
| | | | | | | | | | | | | | | | As the number of boards grows, it's handy to have a script which builds them all and runs host-based unit tests, to make sure that changes are at least somewhat sane before submitting them to the commit queue. BUG=none BRANCH=none TEST=util/make_all.sh Change-Id: Ie3fcb062caedaf36b3e350c3d9be34a9b080c76d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63230 Reviewed-by: Rong Chang <rongchang@chromium.org>
* Truncate version string to 32 charactersRandall Spangler2013-07-191-4/+17
| | | | | | | | | | | | | | | | | | | | | | | The version struct and EC_CMD_GET_VERSION assume 32-character version strings. But if the git tree is dirty and the board name is long, the version string overflows that limit. This change truncates what's stored in the version string to fit. The build info still contains the full version string, as it did before. BUG=chrome-os-partner:21156 BRANCH=none TEST=build BOARD=mccroskey with a dirty tree; it should build. Then cat build/mccroskey/ec_version.h to see CROS_EC_VERSION32 has truncated the version string. Then build a platform of your choice and type 'version' to see that the version string and build info is still reported correctly. Change-Id: Ie71b8efd99a83315f8b4d5ad10c51e48781b12f4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62649 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add ectool discharge command to Falco and Peppy.Dave Parker2013-07-191-13/+27
| | | | | | | | | | | | | | | | | | Expands and renames ectool 'chargeforceidle' command to 'chargecontrol'. Board-specific calls are needed to enable and disable the discharge while on AC power state. BUG=chrome-os-partner:20506 BRANCH=falco,peppy TEST=Run ectool chargecontrol command with each option (normal, idle, discharge) on Falco and Peppy. Verifiy battery is discharging in discharge mode via EC console 'battery' command. Change-Id: I7ac2b18b4f143bf6abc1e0bb878ad21a99f52100 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60689 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add EC_CMD_GET_FLASH_INFO version 1Randall Spangler2013-07-181-2/+18
| | | | | | | | | | | | | | | | | | | | | This adds two new fields: the ideal write size for best EC flashing performance (e.g., page mode instead of word mode), and a flags field with a flag to indicate whether the EC erases its bits to 0 or 1. The EC still supports the old version 0 command, since u-boot and flashrom expect that to work. BUG=chrome-os-partner:20973 BRANCH=(all haswell); this will speed up flashing and software sync TEST=ectool flashinfo 1. old EC, new ectool -> only reports version 0 info 2. new EC, old ectool -> only reports version 0 info 3. new EC, new ectool -> reports new fields Change-Id: I484327fe22a58d2b69d7f6ac767b2d3e81b3e0b7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62378 Reviewed-by: David Hendricks <dhendrix@chromium.org>
* Add 'version' option to ectool test command.Bill Richardson2013-07-161-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just handy to be sure we're correclty passing the command version to the EC. BUG=chromium:242706 BRANCH=falco, peppy TEST=manual Run "hcdebug params" the EC console (using ToT EC) Compare the output on the EC console when you run these two commands on the host: ectool test 0 13 ectool test 0 13 1 You should see these two lines (among other things): [5728.756652 HC 0x0a.0:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [5730.809596 HC 0x0a.1:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] The "0x0a.0" and "0x0a.1" indicate that the version is being passed correctly. Change-Id: I23b97ac6622274a157717f9375945d0866691a37 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61920 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Split wireless power/radio control out of switch.cRandall Spangler2013-07-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Chipset control of wireless power uses the new API instead of overriding the wireless power itself. Refactor board-specific support for it to just a few config #defines instead of board-specific functions. This makes some assumptions about the polarity of the enable signals. Not making those assumptions would require defining an array of structs or some other heavier-weight board-specific info. Since the assumptions hold for all current boards, let's make them now because this is a step in the right direction, and reserve doing something more general until we actually have a use case for it (so we build in just the flexibility we need). BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; see that link wifi turns on at boot and off at shutdown (verify via 'gpioget' from EC console) Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61608 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Uprev panic data struct versionVic Yang2013-07-101-6/+28
| | | | | | | | | | | | | | | | The struct was changed in commit 74c34bbad, but the struct version was left as 1. We need to uprev this so the data returned by host command is useful. BUG=chrome-os-partner:16901 chrome-os-partner:20548 TEST='ectool panicinfo' with new and old struct. Compare output with output from console command 'panicinfo'. BRANCH=None Change-Id: I4df3142497dc5ee21d100c4cb8118fb7a0ce7a7e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60314 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* Initial board commit for Wolf based on Slippy.Dave Parker2013-07-091-1/+1
| | | | | | | | | | | | | Additional fix-ups will come in subsequent CLs. BUG=chrome-os-partner:20760 BRANCH=wolf TEST=Verify "make BOARD=wolf" complete succesfully. Change-Id: I24a37f3bebb1feb37c83c2c1b4f8f8db7bbcb2d8 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61318 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Fix uninitialized constant in util/comm-dev.cBill Richardson2013-07-091-1/+1
| | | | | | | | | | | | | | | | | | This made the /dev/cros_ec method fail when reporting the version. BUG=chrome-os-partner:20571 BRANCH=none TEST=manual ectool version Used to fail; now it works again. Change-Id: Ib5b7188f713981cffce36d065255d81b102d4bbe Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61133 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Move protocol v2 constants to ec_commands.hRandall Spangler2013-07-033-14/+9
| | | | | | | | | | | | | | | | These constants are scattered around the various interface implementations and should be in one place. This will also clean up the u-boot side when ec_commands.h is copied there. BUG=chrome-os-partner:20257 BRANCH=none TEST=build link, spring, pit; test 'ectool hello' Change-Id: Ib1425db00ec8220538d8c5c65107ac9548009516 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60810 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* ec: puppy: add support to flash ecJimmy Zhang2013-07-031-1/+1
| | | | | | | | | | | | BUG=none TEST=flashed ec on venice board Change-Id: I9a8ba6fcbc974d971af7af0f84ff7088cd69b987 Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/60706 Reviewed-by: Andrew Chew <achew@nvidia.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Use EC_CMD_READ_MEMMAP on platforms without mapped memory.Bill Richardson2013-07-031-6/+21
| | | | | | | | | | | | | | | | | | LPC-based ECs provide a region of memory that is mapped into the AP's address space, making it easy to read. This CL uses an alternate EC host command to read that region, for those systems that don't have mapped memory. BUG=none BRANCH=none TEST=none I tested this by building a special command into ectool. Change-Id: If5cc52356f61522ae96e20d4c5d365accc299987 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59662
* Retry ectool commands that return EC_RES_IN_PROGRESSBill Richardson2013-07-031-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This came up when testing issue 242706. If you tell the EC to return EC_RES_IN_PROGRESS, then the EC gets stuck and times out on the next command. I'm not entirely sure what the correct response should be, but I think that the EC might not be doing the right thing either. In any event, this keeps it from getting stuck. BUG=none BRANCH=none TEST=manual Try ectool test 8 14 ectool test 0 14 The first command fails because we told it to, but the second command also fails because the EC is expecting something else. After this change, the second command works. Change-Id: I513294396cff872018316c354d2c41953eb6fdf6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59661
* ectool: Correct the empty console checkSimon Glass2013-07-021-2/+3
| | | | | | | | | | | | | | | | | | | | ectool is waiting for an empty response from the EC to tell it to stop requesting console data. However, the EC only sends an empty response when there is no snapshot data. In particular, it seems to send a 1 byte response (containing just a \0 byte) when there is an empty string. Adjust the check to stop when no data is provided. BUG=chrome-os-partner:20639 BRANCH=none TEST=manual Run on test device and see that 'ectool console' now completes and does not run forever. Change-Id: I565f1be506833c823e5e7eca09be8b2420c8190c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60640 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Add get-protocol-information commandRandall Spangler2013-07-021-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary to support larger packet sizes for host protocol ver.3. The host previously didn't have any way to know how big a packet the EC could accept / respond with (except on LPC, where the size is determined by the I/O window). BUG=chrome-os-partner:20257 BRANCH=none TEST='ectool protoinfo' returns good info; on link, Protocol info: protocol versions: 2 3 max request: 256 bytes max response: 256 bytes flags: 0x00000000 and on pit, Protocol info: protocol versions: 2 3 max request: 544 bytes max response: 544 bytes flags: 0x00000001 Change-Id: Ic1e3831d9b4a96ffbf365c0d09b6023472de39a9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60703 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Allow bigger flash write commandsRandall Spangler2013-07-014-8/+119
| | | | | | | | | | | | | | | | Version 1 of EC_CMD_FLASH_WRITE will use as big a write as possible given the available command parameter space. Falls back to 64 byte writes on old platforms. BUG=chrome-os-partner:20571 BRANCH=none TEST=Copy burn_my_ec onto a link and run it. Write size should be 64 bytes for the first half of the update (since the old EC doesn't support ver.1 of the write command) and 240 bytes for the second half of the update. Change-Id: I5900de3a5700d7c82a2e0c3cf9921b7ced1c0343 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60511
* Comm interface now provides max I/O sizes and preallocated buffersRandall Spangler2013-07-018-42/+76
| | | | | | | | | | | | | | | | | | | | 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
* Add common interface to EC flash commandsRandall Spangler2013-07-015-72/+184
| | | | | | | | | | | | | | | | | ectool and burn_my_ec need to use the same lower-level interface to the EC flash commands, rather than duplicating calling the low-level flash read/write/erase commands. This is a precursor to refactoring the low-level commands to support SPI/STM32L in a follow-up CL. BUG=chrome-os-partner:20571 BRANCH=none TEST=in a root shell, burn_my_ec flashes both RO and RW EC code Change-Id: I4c72690100d86dbff03b7dacc2fb248b571d3820 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60266
* Split file read/write functions out of ectool.cRandall Spangler2013-06-284-81/+125
| | | | | | | | | | | | | | | | ectool.c has gotten monstrously huge. Refactor out some utility functions. This is precursor work to refactoring out a lower-level flash read/write interface. BUG=chrome-os-partner:20571 BRANCH=none TEST=ectool flashread 0x20000 0x80 /tmp foo -> works Change-Id: I26dae609a73e54e8adaec56edbdce6a0bb4b8758 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60265 Reviewed-by: Vic Yang <victoryang@chromium.org>
* ectool command to print panic dataVic Yang2013-06-271-0/+67
| | | | | | | | | | | | | | This can be useful when the EC reboots but we don't have access to the EC console. BUG=chrome-os-partner:20548 TEST=Manual BRANCH=None Change-Id: I0b762011860d7802ffbc208ffa42920fa6ed098d Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60220 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Rename LPC packet size constant for version 3 protocolRandall Spangler2013-06-261-1/+1
| | | | | | | | | | | | | | The maximum packet length for LPC is limited by the I/O space window size. But that's not the case for SPI or LPC. Rename LPC constant before adding a SPI constant. BUG=chrome-os-partner:20257 BRANCH=none TEST=build link Change-Id: I088327a11eff18d401c773db953700a36f9c1bb4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59959
* Add EC_CMD_TEST_PROTOCOL to fake certain responses.Bill Richardson2013-06-203-3/+44
| | | | | | | | | | | | | | | | | | | | | | This lets us force the EC to return various error codes, so that we can be sure we're seeing them. BUG=chromium:242706 BRANCH=none TEST=none Trigger various errors like so: ectool test 0 14 ectool test 1 14 ectool test 5 14 ectool test 8 14 ectool test 0 33 Change-Id: Ia951cd7afacdcce6c8ec7d35d3bfb5b113dea694 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59327 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor host command interface to support version 3 packetsRandall Spangler2013-06-201-6/+108
| | | | | | | | | | | | | | | | | | | | | | | | | This will fix EC flash commands on pit, once the host side (u-boot and cros_ec driver) are upgraded to match. This change is backwards-compatible the EC still supports the existing version 2 protocols for talking to existing AP/kernel/ectool. Once the AP-side supports version 3 for SPI (and existing systems are upgraded), we will remove older SPI support since we haven't shipped a product which uses SPI. BUG=chrome-os-partner:20257 BRANCH=none TEST=disable cros_ec driver support in ectool; 'ectool hello' works on link And with an old ectool which predates this CL, 'ectool hello' also works. On pit, from u-boot prompt, 'crosec test' and 'crosec version' work, and keyboard works. Change-Id: I01f193e316e9aa442fe50d632dc8a4681723e282 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58908 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Doug Anderson <dianders@chromium.org>
* Make target for test coverage report generationVic Yang2013-06-161-0/+2
| | | | | | | | | | | | | By 'make coverage', lcov is used to generate test coverage report in HTML format stored in coverage_rpt folder. BUG=chrome-os-partner:19235 TEST=Generate a report. BRANCH=None Change-Id: I44142eaaeb897cf09179764781120370920144cd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58203
* Fix some stupidness in ectool's comm_init() handlingBill Richardson2013-06-141-1/+1
| | | | | | | | | | | | | | | | | | | ectool was checking for negative return values on comm_init(). It should have been checking for nonzero. Or comm_init should have been returning negative. Whatever. The ectool utility was supposed to be a quick-n-dirty debugging tool, so it's not very well tested. BUG=chromium:249218 BRANCH=none TEST=manual Fired up VM instance, tried old version and new version. Old version coredumps, new version doesn't. Change-Id: I0e27d78eead562a16ff826fb80de9e6b07476e12 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58712 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool prefers /dev/cros_ec, then falls back to i2c, lpcBill Richardson2013-06-058-211/+405
| | | | | | | | | | | | | | | 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
* Make flash_ec capable of writing to an incorrectly-protected STM32Randall Spangler2013-06-031-8/+6
| | | | | | | | | | | | | | | | | | | | | If EC-RO protects itself via the WRPx option bytes, flash_ec will fail to reprogram it. And if EC-RO is broken/unbootable, it won't be able to clear the WRPx option bytes itself when it sees the write protect GPIO is not asserted. Add the -u flag to stm32mon so that it will automatically attempt to unprotect the flash via the option bytes. BUG=chrome-os-partner:19723 BRANCH=none TEST=enable write protect GPIO. Then from console, 'flashwp enable'. Then from the chroot: ./util/flash_ec --board=pit --ro --image=build/pit/ec.RO.flat That should successfully reflash the board. Change-Id: Ic356d29104294d04d5e2a36dc75fd0206b89bd34 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56659
* Clean up flash section defines and increase lm4 image sizeRandall Spangler2013-06-031-3/+27
| | | | | | | | | | | | | | | | | | | | | | | The firmware defines had two almost-identical sets. Coalesce into one consistent set. Link had 256 KB flash, but only allowed 2 80KB images. Future LM4-based platforms (slippy/peppy/falco/etc) will now use the entire flash, with RO=124KB, pstate=4KB, RW=128KB. This matches what the STM32 platforms do, where pstate is contiguous with the RO firmware. No functional change to STM32-based platforms. BUG=chrome-os-partner:19176 BRANCH=none TEST=build all platforms and dump_fmap ec.bin. - stm32-based platforms should report RO=61440@0, RW=65536@0x10000 - link should report RO=81920@0, RW=81920@0x14000 - slippy should report RO=129024@0, RW=131072@0x20000 Change-Id: I20b1d95c16250d9a5d228ead06eef03d96548823 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56655
* Make ectool LED command more genericVic Yang2013-06-031-33/+67
| | | | | | | | | | | | | | | | | | This adds the option to specify which LED to control as well as the ability to query the supported LED color on the board. BUG=chrome-os-partner:19745 TEST=On Spring: - ectool led 0 query -> See the max value for R, G, Y is 0x80. - ectool led 1 query -> See error message. - ectool led 0 yellow -> See LED turns yellow. - ectool led 0 green=0x40 red=0x40 -> See green and red lit up. - ectool led 0 auto -> See LED turns off (without charger.) BRANCH=spring Change-Id: Ibdde2f7450122f59383dad1030a0a2a985386f73 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56877
* Add wireless switch control for WWANDuncan Laurie2013-06-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Haswell devices have EC control of the WWAN power rail. Expose a new wireless switch enable flag for this under the existing wirless enable command. This change also abstracts the wireless enable function to call a per-board handler so the different boards can do the right thing based on their GPIO setup. The haswell boards will switch WLAN radio and WWAN power rails based on the switch inputs. These boards do not have EC control of bluetooth radio/rail power. WLAN (power and radio) still defaults to enabled. Disabling with ectool will turn off the radio but keep the power enabled in order to prevent the PCIe device from disappearing. WWAN (power) still defaults to disabled. Disabling with ectool will turn off the power rail. BUG=chrome-os-partner:19871 BRANCH=none TEST=manual: boot on slippy DEFAULT: > ectool gpioget pp3300_wlan_en GPIO pp3300_wlan_en = 1 > ectool gpioget wlan_off_l GPIO wlan_off_l = 1 > ectool gpioget pp3300_lte_en GPIO pp3300_lte_en = 0 ENABLE WWAN: > ectool wireless 0x7 Success. > ectool gpioget pp3300_lte_en GPIO pp3300_lte_en = 1 DISABLE WLAN (radio): > ectool wireless 0x7 Success. > ectool gpioget pp3300_wlan_en GPIO pp3300_wlan_en = 1 > ectool gpioget wlan_off_l GPIO wlan_off_l = 0 Change-Id: I6f760b8cf5ab47d8f7f0dd8cd4d3e6563464043e Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57215 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Support emulator rebootVic Yang2013-05-281-7/+32
| | | | | | | | | | | | | | When emulator exits with reboot exit code, we should run the emulator again. BUG=chrome-os-partner:19235 TEST=Enable flash test on emulator. See it reboots. BRANCH=None Change-Id: Id0b4c21c1be7ae978be8b336a3498181d881c715 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56701 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add ectool command to control LED colorVic Yang2013-05-281-0/+52
| | | | | | | | | | | | | | | | | | This provides a way to control LED color with ectool. We can either set the color or switch back to automatic control. BUG=chrome-os-partner:19745 TEST=ectool led red -> LED turns red. ectool led green -> LED turns green. Unplug charger -> LED turns off. ectool led green -> LED turns of and shows green. ectool led auto -> LED back to normal. BRANCH=spring Change-Id: I0b455f34cea448660fe44a5fecaac1cb084f8144 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56721 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Create board configuration for peppy bringupDave Parker2013-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change copies the slippy board configuration as a starting point for peppy. This change is essentially the same as https://gerrit.chromium.org/gerrit/55820 BUG=chrome-os-partner:19640 BRANCH=none TEST=manual Tested on slippy as there are no peppy-specific changes yet. cros_workon --board peppy start chromeos-ec emerge-peppy chromeos-ec ~/trunk/src/platform/ec/util/flash_ec --board peppy Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I4c5f7a77fa55a6364effe838f7a656d56bfad9fb Reviewed-on: https://gerrit.chromium.org/gerrit/56332 Reviewed-by: Olof Johansson <olofj@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Create board configuration for falco bringupBill Richardson2013-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change just copies slippy and tweaks a few things that were slippy-specific instead of not-link-specific (there are still bugs open for those things). BUG=chrome-os-partner:18788 BRANCH=none TEST=manual Since there are no Falco-specific changes yet (just slippy with another name), I can try it on Slippy: cros_workon --board falco start chromeos-ec emerge-falco chromeos-ec ~/trunk/src/platform/ec/util/flash_ec --board falco I also built and tested Link EC, to make sure nothing broke there either. Change-Id: I9b3682032bd51adab4450520dfe52e3036750ef9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/55820 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Show power number in 'ectool powerinfo' outputVic Yang2013-05-201-0/+2
| | | | | | | | | | | | | | This is just a simple V*I value so that we don't need to do the math all the time. BUG=None TEST=None BRANCH=None Change-Id: I6317720d196d4bc2392adefb540be14bc34b5978 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/55641 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Show run time of unit testsVic Yang2013-05-141-2/+7
| | | | | | | | | | | | | This is useful for finding out which test runs for too long. BUG=chrome-os-partner:19235 TEST=Run tests and see run time logged. BRANCH=None Change-Id: I5cb6727b2e1017fce1107e4892c1898e66598492 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51105 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Redirect emulator output to stderr if a test failsVic Yang2013-05-141-3/+25
| | | | | | | | | | | | | | If a test fails, redirect emulator output to stderr so that it shows up even when V=1 is not set. BUG=chrome-os-partner:19235 TEST=Manual BRANCH=None Change-Id: I6d8e05eaa222ebe043556bfcd3f63ca7e27c2721 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51097 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Slippy: Changes needed to boot EC without bricking.Bill Richardson2013-05-101-1/+1
| | | | | | | | | | | | | | | | This commits the hacks made during board bringup. Bugs can be filed and fixed based on this starting point. BUG=chrome-os-partner:18825 BRANCH=slippy TEST=manual Try it and see. Change-Id: Ia663eaf9a357633873b1b5d5cc6dbdda63513082 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50875 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Implement I2C passthru commandRandall Spangler2013-05-091-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a revised version of passthru which more closely resembles the kernel interface. It allows multiple read/write messages in a single transaction, and sends back one accumulated result. BUG=chrome-os-partner:18778 BRANCH=none TEST=On link, from root shell: ectool i2cxfer 0 0xb 6 0x21 Read bytes: 0x05 0x41 0x52 0x52 0x4f 0x57 (I did not actually run this with the updated code) On pit, in U-Boot: Read i2c values: Peach # crosec i2c md 48 0 0000: 00 00 3e 00 12 20 4b bf ff ff 20 00 1e 1e 1e 1f ..>.. K... ..... Peach # crosec i2c md 48 0 20 0000: 00 00 3e 00 12 20 4b bf ff ff 20 00 1e 1e 1e 1f ..>.. K... ..... 0010: 1f 1f 1f 1f 1f 1f 20 00 00 07 00 00 00 00 00 00 ...... ......... Update value at offset 10: Peach # crosec i2c mw 48 10 4 Peach # crosec i2c md 48 0 20 0000: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f ..>....... ..... 0010: 04 1f 1f 1f 1f 1f 20 00 00 07 00 00 00 00 00 00 ...... ......... Peach # On pit, in kernel: localhost ~ # i2cdetect -y -a -r 20 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- localhost ~ # i2cdump -f -y 20 0x48 No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f ..>.?.???. .???? 10: 1f 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00 ?????? ..?...... 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ localhost ~ # i2cset -f -y 20 0x48 0x10 0 localhost ~ # i2cdump -f -y 20 0x48 No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f ..>.?.???. .???? 10: 00 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00 .????? ..?...... 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ localhost ~ # i2cset -f -y 20 0x48 0x10 0x1f localhost ~ # i2cdump -f -y 20 0x48 No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: 00 00 3e 00 12 00 0b 1f 1f ff 20 00 1e 1e 1e 1f ..>.?.???. .???? 10: 1f 1f 0e 1f 1f 0e 20 00 00 07 00 00 00 00 00 00 ?????? ..?...... Change-Id: I14d47e1712828f726ac5caddc4beede251570ad3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Updated to simplify protocol: Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49958 Commit-Queue: Doug Anderson <dianders@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org>
* Pthread-based emulator for unit testingstabilize-4100.38.BVic Yang2013-05-071-0/+26
| | | | | | | | | | | | | | This is the first version of pthread-based RTOS emulator. With this, we will be able to test high-level modules entirely on the host machine. BUG=chrome-os-partner:19325 TEST='make runtests' and see tests passing. BRANCH=None Change-Id: I1f5fcd76aa84bdb46c7d35c5e60ae5d92fd3a319 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49954 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Improved the BUILD_ASSERT macro to work outside of functions.Bill Richardson2013-04-292-7/+2
| | | | | | | | | | | | | | | | | | This will let us check the size of static array initializers. Also moved this macro definition and ARRAY_SIZE into a new "tricks.h" header, so that userspace utils can use it too. BUG=none BRANCH=none TEST=manual Built everything, tested on Link. Tried various assertions. Change-Id: I612891108ea37dbca3572e0f25ab54a7bc0ed860 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49417 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add pit support to flash_ecRandall Spangler2013-04-261-1/+1
| | | | | | | | | | | | | Pit flashes the same way daisy does. BUG=chrome-os-partner:18657 BRANCH=none TEST=./util/flash_ec --board=pit --ro --image=build/pit/ec.bin Change-Id: Id3db86b348963f66e7eb03c38a8efabe3379d21b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49320 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Allow either libftdi or libftdi1 at compile time.Todd Broch2013-04-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=chromium:222299 TEST=manual, from chroot: 1. Install libftdi1 (https://gerrit.chromium.org/gerrit/#/c/44731/) 2. cd <path>/ec && make -B - compiles successfully 3. Install libftdi 4. cd <path>/ec && make -B - still compiles successfully Change-Id: I6818d53faa1389937872b0a9826534db4760e448 Reviewed-on: https://gerrit.chromium.org/gerrit/47875 Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* flash_ec: add support for flashing with Toad cableVincent Palatin2013-04-161-12/+48
| | | | | | | | | | | | | | | | | | | | Add support for flashing Spring board through the Toad cable (given the Write Protect screw is not on). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:17570 TEST=with both a Toad cable and a servo v2, flash EC on Spring EVT with the following command: ./util/flash_ec --board=spring and check the state of the servo/toad before and after. Change-Id: Ia4e0d32b062d58b4e906d3f006003fa6097add83 Reviewed-on: https://gerrit.chromium.org/gerrit/48031 Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>