Skip to content

Commit 709b785

Browse files
Yang Yingliangbroonie
authored andcommitted
spi: xilinx: switch to use modern name
Change legacy name master/slave to modern name host/target or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://msgid.link/r/20231128093031.3707034-21-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4e4856e commit 709b785

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

drivers/spi/spi-xilinx.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Xilinx SPI controller driver (master mode only)
3+
* Xilinx SPI controller driver (host mode only)
44
*
55
* Author: MontaVista Software, Inc.
66
* source@mvista.com
@@ -83,7 +83,7 @@ struct xilinx_spi {
8383
void __iomem *regs; /* virt. address of the control registers */
8484

8585
int irq;
86-
bool force_irq; /* force irq to setup master inhibit */
86+
bool force_irq; /* force irq to setup host inhibit */
8787
u8 *rx_ptr; /* pointer in the Tx buffer */
8888
const u8 *tx_ptr; /* pointer in the Rx buffer */
8989
u8 bytes_per_word;
@@ -174,23 +174,23 @@ static void xspi_init_hw(struct xilinx_spi *xspi)
174174
regs_base + XIPIF_V123B_IIER_OFFSET);
175175
/* Disable the global IPIF interrupt */
176176
xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET);
177-
/* Deselect the slave on the SPI bus */
177+
/* Deselect the Target on the SPI bus */
178178
xspi->write_fn(0xffff, regs_base + XSPI_SSR_OFFSET);
179-
/* Disable the transmitter, enable Manual Slave Select Assertion,
180-
* put SPI controller into master mode, and enable it */
179+
/* Disable the transmitter, enable Manual Target Select Assertion,
180+
* put SPI controller into host mode, and enable it */
181181
xspi->write_fn(XSPI_CR_MANUAL_SSELECT | XSPI_CR_MASTER_MODE |
182182
XSPI_CR_ENABLE | XSPI_CR_TXFIFO_RESET | XSPI_CR_RXFIFO_RESET,
183183
regs_base + XSPI_CR_OFFSET);
184184
}
185185

