mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
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: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230823033003.3407403-12-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cae1578847
commit
e56e3de003
@ -53,7 +53,7 @@
|
||||
#define MT7621_LSB_FIRST BIT(3)
|
||||
|
||||
struct mt7621_spi {
|
||||
struct spi_controller *master;
|
||||
struct spi_controller *host;
|
||||
void __iomem *base;
|
||||
unsigned int sys_freq;
|
||||
unsigned int speed;
|
||||
@ -62,7 +62,7 @@ struct mt7621_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)
|
||||
@ -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);
|
||||
int cs = spi_get_chipselect(spi, 0);
|
||||
u32 polar = 0;
|
||||
u32 master;
|
||||
u32 host;
|
||||
|
||||
/*
|
||||
* Select SPI device 7, enable "more buffer mode" and disable
|
||||
* full-duplex (only half-duplex really works on this chip
|
||||
* reliably)
|
||||
*/
|
||||
master = mt7621_spi_read(rs, MT7621_SPI_MASTER);
|
||||
master |= MASTER_RS_SLAVE_SEL | MASTER_MORE_BUFMODE;
|
||||
master &= ~MASTER_FULL_DUPLEX;
|
||||
mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
|
||||
host = mt7621_spi_read(rs, MT7621_SPI_MASTER);
|
||||
host |= MASTER_RS_SLAVE_SEL | MASTER_MORE_BUFMODE;
|
||||
host &= ~MASTER_FULL_DUPLEX;
|
||||
mt7621_spi_write(rs, MT7621_SPI_MASTER, host);
|
||||
|
||||
rs->pending_write = 0;
|
||||
|
||||
@ -245,10 +245,10 @@ static void mt7621_spi_write_half_duplex(struct mt7621_spi *rs,
|
||||
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 mt7621_spi *rs = spi_controller_get_devdata(master);
|
||||
struct mt7621_spi *rs = spi_controller_get_devdata(host);
|
||||
struct spi_device *spi = m->spi;
|
||||
unsigned int speed = spi->max_speed_hz;
|
||||
struct spi_transfer *t = NULL;
|
||||
@ -294,7 +294,7 @@ static int mt7621_spi_transfer_one_message(struct spi_controller *master,
|
||||
|
||||
msg_done:
|
||||
m->status = status;
|
||||
spi_finalize_current_message(master);
|
||||
spi_finalize_current_message(host);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -325,7 +325,7 @@ MODULE_DEVICE_TABLE(of, mt7621_spi_match);
|
||||
static int mt7621_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
struct spi_controller *master;
|
||||
struct spi_controller *host;
|
||||
struct mt7621_spi *rs;
|
||||
void __iomem *base;
|
||||
struct clk *clk;
|
||||
@ -344,25 +344,25 @@ static int mt7621_spi_probe(struct platform_device *pdev)
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(clk),
|
||||
"unable to get SYS clock\n");
|
||||
|
||||
master = devm_spi_alloc_master(&pdev->dev, sizeof(*rs));
|
||||
if (!master) {
|
||||
dev_info(&pdev->dev, "master allocation failed\n");
|
||||
host = devm_spi_alloc_host(&pdev->dev, sizeof(*rs));
|
||||
if (!host) {
|
||||
dev_info(&pdev->dev, "host allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
master->mode_bits = SPI_LSB_FIRST;
|
||||
master->flags = SPI_CONTROLLER_HALF_DUPLEX;
|
||||
master->setup = mt7621_spi_setup;
|
||||
master->transfer_one_message = mt7621_spi_transfer_one_message;
|
||||
master->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
master->num_chipselect = 2;
|
||||
host->mode_bits = SPI_LSB_FIRST;
|
||||
host->flags = SPI_CONTROLLER_HALF_DUPLEX;
|
||||
host->setup = mt7621_spi_setup;
|
||||
host->transfer_one_message = mt7621_spi_transfer_one_message;
|
||||
host->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
host->dev.of_node = pdev->dev.of_node;
|
||||
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->master = master;
|
||||
rs->host = host;
|
||||
rs->sys_freq = clk_get_rate(clk);
|
||||
rs->pending_write = 0;
|
||||
dev_info(&pdev->dev, "sys_freq: %u\n", rs->sys_freq);
|
||||
@ -373,7 +373,7 @@ static int mt7621_spi_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return devm_spi_register_controller(&pdev->dev, master);
|
||||
return devm_spi_register_controller(&pdev->dev, host);
|
||||
}
|
||||
|
||||
MODULE_ALIAS("platform:" DRIVER_NAME);
|
||||
|
Loading…
Reference in New Issue
Block a user