Skip to content

Commit 2ed4fa9

Browse files
vadimp-nvidiawsakernel
authored andcommitted
i2c: mlxcpld: Add support for extended transaction length
Add support for extended length of read and write transactions. New FPGA logic allows to increase size of the read and write transactions length. This feature is verified through capability register 'CPBLTY_REG'. Two bits 5 and 6 of the register are used for length capability detection. Value '10' indicates support of extended transaction length - 128 bytes for read transactions and 132 for write transactions. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Michael Shych <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent d7cf993 commit 2ed4fa9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/i2c/busses/i2c-mlxcpld.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define MLXCPLD_I2C_BUS_NUM 1
2323
#define MLXCPLD_I2C_DATA_REG_SZ 36
2424
#define MLXCPLD_I2C_DATA_SZ_BIT BIT(5)
25+
#define MLXCPLD_I2C_DATA_EXT2_SZ_BIT BIT(6)
2526
#define MLXCPLD_I2C_DATA_SZ_MASK GENMASK(6, 5)
2627
#define MLXCPLD_I2C_SMBUS_BLK_BIT BIT(7)
2728
#define MLXCPLD_I2C_MAX_ADDR_LEN 4
@@ -466,6 +467,13 @@ static const struct i2c_adapter_quirks mlxcpld_i2c_quirks_ext = {
466467
.max_comb_1st_msg_len = 4,
467468
};
468469

470+
static const struct i2c_adapter_quirks mlxcpld_i2c_quirks_ext2 = {
471+
.flags = I2C_AQ_COMB_WRITE_THEN_READ,
472+
.max_read_len = (MLXCPLD_I2C_DATA_REG_SZ - 4) * 4,
473+
.max_write_len = (MLXCPLD_I2C_DATA_REG_SZ - 4) * 4 + MLXCPLD_I2C_MAX_ADDR_LEN,
474+
.max_comb_1st_msg_len = 4,
475+
};
476+
469477
static struct i2c_adapter mlxcpld_i2c_adapter = {
470478
.owner = THIS_MODULE,
471479
.name = "i2c-mlxcpld",
@@ -547,6 +555,8 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev)
547555
/* Check support for extended transaction length */
548556
if ((val & MLXCPLD_I2C_DATA_SZ_MASK) == MLXCPLD_I2C_DATA_SZ_BIT)
549557
mlxcpld_i2c_adapter.quirks = &mlxcpld_i2c_quirks_ext;
558+
else if ((val & MLXCPLD_I2C_DATA_SZ_MASK) == MLXCPLD_I2C_DATA_EXT2_SZ_BIT)
559+
mlxcpld_i2c_adapter.quirks = &mlxcpld_i2c_quirks_ext2;
550560
/* Check support for smbus block transaction */
551561
if (val & MLXCPLD_I2C_SMBUS_BLK_BIT)
552562
priv->smbus_block = true;

0 commit comments

Comments
 (0)