Commit 26c48aea authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: altera: 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/20221229103837.4192759-2-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6c9d1fd5
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define ALTERA_SPI_TXDATA 4 #define ALTERA_SPI_TXDATA 4
#define ALTERA_SPI_STATUS 8 #define ALTERA_SPI_STATUS 8
#define ALTERA_SPI_CONTROL 12 #define ALTERA_SPI_CONTROL 12
#define ALTERA_SPI_SLAVE_SEL 20 #define ALTERA_SPI_TARGET_SEL 20
#define ALTERA_SPI_STATUS_ROE_MSK 0x8 #define ALTERA_SPI_STATUS_ROE_MSK 0x8
#define ALTERA_SPI_STATUS_TOE_MSK 0x10 #define ALTERA_SPI_STATUS_TOE_MSK 0x10
...@@ -67,7 +67,7 @@ static int altr_spi_readl(struct altera_spi *hw, unsigned int reg, ...@@ -67,7 +67,7 @@ static int altr_spi_readl(struct altera_spi *hw, unsigned int reg,
static inline struct altera_spi *altera_spi_to_hw(struct spi_device *sdev) static inline struct altera_spi *altera_spi_to_hw(struct spi_device *sdev)
{ {
return spi_master_get_devdata(sdev->master); return spi_controller_get_devdata(sdev->controller);
} }
static void altera_spi_set_cs(struct spi_device *spi, bool is_high) static void altera_spi_set_cs(struct spi_device *spi, bool is_high)
...@@ -77,9 +77,9 @@ static void altera_spi_set_cs(struct spi_device *spi, bool is_high) ...@@ -77,9 +77,9 @@ static void altera_spi_set_cs(struct spi_device *spi, bool is_high)
if (is_high) { if (is_high) {
hw->imr &= ~ALTERA_SPI_CONTROL_SSO_MSK; hw->imr &= ~ALTERA_SPI_CONTROL_SSO_MSK;
altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr); altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr);
altr_spi_writel(hw, ALTERA_SPI_SLAVE_SEL, 0); altr_spi_writel(hw, ALTERA_SPI_TARGET_SEL, 0);
} else { } else {
altr_spi_writel(hw, ALTERA_SPI_SLAVE_SEL, altr_spi_writel(hw, ALTERA_SPI_TARGET_SEL,
BIT(spi->chip_select)); BIT(spi->chip_select));
hw->imr |= ALTERA_SPI_CONTROL_SSO_MSK; hw->imr |= ALTERA_SPI_CONTROL_SSO_MSK;
altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr); altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr);
...@@ -139,10 +139,10 @@ static void altera_spi_rx_word(struct altera_spi *hw) ...@@ -139,10 +139,10 @@ static void altera_spi_rx_word(struct altera_spi *hw)
hw->count++; hw->count++;
} }
static int altera_spi_txrx(struct spi_master *master, static int altera_spi_txrx(struct spi_controller *host,
struct spi_device *spi, struct spi_transfer *t) struct spi_device *spi, struct spi_transfer *t)
{ {
struct altera_spi *hw = spi_master_get_devdata(master); struct altera_spi *hw = spi_controller_get_devdata(host);
u32 val; u32 val;
hw->tx = t->tx_buf; hw->tx = t->tx_buf;
...@@ -175,15 +175,15 @@ static int altera_spi_txrx(struct spi_master *master, ...@@ -175,15 +175,15 @@ static int altera_spi_txrx(struct spi_master *master,
altera_spi_rx_word(hw); altera_spi_rx_word(hw);
} }
spi_finalize_current_transfer(master); spi_finalize_current_transfer(host);
return 0; return 0;
} }
irqreturn_t altera_spi_irq(int irq, void *dev) irqreturn_t altera_spi_irq(int irq, void *dev)
{ {
struct spi_master *master = dev; struct spi_controller *host = dev;
struct altera_spi *hw = spi_master_get_devdata(master); struct altera_spi *hw = spi_controller_get_devdata(host);
altera_spi_rx_word(hw); altera_spi_rx_word(hw);
...@@ -194,20 +194,20 @@ irqreturn_t altera_spi_irq(int irq, void *dev) ...@@ -194,20 +194,20 @@ irqreturn_t altera_spi_irq(int irq, void *dev)
hw->imr &= ~ALTERA_SPI_CONTROL_IRRDY_MSK; hw->imr &= ~ALTERA_SPI_CONTROL_IRRDY_MSK;
altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr); altr_spi_writel(hw, ALTERA_SPI_CONTROL, hw->imr);
spi_finalize_current_transfer(master); spi_finalize_current_transfer(host);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
EXPORT_SYMBOL_GPL(altera_spi_irq); EXPORT_SYMBOL_GPL(altera_spi_irq);
void altera_spi_init_master(struct spi_master *master) void altera_spi_init_host(struct spi_controller *host)
{ {
struct altera_spi *hw = spi_master_get_devdata(master); struct altera_spi *hw = spi_controller_get_devdata(host);
u32 val; u32 val;
master->transfer_one = altera_spi_txrx; host->transfer_one = altera_spi_txrx;
master->set_cs = altera_spi_set_cs; host->set_cs = altera_spi_set_cs;
/* program defaults into the registers */ /* program defaults into the registers */
hw->imr = 0; /* disable spi interrupts */ hw->imr = 0; /* disable spi interrupts */
...@@ -217,6 +217,6 @@ void altera_spi_init_master(struct spi_master *master) ...@@ -217,6 +217,6 @@ void altera_spi_init_master(struct spi_master *master)
if (val & ALTERA_SPI_STATUS_RRDY_MSK) if (val & ALTERA_SPI_STATUS_RRDY_MSK)
altr_spi_readl(hw, ALTERA_SPI_RXDATA, &val); /* flush rxdata */ altr_spi_readl(hw, ALTERA_SPI_RXDATA, &val); /* flush rxdata */
} }
EXPORT_SYMBOL_GPL(altera_spi_init_master); EXPORT_SYMBOL_GPL(altera_spi_init_host);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -156,7 +156,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev) ...@@ -156,7 +156,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)
hw->irq = -EINVAL; hw->irq = -EINVAL;
altera_spi_init_master(master); altera_spi_init_host(master);
err = devm_spi_register_master(dev, master); err = devm_spi_register_master(dev, master);
if (err) if (err)
......
...@@ -107,7 +107,7 @@ static int altera_spi_probe(struct platform_device *pdev) ...@@ -107,7 +107,7 @@ static int altera_spi_probe(struct platform_device *pdev)
} }
} }
altera_spi_init_master(master); altera_spi_init_host(master);
/* irq is optional */ /* irq is optional */
hw->irq = platform_get_irq(pdev, 0); hw->irq = platform_get_irq(pdev, 0);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
/** /**
* struct altera_spi_platform_data - Platform data of the Altera SPI driver * struct altera_spi_platform_data - Platform data of the Altera SPI driver
* @mode_bits: Mode bits of SPI master. * @mode_bits: Mode bits of SPI host.
* @num_chipselect: Number of chipselects. * @num_chipselect: Number of chipselects.
* @bits_per_word_mask: bitmask of supported bits_per_word for transfers. * @bits_per_word_mask: bitmask of supported bits_per_word for transfers.
* @num_devices: Number of devices that shall be added when the driver * @num_devices: Number of devices that shall be added when the driver
...@@ -46,5 +46,5 @@ struct altera_spi { ...@@ -46,5 +46,5 @@ struct altera_spi {
}; };
extern irqreturn_t altera_spi_irq(int irq, void *dev); extern irqreturn_t altera_spi_irq(int irq, void *dev);
extern void altera_spi_init_master(struct spi_master *master); extern void altera_spi_init_host(struct spi_controller *host);
#endif /* __LINUX_SPI_ALTERA_H */ #endif /* __LINUX_SPI_ALTERA_H */
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