Merge branch 'spi-5.3' into spi-5.4
authorMark Brown <broonie@kernel.org>
Fri, 23 Aug 2019 11:00:22 +0000 (12:00 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 23 Aug 2019 11:00:22 +0000 (12:00 +0100)
1  2 
drivers/spi/spi-bcm-qspi.c
drivers/spi/spi-bcm2835.c
drivers/spi/spi-dw-pci.c
drivers/spi/spi-fsl-qspi.c
drivers/spi/spi-zynq-qspi.c

@@@ -1,8 -1,19 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * Driver for Broadcom BRCMSTB, NSP,  NS2, Cygnus SPI Controllers
   *
   * Copyright 2016 Broadcom
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License, version 2, as
 - * published by the Free Software Foundation (the "GPL").
 - *
 - * 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 version 2 (GPLv2) for more details.
 - *
 - * You should have received a copy of the GNU General Public License
 - * version 2 (GPLv2) along with this source code.
   */
  
  #include <linux/clk.h>
@@@ -343,7 -354,7 +343,7 @@@ static int bcm_qspi_bspi_set_flex_mode(
  {
        int bpc = 0, bpp = 0;
        u8 command = op->cmd.opcode;
-       int width  = op->cmd.buswidth ? op->cmd.buswidth : SPI_NBITS_SINGLE;
+       int width = op->data.buswidth ? op->data.buswidth : SPI_NBITS_SINGLE;
        int addrlen = op->addr.nbytes;
        int flex_mode = 1;
  
@@@ -981,7 -992,7 +981,7 @@@ static int bcm_qspi_exec_mem_op(struct 
        if (mspi_read)
                return bcm_qspi_mspi_exec_mem_op(spi, op);
  
-       ret = bcm_qspi_bspi_set_mode(qspi, op, -1);
+       ret = bcm_qspi_bspi_set_mode(qspi, op, 0);
  
        if (!ret)
                ret = bcm_qspi_bspi_exec_mem_op(spi, op);
@@@ -834,7 -834,8 +834,8 @@@ static int bcm2835_spi_transfer_one(str
        bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
  
        /* handle all the 3-wire mode */
-       if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf))
+       if (spi->mode & SPI_3WIRE && tfr->rx_buf &&
+           tfr->rx_buf != ctlr->dummy_rx)
                cs |= BCM2835_SPI_CS_REN;
        else
                cs &= ~BCM2835_SPI_CS_REN;
@@@ -1015,6 -1016,7 +1016,6 @@@ static int bcm2835_spi_probe(struct pla
  
        bs->irq = platform_get_irq(pdev, 0);
        if (bs->irq <= 0) {
 -              dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
                err = bs->irq ? bs->irq : -ENODEV;
                goto out_controller_put;
        }
diff --combined drivers/spi/spi-dw-pci.c
@@@ -19,6 -19,7 +19,7 @@@ struct spi_pci_desc 
        int     (*setup)(struct dw_spi *);
        u16     num_cs;
        u16     bus_num;
+       u32     max_freq;
  };
  
  static struct spi_pci_desc spi_pci_mid_desc_1 = {
@@@ -33,6 -34,12 +34,12 @@@ static struct spi_pci_desc spi_pci_mid_
        .bus_num = 1,
  };
  
+ static struct spi_pci_desc spi_pci_ehl_desc = {
+       .num_cs = 1,
+       .bus_num = -1,
+       .max_freq = 100000000,
+ };
  static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  {
        struct dw_spi *dws;
@@@ -65,6 -72,7 +72,7 @@@
        if (desc) {
                dws->num_cs = desc->num_cs;
                dws->bus_num = desc->bus_num;
+               dws->max_freq = desc->max_freq;
  
                if (desc->setup) {
                        ret = desc->setup(dws);
@@@ -98,14 -106,16 +106,14 @@@ static void spi_pci_remove(struct pci_d
  #ifdef CONFIG_PM_SLEEP
  static int spi_suspend(struct device *dev)
  {
 -      struct pci_dev *pdev = to_pci_dev(dev);
 -      struct dw_spi *dws = pci_get_drvdata(pdev);
 +      struct dw_spi *dws = dev_get_drvdata(dev);
  
        return dw_spi_suspend_host(dws);
  }
  
  static int spi_resume(struct device *dev)
  {
 -      struct pci_dev *pdev = to_pci_dev(dev);
 -      struct dw_spi *dws = pci_get_drvdata(pdev);
 +      struct dw_spi *dws = dev_get_drvdata(dev);
  
        return dw_spi_resume_host(dws);
  }
@@@ -123,6 -133,11 +131,11 @@@ static const struct pci_device_id pci_i
        { PCI_VDEVICE(INTEL, 0x0800), (kernel_ulong_t)&spi_pci_mid_desc_1},
        /* Intel MID platform SPI controller 2 */
        { PCI_VDEVICE(INTEL, 0x0812), (kernel_ulong_t)&spi_pci_mid_desc_2},
+       /* Intel Elkhart Lake PSE SPI controllers */
+       { PCI_VDEVICE(INTEL, 0x4b84), (kernel_ulong_t)&spi_pci_ehl_desc},
+       { PCI_VDEVICE(INTEL, 0x4b85), (kernel_ulong_t)&spi_pci_ehl_desc},
+       { PCI_VDEVICE(INTEL, 0x4b86), (kernel_ulong_t)&spi_pci_ehl_desc},
+       { PCI_VDEVICE(INTEL, 0x4b87), (kernel_ulong_t)&spi_pci_ehl_desc},
        {},
  };
  
@@@ -206,7 -206,7 +206,7 @@@ static const struct fsl_qspi_devtype_da
  };
  
  static const struct fsl_qspi_devtype_data imx7d_data = {
-       .rxfifo = SZ_512,
+       .rxfifo = SZ_128,
        .txfifo = SZ_512,
        .ahb_buf_size = SZ_1K,
        .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_4X_INT_CLK,
@@@ -860,8 -860,10 +860,8 @@@ static int fsl_qspi_probe(struct platfo
  
        /* find the irq */
        ret = platform_get_irq(pdev, 0);
 -      if (ret < 0) {
 -              dev_err(dev, "failed to get the irq: %d\n", ret);
 +      if (ret < 0)
                goto err_disable_clk;
 -      }
  
        ret = devm_request_irq(dev, ret,
                        fsl_qspi_irq_handler, 0, pdev->name, q);
@@@ -671,6 -671,7 +671,6 @@@ static int zynq_qspi_probe(struct platf
        xqspi->irq = platform_get_irq(pdev, 0);
        if (xqspi->irq <= 0) {
                ret = -ENXIO;
 -              dev_err(&pdev->dev, "irq resource not found\n");
                goto remove_master;
        }
        ret = devm_request_irq(&pdev->dev, xqspi->irq, zynq_qspi_irq,
        ctlr->setup = zynq_qspi_setup_op;
        ctlr->max_speed_hz = clk_get_rate(xqspi->refclk) / 2;
        ctlr->dev.of_node = np;
-       ret = spi_register_controller(ctlr);
+       ret = devm_spi_register_controller(&pdev->dev, ctlr);
        if (ret) {
                dev_err(&pdev->dev, "spi_register_master failed\n");
                goto clk_dis_all;