Commit ad5602ba authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: davinci: switch to use modern name

Change legacy name master to modern name host or controller.

No functional changed.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230728093221.3312026-18-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent cd9fdf5a
...@@ -201,7 +201,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) ...@@ -201,7 +201,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value)
u8 chip_sel = spi_get_chipselect(spi, 0); u8 chip_sel = spi_get_chipselect(spi, 0);
u16 spidat1 = CS_DEFAULT; u16 spidat1 = CS_DEFAULT;
dspi = spi_master_get_devdata(spi->master); dspi = spi_controller_get_devdata(spi->controller);
/* program delay transfers if tx_delay is non zero */ /* program delay transfers if tx_delay is non zero */
if (spicfg && spicfg->wdelay) if (spicfg && spicfg->wdelay)
...@@ -271,7 +271,7 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, ...@@ -271,7 +271,7 @@ static int davinci_spi_setup_transfer(struct spi_device *spi,
u32 hz = 0, spifmt = 0; u32 hz = 0, spifmt = 0;
int prescale; int prescale;
dspi = spi_master_get_devdata(spi->master); dspi = spi_controller_get_devdata(spi->controller);
spicfg = spi->controller_data; spicfg = spi->controller_data;
if (!spicfg) if (!spicfg)
spicfg = &davinci_spi_default_cfg; spicfg = &davinci_spi_default_cfg;
...@@ -379,7 +379,7 @@ static int davinci_spi_of_setup(struct spi_device *spi) ...@@ -379,7 +379,7 @@ static int davinci_spi_of_setup(struct spi_device *spi)
{ {
struct davinci_spi_config *spicfg = spi->controller_data; struct davinci_spi_config *spicfg = spi->controller_data;
struct device_node *np = spi->dev.of_node; struct device_node *np = spi->dev.of_node;
struct davinci_spi *dspi = spi_master_get_devdata(spi->master); struct davinci_spi *dspi = spi_controller_get_devdata(spi->controller);
u32 prop; u32 prop;
if (spicfg == NULL && np) { if (spicfg == NULL && np) {
...@@ -411,7 +411,7 @@ static int davinci_spi_setup(struct spi_device *spi) ...@@ -411,7 +411,7 @@ static int davinci_spi_setup(struct spi_device *spi)
struct device_node *np = spi->dev.of_node; struct device_node *np = spi->dev.of_node;
bool internal_cs = true; bool internal_cs = true;
dspi = spi_master_get_devdata(spi->master); dspi = spi_controller_get_devdata(spi->controller);
if (!(spi->mode & SPI_NO_CS)) { if (!(spi->mode & SPI_NO_CS)) {
if (np && spi_get_csgpiod(spi, 0)) if (np && spi_get_csgpiod(spi, 0))
...@@ -441,7 +441,7 @@ static void davinci_spi_cleanup(struct spi_device *spi) ...@@ -441,7 +441,7 @@ static void davinci_spi_cleanup(struct spi_device *spi)
kfree(spicfg); kfree(spicfg);
} }
static bool davinci_spi_can_dma(struct spi_master *master, static bool davinci_spi_can_dma(struct spi_controller *host,
struct spi_device *spi, struct spi_device *spi,
struct spi_transfer *xfer) struct spi_transfer *xfer)
{ {
...@@ -571,7 +571,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) ...@@ -571,7 +571,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
struct davinci_spi_config *spicfg; struct davinci_spi_config *spicfg;
struct davinci_spi_platform_data *pdata; struct davinci_spi_platform_data *pdata;
dspi = spi_master_get_devdata(spi->master); dspi = spi_controller_get_devdata(spi->controller);
pdata = &dspi->pdata; pdata = &dspi->pdata;
spicfg = (struct davinci_spi_config *)spi->controller_data; spicfg = (struct davinci_spi_config *)spi->controller_data;
if (!spicfg) if (!spicfg)
...@@ -592,7 +592,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) ...@@ -592,7 +592,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
reinit_completion(&dspi->done); reinit_completion(&dspi->done);
if (!davinci_spi_can_dma(spi->master, spi, t)) { if (!davinci_spi_can_dma(spi->controller, spi, t)) {
if (spicfg->io_type != SPI_IO_TYPE_POLL) if (spicfg->io_type != SPI_IO_TYPE_POLL)
set_io_bits(dspi->base + SPIINT, SPIINT_MASKINT); set_io_bits(dspi->base + SPIINT, SPIINT_MASKINT);
/* start the transfer */ /* start the transfer */
...@@ -673,7 +673,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) ...@@ -673,7 +673,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
} }
clear_io_bits(dspi->base + SPIINT, SPIINT_MASKALL); clear_io_bits(dspi->base + SPIINT, SPIINT_MASKALL);
if (davinci_spi_can_dma(spi->master, spi, t)) if (davinci_spi_can_dma(spi->controller, spi, t))
clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN);
clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_SPIENA_MASK); clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
...@@ -855,22 +855,22 @@ static int spi_davinci_get_pdata(struct platform_device *pdev, ...@@ -855,22 +855,22 @@ static int spi_davinci_get_pdata(struct platform_device *pdev,
*/ */
static int davinci_spi_probe(struct platform_device *pdev) static int davinci_spi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_controller *host;
struct davinci_spi *dspi; struct davinci_spi *dspi;
struct davinci_spi_platform_data *pdata; struct davinci_spi_platform_data *pdata;
struct resource *r; struct resource *r;
int ret = 0; int ret = 0;
u32 spipc0; u32 spipc0;
master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi)); host = spi_alloc_host(&pdev->dev, sizeof(struct davinci_spi));
if (master == NULL) { if (host == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
dspi = spi_master_get_devdata(master); dspi = spi_controller_get_devdata(host);
if (dev_get_platdata(&pdev->dev)) { if (dev_get_platdata(&pdev->dev)) {
pdata = dev_get_platdata(&pdev->dev); pdata = dev_get_platdata(&pdev->dev);
...@@ -879,7 +879,7 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -879,7 +879,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
/* update dspi pdata with that from the DT */ /* update dspi pdata with that from the DT */
ret = spi_davinci_get_pdata(pdev, dspi); ret = spi_davinci_get_pdata(pdev, dspi);
if (ret < 0) if (ret < 0)
goto free_master; goto free_host;
} }
/* pdata in dspi is now updated and point pdata to that */ /* pdata in dspi is now updated and point pdata to that */
...@@ -891,13 +891,13 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -891,13 +891,13 @@ static int davinci_spi_probe(struct platform_device *pdev)
GFP_KERNEL); GFP_KERNEL);
if (dspi->bytes_per_word == NULL) { if (dspi->bytes_per_word == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_master; goto free_host;
} }
dspi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r); dspi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
if (IS_ERR(dspi->base)) { if (IS_ERR(dspi->base)) {
ret = PTR_ERR(dspi->base); ret = PTR_ERR(dspi->base);
goto free_master; goto free_host;
} }
dspi->pbase = r->start; dspi->pbase = r->start;
...@@ -905,34 +905,34 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -905,34 +905,34 @@ static int davinci_spi_probe(struct platform_device *pdev)
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret < 0) if (ret < 0)
goto free_master; goto free_host;
dspi->irq = ret; dspi->irq = ret;
ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq, ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
dummy_thread_fn, 0, dev_name(&pdev->dev), dspi); dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
if (ret) if (ret)
goto free_master; goto free_host;
dspi->bitbang.master = master; dspi->bitbang.master = host;
dspi->clk = devm_clk_get(&pdev->dev, NULL); dspi->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(dspi->clk)) { if (IS_ERR(dspi->clk)) {
ret = -ENODEV; ret = -ENODEV;
goto free_master; goto free_host;
} }
ret = clk_prepare_enable(dspi->clk); ret = clk_prepare_enable(dspi->clk);
if (ret) if (ret)
goto free_master; goto free_host;
master->use_gpio_descriptors = true; host->use_gpio_descriptors = true;
master->dev.of_node = pdev->dev.of_node; host->dev.of_node = pdev->dev.of_node;
master->bus_num = pdev->id; host->bus_num = pdev->id;
master->num_chipselect = pdata->num_chipselect; host->num_chipselect = pdata->num_chipselect;
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); host->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
master->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_GPIO_SS; host->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_GPIO_SS;
master->setup = davinci_spi_setup; host->setup = davinci_spi_setup;
master->cleanup = davinci_spi_cleanup; host->cleanup = davinci_spi_cleanup;
master->can_dma = davinci_spi_can_dma; host->can_dma = davinci_spi_can_dma;
dspi->bitbang.chipselect = davinci_spi_chipselect; dspi->bitbang.chipselect = davinci_spi_chipselect;
dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; dspi->bitbang.setup_transfer = davinci_spi_setup_transfer;
...@@ -973,7 +973,7 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -973,7 +973,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
iowrite32(CS_DEFAULT, dspi->base + SPIDEF); iowrite32(CS_DEFAULT, dspi->base + SPIDEF);
/* master mode default */ /* host mode default */
set_io_bits(dspi->base + SPIGCR1, SPIGCR1_CLKMOD_MASK); set_io_bits(dspi->base + SPIGCR1, SPIGCR1_CLKMOD_MASK);
set_io_bits(dspi->base + SPIGCR1, SPIGCR1_MASTER_MASK); set_io_bits(dspi->base + SPIGCR1, SPIGCR1_MASTER_MASK);
set_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK); set_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
...@@ -993,8 +993,8 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -993,8 +993,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
} }
free_clk: free_clk:
clk_disable_unprepare(dspi->clk); clk_disable_unprepare(dspi->clk);
free_master: free_host:
spi_master_put(master); spi_controller_put(host);
err: err:
return ret; return ret;
} }
...@@ -1011,10 +1011,10 @@ static int davinci_spi_probe(struct platform_device *pdev) ...@@ -1011,10 +1011,10 @@ static int davinci_spi_probe(struct platform_device *pdev)
static void davinci_spi_remove(struct platform_device *pdev) static void davinci_spi_remove(struct platform_device *pdev)
{ {
struct davinci_spi *dspi; struct davinci_spi *dspi;
struct spi_master *master; struct spi_controller *host;
master = platform_get_drvdata(pdev); host = platform_get_drvdata(pdev);
dspi = spi_master_get_devdata(master); dspi = spi_controller_get_devdata(host);
spi_bitbang_stop(&dspi->bitbang); spi_bitbang_stop(&dspi->bitbang);
...@@ -1025,7 +1025,7 @@ static void davinci_spi_remove(struct platform_device *pdev) ...@@ -1025,7 +1025,7 @@ static void davinci_spi_remove(struct platform_device *pdev)
dma_release_channel(dspi->dma_tx); dma_release_channel(dspi->dma_tx);
} }
spi_master_put(master); spi_controller_put(host);
} }
static struct platform_driver davinci_spi_driver = { static struct platform_driver davinci_spi_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment