Commit 8726bdce authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: geni-qcom: switch to use modern name

Change legacy name master/slave to modern name host/target or controller.

No functional changed.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://msgid.link/r/20231128093031.3707034-11-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3524d1b7
...@@ -145,10 +145,10 @@ static int get_spi_clk_cfg(unsigned int speed_hz, ...@@ -145,10 +145,10 @@ static int get_spi_clk_cfg(unsigned int speed_hz,
return ret; return ret;
} }
static void handle_se_timeout(struct spi_master *spi, static void handle_se_timeout(struct spi_controller *spi,
struct spi_message *msg) struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
unsigned long time_left; unsigned long time_left;
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
const struct spi_transfer *xfer; const struct spi_transfer *xfer;
...@@ -160,9 +160,9 @@ static void handle_se_timeout(struct spi_master *spi, ...@@ -160,9 +160,9 @@ static void handle_se_timeout(struct spi_master *spi,
xfer = mas->cur_xfer; xfer = mas->cur_xfer;
mas->cur_xfer = NULL; mas->cur_xfer = NULL;
if (spi->slave) { if (spi->target) {
/* /*
* skip CMD Cancel sequnece since spi slave * skip CMD Cancel sequnece since spi target
* doesn`t support CMD Cancel sequnece * doesn`t support CMD Cancel sequnece
*/ */
spin_unlock_irq(&mas->lock); spin_unlock_irq(&mas->lock);
...@@ -225,17 +225,17 @@ static void handle_se_timeout(struct spi_master *spi, ...@@ -225,17 +225,17 @@ static void handle_se_timeout(struct spi_master *spi,
} }
} }
static void handle_gpi_timeout(struct spi_master *spi, struct spi_message *msg) static void handle_gpi_timeout(struct spi_controller *spi, struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
dmaengine_terminate_sync(mas->tx); dmaengine_terminate_sync(mas->tx);
dmaengine_terminate_sync(mas->rx); dmaengine_terminate_sync(mas->rx);
} }
static void spi_geni_handle_err(struct spi_master *spi, struct spi_message *msg) static void spi_geni_handle_err(struct spi_controller *spi, struct spi_message *msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
switch (mas->cur_xfer_mode) { switch (mas->cur_xfer_mode) {
case GENI_SE_FIFO: case GENI_SE_FIFO:
...@@ -286,8 +286,8 @@ static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas) ...@@ -286,8 +286,8 @@ static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas)
static void spi_geni_set_cs(struct spi_device *slv, bool set_flag) static void spi_geni_set_cs(struct spi_device *slv, bool set_flag)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(slv->master); struct spi_geni_master *mas = spi_controller_get_devdata(slv->controller);
struct spi_master *spi = dev_get_drvdata(mas->dev); struct spi_controller *spi = dev_get_drvdata(mas->dev);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
unsigned long time_left; unsigned long time_left;
...@@ -395,9 +395,9 @@ static int geni_spi_set_clock_and_bw(struct spi_geni_master *mas, ...@@ -395,9 +395,9 @@ static int geni_spi_set_clock_and_bw(struct spi_geni_master *mas,
} }
static int setup_fifo_params(struct spi_device *spi_slv, static int setup_fifo_params(struct spi_device *spi_slv,
struct spi_master *spi) struct spi_controller *spi)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
u32 loopback_cfg = 0, cpol = 0, cpha = 0, demux_output_inv = 0; u32 loopback_cfg = 0, cpol = 0, cpha = 0, demux_output_inv = 0;
u32 demux_sel; u32 demux_sel;
...@@ -434,7 +434,7 @@ static int setup_fifo_params(struct spi_device *spi_slv, ...@@ -434,7 +434,7 @@ static int setup_fifo_params(struct spi_device *spi_slv,
static void static void
spi_gsi_callback_result(void *cb, const struct dmaengine_result *result) spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
{ {
struct spi_master *spi = cb; struct spi_controller *spi = cb;
spi->cur_msg->status = -EIO; spi->cur_msg->status = -EIO;
if (result->result != DMA_TRANS_NOERROR) { if (result->result != DMA_TRANS_NOERROR) {
...@@ -454,7 +454,7 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result) ...@@ -454,7 +454,7 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
} }
static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas, static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
struct spi_device *spi_slv, struct spi_master *spi) struct spi_device *spi_slv, struct spi_controller *spi)
{ {
unsigned long flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK; unsigned long flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
struct dma_slave_config config = {}; struct dma_slave_config config = {};
...@@ -560,14 +560,14 @@ static u32 get_xfer_len_in_words(struct spi_transfer *xfer, ...@@ -560,14 +560,14 @@ static u32 get_xfer_len_in_words(struct spi_transfer *xfer,
static bool geni_can_dma(struct spi_controller *ctlr, static bool geni_can_dma(struct spi_controller *ctlr,
struct spi_device *slv, struct spi_transfer *xfer) struct spi_device *slv, struct spi_transfer *xfer)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(slv->master); struct spi_geni_master *mas = spi_controller_get_devdata(slv->controller);
u32 len, fifo_size; u32 len, fifo_size;
if (mas->cur_xfer_mode == GENI_GPI_DMA) if (mas->cur_xfer_mode == GENI_GPI_DMA)
return true; return true;
/* Set SE DMA mode for SPI slave. */ /* Set SE DMA mode for SPI target. */
if (ctlr->slave) if (ctlr->target)
return true; return true;
len = get_xfer_len_in_words(xfer, mas); len = get_xfer_len_in_words(xfer, mas);
...@@ -579,10 +579,10 @@ static bool geni_can_dma(struct spi_controller *ctlr, ...@@ -579,10 +579,10 @@ static bool geni_can_dma(struct spi_controller *ctlr,
return false; return false;
} }
static int spi_geni_prepare_message(struct spi_master *spi, static int spi_geni_prepare_message(struct spi_controller *spi,
struct spi_message *spi_msg) struct spi_message *spi_msg)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
switch (mas->cur_xfer_mode) { switch (mas->cur_xfer_mode) {
...@@ -657,7 +657,7 @@ static int spi_geni_init(struct spi_geni_master *mas) ...@@ -657,7 +657,7 @@ static int spi_geni_init(struct spi_geni_master *mas)
proto = geni_se_read_proto(se); proto = geni_se_read_proto(se);
if (spi->slave) { if (spi->target) {
if (proto != GENI_SE_SPI_SLAVE) { if (proto != GENI_SE_SPI_SLAVE) {
dev_err(mas->dev, "Invalid proto %d\n", proto); dev_err(mas->dev, "Invalid proto %d\n", proto);
goto out_pm; goto out_pm;
...@@ -715,7 +715,7 @@ static int spi_geni_init(struct spi_geni_master *mas) ...@@ -715,7 +715,7 @@ static int spi_geni_init(struct spi_geni_master *mas)
} }
/* We always control CS manually */ /* We always control CS manually */
if (!spi->slave) { if (!spi->target) {
spi_tx_cfg = readl(se->base + SE_SPI_TRANS_CFG); spi_tx_cfg = readl(se->base + SE_SPI_TRANS_CFG);
spi_tx_cfg &= ~CS_TOGGLE; spi_tx_cfg &= ~CS_TOGGLE;
writel(spi_tx_cfg, se->base + SE_SPI_TRANS_CFG); writel(spi_tx_cfg, se->base + SE_SPI_TRANS_CFG);
...@@ -824,7 +824,7 @@ static void geni_spi_handle_rx(struct spi_geni_master *mas) ...@@ -824,7 +824,7 @@ static void geni_spi_handle_rx(struct spi_geni_master *mas)
static int setup_se_xfer(struct spi_transfer *xfer, static int setup_se_xfer(struct spi_transfer *xfer,
struct spi_geni_master *mas, struct spi_geni_master *mas,
u16 mode, struct spi_master *spi) u16 mode, struct spi_controller *spi)
{ {
u32 m_cmd = 0; u32 m_cmd = 0;
u32 len; u32 len;
...@@ -913,11 +913,11 @@ static int setup_se_xfer(struct spi_transfer *xfer, ...@@ -913,11 +913,11 @@ static int setup_se_xfer(struct spi_transfer *xfer,
return ret; return ret;
} }
static int spi_geni_transfer_one(struct spi_master *spi, static int spi_geni_transfer_one(struct spi_controller *spi,
struct spi_device *slv, struct spi_device *slv,
struct spi_transfer *xfer) struct spi_transfer *xfer)
{ {
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
if (spi_geni_is_abort_still_pending(mas)) if (spi_geni_is_abort_still_pending(mas))
...@@ -939,8 +939,8 @@ static int spi_geni_transfer_one(struct spi_master *spi, ...@@ -939,8 +939,8 @@ static int spi_geni_transfer_one(struct spi_master *spi,
static irqreturn_t geni_spi_isr(int irq, void *data) static irqreturn_t geni_spi_isr(int irq, void *data)
{ {
struct spi_master *spi = data; struct spi_controller *spi = data;
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
struct geni_se *se = &mas->se; struct geni_se *se = &mas->se;
u32 m_irq; u32 m_irq;
...@@ -1042,7 +1042,7 @@ static irqreturn_t geni_spi_isr(int irq, void *data) ...@@ -1042,7 +1042,7 @@ static irqreturn_t geni_spi_isr(int irq, void *data)
static int spi_geni_probe(struct platform_device *pdev) static int spi_geni_probe(struct platform_device *pdev)
{ {
int ret, irq; int ret, irq;
struct spi_master *spi; struct spi_controller *spi;
struct spi_geni_master *mas; struct spi_geni_master *mas;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
...@@ -1064,12 +1064,12 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1064,12 +1064,12 @@ static int spi_geni_probe(struct platform_device *pdev)
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
spi = devm_spi_alloc_master(dev, sizeof(*mas)); spi = devm_spi_alloc_host(dev, sizeof(*mas));
if (!spi) if (!spi)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, spi); platform_set_drvdata(pdev, spi);
mas = spi_master_get_devdata(spi); mas = spi_controller_get_devdata(spi);
mas->irq = irq; mas->irq = irq;
mas->dev = dev; mas->dev = dev;
mas->se.dev = dev; mas->se.dev = dev;
...@@ -1113,7 +1113,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1113,7 +1113,7 @@ static int spi_geni_probe(struct platform_device *pdev)
pm_runtime_enable(dev); pm_runtime_enable(dev);
if (device_property_read_bool(&pdev->dev, "spi-slave")) if (device_property_read_bool(&pdev->dev, "spi-slave"))
spi->slave = true; spi->target = true;
ret = geni_icc_get(&mas->se, NULL); ret = geni_icc_get(&mas->se, NULL);
if (ret) if (ret)
...@@ -1135,7 +1135,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1135,7 +1135,7 @@ static int spi_geni_probe(struct platform_device *pdev)
* for dma (gsi) mode, the gsi will set cs based on params passed in * for dma (gsi) mode, the gsi will set cs based on params passed in
* TRE * TRE
*/ */
if (!spi->slave && mas->cur_xfer_mode == GENI_SE_FIFO) if (!spi->target && mas->cur_xfer_mode == GENI_SE_FIFO)
spi->set_cs = spi_geni_set_cs; spi->set_cs = spi_geni_set_cs;
/* /*
...@@ -1148,7 +1148,7 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1148,7 +1148,7 @@ static int spi_geni_probe(struct platform_device *pdev)
if (ret) if (ret)
goto spi_geni_release_dma; goto spi_geni_release_dma;
ret = spi_register_master(spi); ret = spi_register_controller(spi);
if (ret) if (ret)
goto spi_geni_probe_free_irq; goto spi_geni_probe_free_irq;
...@@ -1164,11 +1164,11 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1164,11 +1164,11 @@ static int spi_geni_probe(struct platform_device *pdev)
static void spi_geni_remove(struct platform_device *pdev) static void spi_geni_remove(struct platform_device *pdev)
{ {
struct spi_master *spi = platform_get_drvdata(pdev); struct spi_controller *spi = platform_get_drvdata(pdev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
/* Unregister _before_ disabling pm_runtime() so we stop transfers */ /* Unregister _before_ disabling pm_runtime() so we stop transfers */
spi_unregister_master(spi); spi_unregister_controller(spi);
spi_geni_release_dma_chan(mas); spi_geni_release_dma_chan(mas);
...@@ -1178,8 +1178,8 @@ static void spi_geni_remove(struct platform_device *pdev) ...@@ -1178,8 +1178,8 @@ static void spi_geni_remove(struct platform_device *pdev)
static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
/* Drop the performance state vote */ /* Drop the performance state vote */
...@@ -1194,8 +1194,8 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) ...@@ -1194,8 +1194,8 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
static int __maybe_unused spi_geni_runtime_resume(struct device *dev) static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
struct spi_geni_master *mas = spi_master_get_devdata(spi); struct spi_geni_master *mas = spi_controller_get_devdata(spi);
int ret; int ret;
ret = geni_icc_enable(&mas->se); ret = geni_icc_enable(&mas->se);
...@@ -1211,30 +1211,30 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev) ...@@ -1211,30 +1211,30 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
static int __maybe_unused spi_geni_suspend(struct device *dev) static int __maybe_unused spi_geni_suspend(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_suspend(spi); ret = spi_controller_suspend(spi);
if (ret) if (ret)
return ret; return ret;
ret = pm_runtime_force_suspend(dev); ret = pm_runtime_force_suspend(dev);
if (ret) if (ret)
spi_master_resume(spi); spi_controller_resume(spi);
return ret; return ret;
} }
static int __maybe_unused spi_geni_resume(struct device *dev) static int __maybe_unused spi_geni_resume(struct device *dev)
{ {
struct spi_master *spi = dev_get_drvdata(dev); struct spi_controller *spi = dev_get_drvdata(dev);
int ret; int ret;
ret = pm_runtime_force_resume(dev); ret = pm_runtime_force_resume(dev);
if (ret) if (ret)
return ret; return ret;
ret = spi_master_resume(spi); ret = spi_controller_resume(spi);
if (ret) if (ret)
pm_runtime_force_suspend(dev); pm_runtime_force_suspend(dev);
......
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