summaryrefslogtreecommitdiff
path: root/common/i2c_trace.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: Fix port bug with i2ctrace and i2cscan commandsEdward Hill2020-04-071-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'port' is not the index into i2c_ports[]. Fix i2ctrace and i2cscan to use get_i2c_port() to find the matching port in i2c_ports[] table. Add the port name to the 'i2ctrace list' output to make it clear which port it is. > i2ctrace list id port address -- ---- ------- 0 8 ap_audio 0x4A 1 9 ap_hdmi 0x5A to 0x5F 2 3 ap_mux 0x30 3 4 thermal 0x40 4 5 sensor 0x50 BUG=none BRANCH=none TEST=i2ctrace for I2C_PORT_AP_HDMI on Zork: i2ctrace enable 9 0x4a Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I7b897ac9154751a46ef5961aded569aaec49bfd4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136526 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* i2c: Cleanup I2C tracing outputKeith Short2020-03-101-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of the I2C tracing is hard to parse, especially for reads to I2C registers. This change creates only a single I2C trace for each I2C transfer (instead of 2 entries), and labels the write and read parts of the I2C transaction clearly. Example output (TCPC device during disconnect): i2c: 1:0x20 wr 0x10 rd 0x01 0x00 i2c: 1:0x20 wr 0x10 0x01 0x00 i2c: 1:0x20 wr 0x1A rd 0x1A i2c: 1:0x20 wr 0x1D rd 0x10 i2c: 1:0x20 wr 0x1C rd 0x70 i2c: 1:0x20 wr 0x2F 0x21 i2c: 1:0x20 wr 0x1C 0x70 i2c: 1:0x20 wr 0x2F 0x00 i2c: 1:0x20 wr 0x1C rd 0x70 i2c: 1:0x20 wr 0x1C 0x60 BUG=none BRANCH=none TEST=make buildall TEST=Enable CONFIG_I2C_DEBUG and verify output. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I077196e70ae3abb6c462cf08a3f944b43fdcf82a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2091573 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* i2c: don't output trace line for 0 length dataDenis Brockus2019-12-021-0/+3
| | | | | | | | | | | | | | | | | Write I2C operations always displayed a line indicating a read of port:addr with nothing following. Just don't output any lines that have no data to display. BUG=none BRANCH=none TEST=i2ctrace should not display lines with no data Change-Id: I1ba4bf3e627c47e62c68a592473431fcc195420a Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1940776 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-5/+5
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-191-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: add i2c tracing functionalityJack Rosenthal2019-07-171-0/+201
crbug.com/982442 requests a way for developers to enable tracing of i2c commands when debugging. This adds a new debug feature, the i2ctrace command, which provides that. The command is guarded by CONFIG_I2C_DEBUG. BUG=chromium:982442 BRANCH=none TEST=enabled CONFIG_I2C_DEBUG on arcada_ish, made sure that command functioned as it says on the tin Change-Id: I9c762271237cbf131e5ef7c0f605c89af4f209fd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699347 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>