Skip to content

Commit ea11a8b

Browse files
Yang Yingliangbroonie
authored andcommitted
spi: lantiq: 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 810ee62 commit ea11a8b

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

drivers/spi/spi-lantiq-ssc.c

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
#define LTQ_SPI_STAT_RE BIT(9) /* Receive error flag */
9393
#define LTQ_SPI_STAT_TE BIT(8) /* Transmit error flag */
9494
#define LTQ_SPI_STAT_ME BIT(7) /* Mode error flag */
95-
#define LTQ_SPI_STAT_MS BIT(1) /* Master/slave select bit */
95+
#define LTQ_SPI_STAT_MS BIT(1) /* Host/target select bit */
9696
#define LTQ_SPI_STAT_EN BIT(0) /* Enable bit */
9797
#define LTQ_SPI_STAT_ERRORS (LTQ_SPI_STAT_ME | LTQ_SPI_STAT_TE | \
9898
LTQ_SPI_STAT_RE | LTQ_SPI_STAT_AE | \
@@ -110,8 +110,8 @@
110110
#define LTQ_SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */
111111
#define LTQ_SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */
112112
#define LTQ_SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */
113-
#define LTQ_SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */
114-
#define LTQ_SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */
113+
#define LTQ_SPI_WHBSTATE_SETMS BIT(3) /* Set host select bit */
114+
#define LTQ_SPI_WHBSTATE_CLRMS BIT(2) /* Clear host select bit */
115115
#define LTQ_SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */
116116
#define LTQ_SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */
117117
#define LTQ_SPI_WHBSTATE_CLR_ERRORS (LTQ_SPI_WHBSTATE_CLRRUE | \
@@ -163,7 +163,7 @@ struct lantiq_ssc_hwcfg {
163163
};
164164

165165
struct lantiq_ssc_spi {
166-
struct spi_master *master;
166+
struct spi_controller *host;
167167
struct device *dev;
168168
void __iomem *regbase;
169169
struct clk *spi_clk;
@@ -367,7 +367,7 @@ static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi)
367367
hw_setup_bits_per_word(spi, spi->bits_per_word);
368368
hw_setup_clock_mode(spi, SPI_MODE_0);
369369

370-
/* Enable master mode and clear error flags */
370+
/* Enable host mode and clear error flags */
371371
lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_SETMS |
372372
LTQ_SPI_WHBSTATE_CLR_ERRORS,
373373
LTQ_SPI_WHBSTATE);
@@ -387,8 +387,8 @@ static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi)
387387

388388
static int lantiq_ssc_setup(struct spi_device *spidev)
389389
{
390-
struct spi_master *master = spidev->master;
391-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(master);
390+
struct spi_controller *host = spidev->controller;
391+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(host);
392392
unsigned int cs = spi_get_chipselect(spidev, 0);
393393
u32 gpocon;
394394

@@ -416,10 +416,10 @@ static int lantiq_ssc_setup(struct spi_device *spidev)
416416
return 0;
417417
}
418418

419-
static int lantiq_ssc_prepare_message(struct spi_master *master,
419+
static int lantiq_ssc_prepare_message(struct spi_controller *host,
420420
struct spi_message *message)
421421
{
422-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(master);
422+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(host);
423423

424424
hw_enter_config_mode(spi);
425425
hw_setup_clock_mode(spi, message->spi->mode);
@@ -461,10 +461,10 @@ static void hw_setup_transfer(struct lantiq_ssc_spi *spi,
461461
lantiq_ssc_writel(spi, con, LTQ_SPI_CON);
462462
}
463463

464-
static int lantiq_ssc_unprepare_message(struct spi_master *master,
464+
static int lantiq_ssc_unprepare_message(struct spi_controller *host,
465465
struct spi_message *message)
466466
{
467-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(master);
467+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(host);
468468

469469
flush_workqueue(spi->wq);
470470

@@ -693,8 +693,8 @@ static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data)
693693
lantiq_ssc_maskl(spi, 0, LTQ_SPI_WHBSTATE_CLR_ERRORS, LTQ_SPI_WHBSTATE);
694694

695695
/* set bad status so it can be retried */
696-
if (spi->master->cur_msg)
697-
spi->master->cur_msg->status = -EIO;
696+
if (spi->host->cur_msg)
697+
spi->host->cur_msg->status = -EIO;
698698
queue_work(spi->wq, &spi->work);
699699
spin_unlock(&spi->lock);
700700

@@ -772,22 +772,22 @@ static void lantiq_ssc_bussy_work(struct work_struct *work)
772772
u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT);
773773

774774
if (!(stat & LTQ_SPI_STAT_BSY)) {
775-
spi_finalize_current_transfer(spi->master);
775+
spi_finalize_current_transfer(spi->host);
776776
return;
777777
}
778778

779779
cond_resched();
780780
} while (!time_after_eq(jiffies, end));
781781

782-
if (spi->master->cur_msg)
783-
spi->master->cur_msg->status = -EIO;
784-
spi_finalize_current_transfer(spi->master);
782+
if (spi->host->cur_msg)
783+
spi->host->cur_msg->status = -EIO;
784+
spi_finalize_current_transfer(spi->host);
785785
}
786786

