Commit 9d5920b3 authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

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: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230728093221.3312026-4-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 21ac58f5
...@@ -356,8 +356,8 @@ static bool spi_engine_read_rx_fifo(struct spi_engine *spi_engine) ...@@ -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) static irqreturn_t spi_engine_irq(int irq, void *devid)
{ {
struct spi_master *master = devid; struct spi_controller *host = devid;
struct spi_engine *spi_engine = spi_master_get_devdata(master); struct spi_engine *spi_engine = spi_controller_get_devdata(host);
unsigned int disable_int = 0; unsigned int disable_int = 0;
unsigned int pending; unsigned int pending;
...@@ -396,7 +396,7 @@ static irqreturn_t spi_engine_irq(int irq, void *devid) ...@@ -396,7 +396,7 @@ static irqreturn_t spi_engine_irq(int irq, void *devid)
msg->status = 0; msg->status = 0;
msg->actual_length = msg->frame_length; msg->actual_length = msg->frame_length;
spi_engine->msg = NULL; spi_engine->msg = NULL;
spi_finalize_current_message(master); spi_finalize_current_message(host);
disable_int |= SPI_ENGINE_INT_SYNC; disable_int |= SPI_ENGINE_INT_SYNC;
} }
} }
...@@ -412,11 +412,11 @@ static irqreturn_t spi_engine_irq(int irq, void *devid) ...@@ -412,11 +412,11 @@ static irqreturn_t spi_engine_irq(int irq, void *devid)
return IRQ_HANDLED; 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_message *msg)
{ {
struct spi_engine_program p_dry, *p; 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 int int_enable = 0;
unsigned long flags; unsigned long flags;
size_t size; size_t size;
...@@ -464,7 +464,7 @@ static int spi_engine_transfer_one_message(struct spi_master *master, ...@@ -464,7 +464,7 @@ static int spi_engine_transfer_one_message(struct spi_master *master,
static int spi_engine_probe(struct platform_device *pdev) static int spi_engine_probe(struct platform_device *pdev)
{ {
struct spi_engine *spi_engine; struct spi_engine *spi_engine;
struct spi_master *master; struct spi_controller *host;
unsigned int version; unsigned int version;
int irq; int irq;
int ret; int ret;
...@@ -477,29 +477,29 @@ static int spi_engine_probe(struct platform_device *pdev) ...@@ -477,29 +477,29 @@ static int spi_engine_probe(struct platform_device *pdev)
if (!spi_engine) if (!spi_engine)
return -ENOMEM; return -ENOMEM;
master = spi_alloc_master(&pdev->dev, 0); host = spi_alloc_host(&pdev->dev, 0);
if (!master) if (!host)
return -ENOMEM; return -ENOMEM;
spi_master_set_devdata(master, spi_engine); spi_controller_set_devdata(host, spi_engine);
spin_lock_init(&spi_engine->lock); spin_lock_init(&spi_engine->lock);
spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk"); spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
if (IS_ERR(spi_engine->clk)) { if (IS_ERR(spi_engine->clk)) {
ret = PTR_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"); spi_engine->ref_clk = devm_clk_get(&pdev->dev, "spi_clk");
if (IS_ERR(spi_engine->ref_clk)) { if (IS_ERR(spi_engine->ref_clk)) {
ret = PTR_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); ret = clk_prepare_enable(spi_engine->clk);
if (ret) if (ret)
goto err_put_master; goto err_put_host;
ret = clk_prepare_enable(spi_engine->ref_clk); ret = clk_prepare_enable(spi_engine->ref_clk);
if (ret) if (ret)
...@@ -525,46 +525,46 @@ static int spi_engine_probe(struct platform_device *pdev) ...@@ -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(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE); 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) if (ret)
goto err_ref_clk_disable; goto err_ref_clk_disable;
master->dev.of_node = pdev->dev.of_node; host->dev.of_node = pdev->dev.of_node;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE;
master->bits_per_word_mask = SPI_BPW_MASK(8); host->bits_per_word_mask = SPI_BPW_MASK(8);
master->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2; host->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2;
master->transfer_one_message = spi_engine_transfer_one_message; host->transfer_one_message = spi_engine_transfer_one_message;
master->num_chipselect = 8; host->num_chipselect = 8;
ret = spi_register_master(master); ret = spi_register_controller(host);
if (ret) if (ret)
goto err_free_irq; goto err_free_irq;
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
return 0; return 0;
err_free_irq: err_free_irq:
free_irq(irq, master); free_irq(irq, host);
err_ref_clk_disable: err_ref_clk_disable:
clk_disable_unprepare(spi_engine->ref_clk); clk_disable_unprepare(spi_engine->ref_clk);
err_clk_disable: err_clk_disable:
clk_disable_unprepare(spi_engine->clk); clk_disable_unprepare(spi_engine->clk);
err_put_master: err_put_host:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
static void spi_engine_remove(struct platform_device *pdev) static void spi_engine_remove(struct platform_device *pdev)
{ {
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); struct spi_controller *host = spi_controller_get(platform_get_drvdata(pdev));
struct spi_engine *spi_engine = spi_master_get_devdata(master); struct spi_engine *spi_engine = spi_controller_get_devdata(host);
int irq = platform_get_irq(pdev, 0); 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(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE); writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
......
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