diff options
Diffstat (limited to 'drivers/video/fbdev/mmp/hw/mmp_spi.c')
| -rw-r--r-- | drivers/video/fbdev/mmp/hw/mmp_spi.c | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/drivers/video/fbdev/mmp/hw/mmp_spi.c b/drivers/video/fbdev/mmp/hw/mmp_spi.c index e62ca7bf0d5e..3f253f4271ac 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_spi.c +++ b/drivers/video/fbdev/mmp/hw/mmp_spi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * linux/drivers/video/mmp/hw/mmp_spi.c * using the spi in LCD controler for commands send @@ -6,20 +7,6 @@ * Authors: Guoqing Li <ligq@marvell.com> * Lisa Du <cldu@marvell.com> * Zhou Zhu <zzhu3@marvell.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see <http://www.gnu.org/licenses/>. - * */ #include <linux/errno.h> #include <linux/delay.h> @@ -30,8 +17,8 @@ /** * spi_write - write command to the SPI port + * @spi: the SPI device. * @data: can be 8/16/32-bit, MSB justified data to write. - * @len: data length. * * Wait bus transfer complete IRQ. * The caller is expected to perform the necessary locking. @@ -44,8 +31,8 @@ static inline int lcd_spi_write(struct spi_device *spi, u32 data) { int timeout = 100000, isr, ret = 0; u32 tmp; - void *reg_base = - *(void **)spi_master_get_devdata(spi->master); + void __iomem *reg_base = (void __iomem *) + *(void **) spi_controller_get_devdata(spi->controller); /* clear ISR */ writel_relaxed(~SPI_IRQ_MASK, reg_base + SPU_IRQ_ISR); @@ -93,8 +80,8 @@ static inline int lcd_spi_write(struct spi_device *spi, u32 data) static int lcd_spi_setup(struct spi_device *spi) { - void *reg_base = - *(void **)spi_master_get_devdata(spi->master); + void __iomem *reg_base = (void __iomem *) + *(void **) spi_controller_get_devdata(spi->controller); u32 tmp; tmp = CFG_SCLKCNT(16) | @@ -104,7 +91,7 @@ static int lcd_spi_setup(struct spi_device *spi) writel(tmp, reg_base + LCD_SPU_SPI_CTRL); /* - * After set mode it need a time to pull up the spi singals, + * After set mode it needs some time to pull up the spi signals, * or it would cause the wrong waveform when send spi command, * especially on pxa910h */ @@ -149,32 +136,32 @@ static int lcd_spi_one_transfer(struct spi_device *spi, struct spi_message *m) int lcd_spi_register(struct mmphw_ctrl *ctrl) { - struct spi_master *master; + struct spi_controller *ctlr; void **p_regbase; int err; - master = spi_alloc_master(ctrl->dev, sizeof(void *)); - if (!master) { - dev_err(ctrl->dev, "unable to allocate SPI master\n"); + ctlr = spi_alloc_host(ctrl->dev, sizeof(void *)); + if (!ctlr) { + dev_err(ctrl->dev, "unable to allocate SPI host\n"); return -ENOMEM; } - p_regbase = spi_master_get_devdata(master); - *p_regbase = ctrl->reg_base; + p_regbase = spi_controller_get_devdata(ctlr); + *p_regbase = (void __force *)ctrl->reg_base; /* set bus num to 5 to avoid conflict with other spi hosts */ - master->bus_num = 5; - master->num_chipselect = 1; - master->setup = lcd_spi_setup; - master->transfer = lcd_spi_one_transfer; + ctlr->bus_num = 5; + ctlr->num_chipselect = 1; + ctlr->setup = lcd_spi_setup; + ctlr->transfer = lcd_spi_one_transfer; - err = spi_register_master(master); + err = spi_register_controller(ctlr); if (err < 0) { - dev_err(ctrl->dev, "unable to register SPI master\n"); - spi_master_put(master); + dev_err(ctrl->dev, "unable to register SPI host\n"); + spi_controller_put(ctlr); return err; } - dev_info(&master->dev, "registered\n"); + dev_info(&ctlr->dev, "registered\n"); return 0; } |
