mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
synced 2025-10-03 06:51:35 +10: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)
|
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)
|
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
|
else
|
||||||
out = ioc & ~AR71XX_SPI_IOC_DO;
|
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_wr(sp, AR71XX_SPI_REG_IOC, out);
|
||||||
ath79_spi_delay(sp, nsecs);
|
ath79_spi_delay(sp, nsecs);
|
||||||
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK);
|
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)
|
static int ath79_spi_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct spi_master *master;
|
struct spi_controller *host;
|
||||||
struct ath79_spi *sp;
|
struct ath79_spi *sp;
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
master = spi_alloc_master(&pdev->dev, sizeof(*sp));
|
host = spi_alloc_host(&pdev->dev, sizeof(*sp));
|
||||||
if (master == NULL) {
|
if (host == NULL) {
|
||||||
dev_err(&pdev->dev, "failed to allocate spi master\n");
|
dev_err(&pdev->dev, "failed to allocate spi host\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp = spi_master_get_devdata(master);
|
sp = spi_controller_get_devdata(host);
|
||||||
master->dev.of_node = pdev->dev.of_node;
|
host->dev.of_node = pdev->dev.of_node;
|
||||||
platform_set_drvdata(pdev, sp);
|
platform_set_drvdata(pdev, sp);
|
||||||
|
|
||||||
master->use_gpio_descriptors = true;
|
host->use_gpio_descriptors = true;
|
||||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
||||||
master->flags = SPI_MASTER_GPIO_SS;
|
host->flags = SPI_MASTER_GPIO_SS;
|
||||||
master->num_chipselect = 3;
|
host->num_chipselect = 3;
|
||||||
master->mem_ops = &ath79_mem_ops;
|
host->mem_ops = &ath79_mem_ops;
|
||||||
|
|
||||||
sp->bitbang.master = master;
|
sp->bitbang.master = host;
|
||||||
sp->bitbang.chipselect = ath79_spi_chipselect;
|
sp->bitbang.chipselect = ath79_spi_chipselect;
|
||||||
sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0;
|
sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0;
|
||||||
sp->bitbang.flags = SPI_CS_HIGH;
|
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);
|
sp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(sp->base)) {
|
if (IS_ERR(sp->base)) {
|
||||||
ret = PTR_ERR(sp->base);
|
ret = PTR_ERR(sp->base);
|
||||||
goto err_put_master;
|
goto err_put_host;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->clk = devm_clk_get(&pdev->dev, "ahb");
|
sp->clk = devm_clk_get(&pdev->dev, "ahb");
|
||||||
if (IS_ERR(sp->clk)) {
|
if (IS_ERR(sp->clk)) {
|
||||||
ret = PTR_ERR(sp->clk);
|
ret = PTR_ERR(sp->clk);
|
||||||
goto err_put_master;
|
goto err_put_host;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = clk_prepare_enable(sp->clk);
|
ret = clk_prepare_enable(sp->clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_put_master;
|
goto err_put_host;
|
||||||
|
|
||||||
rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ);
|
rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ);
|
||||||
if (!rate) {
|
if (!rate) {
|
||||||
@ -231,8 +231,8 @@ err_disable:
|
|||||||
ath79_spi_disable(sp);
|
ath79_spi_disable(sp);
|
||||||
err_clk_disable:
|
err_clk_disable:
|
||||||
clk_disable_unprepare(sp->clk);
|
clk_disable_unprepare(sp->clk);
|
||||||
err_put_master:
|
err_put_host:
|
||||||
spi_master_put(sp->bitbang.master);
|
spi_controller_put(host);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ static int ath79_spi_remove(struct platform_device *pdev)
|
|||||||
spi_bitbang_stop(&sp->bitbang);
|
spi_bitbang_stop(&sp->bitbang);
|
||||||
ath79_spi_disable(sp);
|
ath79_spi_disable(sp);
|
||||||
clk_disable_unprepare(sp->clk);
|
clk_disable_unprepare(sp->clk);
|
||||||
spi_master_put(sp->bitbang.master);
|
spi_controller_put(sp->bitbang.master);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user