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

i2c: fsi: reword according to newest specification

Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2
specifications and replace "master/slave" with more appropriate terms.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

authored by

Wolfram Sang and committed by
Andi Shyti
57deeb98 37ce300e

+28 -28
+28 -28
drivers/i2c/busses/i2c-fsi.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * FSI-attached I2C master algorithm 3 + * FSI-attached I2C controller algorithm 4 4 * 5 5 * Copyright 2018 IBM Corporation 6 6 * ··· 145 145 /* choose timeout length from legacy driver; it's well tested */ 146 146 #define I2C_ABORT_TIMEOUT msecs_to_jiffies(100) 147 147 148 - struct fsi_i2c_master { 148 + struct fsi_i2c_ctrl { 149 149 struct fsi_device *fsi; 150 150 u8 fifo_size; 151 151 struct list_head ports; ··· 155 155 struct fsi_i2c_port { 156 156 struct list_head list; 157 157 struct i2c_adapter adapter; 158 - struct fsi_i2c_master *master; 158 + struct fsi_i2c_ctrl *ctrl; 159 159 u16 port; 160 160 u16 xfrd; 161 161 }; ··· 183 183 return fsi_device_write(fsi, reg, &data_be, sizeof(data_be)); 184 184 } 185 185 186 - static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) 186 + static int fsi_i2c_dev_init(struct fsi_i2c_ctrl *i2c) 187 187 { 188 188 int rc; 189 189 u32 mode = I2C_MODE_ENHANCED, extended_status, watermark; ··· 214 214 static int fsi_i2c_set_port(struct fsi_i2c_port *port) 215 215 { 216 216 int rc; 217 - struct fsi_device *fsi = port->master->fsi; 217 + struct fsi_device *fsi = port->ctrl->fsi; 218 218 u32 mode, dummy = 0; 219 219 220 220 rc = fsi_i2c_read_reg(fsi, I2C_FSI_MODE, &mode); ··· 236 236 static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, 237 237 bool stop) 238 238 { 239 - struct fsi_i2c_master *i2c = port->master; 239 + struct fsi_i2c_ctrl *i2c = port->ctrl; 240 240 u32 cmd = I2C_CMD_WITH_START | I2C_CMD_WITH_ADDR; 241 241 242 242 port->xfrd = 0; ··· 268 268 { 269 269 int write; 270 270 int rc; 271 - struct fsi_i2c_master *i2c = port->master; 271 + struct fsi_i2c_ctrl *i2c = port->ctrl; 272 272 int bytes_to_write = i2c->fifo_size - fifo_count; 273 273 int bytes_remaining = msg->len - port->xfrd; 274 274 ··· 294 294 { 295 295 int read; 296 296 int rc; 297 - struct fsi_i2c_master *i2c = port->master; 297 + struct fsi_i2c_ctrl *i2c = port->ctrl; 298 298 int bytes_to_read; 299 299 int xfr_remaining = msg->len - port->xfrd; 300 300 u32 dummy; ··· 330 330 { 331 331 u32 stat = 0; 332 332 struct fsi_i2c_port *port = adap->algo_data; 333 - struct fsi_i2c_master *i2c = port->master; 333 + struct fsi_i2c_ctrl *i2c = port->ctrl; 334 334 335 335 fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); 336 336 ··· 341 341 { 342 342 u32 dummy = 0; 343 343 struct fsi_i2c_port *port = adap->algo_data; 344 - struct fsi_i2c_master *i2c = port->master; 344 + struct fsi_i2c_ctrl *i2c = port->ctrl; 345 345 346 346 if (val) 347 347 fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy); ··· 353 353 { 354 354 u32 stat = 0; 355 355 struct fsi_i2c_port *port = adap->algo_data; 356 - struct fsi_i2c_master *i2c = port->master; 356 + struct fsi_i2c_ctrl *i2c = port->ctrl; 357 357 358 358 fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); 359 359 ··· 364 364 { 365 365 u32 dummy = 0; 366 366 struct fsi_i2c_port *port = adap->algo_data; 367 - struct fsi_i2c_master *i2c = port->master; 367 + struct fsi_i2c_ctrl *i2c = port->ctrl; 368 368 369 369 if (val) 370 370 fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy); ··· 377 377 int rc; 378 378 u32 mode; 379 379 struct fsi_i2c_port *port = adap->algo_data; 380 - struct fsi_i2c_master *i2c = port->master; 380 + struct fsi_i2c_ctrl *i2c = port->ctrl; 381 381 382 382 rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode); 383 383 if (rc) ··· 392 392 int rc; 393 393 u32 mode; 394 394 struct fsi_i2c_port *port = adap->algo_data; 395 - struct fsi_i2c_master *i2c = port->master; 395 + struct fsi_i2c_ctrl *i2c = port->ctrl; 396 396 397 397 rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode); 398 398 if (rc) ··· 402 402 fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); 403 403 } 404 404 405 - static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, 405 + static int fsi_i2c_reset_bus(struct fsi_i2c_ctrl *i2c, 406 406 struct fsi_i2c_port *port) 407 407 { 408 408 int rc; ··· 435 435 return fsi_i2c_dev_init(i2c); 436 436 } 437 437 438 - static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) 438 + static int fsi_i2c_reset_engine(struct fsi_i2c_ctrl *i2c, u16 port) 439 439 { 440 440 int rc; 441 441 u32 mode, dummy = 0; ··· 478 478 unsigned long start; 479 479 u32 cmd = I2C_CMD_WITH_STOP; 480 480 u32 stat; 481 - struct fsi_i2c_master *i2c = port->master; 481 + struct fsi_i2c_ctrl *i2c = port->ctrl; 482 482 struct fsi_device *fsi = i2c->fsi; 483 483 484 484 rc = fsi_i2c_reset_engine(i2c, port->port); ··· 505 505 if (rc) 506 506 return rc; 507 507 508 - /* wait until we see command complete in the master */ 508 + /* wait until we see command complete in the controller */ 509 509 start = jiffies; 510 510 511 511 do { ··· 579 579 unsigned long start = jiffies; 580 580 581 581 do { 582 - rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, 582 + rc = fsi_i2c_read_reg(port->ctrl->fsi, I2C_FSI_STAT, 583 583 &status); 584 584 if (rc) 585 585 return rc; ··· 609 609 int i, rc; 610 610 unsigned long start_time; 611 611 struct fsi_i2c_port *port = adap->algo_data; 612 - struct fsi_i2c_master *master = port->master; 612 + struct fsi_i2c_ctrl *ctrl = port->ctrl; 613 613 struct i2c_msg *msg; 614 614 615 - mutex_lock(&master->lock); 615 + mutex_lock(&ctrl->lock); 616 616 617 617 rc = fsi_i2c_set_port(port); 618 618 if (rc) ··· 633 633 } 634 634 635 635 unlock: 636 - mutex_unlock(&master->lock); 636 + mutex_unlock(&ctrl->lock); 637 637 return rc ? : num; 638 638 } 639 639 ··· 654 654 }; 655 655 656 656 static const struct i2c_algorithm fsi_i2c_algorithm = { 657 - .master_xfer = fsi_i2c_xfer, 657 + .xfer = fsi_i2c_xfer, 658 658 .functionality = fsi_i2c_functionality, 659 659 }; 660 660 ··· 676 676 677 677 static int fsi_i2c_probe(struct device *dev) 678 678 { 679 - struct fsi_i2c_master *i2c; 679 + struct fsi_i2c_ctrl *i2c; 680 680 struct fsi_i2c_port *port; 681 681 struct device_node *np; 682 682 u32 port_no, ports, stat; ··· 699 699 return rc; 700 700 701 701 ports = FIELD_GET(I2C_STAT_MAX_PORT, stat) + 1; 702 - dev_dbg(dev, "I2C master has %d ports\n", ports); 702 + dev_dbg(dev, "I2C controller has %d ports\n", ports); 703 703 704 704 for (port_no = 0; port_no < ports; port_no++) { 705 705 np = fsi_i2c_find_port_of_node(dev->of_node, port_no); ··· 712 712 break; 713 713 } 714 714 715 - port->master = i2c; 715 + port->ctrl = i2c; 716 716 port->port = port_no; 717 717 718 718 port->adapter.owner = THIS_MODULE; ··· 742 742 743 743 static int fsi_i2c_remove(struct device *dev) 744 744 { 745 - struct fsi_i2c_master *i2c = dev_get_drvdata(dev); 745 + struct fsi_i2c_ctrl *i2c = dev_get_drvdata(dev); 746 746 struct fsi_i2c_port *port, *tmp; 747 747 748 748 list_for_each_entry_safe(port, tmp, &i2c->ports, list) { ··· 772 772 module_fsi_driver(fsi_i2c_driver); 773 773 774 774 MODULE_AUTHOR("Eddie James <eajames@us.ibm.com>"); 775 - MODULE_DESCRIPTION("FSI attached I2C master"); 775 + MODULE_DESCRIPTION("FSI attached I2C controller"); 776 776 MODULE_LICENSE("GPL");