mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 05:26:07 +00:00
spi: spi-axi-spi-engine: switch to use modern name
Change legacy name master to modern name host or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230728093221.3312026-4-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
21ac58f591
commit
9d5920b37a
@ -356,8 +356,8 @@ static bool spi_engine_read_rx_fifo(struct spi_engine *spi_engine)
|
||||
|
||||
static irqreturn_t spi_engine_irq(int irq, void *devid)
|
||||
{
|
||||
struct spi_master *master = devid;
|
||||
struct spi_engine *spi_engine = spi_master_get_devdata(master);
|
||||
struct spi_controller *host = devid;
|
||||
struct spi_engine *spi_engine = spi_controller_get_devdata(host);
|
||||
unsigned int disable_int = 0;
|
||||
unsigned int pending;
|
||||
|
||||
@ -396,7 +396,7 @@ static irqreturn_t spi_engine_irq(int irq, void *devid)
|
||||
msg->status = 0;
|
||||
msg->actual_length = msg->frame_length;
|
||||
spi_engine->msg = NULL;
|
||||
spi_finalize_current_message(master);
|
||||
spi_finalize_current_message(host);
|
||||
disable_int |= SPI_ENGINE_INT_SYNC;
|
||||
}
|
||||
}
|
||||
@ -412,11 +412,11 @@ static irqreturn_t spi_engine_irq(int irq, void *devid)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int spi_engine_transfer_one_message(struct spi_master *master,
|
||||
static int spi_engine_transfer_one_message(struct spi_controller *host,
|
||||
struct spi_message *msg)
|
||||
{
|
||||
struct spi_engine_program p_dry, *p;
|
||||
struct spi_engine *spi_engine = spi_master_get_devdata(master);
|
||||
struct spi_engine *spi_engine = spi_controller_get_devdata(host);
|
||||
unsigned int int_enable = 0;
|
||||
unsigned long flags;
|
||||
size_t size;
|
||||
@ -464,7 +464,7 @@ static int spi_engine_transfer_one_message(struct spi_master *master,
|
||||
static int spi_engine_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_engine *spi_engine;
|
||||
struct spi_master *master;
|
||||
struct spi_controller *host;
|
||||
unsigned int version;
|
||||
int irq;
|
||||
int ret;
|
||||
@ -477,29 +477,29 @@ static int spi_engine_probe(struct platform_device *pdev)
|
||||
if (!spi_engine)
|
||||
return -ENOMEM;
|
||||
|
||||
master = spi_alloc_master(&pdev->dev, 0);
|
||||
if (!master)
|
||||
host = spi_alloc_host(&pdev->dev, 0);
|
||||
if (!host)
|
||||
return -ENOMEM;
|
||||
|
||||
spi_master_set_devdata(master, spi_engine);
|
||||
spi_controller_set_devdata(host, spi_engine);
|
||||
|
||||
spin_lock_init(&spi_engine->lock);
|
||||
|
||||
spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
|
||||
if (IS_ERR(spi_engine->clk)) {
|
||||
ret = PTR_ERR(spi_engine->clk);
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
}
|
||||
|
||||
spi_engine->ref_clk = devm_clk_get(&pdev->dev, "spi_clk");
|
||||
if (IS_ERR(spi_engine->ref_clk)) {
|
||||
ret = PTR_ERR(spi_engine->ref_clk);
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(spi_engine->clk);
|
||||
if (ret)
|
||||
goto err_put_master;
|
||||
goto err_put_host;
|
||||
|
||||
ret = clk_prepare_enable(spi_engine->ref_clk);
|
||||
if (ret)
|
||||
@ -525,46 +525,46 @@ static int spi_engine_probe(struct platform_device *pdev)
|
||||
writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
|
||||
writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
|
||||
|
||||
ret = request_irq(irq, spi_engine_irq, 0, pdev->name, master);
|
||||
ret = request_irq(irq, spi_engine_irq, 0, pdev->name, host);
|
||||
if (ret)
|
||||
goto err_ref_clk_disable;
|
||||
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE;
|
||||
master->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
master->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2;
|
||||
master->transfer_one_message = spi_engine_transfer_one_message;
|
||||
master->num_chipselect = 8;
|
||||
host->dev.of_node = pdev->dev.of_node;
|
||||
host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE;
|
||||
host->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
host->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2;
|
||||
host->transfer_one_message = spi_engine_transfer_one_message;
|
||||
host->num_chipselect = 8;
|
||||
|
||||
ret = spi_register_master(master);
|
||||
ret = spi_register_controller(host);
|
||||
if (ret)
|
||||
goto err_free_irq;
|
||||
|
||||
platform_set_drvdata(pdev, master);
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
return 0;
|
||||
err_free_irq:
|
||||
free_irq(irq, master);
|
||||
free_irq(irq, host);
|
||||
err_ref_clk_disable:
|
||||
clk_disable_unprepare(spi_engine->ref_clk);
|
||||
err_clk_disable:
|
||||
clk_disable_unprepare(spi_engine->clk);
|
||||
err_put_master:
|
||||
spi_master_put(master);
|
||||
err_put_host:
|
||||
spi_controller_put(host);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void spi_engine_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
|
||||
struct spi_engine *spi_engine = spi_master_get_devdata(master);
|
||||
struct spi_controller *host = spi_controller_get(platform_get_drvdata(pdev));
|
||||
struct spi_engine *spi_engine = spi_controller_get_devdata(host);
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
|
||||
spi_unregister_master(master);
|
||||
spi_unregister_controller(host);
|
||||
|
||||
free_irq(irq, master);
|
||||
free_irq(irq, host);
|
||||
|
||||
spi_master_put(master);
|
||||
spi_controller_put(host);
|
||||
|
||||
writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
|
||||
writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user