Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd2c6636 authored by Eugeniy Paltsev's avatar Eugeniy Paltsev Committed by Vinod Koul
Browse files

dmaengine: DW DMAC: add multi-block property to device tree



Several versions of DW DMAC have multi block transfers hardware
support. Hardware support of multi block transfers is disabled
by default if we use DT to configure DMAC and software emulation
of multi block transfers used instead.
Add multi-block property, so it is possible to enable hardware
multi block transfers (if present) via DT.

Switch from per device is_nollp variable to multi_block array
to be able enable/disable multi block transfers separately per
channel.

Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 258f2277
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ Optional properties:
  that services interrupts for this device
- is_private: The device channels should be marked as private and not for by the
  general purpose DMA channel allocator. False if not passed.
- multi-block: Multi block transfers supported by hardware. Array property with
  one cell per channel. 0: not supported, 1 (default): supported.

Example:

+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@
			data-width = <4>;
			clocks = <&ahb_clk>;
			clock-names = "hclk";
			multi-block = <1 1 1 1 1 1>;
		};

		i2c0: i2c@FF120000 {
+2 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@
			block_size = <0xfff>;
			dma-masters = <2>;
			data-width = <8 8>;
			multi-block = <1 1 1 1 1 1 1 1>;
		};

		dma@eb000000 {
@@ -134,6 +135,7 @@
			chan_priority = <1>;
			block_size = <0xfff>;
			data-width = <8 8>;
			multi-block = <1 1 1 1 1 1 1 1>;
		};

		fsmc: flash@b0000000 {
+1 −1
Original line number Diff line number Diff line
@@ -1569,7 +1569,7 @@ int dw_dma_probe(struct dw_dma_chip *chip)
				(dwc_params >> DWC_PARAMS_MBLK_EN & 0x1) == 0;
		} else {
			dwc->block_size = pdata->block_size;
			dwc->nollp = pdata->is_nollp;
			dwc->nollp = !pdata->multi_block[i];
		}
	}

+11 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
{
	struct device_node *np = pdev->dev.of_node;
	struct dw_dma_platform_data *pdata;
	u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
	u32 tmp, arr[DW_DMA_MAX_NR_MASTERS], mb[DW_DMA_MAX_NR_CHANNELS];
	u32 nr_masters;
	u32 nr_channels;

@@ -118,6 +118,8 @@ dw_dma_parse_dt(struct platform_device *pdev)

	if (of_property_read_u32(np, "dma-channels", &nr_channels))
		return NULL;
	if (nr_channels > DW_DMA_MAX_NR_CHANNELS)
		return NULL;

	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
	if (!pdata)
@@ -152,6 +154,14 @@ dw_dma_parse_dt(struct platform_device *pdev)
			pdata->data_width[tmp] = BIT(arr[tmp] & 0x07);
	}

	if (!of_property_read_u32_array(np, "multi-block", mb, nr_channels)) {
		for (tmp = 0; tmp < nr_channels; tmp++)
			pdata->multi_block[tmp] = mb[tmp];
	} else {
		for (tmp = 0; tmp < nr_channels; tmp++)
			pdata->multi_block[tmp] = 1;
	}

	return pdata;
}
#else
Loading