Merge branch 'spi-5.5' into spi-linus
authorMark Brown <broonie@kernel.org>
Thu, 23 Jan 2020 12:37:15 +0000 (12:37 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 23 Jan 2020 12:37:15 +0000 (12:37 +0000)
1  2 
drivers/spi/spi-dw.c
drivers/spi/spi-pxa2xx.c

diff --combined drivers/spi/spi-dw.c
@@@ -297,6 -297,9 +297,9 @@@ static int dw_spi_transfer_one(struct s
        dws->len = transfer->len;
        spin_unlock_irqrestore(&dws->buf_lock, flags);
  
+       /* Ensure dw->rx and dw->rx_end are visible */
+       smp_mb();
        spi_enable_chip(dws, 0);
  
        /* Handle per transfer options for bpw and speed */
        cr0 = (transfer->bits_per_word - 1)
                | (chip->type << SPI_FRF_OFFSET)
                | ((((spi->mode & SPI_CPOL) ? 1 : 0) << SPI_SCOL_OFFSET) |
 -                      (((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET))
 +                      (((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET) |
 +                      (((spi->mode & SPI_LOOP) ? 1 : 0) << SPI_SRL_OFFSET))
                | (chip->tmode << SPI_TMOD_OFFSET);
  
        /*
diff --combined drivers/spi/spi-pxa2xx.c
@@@ -461,6 -461,16 +461,16 @@@ int pxa2xx_spi_flush(struct driver_dat
        return limit;
  }
  
+ static void pxa2xx_spi_off(struct driver_data *drv_data)
+ {
+       /* On MMP, disabling SSE seems to corrupt the rx fifo */
+       if (drv_data->ssp_type == MMP2_SSP)
+               return;
+       pxa2xx_spi_write(drv_data, SSCR0,
+                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+ }
  static int null_writer(struct driver_data *drv_data)
  {
        u8 n_bytes = drv_data->n_bytes;
@@@ -587,8 -597,7 +597,7 @@@ static void int_error_stop(struct drive
        if (!pxa25x_ssp_comp(drv_data))
                pxa2xx_spi_write(drv_data, SSTO, 0);
        pxa2xx_spi_flush(drv_data);
-       pxa2xx_spi_write(drv_data, SSCR0,
-                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+       pxa2xx_spi_off(drv_data);
  
        dev_err(&drv_data->pdev->dev, "%s\n", msg);
  
@@@ -686,8 -695,7 +695,7 @@@ static irqreturn_t interrupt_transfer(s
  
  static void handle_bad_msg(struct driver_data *drv_data)
  {
-       pxa2xx_spi_write(drv_data, SSCR0,
-                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+       pxa2xx_spi_off(drv_data);
        pxa2xx_spi_write(drv_data, SSCR1,
                         pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1);
        if (!pxa25x_ssp_comp(drv_data))
@@@ -1062,7 -1070,8 +1070,8 @@@ static int pxa2xx_spi_transfer_one(stru
            || (pxa2xx_spi_read(drv_data, SSCR1) & change_mask)
            != (cr1 & change_mask)) {
                /* stop the SSP, and update the other bits */
-               pxa2xx_spi_write(drv_data, SSCR0, cr0 & ~SSCR0_SSE);
+               if (drv_data->ssp_type != MMP2_SSP)
+                       pxa2xx_spi_write(drv_data, SSCR0, cr0 & ~SSCR0_SSE);
                if (!pxa25x_ssp_comp(drv_data))
                        pxa2xx_spi_write(drv_data, SSTO, chip->timeout);
                /* first set CR1 without interrupt and service enables */
@@@ -1118,8 -1127,7 +1127,7 @@@ static int pxa2xx_spi_slave_abort(struc
        if (!pxa25x_ssp_comp(drv_data))
                pxa2xx_spi_write(drv_data, SSTO, 0);
        pxa2xx_spi_flush(drv_data);
-       pxa2xx_spi_write(drv_data, SSCR0,
-                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+       pxa2xx_spi_off(drv_data);
  
        dev_dbg(&drv_data->pdev->dev, "transfer aborted\n");
  
@@@ -1135,8 -1143,7 +1143,7 @@@ static void pxa2xx_spi_handle_err(struc
        struct driver_data *drv_data = spi_controller_get_devdata(controller);
  
        /* Disable the SSP */
-       pxa2xx_spi_write(drv_data, SSCR0,
-                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+       pxa2xx_spi_off(drv_data);
        /* Clear and disable interrupts and service requests */
        write_SSSR_CS(drv_data, drv_data->clear_sr);
        pxa2xx_spi_write(drv_data, SSCR1,
@@@ -1161,8 -1168,7 +1168,7 @@@ static int pxa2xx_spi_unprepare_transfe
        struct driver_data *drv_data = spi_controller_get_devdata(controller);
  
        /* Disable the SSP now */
-       pxa2xx_spi_write(drv_data, SSCR0,
-                        pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE);
+       pxa2xx_spi_off(drv_data);
  
        return 0;
  }
@@@ -1423,6 -1429,9 +1429,9 @@@ static const struct pci_device_id pxa2x
        /* KBL-H */
        { PCI_VDEVICE(INTEL, 0xa2a9), LPSS_SPT_SSP },
        { PCI_VDEVICE(INTEL, 0xa2aa), LPSS_SPT_SSP },
+       /* CML-V */
+       { PCI_VDEVICE(INTEL, 0xa3a9), LPSS_SPT_SSP },
+       { PCI_VDEVICE(INTEL, 0xa3aa), LPSS_SPT_SSP },
        /* BXT A-Step */
        { PCI_VDEVICE(INTEL, 0x0ac2), LPSS_BXT_SSP },
        { PCI_VDEVICE(INTEL, 0x0ac4), LPSS_BXT_SSP },
        { PCI_VDEVICE(INTEL, 0x02aa), LPSS_CNL_SSP },
        { PCI_VDEVICE(INTEL, 0x02ab), LPSS_CNL_SSP },
        { PCI_VDEVICE(INTEL, 0x02fb), LPSS_CNL_SSP },
 +      /* CML-H */
 +      { PCI_VDEVICE(INTEL, 0x06aa), LPSS_CNL_SSP },
 +      { PCI_VDEVICE(INTEL, 0x06ab), LPSS_CNL_SSP },
 +      { PCI_VDEVICE(INTEL, 0x06fb), LPSS_CNL_SSP },
        /* TGL-LP */
        { PCI_VDEVICE(INTEL, 0xa0aa), LPSS_CNL_SSP },
        { PCI_VDEVICE(INTEL, 0xa0ab), LPSS_CNL_SSP },
@@@ -1545,15 -1550,17 +1554,15 @@@ pxa2xx_spi_init_pdata(struct platform_d
        if (!pdata)
                return NULL;
  
 -      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 -      if (!res)
 -              return NULL;
 -
        ssp = &pdata->ssp;
  
 -      ssp->phys_base = res->start;
 +      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        ssp->mmio_base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(ssp->mmio_base))
                return NULL;
  
 +      ssp->phys_base = res->start;
 +
  #ifdef CONFIG_PCI
        if (pcidev_id) {
                pdata->tx_param = parent;
@@@ -1606,11 -1613,6 +1615,11 @@@ static int pxa2xx_spi_fw_translate_cs(s
        return cs;
  }
  
 +static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi)
 +{
 +      return MAX_DMA_LEN;
 +}
 +
  static int pxa2xx_spi_probe(struct platform_device *pdev)
  {
        struct device *dev = &pdev->dev;
                } else {
                        controller->can_dma = pxa2xx_spi_can_dma;
                        controller->max_dma_len = MAX_DMA_LEN;
 +                      controller->max_transfer_size =
 +                              pxa2xx_spi_max_dma_transfer_size;
                }
        }