spi: New support and problem adjustment of SPI rockchip
authorMark Brown <broonie@kernel.org>
Thu, 17 Feb 2022 18:30:55 +0000 (18:30 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 17 Feb 2022 18:30:55 +0000 (18:30 +0000)
Merge series from Jon Lin <jon.lin@rock-chips.com>:

A collection of fixes and support for new features in the Rockchip
driver.

base-commit: 80808768e41324d2e23de89972b5406c1020e6e4

1  2 
drivers/spi/spi-mt65xx.c

diff --combined drivers/spi/spi-mt65xx.c
index 4f49b2e93ca7b37ec571b9eff797b532a992aff0,753bd313e6fdaaabe4063fc068e84d8d05b42983..bbfeb8046c17cfec3a9595ae48739118a0eabcff
@@@ -12,7 -12,7 +12,7 @@@
  #include <linux/ioport.h>
  #include <linux/module.h>
  #include <linux/of.h>
 -#include <linux/of_gpio.h>
 +#include <linux/gpio/consumer.h>
  #include <linux/platform_device.h>
  #include <linux/platform_data/spi-mt65xx.h>
  #include <linux/pm_runtime.h>
@@@ -605,9 -605,8 +605,9 @@@ static int mtk_spi_setup(struct spi_dev
        if (!spi->controller_data)
                spi->controller_data = (void *)&mtk_default_chip_info;
  
 -      if (mdata->dev_comp->need_pad_sel && gpio_is_valid(spi->cs_gpio))
 -              gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
 +      if (mdata->dev_comp->need_pad_sel && spi->cs_gpiod)
 +              /* CS de-asserted, gpiolib will handle inversion */
 +              gpiod_direction_output(spi->cs_gpiod, 0);
  
        return 0;
  }
@@@ -625,7 -624,7 +625,7 @@@ static irqreturn_t mtk_spi_interrupt(in
        else
                mdata->state = MTK_SPI_IDLE;
  
-       if (!master->can_dma(master, master->cur_msg->spi, trans)) {
+       if (!master->can_dma(master, NULL, trans)) {
                if (trans->rx_buf) {
                        cnt = mdata->xfer_len / 4;
                        ioread32_rep(mdata->base + SPI_RX_DATA_REG,
@@@ -731,7 -730,6 +731,7 @@@ static int mtk_spi_probe(struct platfor
        master->can_dma = mtk_spi_can_dma;
        master->setup = mtk_spi_setup;
        master->set_cs_timing = mtk_spi_set_hw_cs_timing;
 +      master->use_gpio_descriptors = true;
  
        of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node);
        if (!of_id) {
                        goto err_disable_runtime_pm;
                }
  
 -              if (!master->cs_gpios && master->num_chipselect > 1) {
 +              if (!master->cs_gpiods && master->num_chipselect > 1) {
                        dev_err(&pdev->dev,
                                "cs_gpios not specified and num_chipselect > 1\n");
                        ret = -EINVAL;
                        goto err_disable_runtime_pm;
                }
 -
 -              if (master->cs_gpios) {
 -                      for (i = 0; i < master->num_chipselect; i++) {
 -                              ret = devm_gpio_request(&pdev->dev,
 -                                                      master->cs_gpios[i],
 -                                                      dev_name(&pdev->dev));
 -                              if (ret) {
 -                                      dev_err(&pdev->dev,
 -                                              "can't get CS GPIO %i\n", i);
 -                                      goto err_disable_runtime_pm;
 -                              }
 -                      }
 -              }
        }
  
        if (mdata->dev_comp->dma_ext)