Commit b36eb6e3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull spi fixes from Mark Brown:
 "A couple of device ID and quirk updates, plus a bunch of small fixes
  most of which (other than the Cadence one) are unremarkable error
  handling fixes"

* tag 'spi-fix-v7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: atcspi200: Handle invalid buswidth and fix compiler warning
  spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs
  spi: intel-pci: Add support for Nova Lake mobile SPI flash
  spi: cadence-qspi: Fix requesting of APB and AHB clocks on JH7110
  spi: rockchip-sfc: Fix double-free in remove() callback
  spi: atcspi200: Fix double-free in atcspi_configure_dma()
  spi: amlogic: spifc-a4: Fix DMA mapping error handling
parents ff30ea1f f879365c
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A31 SPI Controller

allOf:
  - $ref: spi-controller.yaml

maintainers:
  - Chen-Yu Tsai <wens@csie.org>
  - Maxime Ripard <mripard@kernel.org>
@@ -82,11 +79,11 @@ patternProperties:

      spi-rx-bus-width:
        items:
          - const: 1
          enum: [0, 1, 2, 4]

      spi-tx-bus-width:
        items:
          - const: 1
          enum: [0, 1, 2, 4]

required:
  - compatible
@@ -95,6 +92,28 @@ required:
  - clocks
  - clock-names

allOf:
  - $ref: spi-controller.yaml
  - if:
      not:
        properties:
          compatible:
            contains:
              enum:
                - allwinner,sun50i-r329-spi
                - allwinner,sun55i-a523-spi
    then:
      patternProperties:
        "^.*@[0-9a-f]+":
          properties:
            spi-rx-bus-width:
              items:
                enum: [0, 1]

            spi-tx-bus-width:
              items:
                enum: [0, 1]

unevaluatedProperties: false

examples:
+2 −3
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
	ret = dma_mapping_error(sfc->dev, sfc->daddr);
	if (ret) {
		dev_err(sfc->dev, "DMA mapping error\n");
		goto out_map_data;
		return ret;
	}

	cmd = CMD_DATA_ADDRL(sfc->daddr);
@@ -429,7 +429,6 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
		ret = dma_mapping_error(sfc->dev, sfc->iaddr);
		if (ret) {
			dev_err(sfc->dev, "DMA mapping error\n");
			dma_unmap_single(sfc->dev, sfc->daddr, datalen, dir);
			goto out_map_data;
		}

@@ -448,7 +447,7 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
	return 0;

out_map_info:
	dma_unmap_single(sfc->dev, sfc->iaddr, datalen, dir);
	dma_unmap_single(sfc->dev, sfc->iaddr, infolen, dir);
out_map_data:
	dma_unmap_single(sfc->dev, sfc->daddr, datalen, dir);

+16 −22
Original line number Diff line number Diff line
@@ -195,7 +195,15 @@ static void atcspi_set_trans_ctl(struct atcspi_dev *spi,
	if (op->addr.buswidth > 1)
		tc |= TRANS_ADDR_FMT;
	if (op->data.nbytes) {
		tc |= TRANS_DUAL_QUAD(ffs(op->data.buswidth) - 1);
		unsigned int width_code;

		width_code = ffs(op->data.buswidth) - 1;
		if (unlikely(width_code > 3)) {
			WARN_ON_ONCE(1);
			width_code = 0;
		}
		tc |= TRANS_DUAL_QUAD(width_code);

		if (op->data.dir == SPI_MEM_DATA_IN) {
			if (op->dummy.nbytes)
				tc |= TRANS_MODE_DMY_READ |
@@ -497,31 +505,17 @@ static int atcspi_init_resources(struct platform_device *pdev,

static int atcspi_configure_dma(struct atcspi_dev *spi)
{
	struct dma_chan *dma_chan;
	int ret = 0;
	spi->host->dma_rx = devm_dma_request_chan(spi->dev, "rx");
	if (IS_ERR(spi->host->dma_rx))
		return PTR_ERR(spi->host->dma_rx);

	dma_chan = devm_dma_request_chan(spi->dev, "rx");
	if (IS_ERR(dma_chan)) {
		ret = PTR_ERR(dma_chan);
		goto err_exit;
	}
	spi->host->dma_rx = dma_chan;
	spi->host->dma_tx = devm_dma_request_chan(spi->dev, "tx");
	if (IS_ERR(spi->host->dma_tx))
		return PTR_ERR(spi->host->dma_tx);

	dma_chan = devm_dma_request_chan(spi->dev, "tx");
	if (IS_ERR(dma_chan)) {
		ret = PTR_ERR(dma_chan);
		goto free_rx;
	}
	spi->host->dma_tx = dma_chan;
	init_completion(&spi->dma_completion);

	return ret;

free_rx:
	dma_release_channel(spi->host->dma_rx);
	spi->host->dma_rx = NULL;
err_exit:
	return ret;
	return 0;
}

static int atcspi_enable_clk(struct atcspi_dev *spi)
+6 −0
Original line number Diff line number Diff line
@@ -76,6 +76,11 @@ struct cqspi_flash_pdata {
	u8		cs;
};

static const struct clk_bulk_data cqspi_clks[CLK_QSPI_NUM] = {
	[CLK_QSPI_APB] = { .id = "apb" },
	[CLK_QSPI_AHB] = { .id = "ahb" },
};

struct cqspi_st {
	struct platform_device	*pdev;
	struct spi_controller	*host;
@@ -1823,6 +1828,7 @@ static int cqspi_probe(struct platform_device *pdev)
	}

	/* Obtain QSPI clocks. */
	memcpy(&cqspi->clks, &cqspi_clks, sizeof(cqspi->clks));
	ret = devm_clk_bulk_get_optional(dev, CLK_QSPI_NUM, cqspi->clks);
	if (ret)
		return dev_err_probe(dev, ret, "Failed to get clocks\n");
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
	{ PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info },
	{ PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info },
	{ PCI_VDEVICE(INTEL, 0xa823), (unsigned long)&cnl_info },
	{ PCI_VDEVICE(INTEL, 0xd323), (unsigned long)&cnl_info },
	{ PCI_VDEVICE(INTEL, 0xe323), (unsigned long)&cnl_info },
	{ PCI_VDEVICE(INTEL, 0xe423), (unsigned long)&cnl_info },
	{ },
Loading