787-
static void lantiq_ssc_handle_err(struct spi_master *master,
787+
static void lantiq_ssc_handle_err(struct spi_controller *host,
788788
struct spi_message *message)
789789
{
790-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(master);
790+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(host);
791791

792792
/* flush FIFOs on timeout */
793793
rx_fifo_flush(spi);
@@ -796,7 +796,7 @@ static void lantiq_ssc_handle_err(struct spi_master *master,
796796

797797
static void lantiq_ssc_set_cs(struct spi_device *spidev, bool enable)
798798
{
799-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(spidev->master);
799+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(spidev->controller);
800800
unsigned int cs = spi_get_chipselect(spidev, 0);
801801
u32 fgpo;
802802

@@ -808,11 +808,11 @@ static void lantiq_ssc_set_cs(struct spi_device *spidev, bool enable)
808808
lantiq_ssc_writel(spi, fgpo, LTQ_SPI_FPGO);
809809
}
810810

811-
static int lantiq_ssc_transfer_one(struct spi_master *master,
811+
static int lantiq_ssc_transfer_one(struct spi_controller *host,
812812
struct spi_device *spidev,
813813
struct spi_transfer *t)
814814
{
815-
struct lantiq_ssc_spi *spi = spi_master_get_devdata(master);
815+
struct lantiq_ssc_spi *spi = spi_controller_get_devdata(host);
816816

817817
hw_setup_transfer(spi, spidev, t);
818818

@@ -904,7 +904,7 @@ MODULE_DEVICE_TABLE(of, lantiq_ssc_match);
904904
static int lantiq_ssc_probe(struct platform_device *pdev)
905905
{
906906
struct device *dev = &pdev->dev;
907-
struct spi_master *master;
907+
struct spi_controller *host;
908908
struct lantiq_ssc_spi *spi;
909909
const struct lantiq_ssc_hwcfg *hwcfg;
910910
u32 id, supports_dma, revision;
@@ -913,33 +913,33 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
913913

914914
hwcfg = of_device_get_match_data(dev);
915915

916-
master = spi_alloc_master(dev, sizeof(struct lantiq_ssc_spi));
917-
if (!master)
916+
host = spi_alloc_host(dev, sizeof(struct lantiq_ssc_spi));
917+
if (!host)
918918
return -ENOMEM;
919919

920-
spi = spi_master_get_devdata(master);
921-
spi->master = master;
920+
spi = spi_controller_get_devdata(host);
921+
spi->host = host;
922922
spi->dev = dev;
923923
spi->hwcfg = hwcfg;
924924
platform_set_drvdata(pdev, spi);
925925
spi->regbase = devm_platform_ioremap_resource(pdev, 0);
926926
if (IS_ERR(spi->regbase)) {
927927
err = PTR_ERR(spi->regbase);
928-
goto err_master_put;
928+
goto err_host_put;
929929
}
930930

931931
err = hwcfg->cfg_irq(pdev, spi);
932932
if (err)
933-
goto err_master_put;
933+
goto err_host_put;
934934

935935
spi->spi_clk = devm_clk_get(dev, "gate");
936936
if (IS_ERR(spi->spi_clk)) {
937937
err = PTR_ERR(spi->spi_clk);
938-
goto err_master_put;
938+
goto err_host_put;
939939
}
940940
err = clk_prepare_enable(spi->spi_clk);
941941
if (err)
942-
goto err_master_put;
942+
goto err_host_put;
943943

944944
/*
945945
* Use the old clk_get_fpi() function on Lantiq platform, till it
@@ -965,19 +965,19 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
965965
spi->bits_per_word = 8;
966966
spi->speed_hz = 0;
967967

968-
master->dev.of_node = pdev->dev.of_node;
969-
master->num_chipselect = num_cs;
970-
master->use_gpio_descriptors = true;
971-
master->setup = lantiq_ssc_setup;
972-
master->set_cs = lantiq_ssc_set_cs;
973-
master->handle_err = lantiq_ssc_handle_err;
974-
master->prepare_message = lantiq_ssc_prepare_message;
975-
master->unprepare_message = lantiq_ssc_unprepare_message;
976-
master->transfer_one = lantiq_ssc_transfer_one;
977-
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH |
978-
SPI_LOOP;
979-
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) |
980-
SPI_BPW_MASK(16) | SPI_BPW_MASK(32);
968+
host->dev.of_node = pdev->dev.of_node;
969+
host->num_chipselect = num_cs;
970+
host->use_gpio_descriptors = true;
971+
host->setup = lantiq_ssc_setup;
972+
host->set_cs = lantiq_ssc_set_cs;
973+
host->handle_err = lantiq_ssc_handle_err;
974+
host->prepare_message = lantiq_ssc_prepare_message;
975+
host->unprepare_message = lantiq_ssc_unprepare_message;
976+
host->transfer_one = lantiq_ssc_transfer_one;
977+
host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH |
978+
SPI_LOOP;
979+
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) |
980+
SPI_BPW_MASK(16) | SPI_BPW_MASK(32);
981981

982982
spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM);
983983
if (!spi->wq) {
@@ -998,9 +998,9 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
998998
"Lantiq SSC SPI controller (Rev %i, TXFS %u, RXFS %u, DMA %u)\n",
999999
revision, spi->tx_fifo_size, spi->rx_fifo_size, supports_dma);
10001000

1001-
err = devm_spi_register_master(dev, master);
1001+
err = devm_spi_register_controller(dev, host);
10021002
if (err) {
1003-
dev_err(dev, "failed to register spi_master\n");
1003+
dev_err(dev, "failed to register spi host\n");
10041004
goto err_wq_destroy;
10051005
}
10061006

@@ -1012,8 +1012,8 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
10121012
clk_put(spi->fpi_clk);
10131013
err_clk_disable:
10141014
clk_disable_unprepare(spi->spi_clk);
1015-
err_master_put:
1016-
spi_master_put(master);
1015+
err_host_put:
1016+
spi_controller_put(host);
10171017

10181018
return err;
10191019
}

0 commit comments

Comments
 (0)