spi: xlp: switch to use modern name
Change legacy name master/slave to modern name host/target or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://msgid.link/r/20231128093031.3707034-22-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
709b785a37
commit
1633ffd290
@ -95,7 +95,7 @@ struct xlp_spi_priv {
|
|||||||
int rx_len; /* rx xfer length */
|
int rx_len; /* rx xfer length */
|
||||||
int txerrors; /* TXFIFO underflow count */
|
int txerrors; /* TXFIFO underflow count */
|
||||||
int rxerrors; /* RXFIFO overflow count */
|
int rxerrors; /* RXFIFO overflow count */
|
||||||
int cs; /* slave device chip select */
|
int cs; /* target device chip select */
|
||||||
u32 spi_clk; /* spi clock frequency */
|
u32 spi_clk; /* spi clock frequency */
|
||||||
bool cmd_cont; /* cs active */
|
bool cmd_cont; /* cs active */
|
||||||
struct completion done; /* completion notification */
|
struct completion done; /* completion notification */
|
||||||
@ -138,7 +138,7 @@ static int xlp_spi_setup(struct spi_device *spi)
|
|||||||
u32 fdiv, cfg;
|
u32 fdiv, cfg;
|
||||||
int cs;
|
int cs;
|
||||||
|
|
||||||
xspi = spi_master_get_devdata(spi->master);
|
xspi = spi_controller_get_devdata(spi->controller);
|
||||||
cs = spi_get_chipselect(spi, 0);
|
cs = spi_get_chipselect(spi, 0);
|
||||||
/*
|
/*
|
||||||
* The value of fdiv must be between 4 and 65535.
|
* The value of fdiv must be between 4 and 65535.
|
||||||
@ -343,17 +343,17 @@ static int xlp_spi_txrx_bufs(struct xlp_spi_priv *xs, struct spi_transfer *t)
|
|||||||
return bytesleft;
|
return bytesleft;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xlp_spi_transfer_one(struct spi_master *master,
|
static int xlp_spi_transfer_one(struct spi_controller *host,
|
||||||
struct spi_device *spi,
|
struct spi_device *spi,
|
||||||
struct spi_transfer *t)
|
struct spi_transfer *t)
|
||||||
{
|
{
|
||||||
struct xlp_spi_priv *xspi = spi_master_get_devdata(master);
|
struct xlp_spi_priv *xspi = spi_controller_get_devdata(host);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
xspi->cs = spi_get_chipselect(spi, 0);
|
xspi->cs = spi_get_chipselect(spi, 0);
|
||||||
xspi->dev = spi->dev;
|
xspi->dev = spi->dev;
|
||||||
|
|
||||||
if (spi_transfer_is_last(master, t))
|
if (spi_transfer_is_last(host, t))
|
||||||
xspi->cmd_cont = 0;
|
xspi->cmd_cont = 0;
|
||||||
else
|
else
|
||||||
xspi->cmd_cont = 1;
|
xspi->cmd_cont = 1;
|
||||||
@ -361,13 +361,13 @@ static int xlp_spi_transfer_one(struct spi_master *master,
|
|||||||
if (xlp_spi_txrx_bufs(xspi, t))
|
if (xlp_spi_txrx_bufs(xspi, t))
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
||||||
spi_finalize_current_transfer(master);
|
spi_finalize_current_transfer(host);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xlp_spi_probe(struct platform_device *pdev)
|
static int xlp_spi_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct spi_master *master;
|
struct spi_controller *host;
|
||||||
struct xlp_spi_priv *xspi;
|
struct xlp_spi_priv *xspi;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int irq, err;
|
int irq, err;
|
||||||
@ -398,28 +398,28 @@ static int xlp_spi_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
xspi->spi_clk = clk_get_rate(clk);
|
xspi->spi_clk = clk_get_rate(clk);
|
||||||
|
|
||||||
master = spi_alloc_master(&pdev->dev, 0);
|
host = spi_alloc_host(&pdev->dev, 0);
|
||||||
if (!master) {
|
if (!host) {
|
||||||
dev_err(&pdev->dev, "could not alloc master\n");
|
dev_err(&pdev->dev, "could not alloc host\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
master->bus_num = 0;
|
host->bus_num = 0;
|
||||||
master->num_chipselect = XLP_SPI_MAX_CS;
|
host->num_chipselect = XLP_SPI_MAX_CS;
|
||||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
||||||
master->setup = xlp_spi_setup;
|
host->setup = xlp_spi_setup;
|
||||||
master->transfer_one = xlp_spi_transfer_one;
|
host->transfer_one = xlp_spi_transfer_one;
|
||||||
master->dev.of_node = pdev->dev.of_node;
|
host->dev.of_node = pdev->dev.of_node;
|
||||||
|
|
||||||
init_completion(&xspi->done);
|
init_completion(&xspi->done);
|
||||||
spi_master_set_devdata(master, xspi);
|
spi_controller_set_devdata(host, xspi);
|
||||||
xlp_spi_sysctl_setup(xspi);
|
xlp_spi_sysctl_setup(xspi);
|
||||||
|
|
||||||
/* register spi controller */
|
/* register spi controller */
|
||||||
err = devm_spi_register_master(&pdev->dev, master);
|
err = devm_spi_register_controller(&pdev->dev, host);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "spi register master failed!\n");
|
dev_err(&pdev->dev, "spi register host failed!\n");
|
||||||
spi_master_put(master);
|
spi_controller_put(host);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user