mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
spi: bcm2835aux: switch to use modern name
Change legacy name master to modern name host or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230728093221.3312026-7-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
00be843bc1
commit
901fcd0740
@ -231,8 +231,8 @@ static void bcm2835aux_spi_transfer_helper(struct bcm2835aux_spi *bs)
|
||||
|
||||
static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct spi_master *master = dev_id;
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct spi_controller *host = dev_id;
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
/* IRQ may be shared, so return if our interrupts are disabled */
|
||||
if (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_CNTL1) &
|
||||
@ -251,17 +251,17 @@ static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
|
||||
/* and if rx_len is 0 then disable interrupts and wake up completion */
|
||||
if (!bs->rx_len) {
|
||||
bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1]);
|
||||
spi_finalize_current_transfer(master);
|
||||
spi_finalize_current_transfer(host);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int __bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
|
||||
static int __bcm2835aux_spi_transfer_one_irq(struct spi_controller *host,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *tfr)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
/* enable interrupts */
|
||||
bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1] |
|
||||
@ -272,11 +272,11 @@ static int __bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
|
||||
static int bcm2835aux_spi_transfer_one_irq(struct spi_controller *host,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *tfr)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
/* update statistics */
|
||||
bs->count_transfer_irq++;
|
||||
@ -294,14 +294,14 @@ static int bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
|
||||
}
|
||||
|
||||
/* now run the interrupt mode */
|
||||
return __bcm2835aux_spi_transfer_one_irq(master, spi, tfr);
|
||||
return __bcm2835aux_spi_transfer_one_irq(host, spi, tfr);
|
||||
}
|
||||
|
||||
static int bcm2835aux_spi_transfer_one_poll(struct spi_master *master,
|
||||
static int bcm2835aux_spi_transfer_one_poll(struct spi_controller *host,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *tfr)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
unsigned long timeout;
|
||||
|
||||
/* update statistics */
|
||||
@ -328,7 +328,7 @@ static int bcm2835aux_spi_transfer_one_poll(struct spi_master *master,
|
||||
bs->tx_len, bs->rx_len);
|
||||
/* forward to interrupt handler */
|
||||
bs->count_transfer_irq_after_poll++;
|
||||
return __bcm2835aux_spi_transfer_one_irq(master,
|
||||
return __bcm2835aux_spi_transfer_one_irq(host,
|
||||
spi, tfr);
|
||||
}
|
||||
}
|
||||
@ -337,11 +337,11 @@ static int bcm2835aux_spi_transfer_one_poll(struct spi_master *master,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm2835aux_spi_transfer_one(struct spi_master *master,
|
||||
static int bcm2835aux_spi_transfer_one(struct spi_controller *host,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *tfr)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
unsigned long spi_hz, clk_hz, speed;
|
||||
unsigned long hz_per_byte, byte_limit;
|
||||
|
||||
@ -392,17 +392,17 @@ static int bcm2835aux_spi_transfer_one(struct spi_master *master,
|
||||
|
||||
/* run in polling mode for short transfers */
|
||||
if (tfr->len < byte_limit)
|
||||
return bcm2835aux_spi_transfer_one_poll(master, spi, tfr);
|
||||
return bcm2835aux_spi_transfer_one_poll(host, spi, tfr);
|
||||
|
||||
/* run in interrupt mode for all others */
|
||||
return bcm2835aux_spi_transfer_one_irq(master, spi, tfr);
|
||||
return bcm2835aux_spi_transfer_one_irq(host, spi, tfr);
|
||||
}
|
||||
|
||||
static int bcm2835aux_spi_prepare_message(struct spi_master *master,
|
||||
static int bcm2835aux_spi_prepare_message(struct spi_controller *host,
|
||||
struct spi_message *msg)
|
||||
{
|
||||
struct spi_device *spi = msg->spi;
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
bs->cntl[0] = BCM2835_AUX_SPI_CNTL0_ENABLE |
|
||||
BCM2835_AUX_SPI_CNTL0_VAR_WIDTH |
|
||||
@ -422,20 +422,20 @@ static int bcm2835aux_spi_prepare_message(struct spi_master *master,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm2835aux_spi_unprepare_message(struct spi_master *master,
|
||||
static int bcm2835aux_spi_unprepare_message(struct spi_controller *host,
|
||||
struct spi_message *msg)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
bcm2835aux_spi_reset_hw(bs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bcm2835aux_spi_handle_err(struct spi_master *master,
|
||||
static void bcm2835aux_spi_handle_err(struct spi_controller *host,
|
||||
struct spi_message *msg)
|
||||
{
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
bcm2835aux_spi_reset_hw(bs);
|
||||
}
|
||||
@ -473,18 +473,18 @@ static int bcm2835aux_spi_setup(struct spi_device *spi)
|
||||
|
||||
static int bcm2835aux_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master;
|
||||
struct spi_controller *host;
|
||||
struct bcm2835aux_spi *bs;
|
||||
unsigned long clk_hz;
|
||||
int err;
|
||||
|
||||
master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs));
|
||||
if (!master)
|
||||
host = devm_spi_alloc_host(&pdev->dev, sizeof(*bs));
|
||||
if (!host)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, master);
|
||||
master->mode_bits = (SPI_CPOL | SPI_CS_HIGH | SPI_NO_CS);
|
||||
master->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
platform_set_drvdata(pdev, host);
|
||||
host->mode_bits = (SPI_CPOL | SPI_CS_HIGH | SPI_NO_CS);
|
||||
host->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
/* even though the driver never officially supported native CS
|
||||
* allow a single native CS for legacy DT support purposes when
|
||||
* no cs-gpio is configured.
|
||||
@ -496,16 +496,16 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
|
||||
* * cs_delay_usec: cs is always deasserted one SCK cycle after
|
||||
* a spi_transfer
|
||||
*/
|
||||
master->num_chipselect = 1;
|
||||
master->setup = bcm2835aux_spi_setup;
|
||||
master->transfer_one = bcm2835aux_spi_transfer_one;
|
||||
master->handle_err = bcm2835aux_spi_handle_err;
|
||||
master->prepare_message = bcm2835aux_spi_prepare_message;
|
||||
master->unprepare_message = bcm2835aux_spi_unprepare_message;
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
master->use_gpio_descriptors = true;
|
||||
host->num_chipselect = 1;
|
||||
host->setup = bcm2835aux_spi_setup;
|
||||
host->transfer_one = bcm2835aux_spi_transfer_one;
|
||||
host->handle_err = bcm2835aux_spi_handle_err;
|
||||
host->prepare_message = bcm2835aux_spi_prepare_message;
|
||||
host->unprepare_message = bcm2835aux_spi_unprepare_message;
|
||||
host->dev.of_node = pdev->dev.of_node;
|
||||
host->use_gpio_descriptors = true;
|
||||
|
||||
bs = spi_master_get_devdata(master);
|
||||
bs = spi_controller_get_devdata(host);
|
||||
|
||||
/* the main area */
|
||||
bs->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
@ -544,15 +544,15 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
|
||||
err = devm_request_irq(&pdev->dev, bs->irq,
|
||||
bcm2835aux_spi_interrupt,
|
||||
IRQF_SHARED,
|
||||
dev_name(&pdev->dev), master);
|
||||
dev_name(&pdev->dev), host);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
|
||||
goto out_clk_disable;
|
||||
}
|
||||
|
||||
err = spi_register_master(master);
|
||||
err = spi_register_controller(host);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
|
||||
dev_err(&pdev->dev, "could not register SPI host: %d\n", err);
|
||||
goto out_clk_disable;
|
||||
}
|
||||
|
||||
@ -567,12 +567,12 @@ out_clk_disable:
|
||||
|
||||
static void bcm2835aux_spi_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master = platform_get_drvdata(pdev);
|
||||
struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
|
||||
struct spi_controller *host = platform_get_drvdata(pdev);
|
||||
struct bcm2835aux_spi *bs = spi_controller_get_devdata(host);
|
||||
|
||||
bcm2835aux_debugfs_remove(bs);
|
||||
|
||||
spi_unregister_master(master);
|
||||
spi_unregister_controller(host);
|
||||
|
||||
bcm2835aux_spi_reset_hw(bs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user