Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c: rtl9300: introduce a property for 8 bit width reg address

In RTL9607C i2c controller, in order to indicate that the width of
memory address is 8 bits, 0 is written to MEM_ADDR_WIDTH field as
opposed to 1 for RTL9300 and RTL9310.

Introduce a new property to a driver data to indicate what value
need to written to MEM_ADDR_WIDTH field for this case.

Signed-off-by: Rustam Adilov <adilov@disroot.org>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260401180648.337834-5-adilov@disroot.org

authored by

Rustam Adilov and committed by
Andi Shyti
6afde011 55284a80

+7 -1
+7 -1
drivers/i2c/busses/i2c-rtl9300.c
··· 66 66 u32 wd_reg; 67 67 u8 max_nchan; 68 68 u8 max_data_len; 69 + u8 reg_addr_8bit_len; 69 70 }; 70 71 71 72 #define RTL9300_I2C_MUX_NCHAN 8 ··· 112 111 #define RTL9300_I2C_MST_DATA_WORD2 0x10 113 112 #define RTL9300_I2C_MST_DATA_WORD3 0x14 114 113 #define RTL9300_I2C_MST_GLB_CTRL 0x384 114 + #define RTL9300_REG_ADDR_8BIT_LEN 1 115 115 116 116 #define RTL9310_I2C_MST_IF_CTRL 0x1004 117 117 #define RTL9310_I2C_MST_IF_SEL 0x1008 ··· 307 305 union i2c_smbus_data *data) 308 306 { 309 307 struct rtl9300_i2c_chan *chan = i2c_get_adapdata(adap); 308 + const struct rtl9300_i2c_drv_data *drv_data; 310 309 struct rtl9300_i2c *i2c = chan->i2c; 311 310 struct rtl9300_i2c_xfer xfer = {0}; 312 311 int ret; ··· 317 314 318 315 guard(rtl9300_i2c)(i2c); 319 316 317 + drv_data = device_get_match_data(i2c->dev); 320 318 ret = rtl9300_i2c_config_chan(i2c, chan); 321 319 if (ret) 322 320 return ret; ··· 325 321 xfer.dev_addr = addr & 0x7f; 326 322 xfer.write = (read_write == I2C_SMBUS_WRITE); 327 323 xfer.reg_addr = command; 328 - xfer.reg_addr_len = 1; 324 + xfer.reg_addr_len = drv_data->reg_addr_8bit_len; 329 325 330 326 switch (size) { 331 327 case I2C_SMBUS_BYTE: ··· 517 513 .wd_reg = RTL9300_I2C_MST_DATA_WORD0, 518 514 .max_nchan = RTL9300_I2C_MUX_NCHAN, 519 515 .max_data_len = RTL9300_I2C_MAX_DATA_LEN, 516 + .reg_addr_8bit_len = RTL9300_REG_ADDR_8BIT_LEN, 520 517 }; 521 518 522 519 static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = { ··· 541 536 .wd_reg = RTL9310_I2C_MST_DATA_CTRL, 542 537 .max_nchan = RTL9310_I2C_MUX_NCHAN, 543 538 .max_data_len = RTL9300_I2C_MAX_DATA_LEN, 539 + .reg_addr_8bit_len = RTL9300_REG_ADDR_8BIT_LEN, 544 540 }; 545 541 546 542 static const struct of_device_id i2c_rtl9300_dt_ids[] = {