Add GPCDMA support in Tegra264
v6 cover Add GPCDMA support in Tegra264
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replace dev_err() with dev_err_probe() in the probe function for fixed return values also.v4->v5:
- Use dev_err_probe() when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes. v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from struct tegra_dma_channel_regs.
- Use devm_of_dma_controller_register() to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fix dt_bindings_check warnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Use dma_addr_t for sg_req src/dst fields and drop separate high_add variable and check for the addr_bits only when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.
Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-map
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 32 +- .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 +++++++++++------- 4 files changed, 284 insertions(+), 184 deletions(-)
Signature · 1 line
2.50.1
PATCH v6 1/10 dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
On Tegra264, GPCDMA reset control is not exposed to Linux and is handled by the boot firmware.
Although reset was not exposed in Tegra234 as well, the firmware supported a dummy reset which just returns success on reset without doing an actual reset. This is also not supported in Tegra264 BPMP. Therefore mark 'reset' and 'reset-names' properties as required only for devices prior to Tegra264.
This also necessitates that the Tegra264 compatible be standalone and cannot have the fallback compatible of Tegra186. Since there is no functional impact, we keep reset as required for Tegra234 to avoid breaking the ABI.
--- .../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +16 -7
@@ -15,16 +15,14 @@ maintainers: - Jon Hunter <[email protected]> - Rajesh Gumasta <[email protected]> -allOf: - - $ref: dma-controller.yaml# - properties: compatible: oneOf: - - const: nvidia,tegra186-gpcdma + - enum: + - nvidia,tegra264-gpcdma + - nvidia,tegra186-gpcdma - items: - enum: - - nvidia,tegra264-gpcdma - nvidia,tegra234-gpcdma - nvidia,tegra194-gpcdma - const: nvidia,tegra186-gpcdma
@@ -60,12 +58,23 @@ required: - compatible - reg - interrupts - - resets - - reset-names - "#dma-cells" - iommus - dma-channel-mask +allOf: + - $ref: dma-controller.yaml# + - if: + properties: + compatible: + contains: + enum: + - nvidia,tegra186-gpcdma + then: + required: + - resets + - reset-names + additionalProperties: false examples:
Signature · 1 line
2.50.1
Re: [PATCH v6 01/10] dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
Quoted 14 lines · Akhil R
On Tegra264, GPCDMA reset control is not exposed to Linux and is handled by the boot firmware.
Although reset was not exposed in Tegra234 as well, the firmware supported a dummy reset which just returns success on reset without doing an actual reset. This is also not supported in Tegra264 BPMP. Therefore mark 'reset' and 'reset-names' properties as required only for devices prior to Tegra264.
This also necessitates that the Tegra264 compatible be standalone and cannot have the fallback compatible of Tegra186. Since there is no functional impact, we keep reset as required for Tegra234 to avoid breaking the ABI.
Quoted 6 lines
Fixes bb8c97571db5 ("dt-bindings: dma: Add Tegra264 compatible string")Signed-off-by Akhil R <[email protected]>--- .../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-)
PATCH v6 2/10 arm64: tegra: Remove fallback compatible for GPCDMA
In reply to Akhil RRemove the fallback compatible string "nvidia,tegra186-gpcdma" for GPCDMA in Tegra264. Tegra186 compatible cannot work on Tegra264 because of the register offset changes and absence of the reset property.
--- arch/arm64/boot/dts/nvidia/tegra264.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra264.dtsi +1 -1
@@ -3208,7 +3208,7 @@ agic_page5: interrupt-controller@99b0000 { }; gpcdma: dma-controller@8400000 { - compatible = "nvidia,tegra264-gpcdma", "nvidia,tegra186-gpcdma"; + compatible = "nvidia,tegra264-gpcdma"; reg = <0x0 0x08400000 0x0 0x210000>; interrupts = <GIC_SPI 584 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 585 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.50.1
Rob Herring
maintainerRe: [PATCH v6 02/10] arm64: tegra: Remove fallback compatible for GPCDMA
Quoted 10 lines · Akhil R
Remove the fallback compatible string "nvidia,tegra186-gpcdma" for GPCDMA in Tegra264. Tegra186 compatible cannot work on Tegra264 because of the register offset changes and absence of the reset property.
Fixes 65ef237e4810 ("arm64: tegra: Add Tegra264 support")Signed-off-by Akhil R <[email protected]>--- arch/arm64/boot/dts/nvidia/tegra264.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thierry, Are you going to apply this? The binding change has been picked up and now there's a warning.
Rob
Thierry Reding
maintainerRe: [PATCH v6 02/10] arm64: tegra: Remove fallback compatible for GPCDMA
Quoted 6 lines · Rob Herring
Quoted 5 lines · Akhil R
Remove the fallback compatible string "nvidia,tegra186-gpcdma" for GPCDMA in Tegra264. Tegra186 compatible cannot work on Tegra264 because of the register offset changes and absence of the reset property.
Quoted 8 lines
Quoted 5 lines
Fixes 65ef237e4810 ("arm64: tegra: Add Tegra264 support")Signed-off-by Akhil R <[email protected]>--- arch/arm64/boot/dts/nvidia/tegra264.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Thierry, Are you going to apply this? The binding change has been picked up and now there's a warning.
Yes, I have this in my tree of fixes for 7.1 and plan to send it out towards the end of this week.
Thierry
Thierry Reding
maintainerRe: [PATCH v6 02/10] arm64: tegra: Remove fallback compatible for GPCDMA
Quoted 13 lines · Thierry Reding
Quoted 12 lines · Rob Herring
Quoted 10 lines · Akhil R
Remove the fallback compatible string "nvidia,tegra186-gpcdma" for GPCDMA in Tegra264. Tegra186 compatible cannot work on Tegra264 because of the register offset changes and absence of the reset property.
Fixes 65ef237e4810 ("arm64: tegra: Add Tegra264 support")Signed-off-by Akhil R <[email protected]>--- arch/arm64/boot/dts/nvidia/tegra264.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 2 lines
Thierry, Are you going to apply this? The binding change has been picked up and now there's a warning.
Yes, I have this in my tree of fixes for 7.1 and plan to send it out towards the end of this week.
Sorry, fixes for 7.2-rc1, that is.
Thierry
PATCH v6 3/10 dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
In reply to Akhil RAdd iommu-map property to specify separate stream IDs for each DMA channel. This enables each channel to be in its own IOMMU domain, keeping memory isolated from other devices sharing the same DMA controller.
Define the constraints such that if the channel and stream IDs are contiguous, a single entry can map all the channels, but if the channels or stream IDs are non-contiguous support multiple entries.
--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +9 -0
@@ -14,6 +14,7 @@ description: | maintainers: - Jon Hunter <[email protected]> - Rajesh Gumasta <[email protected]> + - Akhil R <[email protected]> properties: compatible:
@@ -49,6 +50,14 @@ properties: iommus: maxItems: 1 + iommu-map: + description: + Maps DMA channel numbers to IOMMU stream IDs. A single entry can map all + channels when stream IDs are contiguous. In systems where the channels or + stream IDs are not contiguous, multiple entries may be needed. + minItems: 1 + maxItems: 32 + dma-coherent: true dma-channel-mask:
Signature · 1 line
2.50.1
Re: [PATCH v6 03/10] dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
Quoted 9 lines · Akhil R
Add iommu-map property to specify separate stream IDs for each DMA channel. This enables each channel to be in its own IOMMU domain, keeping memory isolated from other devices sharing the same DMA controller.
Define the constraints such that if the channel and stream IDs are contiguous, a single entry can map all the channels, but if the channels or stream IDs are non-contiguous support multiple entries.
Quoted 5 lines
Signed-off-by Akhil R <[email protected]>--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH v6 4/10 dmaengine: tegra: Make reset control optional
In reply to Akhil ROn Tegra264, reset is not available for the driver to control as this is handled by the boot firmware. Hence make the reset control optional and update the error message to reflect the correct error.
--- drivers/dma/tegra186-gpc-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/tegra186-gpc-dma.c +2 -2
@@ -1381,10 +1381,10 @@ static int tegra_dma_probe(struct platform_device *pdev)if (IS_ERR (tdma->base_addr))return PTR_ERR (tdma->base_addr); - tdma->rst =devm_reset_control_get_exclusive (&pdev->dev,"gpcdma" ); + tdma->rst =devm_reset_control_get_optional_exclusive (&pdev->dev,"gpcdma" );if (IS_ERR (tdma->rst)) {return dev_err_probe (&pdev->dev,PTR_ERR (tdma->rst), -"Missing controller reset\n" ); +"Failed to get controller reset\n" ); }reset_control_reset (tdma->rst);
Signature · 1 line
2.50.1
Re: [PATCH v6 04/10] dmaengine: tegra: Make reset control optional
Quoted 15 lines · Akhil R
On Tegra264, reset is not available for the driver to control as this is handled by the boot firmware. Hence make the reset control optional and update the error message to reflect the correct error.
Signed-off-by Akhil R <[email protected]>Reviewed-by Frank Li <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/tegra186-gpc-dma.c +0
-0
drivers/dma/tegra186-gpc-dma.c static int tegra_dma_probe(struct platform_device *pdev) · line 1387
Quoted 9 lines
drivers/dma/tegra186-gpc-dma.c +2
-2@@ -1381,10 +1381,10 @@ static int tegra_dma_probe(struct platform_device *pdev)if (IS_ERR (tdma->base_addr))return PTR_ERR (tdma->base_addr); - tdma->rst =devm_reset_control_get_exclusive (&pdev->dev,"gpcdma" ); + tdma->rst =devm_reset_control_get_optional_exclusive (&pdev->dev,"gpcdma" );if (IS_ERR (tdma->rst)) {return dev_err_probe (&pdev->dev,PTR_ERR (tdma->rst), -"Missing controller reset\n" ); +"Failed to get controller reset\n" );
This change is a bit pointless, but I suppose it's a little more accurate this way, so:
PATCH v6 5/10 dmaengine: tegra: Use struct for register offsets
In reply to Akhil RRepurpose the struct tegra_dma_channel_regs to define offsets for all the channel registers. Previously, the struct only held the register values for each transfer and was wrapped within tegra_dma_sg_req. Move the values directly into tegra_dma_sg_req and use channel_regs for storing the register offsets. Update all register reads/writes to use the struct channel_regs. This prepares for the register offset change in Tegra264.
--- drivers/dma/tegra186-gpc-dma.c | 282 +++++++++++++++++---------------- 1 file changed, 142 insertions(+), 140 deletions(-)
drivers/dma/tegra186-gpc-dma.c +142 -140
@@ -22,7 +22,6 @@#include "virt-dma.h" /* CSR register */ -#define TEGRA_GPCDMA_CHAN_CSR 0x00#define TEGRA_GPCDMA_CSR_ENB BIT(31)#define TEGRA_GPCDMA_CSR_IE_EOC BIT(30)#define TEGRA_GPCDMA_CSR_ONCE BIT(27)
@@ -58,7 +57,6 @@#define TEGRA_GPCDMA_CSR_WEIGHT GENMASK(13, 10)/* STATUS register */ -#define TEGRA_GPCDMA_CHAN_STATUS 0x004#define TEGRA_GPCDMA_STATUS_BUSY BIT(31)#define TEGRA_GPCDMA_STATUS_ISE_EOC BIT(30)#define TEGRA_GPCDMA_STATUS_PING_PONG BIT(28)
@@ -70,22 +68,13 @@#define TEGRA_GPCDMA_STATUS_IRQ_STA BIT(21)#define TEGRA_GPCDMA_STATUS_IRQ_TRIG_STA BIT(20) -#define TEGRA_GPCDMA_CHAN_CSRE 0x008#define TEGRA_GPCDMA_CHAN_CSRE_PAUSE BIT(31) -/* Source address */ -#define TEGRA_GPCDMA_CHAN_SRC_PTR 0x00C - -/* Destination address */ -#define TEGRA_GPCDMA_CHAN_DST_PTR 0x010 -/* High address pointer */ -#define TEGRA_GPCDMA_CHAN_HIGH_ADDR_PTR 0x014#define TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR GENMASK(7, 0)#define TEGRA_GPCDMA_HIGH_ADDR_DST_PTR GENMASK(23, 16)/* MC sequence register */ -#define TEGRA_GPCDMA_CHAN_MCSEQ 0x18#define TEGRA_GPCDMA_MCSEQ_DATA_SWAP BIT(31)#define TEGRA_GPCDMA_MCSEQ_REQ_COUNT GENMASK(30, 25)#define TEGRA_GPCDMA_MCSEQ_BURST GENMASK(24, 23)
@@ -101,7 +90,6 @@#define TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK GENMASK(6, 0)/* MMIO sequence register */ -#define TEGRA_GPCDMA_CHAN_MMIOSEQ 0x01c#define TEGRA_GPCDMA_MMIOSEQ_DBL_BUF BIT(31)#define TEGRA_GPCDMA_MMIOSEQ_BUS_WIDTH GENMASK(30, 28)#define TEGRA_GPCDMA_MMIOSEQ_BUS_WIDTH_8 \
@@ -120,17 +108,7 @@#define TEGRA_GPCDMA_MMIOSEQ_WRAP_WORD GENMASK(18, 16)#define TEGRA_GPCDMA_MMIOSEQ_MMIO_PROT GENMASK(8, 7) -/* Channel WCOUNT */ -#define TEGRA_GPCDMA_CHAN_WCOUNT 0x20 - -/* Transfer count */ -#define TEGRA_GPCDMA_CHAN_XFER_COUNT 0x24 - -/* DMA byte count status */ -#define TEGRA_GPCDMA_CHAN_DMA_BYTE_STATUS 0x28 -/* Error Status Register */ -#define TEGRA_GPCDMA_CHAN_ERR_STATUS 0x30#define TEGRA_GPCDMA_CHAN_ERR_TYPE_SHIFT 8#define TEGRA_GPCDMA_CHAN_ERR_TYPE_MASK 0xF#define TEGRA_GPCDMA_CHAN_ERR_TYPE (err) ( \
@@ -143,16 +121,6 @@#define TEGRA_DMA_MC_SLAVE_ERR 0xB#define TEGRA_DMA_MMIO_SLAVE_ERR 0xA -/* Fixed Pattern */ -#define TEGRA_GPCDMA_CHAN_FIXED_PATTERN 0x34 - -#define TEGRA_GPCDMA_CHAN_TZ 0x38 -#define TEGRA_GPCDMA_CHAN_TZ_MMIO_PROT_1 BIT(0) -#define TEGRA_GPCDMA_CHAN_TZ_MC_PROT_1 BIT(1) - -#define TEGRA_GPCDMA_CHAN_SPARE 0x3c -#define TEGRA_GPCDMA_CHAN_SPARE_EN_LEGACY_FC BIT(16) -/* * If any burst is in flight and DMA paused then this is the time to complete * on-flight burst and update DMA status register.
@@ -181,18 +149,24 @@ struct tegra_dma_chip_data {unsigned int nr_channels;unsigned int channel_reg_size;unsigned int max_dma_count; +const struct tegra_dma_channel_regs *channel_regs;int (*terminate)(struct tegra_dma_channel *tdc); };/* DMA channel registers */ struct tegra_dma_channel_regs {u32 csr; -u32 src_ptr; -u32 dst_ptr; -u32 high_addr_ptr; +u32 status; +u32 csre; +u32 src; +u32 dst; +u32 high_addr;u32 mc_seq;u32 mmio_seq;u32 wcount; +u32 wxfer; +u32 wstatus; +u32 err_status;u32 fixed_pattern; };
@@ -205,7 +179,14 @@ struct tegra_dma_channel_regs {*/ struct tegra_dma_sg_req {unsigned int len; -struct tegra_dma_channel_regs ch_regs; +u32 csr; +u32 src; +u32 dst; +u32 high_addr; +u32 mc_seq; +u32 mmio_seq; +u32 wcount; +u32 fixed_pattern; };/*
@@ -228,19 +209,20 @@ struct tegra_dma_desc {* tegra_dma_channel: Channel specific information */ struct tegra_dma_channel { -bool config_init; -char name[30 ]; -enum dma_transfer_direction sid_dir; -enum dma_status status; -int id; -int irq; -int slave_id; +const struct tegra_dma_channel_regs *regs;struct tegra_dma *tdma;struct virt_dma_chan vc;struct tegra_dma_desc *dma_desc;struct dma_slave_config dma_sconfig; +enum dma_transfer_direction sid_dir; +enum dma_status status;unsigned int stream_id;unsigned long chan_base_offset; +bool config_init; +char name[30 ]; +int id; +int irq; +int slave_id; };/*
@@ -288,22 +270,22 @@ static void tegra_dma_dump_chan_regs(struct tegra_dma_channel *tdc) {dev_dbg (tdc2dev (tdc),"DMA Channel %d name %s register dump:\n" , tdc->id, tdc->name); -dev_dbg (tdc2dev (tdc),"CSR %x STA %x CSRE %x SRC %x DST %x\n" , -tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSR ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_STATUS ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSRE ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_SRC_PTR ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_DST_PTR ) - ); -dev_dbg (tdc2dev (tdc),"MCSEQ %x IOSEQ %x WCNT %x XFER %x BSTA %x\n" , -tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_MMIOSEQ ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_WCOUNT ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_XFER_COUNT ), -tdc_read (tdc,TEGRA_GPCDMA_CHAN_DMA_BYTE_STATUS ) - ); +dev_dbg (tdc2dev (tdc),"CSR %x STA %x CSRE %x\n" , +tdc_read (tdc, tdc->regs->csr), +tdc_read (tdc, tdc->regs->status), +tdc_read (tdc, tdc->regs->csre)); +dev_dbg (tdc2dev (tdc),"SRC %x DST %x HI ADDR %x\n" , +tdc_read (tdc, tdc->regs->src), +tdc_read (tdc, tdc->regs->dst), +tdc_read (tdc, tdc->regs->high_addr)); +dev_dbg (tdc2dev (tdc),"MCSEQ %x IOSEQ %x WCNT %x XFER %x WSTA %x\n" , +tdc_read (tdc, tdc->regs->mc_seq), +tdc_read (tdc, tdc->regs->mmio_seq), +tdc_read (tdc, tdc->regs->wcount), +tdc_read (tdc, tdc->regs->wxfer), +tdc_read (tdc, tdc->regs->wstatus));dev_dbg (tdc2dev (tdc),"DMA ERR_STA %x\n" , -tdc_read (tdc,TEGRA_GPCDMA_CHAN_ERR_STATUS )); +tdc_read (tdc, tdc->regs->err_status)); } static int tegra_dma_sid_reserve(struct tegra_dma_channel *tdc,
@@ -377,13 +359,13 @@ static int tegra_dma_pause(struct tegra_dma_channel *tdc)int ret;u32 val; - val =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSRE ); + val =tdc_read (tdc, tdc->regs->csre); val |=TEGRA_GPCDMA_CHAN_CSRE_PAUSE ; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSRE , val); +tdc_write (tdc, tdc->regs->csre, val);/* Wait until busy bit is de-asserted */ ret = readl_relaxed_poll_timeout_atomic(tdc->tdma->base_addr + - tdc->chan_base_offset + TEGRA_GPCDMA_CHAN_STATUS, + tdc->chan_base_offset + tdc->regs->status, val, !(val & TEGRA_GPCDMA_STATUS_BUSY), TEGRA_GPCDMA_BURST_COMPLETE_TIME,
@@ -419,9 +401,9 @@ static void tegra_dma_resume(struct tegra_dma_channel *tdc) {u32 val; - val =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSRE ); + val =tdc_read (tdc, tdc->regs->csre); val &= ~TEGRA_GPCDMA_CHAN_CSRE_PAUSE ; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSRE , val); +tdc_write (tdc, tdc->regs->csre, val); tdc->status =DMA_IN_PROGRESS ; }
@@ -456,27 +438,27 @@ static void tegra_dma_disable(struct tegra_dma_channel *tdc) {u32 csr, status; - csr =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSR ); + csr =tdc_read (tdc, tdc->regs->csr);/* Disable interrupts */ csr &= ~TEGRA_GPCDMA_CSR_IE_EOC ;/* Disable DMA */ csr &= ~TEGRA_GPCDMA_CSR_ENB ; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , csr); +tdc_write (tdc, tdc->regs->csr, csr);/* Clear interrupt status if it is there */ - status =tdc_read (tdc,TEGRA_GPCDMA_CHAN_STATUS ); + status =tdc_read (tdc, tdc->regs->status);if (status &TEGRA_GPCDMA_STATUS_ISE_EOC ) {dev_dbg (tdc2dev (tdc),"%s():clearing interrupt\n" , __func__); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_STATUS , status); +tdc_write (tdc, tdc->regs->status, status); } }static void tegra_dma_configure_next_sg (struct tegra_dma_channel *tdc) {struct tegra_dma_desc *dma_desc = tdc->dma_desc; -struct tegra_dma_channel_regs *ch_regs; +struct tegra_dma_sg_req *sg_req;int ret;u32 val;
@@ -488,29 +470,29 @@ static void tegra_dma_configure_next_sg(struct tegra_dma_channel *tdc)/* Configure next transfer immediately after DMA is busy */ ret =readl_relaxed_poll_timeout_atomic (tdc->tdma->base_addr + - tdc->chan_base_offset +TEGRA_GPCDMA_CHAN_STATUS , + tdc->chan_base_offset + tdc->regs->status, val, (val &TEGRA_GPCDMA_STATUS_BUSY ),0 ,TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT );if (ret)return ; - ch_regs = &dma_desc->sg_req[dma_desc->sg_idx].ch_regs; + sg_req = &dma_desc->sg_req[dma_desc->sg_idx]; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_WCOUNT , ch_regs->wcount); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_SRC_PTR , ch_regs->src_ptr); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_DST_PTR , ch_regs->dst_ptr); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_HIGH_ADDR_PTR , ch_regs->high_addr_ptr); +tdc_write (tdc, tdc->regs->wcount, sg_req->wcount); +tdc_write (tdc, tdc->regs->src, sg_req->src); +tdc_write (tdc, tdc->regs->dst, sg_req->dst); +tdc_write (tdc, tdc->regs->high_addr, sg_req->high_addr);/* Start DMA */ -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , - ch_regs->csr |TEGRA_GPCDMA_CSR_ENB ); +tdc_write (tdc, tdc->regs->csr, + sg_req->csr |TEGRA_GPCDMA_CSR_ENB ); }static void tegra_dma_start (struct tegra_dma_channel *tdc) {struct tegra_dma_desc *dma_desc = tdc->dma_desc; -struct tegra_dma_channel_regs *ch_regs; +struct tegra_dma_sg_req *sg_req;struct virt_dma_desc *vdesc;if (!dma_desc) {
@@ -526,21 +508,21 @@ static void tegra_dma_start(struct tegra_dma_channel *tdc)tegra_dma_resume (tdc); } - ch_regs = &dma_desc->sg_req[dma_desc->sg_idx].ch_regs; + sg_req = &dma_desc->sg_req[dma_desc->sg_idx]; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_WCOUNT , ch_regs->wcount); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR ,0 ); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_SRC_PTR , ch_regs->src_ptr); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_DST_PTR , ch_regs->dst_ptr); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_HIGH_ADDR_PTR , ch_regs->high_addr_ptr); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_FIXED_PATTERN , ch_regs->fixed_pattern); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_MMIOSEQ , ch_regs->mmio_seq); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_MCSEQ , ch_regs->mc_seq); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , ch_regs->csr); +tdc_write (tdc, tdc->regs->wcount, sg_req->wcount); +tdc_write (tdc, tdc->regs->csr,0 ); +tdc_write (tdc, tdc->regs->src, sg_req->src); +tdc_write (tdc, tdc->regs->dst, sg_req->dst); +tdc_write (tdc, tdc->regs->high_addr, sg_req->high_addr); +tdc_write (tdc, tdc->regs->fixed_pattern, sg_req->fixed_pattern); +tdc_write (tdc, tdc->regs->mmio_seq, sg_req->mmio_seq); +tdc_write (tdc, tdc->regs->mc_seq, sg_req->mc_seq); +tdc_write (tdc, tdc->regs->csr, sg_req->csr);/* Start DMA */ -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , - ch_regs->csr |TEGRA_GPCDMA_CSR_ENB ); +tdc_write (tdc, tdc->regs->csr, + sg_req->csr |TEGRA_GPCDMA_CSR_ENB ); }static void tegra_dma_xfer_complete (struct tegra_dma_channel *tdc)
@@ -601,19 +583,19 @@ static irqreturn_t tegra_dma_isr(int irq, void *dev_id)u32 status;/* Check channel error status register */ - status =tdc_read (tdc,TEGRA_GPCDMA_CHAN_ERR_STATUS ); + status =tdc_read (tdc, tdc->regs->err_status);if (status) {tegra_dma_chan_decode_error (tdc, status);tegra_dma_dump_chan_regs (tdc); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_ERR_STATUS ,0xFFFFFFFF ); +tdc_write (tdc, tdc->regs->err_status,0xFFFFFFFF ); }spin_lock (&tdc->vc.lock); - status =tdc_read (tdc,TEGRA_GPCDMA_CHAN_STATUS ); + status =tdc_read (tdc, tdc->regs->status);if (!(status &TEGRA_GPCDMA_STATUS_ISE_EOC )) goto irq_done; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_STATUS , +tdc_write (tdc, tdc->regs->status,TEGRA_GPCDMA_STATUS_ISE_EOC );if (!dma_desc)
@@ -673,10 +655,10 @@ static int tegra_dma_stop_client(struct tegra_dma_channel *tdc)* to stop DMA engine from starting any more bursts for * the given client and wait for in flight bursts to complete */ - csr =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSR ); + csr =tdc_read (tdc, tdc->regs->csr); csr &= ~(TEGRA_GPCDMA_CSR_REQ_SEL_MASK ); csr |=TEGRA_GPCDMA_CSR_REQ_SEL_UNUSED ; -tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , csr); +tdc_write (tdc, tdc->regs->csr, csr);/* Wait for in flight data transfer to finish */ udelay (TEGRA_GPCDMA_BURST_COMPLETE_TIME );
@@ -687,7 +669,7 @@ static int tegra_dma_stop_client(struct tegra_dma_channel *tdc) ret = readl_relaxed_poll_timeout_atomic(tdc->tdma->base_addr + tdc->chan_base_offset + - TEGRA_GPCDMA_CHAN_STATUS, + tdc->regs->status, status, !(status & (TEGRA_GPCDMA_STATUS_CHANNEL_TX | TEGRA_GPCDMA_STATUS_CHANNEL_RX)),
@@ -739,14 +721,14 @@ static int tegra_dma_get_residual(struct tegra_dma_channel *tdc)unsigned int bytes_xfer, residual;u32 wcount =0 , status; - wcount =tdc_read (tdc,TEGRA_GPCDMA_CHAN_XFER_COUNT ); + wcount =tdc_read (tdc, tdc->regs->wxfer);/* * Set wcount = 0 if EOC bit is set. The transfer would have * already completed and the CHAN_XFER_COUNT could have updated * for the next transfer, specifically in case of cyclic transfers. */ - status =tdc_read (tdc,TEGRA_GPCDMA_CHAN_STATUS ); + status =tdc_read (tdc, tdc->regs->status);if (status &TEGRA_GPCDMA_STATUS_ISE_EOC ) wcount =0 ;
@@ -893,7 +875,7 @@ tegra_dma_prep_dma_memset(struct dma_chan *dc, dma_addr_t dest, int value,/* Configure default priority weight for the channel */ csr |=FIELD_PREP (TEGRA_GPCDMA_CSR_WEIGHT ,1 ); - mc_seq =tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ); + mc_seq =tdc_read (tdc, tdc->regs->mc_seq);/* retain stream-id and clean rest */ mc_seq &=TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK ;
@@ -916,16 +898,16 @@ tegra_dma_prep_dma_memset(struct dma_chan *dc, dma_addr_t dest, int value, dma_desc->sg_count =1 ; sg_req = dma_desc->sg_req; - sg_req[0 ].ch_regs.src_ptr =0 ; - sg_req[0 ].ch_regs.dst_ptr = dest; - sg_req[0 ].ch_regs.high_addr_ptr = + sg_req[0 ].src =0 ; + sg_req[0 ].dst = dest; + sg_req[0 ].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (dest >>32 )); - sg_req[0 ].ch_regs.fixed_pattern = value; + sg_req[0 ].fixed_pattern = value;/* Word count reg takes value as (N +1) words */ - sg_req[0 ].ch_regs.wcount = ((len -4 ) >>2 ); - sg_req[0 ].ch_regs.csr = csr; - sg_req[0 ].ch_regs.mmio_seq =0 ; - sg_req[0 ].ch_regs.mc_seq = mc_seq; + sg_req[0 ].wcount = ((len -4 ) >>2 ); + sg_req[0 ].csr = csr; + sg_req[0 ].mmio_seq =0 ; + sg_req[0 ].mc_seq = mc_seq; sg_req[0 ].len = len; dma_desc->cyclic = false;
@@ -961,7 +943,7 @@ tegra_dma_prep_dma_memcpy(struct dma_chan *dc, dma_addr_t dest,/* Configure default priority weight for the channel */ csr |=FIELD_PREP (TEGRA_GPCDMA_CSR_WEIGHT ,1 ); - mc_seq =tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ); + mc_seq =tdc_read (tdc, tdc->regs->mc_seq);/* retain stream-id and clean rest */ mc_seq &= (TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK ) | (TEGRA_GPCDMA_MCSEQ_STREAM_ID1_MASK );
@@ -985,17 +967,17 @@ tegra_dma_prep_dma_memcpy(struct dma_chan *dc, dma_addr_t dest, dma_desc->sg_count =1 ; sg_req = dma_desc->sg_req; - sg_req[0 ].ch_regs.src_ptr = src; - sg_req[0 ].ch_regs.dst_ptr = dest; - sg_req[0 ].ch_regs.high_addr_ptr = + sg_req[0 ].src = src; + sg_req[0 ].dst = dest; + sg_req[0 ].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (src >>32 )); - sg_req[0 ].ch_regs.high_addr_ptr |= + sg_req[0 ].high_addr |=FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (dest >>32 ));/* Word count reg takes value as (N +1) words */ - sg_req[0 ].ch_regs.wcount = ((len -4 ) >>2 ); - sg_req[0 ].ch_regs.csr = csr; - sg_req[0 ].ch_regs.mmio_seq =0 ; - sg_req[0 ].ch_regs.mc_seq = mc_seq; + sg_req[0 ].wcount = ((len -4 ) >>2 ); + sg_req[0 ].csr = csr; + sg_req[0 ].mmio_seq =0 ; + sg_req[0 ].mc_seq = mc_seq; sg_req[0 ].len = len; dma_desc->cyclic = false;
@@ -1049,7 +1031,7 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl,if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_GPCDMA_CSR_IE_EOC ; - mc_seq =tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ); + mc_seq =tdc_read (tdc, tdc->regs->mc_seq);/* retain stream-id and clean rest */ mc_seq &=TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK ;
@@ -1096,14 +1078,14 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl, dma_desc->bytes_req += len;if (direction ==DMA_MEM_TO_DEV ) { - sg_req[i].ch_regs.src_ptr = mem; - sg_req[i].ch_regs.dst_ptr = apb_ptr; - sg_req[i].ch_regs.high_addr_ptr = + sg_req[i].src = mem; + sg_req[i].dst = apb_ptr; + sg_req[i].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (mem >>32 )); }else if (direction ==DMA_DEV_TO_MEM ) { - sg_req[i].ch_regs.src_ptr = apb_ptr; - sg_req[i].ch_regs.dst_ptr = mem; - sg_req[i].ch_regs.high_addr_ptr = + sg_req[i].src = apb_ptr; + sg_req[i].dst = mem; + sg_req[i].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (mem >>32 )); }
@@ -1111,10 +1093,10 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl,* Word count register takes input in words. Writing a value * of N into word count register means a req of (N+1) words. */ - sg_req[i].ch_regs.wcount = ((len -4 ) >>2 ); - sg_req[i].ch_regs.csr = csr; - sg_req[i].ch_regs.mmio_seq = mmio_seq; - sg_req[i].ch_regs.mc_seq = mc_seq; + sg_req[i].wcount = ((len -4 ) >>2 ); + sg_req[i].csr = csr; + sg_req[i].mmio_seq = mmio_seq; + sg_req[i].mc_seq = mc_seq; sg_req[i].len = len; }
@@ -1186,7 +1168,7 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_l mmio_seq |=FIELD_PREP (TEGRA_GPCDMA_MMIOSEQ_WRAP_WORD ,1 ); - mc_seq =tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ); + mc_seq =tdc_read (tdc, tdc->regs->mc_seq);/* retain stream-id and clean rest */ mc_seq &=TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK ;
@@ -1217,24 +1199,24 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_lfor (i =0 ; i < period_count; i++) { mmio_seq |=get_burst_size (tdc, burst_size, slave_bw, len);if (direction ==DMA_MEM_TO_DEV ) { - sg_req[i].ch_regs.src_ptr = mem; - sg_req[i].ch_regs.dst_ptr = apb_ptr; - sg_req[i].ch_regs.high_addr_ptr = + sg_req[i].src = mem; + sg_req[i].dst = apb_ptr; + sg_req[i].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (mem >>32 )); }else if (direction ==DMA_DEV_TO_MEM ) { - sg_req[i].ch_regs.src_ptr = apb_ptr; - sg_req[i].ch_regs.dst_ptr = mem; - sg_req[i].ch_regs.high_addr_ptr = + sg_req[i].src = apb_ptr; + sg_req[i].dst = mem; + sg_req[i].high_addr =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (mem >>32 )); }/* * Word count register takes input in words. Writing a value * of N into word count register means a req of (N+1) words. */ - sg_req[i].ch_regs.wcount = ((len -4 ) >>2 ); - sg_req[i].ch_regs.csr = csr; - sg_req[i].ch_regs.mmio_seq = mmio_seq; - sg_req[i].ch_regs.mc_seq = mc_seq; + sg_req[i].wcount = ((len -4 ) >>2 ); + sg_req[i].csr = csr; + sg_req[i].mmio_seq = mmio_seq; + sg_req[i].mc_seq = mc_seq; sg_req[i].len = len; mem += len;
@@ -1304,11 +1286,28 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,return chan; } +static const struct tegra_dma_channel_regs tegra186_reg_offsets = { + .csr =0x0 , + .status =0x4 , + .csre =0x8 , + .src =0xc , + .dst =0x10 , + .high_addr =0x14 , + .mc_seq =0x18 , + .mmio_seq =0x1c , + .wcount =0x20 , + .wxfer =0x24 , + .wstatus =0x28 , + .err_status =0x30 , + .fixed_pattern =0x34 , +}; +static const struct tegra_dma_chip_data tegra186_dma_chip_data = { .nr_channels =32 , .channel_reg_size =SZ_64K , .max_dma_count =SZ_1G , .hw_support_pause = false, + .channel_regs = &tegra186_reg_offsets, .terminate = tegra_dma_stop_client, };
@@ -1317,6 +1316,7 @@ static const struct tegra_dma_chip_data tegra194_dma_chip_data = { .channel_reg_size = SZ_64K, .max_dma_count = SZ_1G, .hw_support_pause = true, + .channel_regs = &tegra186_reg_offsets, .terminate = tegra_dma_pause, };
@@ -1325,6 +1325,7 @@ static const struct tegra_dma_chip_data tegra234_dma_chip_data = { .channel_reg_size = SZ_64K, .max_dma_count = SZ_1G, .hw_support_pause = true, + .channel_regs = &tegra186_reg_offsets, .terminate = tegra_dma_pause_noerr, };
@@ -1345,7 +1346,7 @@ MODULE_DEVICE_TABLE(of, tegra_dma_of_match);static int tegra_dma_program_sid (struct tegra_dma_channel *tdc,int stream_id) { -unsigned int reg_val =tdc_read (tdc,TEGRA_GPCDMA_CHAN_MCSEQ ); +unsigned int reg_val =tdc_read (tdc, tdc->regs->mc_seq); reg_val &= ~(TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK ); reg_val &= ~(TEGRA_GPCDMA_MCSEQ_STREAM_ID1_MASK );
@@ -1353,7 +1354,7 @@ static int tegra_dma_program_sid(struct tegra_dma_channel *tdc, int stream_id) reg_val |=FIELD_PREP (TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK , stream_id); reg_val |=FIELD_PREP (TEGRA_GPCDMA_MCSEQ_STREAM_ID1_MASK , stream_id); -tdc_write (tdc,TEGRA_GPCDMA_CHAN_MCSEQ , reg_val); +tdc_write (tdc, tdc->regs->mc_seq, reg_val);return 0 ; }
@@ -1419,6 +1420,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdc->chan_base_offset =TEGRA_GPCDMA_CHANNEL_BASE_ADDR_OFFSET + i * cdata->channel_reg_size;snprintf (tdc->name,sizeof (tdc->name),"gpcdma.%d" , i); + tdc->regs = cdata->channel_regs; tdc->tdma = tdma; tdc->id = i; tdc->slave_id =-1 ;
Signature · 1 line
2.50.1
Re: [PATCH v6 05/10] dmaengine: tegra: Use struct for register offsets
On Tue, Mar 31, 2026 at 03:52:58PM +0530, Akhil R wrote:
[...]
Quoted 1 line
drivers/dma/tegra186-gpc-dma.c +0
-0
[...]
drivers/dma/tegra186-gpc-dma.c struct tegra_dma_chip_data { · line 152
Quoted 5 lines
drivers/dma/tegra186-gpc-dma.c +1
-0@@ -181,18 +149,24 @@ struct tegra_dma_chip_data {unsigned int nr_channels;unsigned int channel_reg_size;unsigned int max_dma_count; +const struct tegra_dma_channel_regs *channel_regs;
Odd. I would've thought you'd have to predeclare the structure, but if this builds fine, I suppose it's okay this way, too:
PATCH v6 6/10 dmaengine: tegra: Support address width > 39 bits
In reply to Akhil RTegra264 supports address width of 41 bits. Unlike older SoCs which use a common high_addr register for upper address bits, Tegra264 has separate src_high and dst_high registers to accommodate this wider address space.
Add an addr_bits property to the device data structure to specify the number of address bits supported on each device and use that to program the appropriate registers.
Update the sg_req struct to remove the high_addr field and use dma_addr_t for src and dst to store the complete addresses. Extract the high address bits only when programming the registers.
--- drivers/dma/tegra186-gpc-dma.c | 83 +++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 31 deletions(-)
drivers/dma/tegra186-gpc-dma.c +52 -31
@@ -146,6 +146,7 @@ struct tegra_dma_channel;*/ struct tegra_dma_chip_data {bool hw_support_pause; +unsigned int addr_bits;unsigned int nr_channels;unsigned int channel_reg_size;unsigned int max_dma_count;
@@ -161,6 +162,8 @@ struct tegra_dma_channel_regs {u32 src;u32 dst;u32 high_addr; +u32 src_high; +u32 dst_high;u32 mc_seq;u32 mmio_seq;u32 wcount;
@@ -179,10 +182,9 @@ struct tegra_dma_channel_regs {*/ struct tegra_dma_sg_req {unsigned int len; +dma_addr_t src; +dma_addr_t dst;u32 csr; -u32 src; -u32 dst; -u32 high_addr;u32 mc_seq;u32 mmio_seq;u32 wcount;
@@ -266,6 +268,25 @@ static inline struct device *tdc2dev(struct tegra_dma_channel *tdc)return tdc->vc.chan.device->dev; } +static void tegra_dma_program_addr (struct tegra_dma_channel *tdc, +struct tegra_dma_sg_req *sg_req) +{ +tdc_write (tdc, tdc->regs->src,lower_32_bits (sg_req->src)); +tdc_write (tdc, tdc->regs->dst,lower_32_bits (sg_req->dst)); + +if (tdc->tdma->chip_data->addr_bits >39 ) { +tdc_write (tdc, tdc->regs->src_high,upper_32_bits (sg_req->src)); +tdc_write (tdc, tdc->regs->dst_high,upper_32_bits (sg_req->dst)); + }else { +u32 src_high =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , +upper_32_bits (sg_req->src)); +u32 dst_high =FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , +upper_32_bits (sg_req->dst)); + +tdc_write (tdc, tdc->regs->high_addr, src_high | dst_high); + } +} +static void tegra_dma_dump_chan_regs (struct tegra_dma_channel *tdc) { dev_dbg(tdc2dev(tdc), "DMA Channel %d name %s register dump:\n",
@@ -274,10 +295,20 @@ static void tegra_dma_dump_chan_regs(struct tegra_dma_channel *tdc)tdc_read (tdc, tdc->regs->csr),tdc_read (tdc, tdc->regs->status), tdc_read(tdc, tdc->regs->csre)); -dev_dbg (tdc2dev (tdc),"SRC %x DST %x HI ADDR %x\n" , -tdc_read (tdc, tdc->regs->src), -tdc_read (tdc, tdc->regs->dst), -tdc_read (tdc, tdc->regs->high_addr)); + +if (tdc->tdma->chip_data->addr_bits >39 ) { +dev_dbg (tdc2dev (tdc),"SRC %x SRC HI %x DST %x DST HI %x\n" , +tdc_read (tdc, tdc->regs->src), +tdc_read (tdc, tdc->regs->src_high), +tdc_read (tdc, tdc->regs->dst), +tdc_read (tdc, tdc->regs->dst_high)); + }else { +dev_dbg (tdc2dev (tdc),"SRC %x DST %x HI ADDR %x\n" , +tdc_read (tdc, tdc->regs->src), +tdc_read (tdc, tdc->regs->dst), +tdc_read (tdc, tdc->regs->high_addr)); + } + dev_dbg(tdc2dev(tdc), "MCSEQ %x IOSEQ %x WCNT %x XFER %x WSTA %x\n", tdc_read(tdc, tdc->regs->mc_seq), tdc_read(tdc, tdc->regs->mmio_seq),
@@ -480,9 +511,7 @@ static void tegra_dma_configure_next_sg(struct tegra_dma_channel *tdc) sg_req = &dma_desc->sg_req[dma_desc->sg_idx];tdc_write (tdc, tdc->regs->wcount, sg_req->wcount); -tdc_write (tdc, tdc->regs->src, sg_req->src); -tdc_write (tdc, tdc->regs->dst, sg_req->dst); -tdc_write (tdc, tdc->regs->high_addr, sg_req->high_addr); +tegra_dma_program_addr (tdc, sg_req);/* Start DMA */ tdc_write(tdc, tdc->regs->csr,
@@ -510,11 +539,9 @@ static void tegra_dma_start(struct tegra_dma_channel *tdc) sg_req = &dma_desc->sg_req[dma_desc->sg_idx]; +tegra_dma_program_addr (tdc, sg_req);tdc_write (tdc, tdc->regs->wcount, sg_req->wcount);tdc_write (tdc, tdc->regs->csr,0 ); -tdc_write (tdc, tdc->regs->src, sg_req->src); -tdc_write (tdc, tdc->regs->dst, sg_req->dst); -tdc_write (tdc, tdc->regs->high_addr, sg_req->high_addr);tdc_write (tdc, tdc->regs->fixed_pattern, sg_req->fixed_pattern);tdc_write (tdc, tdc->regs->mmio_seq, sg_req->mmio_seq);tdc_write (tdc, tdc->regs->mc_seq, sg_req->mc_seq);
@@ -819,7 +846,7 @@ static unsigned int get_burst_size(struct tegra_dma_channel *tdc, static int get_transfer_param(struct tegra_dma_channel *tdc, enum dma_transfer_direction direction, - u32 *apb_addr, + dma_addr_t *apb_addr, u32 *mmio_seq, u32 *csr, unsigned int *burst_size,
@@ -897,11 +924,9 @@ tegra_dma_prep_dma_memset(struct dma_chan *dc, dma_addr_t dest, int value, dma_desc->bytes_req = len; dma_desc->sg_count =1 ; sg_req = dma_desc->sg_req; - sg_req[0 ].src =0 ; sg_req[0 ].dst = dest; - sg_req[0 ].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (dest >>32 )); + sg_req[0 ].fixed_pattern = value;/* Word count reg takes value as (N +1) words */ sg_req[0 ].wcount = ((len -4 ) >>2 );
@@ -969,10 +994,7 @@ tegra_dma_prep_dma_memcpy(struct dma_chan *dc, dma_addr_t dest, sg_req[0 ].src = src; sg_req[0 ].dst = dest; - sg_req[0 ].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (src >>32 )); - sg_req[0 ].high_addr |= -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (dest >>32 )); +/* Word count reg takes value as (N +1) words */ sg_req[0 ].wcount = ((len -4 ) >>2 ); sg_req[0 ].csr = csr;
@@ -992,7 +1014,8 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl,struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);unsigned int max_dma_count = tdc->tdma->chip_data->max_dma_count;enum dma_slave_buswidth slave_bw =DMA_SLAVE_BUSWIDTH_UNDEFINED ; -u32 csr, mc_seq, apb_ptr =0 , mmio_seq =0 ; +u32 csr, mc_seq, mmio_seq =0 ; +dma_addr_t apb_ptr =0 ;struct tegra_dma_sg_req *sg_req;struct tegra_dma_desc *dma_desc;struct scatterlist *sg;
@@ -1080,13 +1103,9 @@ tegra_dma_prep_slave_sg(struct dma_chan *dc, struct scatterlist *sgl,if (direction ==DMA_MEM_TO_DEV ) { sg_req[i].src = mem; sg_req[i].dst = apb_ptr; - sg_req[i].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (mem >>32 )); }else if (direction ==DMA_DEV_TO_MEM ) { sg_req[i].src = apb_ptr; sg_req[i].dst = mem; - sg_req[i].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (mem >>32 )); }/*
@@ -1110,7 +1129,8 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_l unsigned long flags) {enum dma_slave_buswidth slave_bw =DMA_SLAVE_BUSWIDTH_UNDEFINED ; -u32 csr, mc_seq, apb_ptr =0 , mmio_seq =0 , burst_size; +u32 csr, mc_seq, mmio_seq =0 , burst_size; +dma_addr_t apb_ptr =0 ;unsigned int max_dma_count, len, period_count, i;struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);struct tegra_dma_desc *dma_desc;
@@ -1201,13 +1221,9 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_lif (direction ==DMA_MEM_TO_DEV ) { sg_req[i].src = mem; sg_req[i].dst = apb_ptr; - sg_req[i].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR , (mem >>32 )); }else if (direction ==DMA_DEV_TO_MEM ) { sg_req[i].src = apb_ptr; sg_req[i].dst = mem; - sg_req[i].high_addr = -FIELD_PREP (TEGRA_GPCDMA_HIGH_ADDR_DST_PTR , (mem >>32 )); }/* * Word count register takes input in words. Writing a value
@@ -1304,6 +1320,7 @@ static const struct tegra_dma_channel_regs tegra186_reg_offsets = {static const struct tegra_dma_chip_data tegra186_dma_chip_data = { .nr_channels =32 , + .addr_bits =39 , .channel_reg_size =SZ_64K , .max_dma_count =SZ_1G , .hw_support_pause = false,
@@ -1313,6 +1330,7 @@ static const struct tegra_dma_chip_data tegra186_dma_chip_data = {static const struct tegra_dma_chip_data tegra194_dma_chip_data = { .nr_channels =32 , + .addr_bits =39 , .channel_reg_size =SZ_64K , .max_dma_count =SZ_1G , .hw_support_pause = true,
@@ -1322,6 +1340,7 @@ static const struct tegra_dma_chip_data tegra194_dma_chip_data = {static const struct tegra_dma_chip_data tegra234_dma_chip_data = { .nr_channels =32 , + .addr_bits =39 , .channel_reg_size =SZ_64K , .max_dma_count =SZ_1G , .hw_support_pause = true,
@@ -1433,6 +1452,8 @@ static int tegra_dma_probe(struct platform_device *pdev) tdc->stream_id = stream_id; } +dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (cdata->addr_bits)); +dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_MEMCPY , tdma->dma_dev.cap_mask);
Signature · 1 line
2.50.1
Re: [PATCH v6 06/10] dmaengine: tegra: Support address width > 39 bits
Quoted 12 lines · Akhil R
Tegra264 supports address width of 41 bits. Unlike older SoCs which use a common
high_addrregister for upper address bits, Tegra264 has separatesrc_highanddst_highregisters to accommodate this wider address space.Add an
addr_bitsproperty to the device data structure to specify the number of address bits supported on each device and use that to program the appropriate registers.Update the
sg_reqstruct to remove thehigh_addrfield and usedma_addr_tfor src and dst to store the complete addresses. Extract the high address bits only when programming the registers.
Quoted 5 lines
Signed-off-by Akhil R <[email protected]>Reviewed-by Frank Li <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 83 +++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 31 deletions(-)
Sorry for not noticing this earlier.
My understanding is that previously this IP (along with most others) did support 40 bit addressing. That's a much more natural boundary, too. The reason why 39 is often mentioned in this context is that bit 39 was treated specially and interpreted by the memory controller as a way to swizzle memory between the Tegra and discrete GPU formats.
I assume GPC DMA was in the same category. I'd be very surprised if there really was a limit on exactly 39 bits. Looking at the register documentation, I see that the high address register is 8 bits, which together with the 32 bits from the regular ADR register gives 40 bits.
Given the above this patch looks wrong. Technically the previous iterations did support the full 40 bits, and that should be reflected in the DMA mask. The platform-specific 39-bit restriction due to the swizzle bit is something that we've always represented via the dma-ranges property, but it doesn't reflect the capabilities of the hardware.
It's a bit odd that GPC DMA on Tegra264 supports 41 bits. I think the regular address map is only 40 bits, but I guess if the registers define it this way, might as well support it.
Thierry
PATCH v6 7/10 dmaengine: tegra: Use managed DMA controller registration
In reply to Akhil RSwitch to managed registration in probe. This simplifies the error paths in the probe and also removes the requirement of the driver remove function.
--- drivers/dma/tegra186-gpc-dma.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/dma/tegra186-gpc-dma.c +4 -15
@@ -1483,37 +1483,27 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.device_synchronize = tegra_dma_chan_synchronize; tdma->dma_dev.residue_granularity =DMA_RESIDUE_GRANULARITY_BURST ; - ret =dma_async_device_register (&tdma->dma_dev); + ret =dmaenginem_async_device_register (&tdma->dma_dev);if (ret <0 ) {dev_err_probe (&pdev->dev, ret,"GPC DMA driver registration failed\n" );return ret; } - ret =of_dma_controller_register (pdev->dev.of_node, - tegra_dma_of_xlate, tdma); + ret =devm_of_dma_controller_register (&pdev->dev, pdev->dev.of_node, + tegra_dma_of_xlate, tdma);if (ret <0 ) {dev_err_probe (&pdev->dev, ret,"GPC DMA OF registration failed\n" ); - -dma_async_device_unregister (&tdma->dma_dev);return ret; } -dev_info (&pdev->dev,"GPC DMA driver register %lu channels\n" , +dev_info (&pdev->dev,"GPC DMA driver registered %lu channels\n" ,hweight_long (tdma->chan_mask));return 0 ; } -static void tegra_dma_remove (struct platform_device *pdev) -{ -struct tegra_dma *tdma =platform_get_drvdata (pdev); - -of_dma_controller_free (pdev->dev.of_node); -dma_async_device_unregister (&tdma->dma_dev); -} -static int __maybe_unused tegra_dma_pm_suspend (struct device *dev) {struct tegra_dma *tdma =dev_get_drvdata (dev);
@@ -1564,7 +1554,6 @@ static struct platform_driver tegra_dma_driver = { .of_match_table = tegra_dma_of_match, }, .probe = tegra_dma_probe, - .remove = tegra_dma_remove, };module_platform_driver (tegra_dma_driver);
Signature · 1 line
2.50.1
Re: [PATCH v6 07/10] dmaengine: tegra: Use managed DMA controller registration
Quoted 9 lines · Akhil R
Switch to managed registration in probe. This simplifies the error paths in the probe and also removes the requirement of the driver remove function.
Signed-off-by Akhil R <[email protected]>Suggested-by Frank Li <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
PATCH v6 8/10 dmaengine: tegra: Use iommu-map for stream ID
In reply to Akhil RUse 'iommu-map', when provided, to get the stream ID to be programmed for each channel. Iterate over the channels registered and configure each channel device separately using of_dma_configure_id() to allow it to use a separate IOMMU domain for the transfer. However, do this in a second loop since the first loop populates the DMA device channels list and async_device_register() registers the channels. Both are prerequisites for using the channel device in the next loop.
Channels will continue to use the same global stream ID if the 'iommu-map' property is not present in the device tree.
--- drivers/dma/tegra186-gpc-dma.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)
drivers/dma/tegra186-gpc-dma.c +44 -9
@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/of_dma.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reset.h> #include <linux/slab.h>
@@ -1380,9 +1381,13 @@ static int tegra_dma_program_sid(struct tegra_dma_channel *tdc, int stream_id)static int tegra_dma_probe (struct platform_device *pdev) {const struct tegra_dma_chip_data *cdata =NULL ; +struct tegra_dma_channel *tdc; +struct tegra_dma *tdma; +struct dma_chan *chan; +struct device *chdev; +bool use_iommu_map = false;unsigned int i;u32 stream_id; -struct tegra_dma *tdma;int ret; cdata =of_device_get_match_data (&pdev->dev);
@@ -1410,9 +1415,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.dev = &pdev->dev; -if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) { -dev_err (&pdev->dev,"Missing iommu stream-id\n" ); -return -EINVAL ; + use_iommu_map =of_property_present (pdev->dev.of_node,"iommu-map" ); +if (!use_iommu_map) { +if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) +return dev_err_probe (&pdev->dev, -EINVAL ,"Missing iommu stream-id\n" ); } ret = device_property_read_u32(&pdev->dev, "dma-channel-mask",
@@ -1424,9 +1430,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->chan_mask =TEGRA_GPCDMA_DEFAULT_CHANNEL_MASK ; } +/* Initialize vchan for each channel and populate the channels list */ INIT_LIST_HEAD (&tdma->dma_dev.channels);for (i =0 ; i < cdata->nr_channels; i++) { -struct tegra_dma_channel *tdc = &tdma->channels[i]; + tdc = &tdma->channels[i];/* Check for channel mask */ if (!(tdma->chan_mask &BIT (i)))
@@ -1446,10 +1453,6 @@ static int tegra_dma_probe(struct platform_device *pdev)vchan_init (&tdc->vc, &tdma->dma_dev); tdc->vc.desc_free = tegra_dma_desc_free; - -/* program stream-id for this channel */ -tegra_dma_program_sid (tdc, stream_id); - tdc->stream_id = stream_id; }dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (cdata->addr_bits));
@@ -1483,6 +1486,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.device_synchronize = tegra_dma_chan_synchronize; tdma->dma_dev.residue_granularity =DMA_RESIDUE_GRANULARITY_BURST ; +/* Register the DMA device and the channels */ ret =dmaenginem_async_device_register (&tdma->dma_dev);if (ret <0 ) { dev_err_probe(&pdev->dev, ret,
@@ -1490,6 +1494,37 @@ static int tegra_dma_probe(struct platform_device *pdev)return ret; } +/* +* Configure stream ID for each channel from the channels registered +* above. This is done in a separate iteration to ensure that only +* the channels available and registered for the DMA device are used. +*/ +list_for_each_entry (chan, &tdma->dma_dev.channels, device_node) { + chdev = &chan->dev->device; + tdc =to_tegra_dma_chan (chan); + +if (use_iommu_map) { + chdev->bus = pdev->dev.bus; +dma_coerce_mask_and_coherent (chdev,DMA_BIT_MASK (cdata->addr_bits)); + + ret =of_dma_configure_id (chdev, pdev->dev.of_node, + true, &tdc->id); +if (ret) +return dev_err_probe (chdev, ret, +"Failed to configure IOMMU for channel %d\n" , tdc->id); + +if (!tegra_dev_iommu_get_stream_id (chdev, &stream_id)) +return dev_err_probe (chdev, -EINVAL , +"Failed to get stream ID for channel %d\n" , tdc->id); + + chan->dev->chan_dma_dev = true; + } + +/* program stream-id for this channel */ +tegra_dma_program_sid (tdc, stream_id); + tdc->stream_id = stream_id; + } + ret =devm_of_dma_controller_register (&pdev->dev, pdev->dev.of_node, tegra_dma_of_xlate, tdma);if (ret <0 ) {
Signature · 1 line
2.50.1
Re: [PATCH v6 08/10] dmaengine: tegra: Use iommu-map for stream ID
Quoted 8 lines · Akhil R
Use 'iommu-map', when provided, to get the stream ID to be programmed for each channel. Iterate over the channels registered and configure each channel device separately using
of_dma_configure_id()to allow it to use a separate IOMMU domain for the transfer. However, do this in a second loop since the first loop populates the DMA device channels list andasync_device_register()registers the channels. Both are prerequisites for using the channel device in the next loop.
Quoted 5 lines
Channels will continue to use the same global stream ID if the 'iommu-map' property is not present in the device tree.
Signed-off-by Akhil R <[email protected]>---
Quoted 116 lines
drivers/dma/tegra186-gpc-dma.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)drivers/dma/tegra186-gpc-dma.c +44
-10@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/of_dma.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reset.h> #include <linux/slab.h> @@ -1380,9 +1381,13 @@ static int tegra_dma_program_sid(struct tegra_dma_channel *tdc, int stream_id)static int tegra_dma_probe (struct platform_device *pdev) {const struct tegra_dma_chip_data *cdata =NULL ; +struct tegra_dma_channel *tdc; +struct tegra_dma *tdma; +struct dma_chan *chan; +struct device *chdev; +bool use_iommu_map = false;unsigned int i;u32 stream_id; -struct tegra_dma *tdma;int ret; cdata =of_device_get_match_data (&pdev->dev);@@ -1410,9 +1415,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.dev = &pdev->dev; -if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) { -dev_err (&pdev->dev,"Missing iommu stream-id\n" ); -return -EINVAL ; + use_iommu_map =of_property_present (pdev->dev.of_node,"iommu-map" ); +if (!use_iommu_map) { +if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) +return dev_err_probe (&pdev->dev, -EINVAL ,"Missing iommu stream-id\n" ); } ret = device_property_read_u32(&pdev->dev, "dma-channel-mask",@@ -1424,9 +1430,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->chan_mask =TEGRA_GPCDMA_DEFAULT_CHANNEL_MASK ; } +/* Initialize vchan for each channel and populate the channels list */ INIT_LIST_HEAD (&tdma->dma_dev.channels);for (i =0 ; i < cdata->nr_channels; i++) { -struct tegra_dma_channel *tdc = &tdma->channels[i]; + tdc = &tdma->channels[i];/* Check for channel mask */ if (!(tdma->chan_mask &BIT (i)))@@ -1446,10 +1453,6 @@ static int tegra_dma_probe(struct platform_device *pdev)vchan_init (&tdc->vc, &tdma->dma_dev); tdc->vc.desc_free = tegra_dma_desc_free; - -/* program stream-id for this channel */ -tegra_dma_program_sid (tdc, stream_id); - tdc->stream_id = stream_id; }dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (cdata->addr_bits));@@ -1483,6 +1486,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.device_synchronize = tegra_dma_chan_synchronize; tdma->dma_dev.residue_granularity =DMA_RESIDUE_GRANULARITY_BURST ; +/* Register the DMA device and the channels */ ret =dmaenginem_async_device_register (&tdma->dma_dev);if (ret <0 ) { dev_err_probe(&pdev->dev, ret,@@ -1490,6 +1494,37 @@ static int tegra_dma_probe(struct platform_device *pdev)return ret; } +/* +* Configure stream ID for each channel from the channels registered +* above. This is done in a separate iteration to ensure that only +* the channels available and registered for the DMA device are used. +*/ +list_for_each_entry (chan, &tdma->dma_dev.channels, device_node) { + chdev = &chan->dev->device; + tdc =to_tegra_dma_chan (chan); + +if (use_iommu_map) { + chdev->bus = pdev->dev.bus; +dma_coerce_mask_and_coherent (chdev,DMA_BIT_MASK (cdata->addr_bits)); + + ret =of_dma_configure_id (chdev, pdev->dev.of_node, + true, &tdc->id); +if (ret) +return dev_err_probe (chdev, ret, +"Failed to configure IOMMU for channel %d\n" , tdc->id); + +if (!tegra_dev_iommu_get_stream_id (chdev, &stream_id)) +return dev_err_probe (chdev, -EINVAL , +"Failed to get stream ID for channel %d\n" , tdc->id); + + chan->dev->chan_dma_dev = true; + } + +/* program stream-id for this channel */ +tegra_dma_program_sid (tdc, stream_id); + tdc->stream_id = stream_id; + } + ret =devm_of_dma_controller_register (&pdev->dev, pdev->dev.of_node, tegra_dma_of_xlate, tdma);if (ret <0 ) { --2.50.1
Re: [PATCH v6 08/10] dmaengine: tegra: Use iommu-map for stream ID
In reply to Akhil RQuoted 29 lines · Akhil R
Use 'iommu-map', when provided, to get the stream ID to be programmed for each channel. Iterate over the channels registered and configure each channel device separately using
of_dma_configure_id()to allow it to use a separate IOMMU domain for the transfer. However, do this in a second loop since the first loop populates the DMA device channels list andasync_device_register()registers the channels. Both are prerequisites for using the channel device in the next loop.Channels will continue to use the same global stream ID if the 'iommu-map' property is not present in the device tree.
Signed-off-by Akhil R <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)drivers/dma/tegra186-gpc-dma.c +1
-0@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/of_dma.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/reset.h> #include <linux/slab.h>
drivers/dma/tegra186-gpc-dma.c static int tegra_dma_program_sid(struct tegra_dma_channel *tdc, int stream_id) · line 1388
Quoted 8 lines
drivers/dma/tegra186-gpc-dma.c +5
-0@@ -1380,9 +1381,13 @@ static int tegra_dma_program_sid(struct tegra_dma_channel *tdc, int stream_id)static int tegra_dma_probe (struct platform_device *pdev) {const struct tegra_dma_chip_data *cdata =NULL ; +struct tegra_dma_channel *tdc; +struct tegra_dma *tdma; +struct dma_chan *chan; +struct device *chdev; +bool use_iommu_map = false;
No use in initiazising this since you immediately assign to it the return value of of_property_present() below.
Quoted 7 lines
drivers/dma/tegra186-gpc-dma.c +0
-1unsigned int i;u32 stream_id; -struct tegra_dma *tdma;int ret; cdata =of_device_get_match_data (&pdev->dev);
drivers/dma/tegra186-gpc-dma.c static int tegra_dma_probe(struct platform_device *pdev) · line 1421
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c +4
-3@@ -1410,9 +1415,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.dev = &pdev->dev; -if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) { -dev_err (&pdev->dev,"Missing iommu stream-id\n" ); -return -EINVAL ; + use_iommu_map =of_property_present (pdev->dev.of_node,"iommu-map" ); +if (!use_iommu_map) { +if (!tegra_dev_iommu_get_stream_id (&pdev->dev, &stream_id)) +return dev_err_probe (&pdev->dev, -EINVAL ,"Missing iommu stream-id\n" );
Looks like checkpatch.pl would complain about this being too long.
Quoted 50 lines
drivers/dma/tegra186-gpc-dma.c +15
-5} ret = device_property_read_u32(&pdev->dev, "dma-channel-mask",@@ -1424,9 +1430,10 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->chan_mask =TEGRA_GPCDMA_DEFAULT_CHANNEL_MASK ; } +/* Initialize vchan for each channel and populate the channels list */ INIT_LIST_HEAD (&tdma->dma_dev.channels);for (i =0 ; i < cdata->nr_channels; i++) { -struct tegra_dma_channel *tdc = &tdma->channels[i]; + tdc = &tdma->channels[i];/* Check for channel mask */ if (!(tdma->chan_mask &BIT (i)))@@ -1446,10 +1453,6 @@ static int tegra_dma_probe(struct platform_device *pdev)vchan_init (&tdc->vc, &tdma->dma_dev); tdc->vc.desc_free = tegra_dma_desc_free; - -/* program stream-id for this channel */ -tegra_dma_program_sid (tdc, stream_id); - tdc->stream_id = stream_id; }dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (cdata->addr_bits));@@ -1483,6 +1486,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.device_synchronize = tegra_dma_chan_synchronize; tdma->dma_dev.residue_granularity =DMA_RESIDUE_GRANULARITY_BURST ; +/* Register the DMA device and the channels */ ret =dmaenginem_async_device_register (&tdma->dma_dev);if (ret <0 ) { dev_err_probe(&pdev->dev, ret,@@ -1490,6 +1494,37 @@ static int tegra_dma_probe(struct platform_device *pdev)return ret; } +/* +* Configure stream ID for each channel from the channels registered +* above. This is done in a separate iteration to ensure that only +* the channels available and registered for the DMA device are used. +*/ +list_for_each_entry (chan, &tdma->dma_dev.channels, device_node) { + chdev = &chan->dev->device; + tdc =to_tegra_dma_chan (chan); + +if (use_iommu_map) { + chdev->bus = pdev->dev.bus; +dma_coerce_mask_and_coherent (chdev,DMA_BIT_MASK (cdata->addr_bits));
drivers/dma/tegra186-gpc-dma.c static int tegra_dma_probe(struct platform_device *pdev) · line 1518
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c +10
-0+ + ret =of_dma_configure_id (chdev, pdev->dev.of_node, + true, &tdc->id); +if (ret) +return dev_err_probe (chdev, ret, +"Failed to configure IOMMU for channel %d\n" , tdc->id); + +if (!tegra_dev_iommu_get_stream_id (chdev, &stream_id)) +return dev_err_probe (chdev, -EINVAL , +"Failed to get stream ID for channel %d\n" , tdc->id);
There are also a few very long lines here. Make sure to run checkpatch on these patches and remove all warnings. For dev_err_probe() some of these might be okay. Otherwise, one alternative might be to reduce the nesting here and push the inner "if" into a separate function.
Thierry
Quoted 15 lines
drivers/dma/tegra186-gpc-dma.c +9
-0+ + chan->dev->chan_dma_dev = true; + } + +/* program stream-id for this channel */ +tegra_dma_program_sid (tdc, stream_id); + tdc->stream_id = stream_id; + } + ret =devm_of_dma_controller_register (&pdev->dev, pdev->dev.of_node, tegra_dma_of_xlate, tdma);if (ret <0 ) {Signature · 1 line
2.50.1
PATCH v6 9/10 dmaengine: tegra: Add Tegra264 support
In reply to Akhil RAdd compatible and chip data to support GPCDMA in Tegra264, which has differences in register layout and address bits compared to previous versions.
--- drivers/dma/tegra186-gpc-dma.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/dma/tegra186-gpc-dma.c +30 -0
@@ -1319,6 +1319,23 @@ static const struct tegra_dma_channel_regs tegra186_reg_offsets = { .fixed_pattern = 0x34, }; +static const struct tegra_dma_channel_regs tegra264_reg_offsets = { + .csr =0x0 , + .status =0x4 , + .csre =0x8 , + .src =0xc , + .dst =0x10 , + .src_high =0x14 , + .dst_high =0x18 , + .mc_seq =0x1c , + .mmio_seq =0x20 , + .wcount =0x24 , + .wxfer =0x28 , + .wstatus =0x2c , + .err_status =0x34 , + .fixed_pattern =0x38 , +}; +static const struct tegra_dma_chip_data tegra186_dma_chip_data = { .nr_channels =32 , .addr_bits =39 ,
@@ -1349,6 +1366,16 @@ static const struct tegra_dma_chip_data tegra234_dma_chip_data = { .terminate = tegra_dma_pause_noerr, }; +static const struct tegra_dma_chip_data tegra264_dma_chip_data = { + .nr_channels =32 , + .addr_bits =41 , + .channel_reg_size =SZ_64K , + .max_dma_count =SZ_1G , + .hw_support_pause = true, + .channel_regs = &tegra264_reg_offsets, + .terminate = tegra_dma_pause_noerr, +}; +static const struct of_device_id tegra_dma_of_match[] = { { .compatible ="nvidia,tegra186-gpcdma" ,
@@ -1359,6 +1386,9 @@ static const struct of_device_id tegra_dma_of_match[] = { }, { .compatible = "nvidia,tegra234-gpcdma", .data = &tegra234_dma_chip_data, + }, { + .compatible = "nvidia,tegra264-gpcdma", + .data = &tegra264_dma_chip_data, }, { }, };
Signature · 1 line
2.50.1
Re: [PATCH v6 09/10] dmaengine: tegra: Add Tegra264 support
Quoted 9 lines · Akhil R
Add compatible and chip data to support GPCDMA in Tegra264, which has differences in register layout and address bits compared to previous versions.
Signed-off-by Akhil R <[email protected]>Reviewed-by Frank Li <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
PATCH v6 10/10 arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-map
In reply to Akhil REnable GPCDMA in Tegra264 and add the iommu-map property so that each channel uses a separate stream ID and gets its own IOMMU domain for memory.
--- arch/arm64/boot/dts/nvidia/tegra264-p3834.dtsi | 4 ++++ arch/arm64/boot/dts/nvidia/tegra264.dtsi | 1 + 2 files changed, 5 insertions(+)
arch/arm64/boot/dts/nvidia/tegra264-p3834.dtsi +4 -0
@@ -9,6 +9,10 @@ aliases { }; bus@0 { + dma-controller@8400000 { + status = "okay"; + }; + serial@c4e0000 { status = "okay"; };
arch/arm64/boot/dts/nvidia/tegra264.dtsi +1 -0
@@ -3244,6 +3244,7 @@ gpcdma: dma-controller@8400000 { <GIC_SPI 615 IRQ_TYPE_LEVEL_HIGH>; #dma-cells = <1>; iommus = <&smmu1 0x00000800>; + iommu-map = <1 &smmu1 0x801 31>; dma-coherent; dma-channel-mask = <0xfffffffe>; status = "disabled";
Signature · 1 line
2.50.1
Quoted 48 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-map
Quoted 6 lines
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 32 +- .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 +++++++++++------- 4 files changed, 284 insertions(+), 184 deletions(-)
For the series ...
Thanks!
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerHi Vinod,
Quoted 57 lines · Jon Hunter
Quoted 48 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-mapQuoted 6 lines
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml| 32 +-.../arm64/boot/dts/nvidia/tegra264-p3834.dtsi| 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 +++++++++++-------4 files changed, 284 insertions(+), 184 deletions(-)
Quoted 3 lines
For the series ...
Reviewed-by Jon Hunter <[email protected]>
I am not sure if it is too late to pick this up for v7.1, but we would like to get this into -next if you are happy with it.
Thanks
Jon
Signature · 1 line
nvpublic
Quoted 58 lines · Jon Hunter
Quoted 57 lines · Jon Hunter
Quoted 54 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-map.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 32 +- .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 +++++++++++------- 4 files changed, 284 insertions(+), 184 deletions(-)
Quoted 6 lines
Quoted 3 lines
For the series ...
Reviewed-by Jon Hunter <[email protected]>I am not sure if it is too late to pick this up for v7.1, but we would like to get this into -next if you are happy with it.
Hi Vinod,
Just a gentle reminder on this series. Could you please take a look? Please let me know if you see any concerns.
Best Regards,
Akhil
Jon Hunter
maintainerHi Vinod,
Quoted 63 lines · Akhil R
Quoted 62 lines · Jon Hunter
Quoted 60 lines · Jon Hunter
Quoted 48 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-mapQuoted 6 lines
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 32 +- .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 +++++++++++------- 4 files changed, 284 insertions(+), 184 deletions(-)For the series ...
Reviewed-by Jon Hunter <[email protected]>
Quoted 7 lines
Quoted 2 lines
I am not sure if it is too late to pick this up for v7.1, but we would like to get this into -next if you are happy with it.
Hi Vinod,
Just a gentle reminder on this series. Could you please take a look? Please let me know if you see any concerns.
These still apply cleanly on top of -next. Please can you pick these up now?
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerHi Vinod,
Quoted 76 lines · Jon Hunter
Hi Vinod,
Quoted 73 lines · Akhil R
Quoted 71 lines · Jon Hunter
Quoted 64 lines · Jon Hunter
Quoted 54 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed
return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition
in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask
value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU
supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.Akhil R (10):
dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
arm64: tegra: Remove fallback compatible for GPCDMA
dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
dmaengine: tegra: Make reset control optional
dmaengine: tegra: Use struct for register offsets
dmaengine: tegra: Support address width > 39 bits
dmaengine: tegra: Use managed DMA controller registration
dmaengine: tegra: Use iommu-map for stream ID
dmaengine: tegra: Add Tegra264 support
arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-mapQuoted 7 lines
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml| 32 +-.../arm64/boot/dts/nvidia/tegra264-p3834.dtsi| 4 + arch/arm64/boot/dts/nvidia/tegra264.dtsi | 3 +- drivers/dma/tegra186-gpc-dma.c | 429 ++++++++++
+-------4 files changed, 284 insertions(+), 184 deletions(-)Quoted 3 lines
For the series ...
Reviewed-by Jon Hunter <[email protected]>I am not sure if it is too late to pick this up for v7.1, but we would like to get this into -next if you are happy with it.
Quoted 7 lines
Quoted 4 lines
Hi Vinod,
Just a gentle reminder on this series. Could you please take a look? Please let me know if you see any concerns.
These still apply cleanly on top of -next. Please can you pick these up now?
Please can you respond to this? This still apply cleanly, so we would like to get these queued for v7.2 unless you have some objections.
Jon
Signature · 1 line
nvpublic
Re: (subset) [PATCH v6 00/10] Add GPCDMA support in Tegra264
In reply to Akhil RQuoted 36 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.
Quoted 1 line
[...]
Applied, thanks!
[01/10] dt-bindings: dma: nvidia,tegra186-gpc-dma: Make reset optional
commit: cc6049bd3fa8501ee27042df469a19ed69cf406d
[03/10] dt-bindings: dma: nvidia,tegra186-gpc-dma: Add iommu-map property
commit: d6d7ffb994c676e6414a725d7eb8f208d901b63a
[04/10] dmaengine: tegra: Make reset control optional
commit: 680e1b928a6adc1b2d95038ffe9c9887ceafd478
[05/10] dmaengine: tegra: Use struct for register offsets
commit: 5000beabae65310ec81db40dcda181b0a6192ff3
[06/10] dmaengine: tegra: Support address width > 39 bits
commit: 286632b9bf1cf239482d54b592cc1d5bbd5ec783
[07/10] dmaengine: tegra: Use managed DMA controller registration
commit: 45921a3282d642038d92737fab24107522324bd4
[08/10] dmaengine: tegra: Use iommu-map for stream ID
commit: 321c0a15f027b83b20ed37717191a2187c9e2eb7
[09/10] dmaengine: tegra: Add Tegra264 support
commit: b236b7973808195fd9c471492bee0041148b823eBest regards,
Signature · 1 line
~Vinod
Re: (subset) [PATCH v6 00/10] Add GPCDMA support in Tegra264
In reply to Akhil RFrom: Thierry Reding <[email protected]>
Quoted 36 lines · Akhil R
This series adds support for GPCDMA in Tegra264 with additional support for separate stream ID for each channel. Tegra264 GPCDMA controller has changes in the register offsets and uses 41-bit addressing for memory. Add changes in the tegra186-gpc-dma driver to support these.
v5->v6:
- Replacedev_err()withdev_err_probe()in the probe function for fixed return values also.v4->v5:
- Usedev_err_probe()when returning error from the probe function.
- Remove tegra194 and tegra234 compatible from the reset 'if' condition in the bindings as suggested in v2 (which I missed).v3->v4:
- Split device tree changes to two patches.
- Reordered patches to have fixes first.
- Added fixes tag to dt-bindings and device tree changes.v2->v3:
- Add description for iommu-map property and update commit descriptions.
- Use enum for compatible string instead of const.
- Remove unused registers from structtegra_dma_channel_regs.
- Usedevm_of_dma_controller_register()to register the DMA controller.
- Remove return value check for mask setting in the driver as the bitmask value is always greater than 32.v1->v2:
- Fixdt_bindings_checkwarnings
- Drop fallback compatible "nvidia,tegra186-gpcdma" from Tegra264 DT
- Usedma_addr_tforsg_reqsrc/dst fields and drop separatehigh_addvariable and check for theaddr_bitsonly when programming the registers.
- Update address width to 39 bits for Tegra234 and before since the SMMU supports only up to 39 bits till Tegra234.
- Add a patch to do managed DMA controller registration.
- Describe the second iteration in the probe.
- Update commit descriptions.
Quoted 1 line
[...]
Applied, thanks!
[02/10] arm64: tegra: Remove fallback compatible for GPCDMA
commit: ee7863e43228a3143398dc5bbb943c9a735a8fca
[10/10] arm64: tegra: Enable GPCDMA in Tegra264 and add iommu-map
commit: d2bca791d5a6c00ed24e92fa71f829553b1b1674Best regards,
Signature · 1 line
Thierry Reding <[email protected]>