Driver for tango DMA engine
Hello Mans,
I would like to push upstream the driver you wrote for the tango DMA engine. Could you take a look at my fixes, perhaps some/all can be squashed into the initial patch?
Vinod, can you take a look at this submission, and tell me if you spot any issue?
Regards.
Mans Rullgard (1):
dmaengine: Import tango MBUS driver
Marc Gonzalez (5):
Provide names for SBOX register offsets
Fixup for tango4 support
Fixup tangox_dma_sbox_map
Fixup tangox_dma_reset
Relax write accesses
drivers/dma/Kconfig | 6 + drivers/dma/Makefile | 1 + drivers/dma/tango-dma.c | 582 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 589 insertions(+) create mode 100644 drivers/dma/tango-dma.c
Signature · 1 line
2.9.0
PATCH 1/6 dmaengine: Import tango MBUS driver
From: Mans Rullgard <[email protected]>
https://github.com/mansr/linux-tangox/blob/master/drivers/dma/tangox-dma.c
--- drivers/dma/Kconfig | 6 + drivers/dma/Makefile | 1 + drivers/dma/tango-dma.c | 583 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 590 insertions(+) create mode 100644 drivers/dma/tango-dma.c
drivers/dma/Kconfig +6 -0
@@ -466,6 +466,12 @@ config TXX9_DMAC Support the TXx9 SoC internal DMA controller. This can be integrated in chips such as the Toshiba TX4927/38/39. +config TANGO_DMA + tristate "Sigma Designs SMP86xx DMA support" + depends on ARCH_TANGO + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + config TEGRA20_APB_DMA bool "NVIDIA Tegra20 APB DMA support" depends on ARCH_TEGRA
drivers/dma/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o obj-$(CONFIG_STM32_DMA) += stm32-dma.o obj-$(CONFIG_S3C24XX_DMAC) += s3c24xx-dma.o obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o +obj-$(CONFIG_TANGO_DMA) += tango-dma.o obj-$(CONFIG_TEGRA20_APB_DMA) += tegra20-apb-dma.o obj-$(CONFIG_TEGRA210_ADMA) += tegra210-adma.o obj-$(CONFIG_TIMB_DMA) += timb_dma.o
drivers/dma/tango-dma.c new file +583 -0
583 lines not on this page · raw message
Signature · 1 line
2.9.0
PATCH 2/6 Provide names for SBOX register offsets
In reply to Marc Gonzalez--- drivers/dma/tango-dma.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/dma/tango-dma.c +5 -0
@@ -38,6 +38,11 @@#define DMA_MODE_DOUBLE 2#define DMA_MODE_RECT 3 +#define SBOX_RESET 0 +#define SBOX_RESET2 4 +#define SBOX_ROUTE 8 +#define SBOX_ROUTE2 12 +struct tangox_dma_sg {dma_addr_t addr;unsigned int len;
Signature · 1 line
2.9.0
PATCH 3/6 Fixup for tango4 support
In reply to Marc Gonzalez--- drivers/dma/tango-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/tango-dma.c +2 -2
@@ -156,7 +156,7 @@ static int tangox_dma_issue_single(struct tangox_dma_pchan *pchan,writel (sg->addr, pchan->base +DMA_ADDR );writel (sg->len, pchan->base +DMA_COUNT );wmb (); -writel (flags <<2 |DMA_MODE_SINGLE , pchan->base +DMA_CMD ); +writel (DMA_MODE_SINGLE <<1 | flags, pchan->base +DMA_CMD );wmb ();return sg->len;
@@ -569,7 +569,7 @@ static int tangox_dma_remove(struct platform_device *pdev) }static struct of_device_id tangox_dma_dt_ids[] = { - { .compatible ="sigma,smp8640-dma" }, + { .compatible ="sigma,smp8758-dma" }, { } };
Signature · 1 line
2.9.0
PATCH 4/6 Fixup tangox_dma_sbox_map
In reply to Marc Gonzalez--- drivers/dma/tango-dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/tango-dma.c +3 -3
@@ -108,11 +108,11 @@ static struct tangox_dma_desc *tangox_dma_alloc_desc(unsigned int num_sgs)static void tangox_dma_sbox_map (struct tangox_dma_device *dev,int src,int dst) { -void __iomem *addr = dev->sbox_base +8 ; +void __iomem *addr = dev->sbox_base +SBOX_ROUTE ;int shift = (dst -1 ) *4 ; -if (shift >31 ) { - addr +=4 ; +if (dst >8 ) { + addr = dev->sbox_base +SBOX_ROUTE2 ; shift -=32 ; }
Signature · 1 line
2.9.0
PATCH 5/6 Fixup tangox_dma_reset
In reply to Marc Gonzalez--- drivers/dma/tango-dma.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/dma/tango-dma.c +6 -10
@@ -414,18 +414,14 @@ static void tangox_dma_desc_free(struct virt_dma_desc *vd)static void tangox_dma_reset (struct tangox_dma_device *dev) { -int i; +writel (0xffffffff , dev->sbox_base +SBOX_RESET ); +writel (0xffffffff , dev->sbox_base +SBOX_RESET2 ); -for (i =0 ; i <2 ; i++) { -writel (0xffffffff , dev->sbox_base); -writel (0xff00ff00 , dev->sbox_base); -writel (0xffffffff , dev->sbox_base +4 ); -writel (0xff00ff00 , dev->sbox_base +4 ); -udelay (2 ); - } +writel (0xff00ff00 , dev->sbox_base +SBOX_RESET ); +writel (0xff00ff00 , dev->sbox_base +SBOX_RESET2 ); -writel (0xffffffff , dev->sbox_base +8 ); -writel (0xffffffff , dev->sbox_base +12 ); +writel (0xffffffff , dev->sbox_base +SBOX_ROUTE ); +writel (0xffffffff , dev->sbox_base +SBOX_ROUTE2 ); } static struct dma_chan *tangox_dma_xlate(struct of_phandle_args *dma_spec,
Signature · 1 line
2.9.0
PATCH 6/6 Relax write accesses
In reply to Marc Gonzalez--- drivers/dma/tango-dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/tango-dma.c +3 -5
@@ -153,11 +153,9 @@ static void tangox_dma_pchan_detach(struct tangox_dma_pchan *pchan)static int tangox_dma_issue_single (struct tangox_dma_pchan *pchan,struct tangox_dma_sg *sg,int flags) { -writel (sg->addr, pchan->base +DMA_ADDR ); -writel (sg->len, pchan->base +DMA_COUNT ); -wmb (); -writel (DMA_MODE_SINGLE <<1 | flags, pchan->base +DMA_CMD ); -wmb (); +writel_relaxed (sg->addr, pchan->base +DMA_ADDR ); +writel_relaxed (sg->len, pchan->base +DMA_COUNT ); +writel_relaxed (DMA_MODE_SINGLE <<1 | flags, pchan->base +DMA_CMD );return sg->len; }
Signature · 1 line
2.9.0
Quoted 14 lines · Marc Gonzalez
Hello Mans,
I would like to push upstream the driver you wrote for the tango DMA engine. Could you take a look at my fixes, perhaps some/all can be squashed into the initial patch?
Vinod, can you take a look at this submission, and tell me if you spot any issue?
Regards.
Mans Rullgard (1):
dmaengine: Import tango MBUS driver
Quoted 6 lines
Marc Gonzalez (5):
Provide names for SBOX register offsets
Fixup for tango4 support
Fixuptangox_dma_sbox_map
Fixuptangox_dma_reset
Relax write accesses
I have some other and conflicting fixes not in the github repo. You should have asked me before sending this.
Since I'll end up supporting this, I'd really appreciate a little more cooperation from your side.
Signature · 1 line
Måns Rullgård