Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/imx', 'spi/topic...
authorMark Brown <broonie@kernel.org>
Fri, 30 Sep 2016 16:14:10 +0000 (09:14 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 30 Sep 2016 16:14:10 +0000 (09:14 -0700)
1  2  3  4  5  6 
drivers/spi/Kconfig
drivers/spi/Makefile
include/linux/spi/spi.h

diff --combined drivers/spi/Kconfig
@@@@@@@ -153,16 -153,6 -153,6 -153,6 -153,6 -153,6 +153,16 @@@@@@@ config SPI_BCM63XX_HSSP
          This enables support for the High Speed SPI controller present on
          newer Broadcom BCM63XX SoCs.
      
 +++++config SPI_BCM_QSPI
 +++++  tristate "Broadcom BSPI and MSPI controller support"
 +++++  depends on ARCH_BRCMSTB || ARCH_BCM || ARCH_BCM_IPROC || COMPILE_TEST
 +++++  default ARCH_BCM_IPROC
 +++++  help
 +++++    Enables support for the Broadcom SPI flash and MSPI controller.
 +++++    Select this option for any one of BRCMSTB, iProc NSP and NS2 SoCs
 +++++    based platforms. This driver works for both SPI master for spi-nor
 +++++    flash device as well as MSPI device.
 +++++
      config SPI_BITBANG
        tristate "Utilities for Bitbanging SPI masters"
        help
@@@@@@@ -295,6 -285,6 -285,6 -285,13 -285,6 -285,6 +295,13 @@@@@@@ config SPI_IM
          This enables using the Freescale i.MX SPI controllers in master
          mode.
      
+++ ++config SPI_JCORE
+++ ++  tristate "J-Core SPI Master"
+++ ++  depends on OF && (SUPERH || COMPILE_TEST)
+++ ++  help
+++ ++    This enables support for the SPI master controller in the J-Core
+++ ++    synthesizable, open source SoC.
+++ ++
      config SPI_LM70_LLP
        tristate "Parallel port adapter for LM70 eval board (DEVELOPMENT)"
        depends on PARPORT
diff --combined drivers/spi/Makefile
@@@@@@@ -21,7 -21,6 -21,6 -21,6 -21,6 -21,6 +21,7 @@@@@@@ obj-$(CONFIG_SPI_BCM2835AUX)          += spi-bc
      obj-$(CONFIG_SPI_BCM53XX)         += spi-bcm53xx.o
      obj-$(CONFIG_SPI_BCM63XX)         += spi-bcm63xx.o
      obj-$(CONFIG_SPI_BCM63XX_HSSPI)           += spi-bcm63xx-hsspi.o
 +++++obj-$(CONFIG_SPI_BCM_QSPI)                += spi-iproc-qspi.o spi-brcmstb-qspi.o spi-bcm-qspi.o
      obj-$(CONFIG_SPI_BFIN5XX)         += spi-bfin5xx.o
      obj-$(CONFIG_SPI_ADI_V3)                += spi-adi-v3.o
      obj-$(CONFIG_SPI_BFIN_SPORT)              += spi-bfin-sport.o
@@@@@@@ -47,6 -46,6 -46,6 -46,7 -46,6 -46,6 +47,7 @@@@@@@ obj-$(CONFIG_SPI_FSL_SPI)             += spi-fsl-s
      obj-$(CONFIG_SPI_GPIO)                    += spi-gpio.o
      obj-$(CONFIG_SPI_IMG_SPFI)                += spi-img-spfi.o
      obj-$(CONFIG_SPI_IMX)                     += spi-imx.o
+++ ++obj-$(CONFIG_SPI_JCORE)                   += spi-jcore.o
      obj-$(CONFIG_SPI_LM70_LLP)                += spi-lm70llp.o
      obj-$(CONFIG_SPI_LP8841_RTC)              += spi-lp8841-rtc.o
      obj-$(CONFIG_SPI_MESON_SPIFC)             += spi-meson-spifc.o
diff --combined include/linux/spi/spi.h
@@@@@@@ -312,6 -312,8 -312,6 -312,6 -312,6 -312,6 +312,8 @@@@@@@ static inline void spi_unregister_drive
       * @flags: other constraints relevant to this driver
       * @max_transfer_size: function that returns the max transfer size for
       *        a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
+ ++++ * @max_message_size: function that returns the max message size for
+ ++++ *        a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
       * @io_mutex: mutex for physical bus access
       * @bus_lock_spinlock: spinlock for SPI bus locking
       * @bus_lock_mutex: mutex for exclusion of multiple callers
@@@@@@@ -442,10 -444,11 -442,10 -442,10 -442,10 -442,10 +444,11 @@@@@@@ struct spi_master 
      #define SPI_MASTER_MUST_TX      BIT(4)            /* requires tx */
      
        /*
- ----   * on some hardware transfer size may be constrained
+ ++++   * on some hardware transfer / message size may be constrained
         * the limit may depend on device transfer settings
         */
        size_t (*max_transfer_size)(struct spi_device *spi);
+ ++++  size_t (*max_message_size)(struct spi_device *spi);
      
        /* I/O mutex */
        struct mutex            io_mutex;
@@@@@@@ -905,12 -908,26 -905,12 -905,12 -905,12 -905,12 +908,26 @@@@@@@ extern int spi_async_locked(struct spi_
                            struct spi_message *message);
      
      static inline size_t
- ----spi_max_transfer_size(struct spi_device *spi)
+ ++++spi_max_message_size(struct spi_device *spi)
      {
        struct spi_master *master = spi->master;
- ----  if (!master->max_transfer_size)
+ ++++  if (!master->max_message_size)
                return SIZE_MAX;
- ----  return master->max_transfer_size(spi);
+ ++++  return master->max_message_size(spi);
+ ++++}
+ ++++
+ ++++static inline size_t
+ ++++spi_max_transfer_size(struct spi_device *spi)
+ ++++{
+ ++++  struct spi_master *master = spi->master;
+ ++++  size_t tr_max = SIZE_MAX;
+ ++++  size_t msg_max = spi_max_message_size(spi);
+ ++++
+ ++++  if (master->max_transfer_size)
+ ++++          tr_max = master->max_transfer_size(spi);
+ ++++
+ ++++  /* transfer size limit must not be greater than messsage size limit */
+ ++++  return min(tr_max, msg_max);
      }
      
      /*---------------------------------------------------------------------------*/
@@@@@@@ -979,30 -996,6 -979,6 -979,6 -979,6 -979,6 +996,30 @@@@@@@ extern int spi_sync_locked(struct spi_d
      extern int spi_bus_lock(struct spi_master *master);
      extern int spi_bus_unlock(struct spi_master *master);
      
 +++++/**
 +++++ * spi_sync_transfer - synchronous SPI data transfer
 +++++ * @spi: device with which data will be exchanged
 +++++ * @xfers: An array of spi_transfers
 +++++ * @num_xfers: Number of items in the xfer array
 +++++ * Context: can sleep
 +++++ *
 +++++ * Does a synchronous SPI data transfer of the given spi_transfer array.
 +++++ *
 +++++ * For more specific semantics see spi_sync().
 +++++ *
 +++++ * Return: Return: zero on success, else a negative error code.
 +++++ */
 +++++static inline int
 +++++spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
 +++++  unsigned int num_xfers)
 +++++{
 +++++  struct spi_message msg;
 +++++
 +++++  spi_message_init_with_transfers(&msg, xfers, num_xfers);
 +++++
 +++++  return spi_sync(spi, &msg);
 +++++}
 +++++
      /**
       * spi_write - SPI synchronous write
       * @spi: device to which data will be written
@@@@@@@ -1022,8 -1015,11 -998,11 -998,11 -998,11 -998,11 +1039,8 @@@@@@@ spi_write(struct spi_device *spi, cons
                        .tx_buf         = buf,
                        .len            = len,
                };
 -----  struct spi_message      m;
      
 -----  spi_message_init(&m);
 -----  spi_message_add_tail(&t, &m);
 -----  return spi_sync(spi, &m);
 +++++  return spi_sync_transfer(spi, &t, 1);
      }
      
      /**
@@@@@@@ -1045,8 -1041,35 -1024,35 -1024,35 -1024,35 -1024,35 +1062,8 @@@@@@@ spi_read(struct spi_device *spi, void *
                        .rx_buf         = buf,
                        .len            = len,
                };
 -----  struct spi_message      m;
  ----
  ----  spi_message_init(&m);
  ----  spi_message_add_tail(&t, &m);
  ----  return spi_sync(spi, &m);
  ----}
      
 -      spi_message_init(&m);
 -      spi_message_add_tail(&t, &m);
 -      return spi_sync(spi, &m);
 -    }
 -    
 -----/**
 ----- * spi_sync_transfer - synchronous SPI data transfer
 ----- * @spi: device with which data will be exchanged
 ----- * @xfers: An array of spi_transfers
 ----- * @num_xfers: Number of items in the xfer array
 ----- * Context: can sleep
 ----- *
 ----- * Does a synchronous SPI data transfer of the given spi_transfer array.
 ----- *
 ----- * For more specific semantics see spi_sync().
 ----- *
 ----- * Return: Return: zero on success, else a negative error code.
 ----- */
 -----static inline int
 -----spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
 -----  unsigned int num_xfers)
 -----{
 -----  struct spi_message msg;
 -----
 -----  spi_message_init_with_transfers(&msg, xfers, num_xfers);
 -----
 -----  return spi_sync(spi, &msg);
 +++++  return spi_sync_transfer(spi, &t, 1);
      }
      
      /* this copies txbuf and rxbuf data; for small transfers only! */