mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 09:13:55 +08:00
spi: ath79: 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://lore.kernel.org/r/20221230092806.1687340-2-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
02c9e5b768
commit
5aede90a1f
@ -58,7 +58,7 @@ static inline void ath79_spi_wr(struct ath79_spi *sp, unsigned int reg, u32 val)
|
||||
|
||||
static inline struct ath79_spi *ath79_spidev_to_sp(struct spi_device *spi)
|
||||
{
|
||||
return spi_master_get_devdata(spi->master);
|
||||
return spi_controller_get_devdata(spi->controller);
|
||||
}
|
||||
|
||||
static inline void ath79_spi_delay(struct ath79_spi *sp, unsigned int nsecs)
|
||||
@ -120,7 +120,7 @@ static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned int nsecs,
|
||||
else
|
||||
out = ioc & ~AR71XX_SPI_IOC_DO;
|
||||
|
||||
/* setup MSB (to slave) on trailing edge */
|
||||
/* setup MSB (to target) on trailing edge */
|
||||
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
|
||||
ath79_spi_delay(sp, nsecs);
|
||||
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK);
|
||||
@ -168,28 +168,28 @@ static const struct spi_controller_mem_ops ath79_mem_ops = {
|
||||
|
||||
static int ath79_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master;
|
||||
struct spi_controller *host;
|
||||
struct ath79_spi *sp;
|
||||
unsigned long rate;
|
||||
int ret;
|
||||
|
||||
master = spi_alloc_master(&pdev->dev, sizeof(*sp));
|
||||
if (master == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate spi master\n");
|
||||
host = spi_alloc_host(&pdev->dev, sizeof(*sp));
|
||||
if (host == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate spi host\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
sp = spi_master_get_devdata(master);
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
sp = spi_controller_get_devdata(host);
|
||||
host->dev.of_node = pdev->dev.of_node;
|
||||
platform_set_drvdata(pdev, sp);
|
||||
|
||||
master->use_gpio_descriptors = true;
|
||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
||||
master->flags = SPI_MASTER_GPIO_SS;
|
||||
master->num_chipselect = 3;
|
||||
master->mem_ops = &ath79_mem_ops;
|
||||
host->use_gpio_descriptors = true;
|
||||
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
||||
host->flags = SPI_MASTER_GPIO_SS;
|
||||
host->num_chipselect = 3;
|
||||
host->mem_ops = &ath79_mem_ops;
|
||||
|
||||
sp->bitbang.master = master;
|
||||
sp->bitbang.master = host;
|
||||
sp->bitbang.chipselect = ath79_spi_chipselect;
|
||||
sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0;
|
||||
sp->bitbang.flags = SPI_CS_HIGH;
|
||||
@ -197,18 +197,18 @@ static int ath79_spi_probe(struct platform_device *pdev)
|
||||
sp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(sp->base)) {
|
||||
ret = PTR_ERR(sp->base);
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
}
|
||||
|
||||
sp->clk = devm_clk_get(&pdev->dev, "ahb");
|
||||
if (IS_ERR(sp->clk)) {
|
||||
ret = PTR_ERR(sp->clk);
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(sp->clk);
|
||||
if (ret)
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
|
||||
rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ);
|
||||
if (!rate) {
|
||||
@ -231,8 +231,8 @@ err_disable:
|
||||
ath79_spi_disable(sp);
|
||||
err_clk_disable:
|
||||
clk_disable_unprepare(sp->clk);
|
||||
err_put_master:
|
||||
spi_master_put(sp->bitbang.master);
|
||||
err_put_host:
|
||||
spi_controller_put(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -244,7 +244,7 @@ static int ath79_spi_remove(struct platform_device *pdev)
|
||||
spi_bitbang_stop(&sp->bitbang);
|
||||
ath79_spi_disable(sp);
|
||||
clk_disable_unprepare(sp->clk);
|
||||
spi_master_put(sp->bitbang.master);
|
||||
spi_controller_put(sp->bitbang.master);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user