Commit 605ea5aa authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull spi updates from Mark Brown:
 "The big change this release has been some excellent work from Lukas
  Wunner which closes a bunch of holes in the cleanup paths for drivers,
  mainly introduced as a result of devm conversions causing bad
  interactions with the support SPI has for allocating the bus and
  driver data together.

  Together with some of the other work done it feels like we've turned
  the corner on several long standing pain points with the API.

  Summary:

   - Many cleanups around probe/remove and error handling from Lukas
     Wunner and Uwe Kleine-König, and further fixes around PM from Zhang
     Qilong.

   - Provide a mask for which bits of the mode can safely be configured
     by drivers and use that to fix an issue with the ADS7846 driver.

   - Documentation of the expected interactions between SPI and GPIO
     level chip select polarity configuration from H. Nikolaus Schaller,
     hopefully we're pretty much at the end of sorting out the
     interactions there. Thanks to Nikolaus, Sven Van Asbroeck and Linus
     Walleij for this.

   - DMA support for Allwinner sun6i controllers.

   - Support for Canaan K210 Designware implementations and Intel Adler
     Lake"

* tag 'spi-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (69 commits)
  spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors
  spi: Limit the spi device max speed to controller's max speed
  spi: spi-geni-qcom: Use the new method of gpio CS control
  platform/chrome: cros_ec_spi: Drop bits_per_word assignment
  platform/chrome: cros_ec_spi: Don't overwrite spi::mode
  spi: dw: Add support for the Canaan K210 SoC SPI
  spi: dw: Add support for 32-bits max xfer size
  dt-bindings: spi: dw-apb-ssi: Add Canaan K210 SPI controller
  spi: Update DT binding docs to support SiFive FU740 SoC
  spi: atmel-quadspi: Fix use-after-free on unbind
  spi: npcm-fiu: Disable clock in probe error path
  spi: ar934x: Don't leak SPI master in probe error path
  spi: mt7621: Don't leak SPI master in probe error path
  spi: mt7621: Disable clock in probe error path
  media: netup_unidvb: Don't leak SPI master in probe error path
  spi: sc18is602: Don't leak SPI master in probe error path
  spi: rb4xx: Don't leak SPI master in probe error path
  spi: gpio: Don't leak SPI master in probe error path
  spi: spi-mtk-nor: Don't leak SPI master in probe error path
  spi: mxic: Don't leak SPI master in probe error path
  ...
parents 2dda5700 3e98a021
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ properties:
        const: baikal,bt1-ssi
      - description: Baikal-T1 System Boot SPI Controller
        const: baikal,bt1-sys-ssi
      - description: Canaan Kendryte K210 SoS SPI Controller
        const: canaan,k210-spi

  reg:
    minItems: 1
+27 −0
Original line number Diff line number Diff line
@@ -42,6 +42,33 @@ properties:
        cs2 : &gpio1 1 0
        cs3 : &gpio1 2 0

      The second flag of a gpio descriptor can be GPIO_ACTIVE_HIGH (0)
      or GPIO_ACTIVE_LOW(1). Legacy device trees often use 0.

      There is a special rule set for combining the second flag of an
      cs-gpio with the optional spi-cs-high flag for SPI slaves.

      Each table entry defines how the CS pin is to be physically
      driven (not considering potential gpio inversions by pinmux):

      device node     | cs-gpio       | CS pin state active | Note
      ================+===============+=====================+=====
      spi-cs-high     | -             | H                   |
      -               | -             | L                   |
      spi-cs-high     | ACTIVE_HIGH   | H                   |
      -               | ACTIVE_HIGH   | L                   | 1
      spi-cs-high     | ACTIVE_LOW    | H                   | 2
      -               | ACTIVE_LOW    | L                   |

      Notes:
      1) Should print a warning about polarity inversion.
         Here it would be wise to avoid and define the gpio as
         ACTIVE_LOW.
      2) Should print a warning about polarity inversion
         because ACTIVE_LOW is overridden by spi-cs-high.
         Should be generally avoided and be replaced by
         spi-cs-high + ACTIVE_HIGH.

  num-cs:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
+6 −4
Original line number Diff line number Diff line
@@ -17,15 +17,17 @@ allOf:
properties:
  compatible:
    items:
      - const: sifive,fu540-c000-spi
      - enum:
          - sifive,fu540-c000-spi
          - sifive,fu740-c000-spi
      - const: sifive,spi0

    description:
      Should be "sifive,<chip>-spi" and "sifive,spi<version>".
      Supported compatible strings are -
      "sifive,fu540-c000-spi" for the SiFive SPI v0 as integrated
      onto the SiFive FU540 chip, and "sifive,spi0" for the SiFive
      SPI v0 IP block with no chip integration tweaks.
      "sifive,fu540-c000-spi" and "sifive,fu740-c000-spi" for the SiFive SPI v0
      as integrated onto the SiFive FU540 and FU740 chip resp, and "sifive,spi0"
      for the SiFive SPI v0 IP block with no chip integration tweaks.
      Please refer to sifive-blocks-ip-versioning.txt for details

      SPI RTL that corresponds to the IP block version numbers can be found here -
+2 −1
Original line number Diff line number Diff line
@@ -1288,7 +1288,8 @@ static int ads7846_probe(struct spi_device *spi)
	 * may not.  So we stick to very-portable 8 bit words, both RX and TX.
	 */
	spi->bits_per_word = 8;
	spi->mode = SPI_MODE_0;
	spi->mode &= ~SPI_MODE_X_MASK;
	spi->mode |= SPI_MODE_0;
	err = spi_setup(spi);
	if (err < 0)
		return err;
+3 −2
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
	struct spi_master *master;
	struct netup_spi *nspi;

	master = spi_alloc_master(&ndev->pci_dev->dev,
	master = devm_spi_alloc_master(&ndev->pci_dev->dev,
		sizeof(struct netup_spi));
	if (!master) {
		dev_err(&ndev->pci_dev->dev,
@@ -208,6 +208,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
		ndev->pci_slot,
		ndev->pci_func);
	if (!spi_new_device(master, &netup_spi_board)) {
		spi_unregister_master(master);
		ndev->spi = NULL;
		dev_err(&ndev->pci_dev->dev,
			"%s(): unable to create SPI device\n", __func__);
@@ -226,13 +227,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
	if (!spi)
		return;

	spi_unregister_master(spi->master);
	spin_lock_irqsave(&spi->lock, flags);
	reg = readw(&spi->regs->control_stat);
	writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
	reg = readw(&spi->regs->control_stat);
	writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat);
	spin_unlock_irqrestore(&spi->lock, flags);
	spi_unregister_master(spi->master);
	ndev->spi = NULL;
}

Loading