Commit 5ee8cd26 authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: tegra20-sflash: 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://msgid.link/r/20231128093031.3707034-13-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fe2e1c22
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
struct tegra_sflash_data { struct tegra_sflash_data {
struct device *dev; struct device *dev;
struct spi_master *master; struct spi_controller *host;
spinlock_t lock; spinlock_t lock;
struct clk *clk; struct clk *clk;
...@@ -251,7 +251,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, ...@@ -251,7 +251,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi,
struct spi_transfer *t, bool is_first_of_msg, struct spi_transfer *t, bool is_first_of_msg,
bool is_single_xfer) bool is_single_xfer)
{ {
struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(spi->controller);
u32 speed; u32 speed;
u32 command; u32 command;
...@@ -303,12 +303,12 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, ...@@ -303,12 +303,12 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi,
return tegra_sflash_start_cpu_based_transfer(tsd, t); return tegra_sflash_start_cpu_based_transfer(tsd, t);
} }
static int tegra_sflash_transfer_one_message(struct spi_master *master, static int tegra_sflash_transfer_one_message(struct spi_controller *host,
struct spi_message *msg) struct spi_message *msg)
{ {
bool is_first_msg = true; bool is_first_msg = true;
int single_xfer; int single_xfer;
struct tegra_sflash_data *tsd = spi_master_get_devdata(master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(host);
struct spi_transfer *xfer; struct spi_transfer *xfer;
struct spi_device *spi = msg->spi; struct spi_device *spi = msg->spi;
int ret; int ret;
...@@ -351,7 +351,7 @@ static int tegra_sflash_transfer_one_message(struct spi_master *master, ...@@ -351,7 +351,7 @@ static int tegra_sflash_transfer_one_message(struct spi_master *master,
exit: exit:
tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND);
msg->status = ret; msg->status = ret;
spi_finalize_current_message(master); spi_finalize_current_message(host);
return ret; return ret;
} }
...@@ -416,7 +416,7 @@ MODULE_DEVICE_TABLE(of, tegra_sflash_of_match); ...@@ -416,7 +416,7 @@ MODULE_DEVICE_TABLE(of, tegra_sflash_of_match);
static int tegra_sflash_probe(struct platform_device *pdev) static int tegra_sflash_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_controller *host;
struct tegra_sflash_data *tsd; struct tegra_sflash_data *tsd;
int ret; int ret;
const struct of_device_id *match; const struct of_device_id *match;
...@@ -427,37 +427,37 @@ static int tegra_sflash_probe(struct platform_device *pdev) ...@@ -427,37 +427,37 @@ static int tegra_sflash_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
master = spi_alloc_master(&pdev->dev, sizeof(*tsd)); host = spi_alloc_host(&pdev->dev, sizeof(*tsd));
if (!master) { if (!host) {
dev_err(&pdev->dev, "master allocation failed\n"); dev_err(&pdev->dev, "host allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
/* the spi->mode bits understood by this driver: */ /* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA; host->mode_bits = SPI_CPOL | SPI_CPHA;
master->transfer_one_message = tegra_sflash_transfer_one_message; host->transfer_one_message = tegra_sflash_transfer_one_message;
master->auto_runtime_pm = true; host->auto_runtime_pm = true;
master->num_chipselect = MAX_CHIP_SELECT; host->num_chipselect = MAX_CHIP_SELECT;
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
tsd = spi_master_get_devdata(master); tsd = spi_controller_get_devdata(host);
tsd->master = master; tsd->host = host;
tsd->dev = &pdev->dev; tsd->dev = &pdev->dev;
spin_lock_init(&tsd->lock); spin_lock_init(&tsd->lock);
if (of_property_read_u32(tsd->dev->of_node, "spi-max-frequency", if (of_property_read_u32(tsd->dev->of_node, "spi-max-frequency",
&master->max_speed_hz)) &host->max_speed_hz))
master->max_speed_hz = 25000000; /* 25MHz */ host->max_speed_hz = 25000000; /* 25MHz */
tsd->base = devm_platform_ioremap_resource(pdev, 0); tsd->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(tsd->base)) { if (IS_ERR(tsd->base)) {
ret = PTR_ERR(tsd->base); ret = PTR_ERR(tsd->base);
goto exit_free_master; goto exit_free_host;
} }
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret < 0) if (ret < 0)
goto exit_free_master; goto exit_free_host;
tsd->irq = ret; tsd->irq = ret;
ret = request_irq(tsd->irq, tegra_sflash_isr, 0, ret = request_irq(tsd->irq, tegra_sflash_isr, 0,
...@@ -465,7 +465,7 @@ static int tegra_sflash_probe(struct platform_device *pdev) ...@@ -465,7 +465,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
tsd->irq); tsd->irq);
goto exit_free_master; goto exit_free_host;
} }
tsd->clk = devm_clk_get(&pdev->dev, NULL); tsd->clk = devm_clk_get(&pdev->dev, NULL);
...@@ -505,10 +505,10 @@ static int tegra_sflash_probe(struct platform_device *pdev) ...@@ -505,10 +505,10 @@ static int tegra_sflash_probe(struct platform_device *pdev)
tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND);
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
master->dev.of_node = pdev->dev.of_node; host->dev.of_node = pdev->dev.of_node;
ret = devm_spi_register_master(&pdev->dev, master); ret = devm_spi_register_controller(&pdev->dev, host);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "can not register to master err %d\n", ret); dev_err(&pdev->dev, "can not register to host err %d\n", ret);
goto exit_pm_disable; goto exit_pm_disable;
} }
return ret; return ret;
...@@ -519,15 +519,15 @@ static int tegra_sflash_probe(struct platform_device *pdev) ...@@ -519,15 +519,15 @@ static int tegra_sflash_probe(struct platform_device *pdev)
tegra_sflash_runtime_suspend(&pdev->dev); tegra_sflash_runtime_suspend(&pdev->dev);
exit_free_irq: exit_free_irq:
free_irq(tsd->irq, tsd); free_irq(tsd->irq, tsd);
exit_free_master: exit_free_host:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
static void tegra_sflash_remove(struct platform_device *pdev) static void tegra_sflash_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_controller *host = platform_get_drvdata(pdev);
struct tegra_sflash_data *tsd = spi_master_get_devdata(master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(host);
free_irq(tsd->irq, tsd); free_irq(tsd->irq, tsd);
...@@ -539,15 +539,15 @@ static void tegra_sflash_remove(struct platform_device *pdev) ...@@ -539,15 +539,15 @@ static void tegra_sflash_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int tegra_sflash_suspend(struct device *dev) static int tegra_sflash_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
return spi_master_suspend(master); return spi_controller_suspend(host);
} }
static int tegra_sflash_resume(struct device *dev) static int tegra_sflash_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct tegra_sflash_data *tsd = spi_master_get_devdata(master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(host);
int ret; int ret;
ret = pm_runtime_resume_and_get(dev); ret = pm_runtime_resume_and_get(dev);
...@@ -558,14 +558,14 @@ static int tegra_sflash_resume(struct device *dev) ...@@ -558,14 +558,14 @@ static int tegra_sflash_resume(struct device *dev)
tegra_sflash_writel(tsd, tsd->command_reg, SPI_COMMAND); tegra_sflash_writel(tsd, tsd->command_reg, SPI_COMMAND);
pm_runtime_put(dev); pm_runtime_put(dev);
return spi_master_resume(master); return spi_controller_resume(host);
} }
#endif #endif
static int tegra_sflash_runtime_suspend(struct device *dev) static int tegra_sflash_runtime_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct tegra_sflash_data *tsd = spi_master_get_devdata(master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(host);
/* Flush all write which are in PPSB queue by reading back */ /* Flush all write which are in PPSB queue by reading back */
tegra_sflash_readl(tsd, SPI_COMMAND); tegra_sflash_readl(tsd, SPI_COMMAND);
...@@ -576,8 +576,8 @@ static int tegra_sflash_runtime_suspend(struct device *dev) ...@@ -576,8 +576,8 @@ static int tegra_sflash_runtime_suspend(struct device *dev)
static int tegra_sflash_runtime_resume(struct device *dev) static int tegra_sflash_runtime_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct tegra_sflash_data *tsd = spi_master_get_devdata(master); struct tegra_sflash_data *tsd = spi_controller_get_devdata(host);
int ret; int ret;
ret = clk_prepare_enable(tsd->clk); ret = clk_prepare_enable(tsd->clk);
......
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