186186
static void xilinx_spi_chipselect(struct spi_device *spi, int is_on)
187187
{
188-
struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
188+
struct xilinx_spi *xspi = spi_controller_get_devdata(spi->controller);
189189
u16 cr;
190190
u32 cs;
191191

192192
if (is_on == BITBANG_CS_INACTIVE) {
193-
/* Deselect the slave on the SPI bus */
193+
/* Deselect the target on the SPI bus */
194194
xspi->write_fn(xspi->cs_inactive, xspi->regs + XSPI_SSR_OFFSET);
195195
return;
196196
}
@@ -225,7 +225,7 @@ static void xilinx_spi_chipselect(struct spi_device *spi, int is_on)
225225
static int xilinx_spi_setup_transfer(struct spi_device *spi,
226226
struct spi_transfer *t)
227227
{
228-
struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
228+
struct xilinx_spi *xspi = spi_controller_get_devdata(spi->controller);
229229

230230
if (spi->mode & SPI_CS_HIGH)
231231
xspi->cs_inactive &= ~BIT(spi_get_chipselect(spi, 0));
@@ -237,7 +237,7 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
237237

238238
static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
239239
{
240-
struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
240+
struct xilinx_spi *xspi = spi_controller_get_devdata(spi->controller);
241241
int remaining_words; /* the number of words left to transfer */
242242
bool use_irq = false;
243243
u16 cr = 0;
@@ -335,9 +335,9 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
335335
}
336336

337337

338-
/* This driver supports single master mode only. Hence Tx FIFO Empty
338+
/* This driver supports single host mode only. Hence Tx FIFO Empty
339339
* is the only interrupt we care about.
340-
* Receive FIFO Overrun, Transmit FIFO Underrun, Mode Fault, and Slave Mode
340+
* Receive FIFO Overrun, Transmit FIFO Underrun, Mode Fault, and Target Mode
341341
* Fault are not to happen.
342342
*/
343343
static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
@@ -393,7 +393,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
393393
struct xspi_platform_data *pdata;
394394
struct resource *res;
395395
int ret, num_cs = 0, bits_per_word;
396-
struct spi_master *master;
396+
struct spi_controller *host;
397397
bool force_irq = false;
398398
u32 tmp;
399399
u8 i;
@@ -415,26 +415,26 @@ static int xilinx_spi_probe(struct platform_device *pdev)
415415

416416
if (!num_cs) {
417417
dev_err(&pdev->dev,
418-
"Missing slave select configuration data\n");
418+
"Missing target select configuration data\n");
419419
return -EINVAL;
420420
}
421421

422422
if (num_cs > XILINX_SPI_MAX_CS) {
423-
dev_err(&pdev->dev, "Invalid number of spi slaves\n");
423+
dev_err(&pdev->dev, "Invalid number of spi targets\n");
424424
return -EINVAL;
425425
}
426426

427-
master = devm_spi_alloc_master(&pdev->dev, sizeof(struct xilinx_spi));
428-
if (!master)
427+
host = devm_spi_alloc_host(&pdev->dev, sizeof(struct xilinx_spi));
428+
if (!host)
429429
return -ENODEV;
430430

431431
/* the spi->mode bits understood by this driver: */
432-
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP |
433-
SPI_CS_HIGH;
432+
host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP |
433+
SPI_CS_HIGH;
434434

435-
xspi = spi_master_get_devdata(master);
435+
xspi = spi_controller_get_devdata(host);
436436
xspi->cs_inactive = 0xffffffff;
437-
xspi->bitbang.master = master;
437+
xspi->bitbang.master = host;
438438
xspi->bitbang.chipselect = xilinx_spi_chipselect;
439439
xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;
440440
xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
@@ -444,9 +444,9 @@ static int xilinx_spi_probe(struct platform_device *pdev)
444444
if (IS_ERR(xspi->regs))
445445
return PTR_ERR(xspi->regs);
446446

447-
master->bus_num = pdev->id;
448-
master->num_chipselect = num_cs;
449-
master->dev.of_node = pdev->dev.of_node;
447+
host->bus_num = pdev->id;
448+
host->num_chipselect = num_cs;
449+
host->dev.of_node = pdev->dev.of_node;
450450

451451
/*
452452
* Detect endianess on the IP via loop bit in CR. Detection
@@ -466,7 +466,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
466466
xspi->write_fn = xspi_write32_be;
467467
}
468468

469-
master->bits_per_word_mask = SPI_BPW_MASK(bits_per_word);
469+
host->bits_per_word_mask = SPI_BPW_MASK(bits_per_word);
470470
xspi->bytes_per_word = bits_per_word / 8;
471471
xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
472472

@@ -496,17 +496,17 @@ static int xilinx_spi_probe(struct platform_device *pdev)
496496

497497
if (pdata) {
498498
for (i = 0; i < pdata->num_devices; i++)
499-
spi_new_device(master, pdata->devices + i);
499+
spi_new_device(host, pdata->devices + i);
500500
}
501501

502-
platform_set_drvdata(pdev, master);
502+
platform_set_drvdata(pdev, host);
503503
return 0;
504504
}
505505

506506
static void xilinx_spi_remove(struct platform_device *pdev)
507507
{
508-
struct spi_master *master = platform_get_drvdata(pdev);
509-
struct xilinx_spi *xspi = spi_master_get_devdata(master);
508+
struct spi_controller *host = platform_get_drvdata(pdev);
509+
struct xilinx_spi *xspi = spi_controller_get_devdata(host);
510510
void __iomem *regs_base = xspi->regs;
511511

512512
spi_bitbang_stop(&xspi->bitbang);
@@ -516,7 +516,7 @@ static void xilinx_spi_remove(struct platform_device *pdev)
516516
/* Disable the global IPIF interrupt */
517517
xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET);
518518

519-
spi_master_put(xspi->bitbang.master);
519+
spi_controller_put(xspi->bitbang.master);
520520
}
521521

522522
/* work with hotplug and coldplug */

0 commit comments

Comments
 (0)