archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] dw_dmac: make driver endianness configurable
@ 2012-09-02 17:52 Hein Tibosch
  0 siblings, 0 replies; only message in thread
From: Hein Tibosch @ 2012-09-02 17:52 UTC (permalink / raw)
  To: Andrew Morton, viresh kumar, Hans-Christian Egtvedt
  Cc: Arnd Bergmann, Linux Kernel Mailing List, ludovic.desroches,
	Havard Skinnemoen, Nicolas Ferre, spear-devel

From: Hein Tibosch <>

v4: now based and tested on 3.6-rc4

The dw_dmac was originally developed for avr32 to be used with the Synopsys
DesignWare AHB DMA controller. After 2.6.38, access to the device's i/o
memory was done with the little-endian readl/writel functions

This didn't work on the avr32 platform, because it needs native-endian
(i.e. big-endian) accessors.
This patch makes the endianness configurable using 'DW_DMAC_BIG_ENDIAN_IO',
which will default be true for AVR32

Signed-off-by: Hein Tibosch <>
Acked-by: Viresh Kumar <>
Acked-by: Arnd Bergmann <>
Reviewed-by: Hans-Christian Egtvedt <>

 drivers/dma/Kconfig        |   11 +++++++++++
 drivers/dma/dw_dmac_regs.h |   14 ++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index d06ea29..5a26d46 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -90,6 +90,17 @@ config DW_DMAC
 	  Support the Synopsys DesignWare AHB DMA controller.  This
 	  can be integrated in chips such as the Atmel AT32ap7000.
+	bool "Use big endian I/O register access"
+	default y if AVR32
+	depends on DW_DMAC
+	help
+	  Say yes here to use big endian I/O access when reading and writing
+	  to the DMA controller registers. This is needed on some platforms,
+	  like the Atmel AVR32 architecture.
+	  If unsure, use the default setting.
 config AT_HDMAC
 	tristate "Atmel AHB DMA support"
 	depends on ARCH_AT91
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 50830be..8aad868 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -175,10 +175,17 @@ __dwc_regs(struct dw_dma_chan *dwc)
 	return dwc->ch_regs;
+#define channel_readl(dwc, name) \
+	ioread32be(&(__dwc_regs(dwc)->name))
+#define channel_writel(dwc, name, val) \
+	iowrite32be((val), &(__dwc_regs(dwc)->name))
 #define channel_readl(dwc, name) \
 #define channel_writel(dwc, name, val) \
 	writel((val), &(__dwc_regs(dwc)->name))
 static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
@@ -201,10 +208,17 @@ static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
 	return dw->regs;
+#define dma_readl(dwc, name) \
+	ioread32be(&(__dw_regs(dw)->name))
+#define dma_writel(dwc, name, val) \
+	iowrite32be((val), &(__dw_regs(dw)->name))
 #define dma_readl(dw, name) \
 #define dma_writel(dw, name, val) \
 	writel((val), &(__dw_regs(dw)->name))
 #define channel_set_bit(dw, reg, mask) \
 	dma_writel(dw, reg, ((mask) << 8) | (mask))

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-02 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-02 17:52 [PATCH v4 1/3] dw_dmac: make driver endianness configurable Hein Tibosch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).