diff options
author | Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz> | 2024-10-10 05:53:15 +0300 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2025-03-18 23:53:52 +0300 |
commit | 517ec053eeb48f4fe96271b32b3df9c8e269a29c (patch) | |
tree | 597d6135f5854916d907b847575502c0af0416d6 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 4701f33a10702d5fc577c32434eb62adde0a1ae1 (diff) | |
download | linux-517ec053eeb48f4fe96271b32b3df9c8e269a29c.tar.xz |
i2c: octeon: refactor common i2c operations
Refactor the current implementation of the high-level composite read and
write operations in preparation of the addition of block-mode read/write
operations.
The sending of the i2c command is generic and will apply for both the
block-mode and non-block-mode ops. Extract this from the current hlc
ops, and place into a generic function, octeon_i2c_hlc_cmd_send.
The considerations made for extended addresses in the command
construction are almost common for all cases, extract these into
octeon_i2c_hlc_ext. There is one difference between the extended read
and write cases. When performing extended read or writes the SW_TWSI_EXT
must be written with an extended internal address, but the data field is
only filled in the write case (read back in read case). This results in
the original code block for the read case immediately writing this
register, while the write case fills in any data and then writes the
register. To create a common block of code for both processes remove the
SW_TWSI_EXT write from within the code block and instead in it's place a
variable is set, set_ext, which is returned and used as a condition to
do the register write, in the read command case.
There are parts of the commands construction which are common (only in
the read case), extract this and place into generic function
octeon_i2c_hlc_read_cmd. This function also reads the return from
octeon_i2c_hlc_ext and completes the write to SW_TWSI_EXT if required.
The write commands cannot be made entirely into common code as there are
distinct differences in the block mode and non-block-mode process.
Particularly the writing of data into the buffer.
Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20241010025317.2040470-2-aryan.srivastava@alliedtelesis.co.nz
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions