Commit e6b7e64c authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: st-ssc4: 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-4-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8c537847
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Patrice Chotard <patrice.chotard@st.com> * Patrice Chotard <patrice.chotard@st.com>
* Lee Jones <lee.jones@linaro.org> * Lee Jones <lee.jones@linaro.org>
* *
* SPI master mode controller driver, used in STMicroelectronics devices. * SPI host mode controller driver, used in STMicroelectronics devices.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
...@@ -115,10 +115,10 @@ static void ssc_read_rx_fifo(struct spi_st *spi_st) ...@@ -115,10 +115,10 @@ static void ssc_read_rx_fifo(struct spi_st *spi_st)
spi_st->words_remaining -= count; spi_st->words_remaining -= count;
} }
static int spi_st_transfer_one(struct spi_master *master, static int spi_st_transfer_one(struct spi_controller *host,
struct spi_device *spi, struct spi_transfer *t) struct spi_device *spi, struct spi_transfer *t)
{ {
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
uint32_t ctl = 0; uint32_t ctl = 0;
/* Setup transfer */ /* Setup transfer */
...@@ -165,7 +165,7 @@ static int spi_st_transfer_one(struct spi_master *master, ...@@ -165,7 +165,7 @@ static int spi_st_transfer_one(struct spi_master *master,
if (ctl) if (ctl)
writel_relaxed(ctl, spi_st->base + SSC_CTL); writel_relaxed(ctl, spi_st->base + SSC_CTL);
spi_finalize_current_transfer(spi->master); spi_finalize_current_transfer(spi->controller);
return t->len; return t->len;
} }
...@@ -174,7 +174,7 @@ static int spi_st_transfer_one(struct spi_master *master, ...@@ -174,7 +174,7 @@ static int spi_st_transfer_one(struct spi_master *master,
#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_HIGH) #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_HIGH)
static int spi_st_setup(struct spi_device *spi) static int spi_st_setup(struct spi_device *spi)
{ {
struct spi_st *spi_st = spi_master_get_devdata(spi->master); struct spi_st *spi_st = spi_controller_get_devdata(spi->controller);
u32 spi_st_clk, sscbrg, var; u32 spi_st_clk, sscbrg, var;
u32 hz = spi->max_speed_hz; u32 hz = spi->max_speed_hz;
...@@ -274,35 +274,35 @@ static irqreturn_t spi_st_irq(int irq, void *dev_id) ...@@ -274,35 +274,35 @@ static irqreturn_t spi_st_irq(int irq, void *dev_id)
static int spi_st_probe(struct platform_device *pdev) static int spi_st_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct spi_master *master; struct spi_controller *host;
struct spi_st *spi_st; struct spi_st *spi_st;
int irq, ret = 0; int irq, ret = 0;
u32 var; u32 var;
master = spi_alloc_master(&pdev->dev, sizeof(*spi_st)); host = spi_alloc_host(&pdev->dev, sizeof(*spi_st));
if (!master) if (!host)
return -ENOMEM; return -ENOMEM;
master->dev.of_node = np; host->dev.of_node = np;
master->mode_bits = MODEBITS; host->mode_bits = MODEBITS;
master->setup = spi_st_setup; host->setup = spi_st_setup;
master->transfer_one = spi_st_transfer_one; host->transfer_one = spi_st_transfer_one;
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); host->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
master->auto_runtime_pm = true; host->auto_runtime_pm = true;
master->bus_num = pdev->id; host->bus_num = pdev->id;
master->use_gpio_descriptors = true; host->use_gpio_descriptors = true;
spi_st = spi_master_get_devdata(master); spi_st = spi_controller_get_devdata(host);
spi_st->clk = devm_clk_get(&pdev->dev, "ssc"); spi_st->clk = devm_clk_get(&pdev->dev, "ssc");
if (IS_ERR(spi_st->clk)) { if (IS_ERR(spi_st->clk)) {
dev_err(&pdev->dev, "Unable to request clock\n"); dev_err(&pdev->dev, "Unable to request clock\n");
ret = PTR_ERR(spi_st->clk); ret = PTR_ERR(spi_st->clk);
goto put_master; goto put_host;
} }
ret = clk_prepare_enable(spi_st->clk); ret = clk_prepare_enable(spi_st->clk);
if (ret) if (ret)
goto put_master; goto put_host;
init_completion(&spi_st->done); init_completion(&spi_st->done);
...@@ -324,7 +324,7 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -324,7 +324,7 @@ static int spi_st_probe(struct platform_device *pdev)
var &= ~SSC_CTL_SR; var &= ~SSC_CTL_SR;
writel_relaxed(var, spi_st->base + SSC_CTL); writel_relaxed(var, spi_st->base + SSC_CTL);
/* Set SSC into slave mode before reconfiguring PIO pins */ /* Set SSC into target mode before reconfiguring PIO pins */
var = readl_relaxed(spi_st->base + SSC_CTL); var = readl_relaxed(spi_st->base + SSC_CTL);
var &= ~SSC_CTL_MS; var &= ~SSC_CTL_MS;
writel_relaxed(var, spi_st->base + SSC_CTL); writel_relaxed(var, spi_st->base + SSC_CTL);
...@@ -347,11 +347,11 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -347,11 +347,11 @@ static int spi_st_probe(struct platform_device *pdev)
pm_runtime_set_active(&pdev->dev); pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, host);
ret = devm_spi_register_master(&pdev->dev, master); ret = devm_spi_register_controller(&pdev->dev, host);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to register master\n"); dev_err(&pdev->dev, "Failed to register host\n");
goto rpm_disable; goto rpm_disable;
} }
...@@ -361,15 +361,15 @@ static int spi_st_probe(struct platform_device *pdev) ...@@ -361,15 +361,15 @@ static int spi_st_probe(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable: clk_disable:
clk_disable_unprepare(spi_st->clk); clk_disable_unprepare(spi_st->clk);
put_master: put_host:
spi_master_put(master); spi_controller_put(host);
return ret; return ret;
} }
static void spi_st_remove(struct platform_device *pdev) static void spi_st_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_controller *host = platform_get_drvdata(pdev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -381,8 +381,8 @@ static void spi_st_remove(struct platform_device *pdev) ...@@ -381,8 +381,8 @@ static void spi_st_remove(struct platform_device *pdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int spi_st_runtime_suspend(struct device *dev) static int spi_st_runtime_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
writel_relaxed(0, spi_st->base + SSC_IEN); writel_relaxed(0, spi_st->base + SSC_IEN);
pinctrl_pm_select_sleep_state(dev); pinctrl_pm_select_sleep_state(dev);
...@@ -394,8 +394,8 @@ static int spi_st_runtime_suspend(struct device *dev) ...@@ -394,8 +394,8 @@ static int spi_st_runtime_suspend(struct device *dev)
static int spi_st_runtime_resume(struct device *dev) static int spi_st_runtime_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct spi_st *spi_st = spi_master_get_devdata(master); struct spi_st *spi_st = spi_controller_get_devdata(host);
int ret; int ret;
ret = clk_prepare_enable(spi_st->clk); ret = clk_prepare_enable(spi_st->clk);
...@@ -408,10 +408,10 @@ static int spi_st_runtime_resume(struct device *dev) ...@@ -408,10 +408,10 @@ static int spi_st_runtime_resume(struct device *dev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int spi_st_suspend(struct device *dev) static int spi_st_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_suspend(master); ret = spi_controller_suspend(host);
if (ret) if (ret)
return ret; return ret;
...@@ -420,10 +420,10 @@ static int spi_st_suspend(struct device *dev) ...@@ -420,10 +420,10 @@ static int spi_st_suspend(struct device *dev)
static int spi_st_resume(struct device *dev) static int spi_st_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
int ret; int ret;
ret = spi_master_resume(master); ret = spi_controller_resume(host);
if (ret) if (ret)
return ret; return ret;
......
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