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

spi: mt7621: 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://lore.kernel.org/r/20230823033003.3407403-12-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent cae15788
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#define MT7621_LSB_FIRST BIT(3) #define MT7621_LSB_FIRST BIT(3)
struct mt7621_spi { struct mt7621_spi {
struct spi_controller *master; struct spi_controller *host;
void __iomem *base; void __iomem *base;
unsigned int sys_freq; unsigned int sys_freq;
unsigned int speed; unsigned int speed;
...@@ -62,7 +62,7 @@ struct mt7621_spi { ...@@ -62,7 +62,7 @@ struct mt7621_spi {
static inline struct mt7621_spi *spidev_to_mt7621_spi(struct spi_device *spi) static inline struct mt7621_spi *spidev_to_mt7621_spi(struct spi_device *spi)
{ {
return spi_controller_get_devdata(spi->master); return spi_controller_get_devdata(spi->controller);
} }
static inline u32 mt7621_spi_read(struct mt7621_spi *rs, u32 reg) static inline u32 mt7621_spi_read(struct mt7621_spi *rs, u32 reg)
...@@ -80,17 +80,17 @@ static void mt7621_spi_set_cs(struct spi_device *spi, int enable) ...@@ -80,17 +80,17 @@ static void mt7621_spi_set_cs(struct spi_device *spi, int enable)
struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); struct mt7621_spi *rs = spidev_to_mt7621_spi(spi);
int cs = spi_get_chipselect(spi, 0); int cs = spi_get_chipselect(spi, 0);
u32 polar = 0; u32 polar = 0;
u32 master; u32 host;
/* /*
* Select SPI device 7, enable "more buffer mode" and disable * Select SPI device 7, enable "more buffer mode" and disable
* full-duplex (only half-duplex really works on this chip * full-duplex (only half-duplex really works on this chip
* reliably) * reliably)
*/ */
master = mt7621_spi_read(rs, MT7621_SPI_MASTER); host = mt7621_spi_read(rs, MT7621_SPI_MASTER);
master |= MASTER_RS_SLAVE_SEL | MASTER_MORE_BUFMODE; host |= MASTER_RS_SLAVE_SEL | MASTER_MORE_BUFMODE;
master &= ~MASTER_FULL_DUPLEX; host &= ~MASTER_FULL_DUPLEX;
mt7621_spi_write(rs, MT7621_SPI_MASTER, master); mt7621_spi_write(rs, MT7621_SPI_MASTER, host);
rs->pending_write = 0; rs->pending_write = 0;
...@@ -245,10 +245,10 @@ static void mt7621_spi_write_half_duplex(struct mt7621_spi *rs, ...@@ -245,10 +245,10 @@ static void mt7621_spi_write_half_duplex(struct mt7621_spi *rs,
rs->pending_write = len; rs->pending_write = len;
} }
static int mt7621_spi_transfer_one_message(struct spi_controller *master, static int mt7621_spi_transfer_one_message(struct spi_controller *host,
struct spi_message *m) struct spi_message *m)
{ {
struct mt7621_spi *rs = spi_controller_get_devdata(master); struct mt7621_spi *rs = spi_controller_get_devdata(host);
struct spi_device *spi = m->spi; struct spi_device *spi = m->spi;
unsigned int speed = spi->max_speed_hz; unsigned int speed = spi->max_speed_hz;
struct spi_transfer *t = NULL; struct spi_transfer *t = NULL;
...@@ -294,7 +294,7 @@ static int mt7621_spi_transfer_one_message(struct spi_controller *master, ...@@ -294,7 +294,7 @@ static int mt7621_spi_transfer_one_message(struct spi_controller *master,
msg_done: msg_done:
m->status = status; m->status = status;
spi_finalize_current_message(master); spi_finalize_current_message(host);
return 0; return 0;
} }
...@@ -325,7 +325,7 @@ MODULE_DEVICE_TABLE(of, mt7621_spi_match); ...@@ -325,7 +325,7 @@ MODULE_DEVICE_TABLE(of, mt7621_spi_match);
static int mt7621_spi_probe(struct platform_device *pdev) static int mt7621_spi_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match; const struct of_device_id *match;
struct spi_controller *master; struct spi_controller *host;
struct mt7621_spi *rs; struct mt7621_spi *rs;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
...@@ -344,25 +344,25 @@ static int mt7621_spi_probe(struct platform_device *pdev) ...@@ -344,25 +344,25 @@ static int mt7621_spi_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(clk), return dev_err_probe(&pdev->dev, PTR_ERR(clk),
"unable to get SYS clock\n"); "unable to get SYS clock\n");
master = devm_spi_alloc_master(&pdev->dev, sizeof(*rs)); host = devm_spi_alloc_host(&pdev->dev, sizeof(*rs));
if (!master) { if (!host) {
dev_info(&pdev->dev, "master allocation failed\n"); dev_info(&pdev->dev, "host allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
master->mode_bits = SPI_LSB_FIRST; host->mode_bits = SPI_LSB_FIRST;
master->flags = SPI_CONTROLLER_HALF_DUPLEX; host->flags = SPI_CONTROLLER_HALF_DUPLEX;
master->setup = mt7621_spi_setup; host->setup = mt7621_spi_setup;
master->transfer_one_message = mt7621_spi_transfer_one_message; host->transfer_one_message = mt7621_spi_transfer_one_message;
master->bits_per_word_mask = SPI_BPW_MASK(8); host->bits_per_word_mask = SPI_BPW_MASK(8);
master->dev.of_node = pdev->dev.of_node; host->dev.of_node = pdev->dev.of_node;
master->num_chipselect = 2; host->num_chipselect = 2;
dev_set_drvdata(&pdev->dev, master); dev_set_drvdata(&pdev->dev, host);
rs = spi_controller_get_devdata(master); rs = spi_controller_get_devdata(host);
rs->base = base; rs->base = base;
rs->master = master; rs->host = host;
rs->sys_freq = clk_get_rate(clk); rs->sys_freq = clk_get_rate(clk);
rs->pending_write = 0; rs->pending_write = 0;
dev_info(&pdev->dev, "sys_freq: %u\n", rs->sys_freq); dev_info(&pdev->dev, "sys_freq: %u\n", rs->sys_freq);
...@@ -373,7 +373,7 @@ static int mt7621_spi_probe(struct platform_device *pdev) ...@@ -373,7 +373,7 @@ static int mt7621_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
return devm_spi_register_controller(&pdev->dev, master); return devm_spi_register_controller(&pdev->dev, host);
} }
MODULE_ALIAS("platform:" DRIVER_NAME); MODULE_ALIAS("platform:" DRIVER_NAME);
......
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