* [PATCH 1/3] dmaengine: at_hdmac: remove some at_dma_slave comments
2012-05-10 10:17 [PATCH 0/3] dmaengine: at_hdmac: slave configuration Nicolas Ferre
@ 2012-05-10 10:17 ` Nicolas Ferre
2012-05-10 10:17 ` [PATCH 2/3] dmaengine: at_hdmac: remove ATC_DEFAULT_CTRLA constant Nicolas Ferre
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2012-05-10 10:17 UTC (permalink / raw)
To: linux-arm-kernel
These comments were covering removed struct at_dma_slave fields.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/mach-at91/include/mach/at_hdmac.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index fff48d1..810a13e 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -26,11 +26,6 @@ struct at_dma_platform_data {
/**
* struct at_dma_slave - Controller-specific information about a slave
* @dma_dev: required DMA master device
- * @tx_reg: physical address of data register used for
- * memory-to-peripheral transfers
- * @rx_reg: physical address of data register used for
- * peripheral-to-memory transfers
- * @reg_width: peripheral register width
* @cfg: Platform-specific initializer for the CFG register
* @ctrla: Platform-specific initializer for the CTRLA register
*/
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] dmaengine: at_hdmac: remove ATC_DEFAULT_CTRLA constant
2012-05-10 10:17 [PATCH 0/3] dmaengine: at_hdmac: slave configuration Nicolas Ferre
2012-05-10 10:17 ` [PATCH 1/3] dmaengine: at_hdmac: remove some at_dma_slave comments Nicolas Ferre
@ 2012-05-10 10:17 ` Nicolas Ferre
2012-05-10 10:17 ` [PATCH 3/3] dmaengine: at_hdmac: take maxburst from slave configuration Nicolas Ferre
2012-05-15 3:18 ` [PATCH 0/3] dmaengine: at_hdmac: " Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2012-05-10 10:17 UTC (permalink / raw)
To: linux-arm-kernel
Not needed constant that was set to 0.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/dma/at_hdmac.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 445fdf8..b3f7cbd 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -39,7 +39,6 @@
*/
#define ATC_DEFAULT_CFG (ATC_FIFOCFG_HALFFIFO)
-#define ATC_DEFAULT_CTRLA (0)
#define ATC_DEFAULT_CTRLB (ATC_SIF(AT_DMA_MEM_IF) \
|ATC_DIF(AT_DMA_MEM_IF))
@@ -572,7 +571,6 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
return NULL;
}
- ctrla = ATC_DEFAULT_CTRLA;
ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN
| ATC_SRC_ADDR_MODE_INCR
| ATC_DST_ADDR_MODE_INCR
@@ -583,13 +581,13 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
* of the most common optimization.
*/
if (!((src | dest | len) & 3)) {
- ctrla |= ATC_SRC_WIDTH_WORD | ATC_DST_WIDTH_WORD;
+ ctrla = ATC_SRC_WIDTH_WORD | ATC_DST_WIDTH_WORD;
src_width = dst_width = 2;
} else if (!((src | dest | len) & 1)) {
- ctrla |= ATC_SRC_WIDTH_HALFWORD | ATC_DST_WIDTH_HALFWORD;
+ ctrla = ATC_SRC_WIDTH_HALFWORD | ATC_DST_WIDTH_HALFWORD;
src_width = dst_width = 1;
} else {
- ctrla |= ATC_SRC_WIDTH_BYTE | ATC_DST_WIDTH_BYTE;
+ ctrla = ATC_SRC_WIDTH_BYTE | ATC_DST_WIDTH_BYTE;
src_width = dst_width = 0;
}
@@ -666,7 +664,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
return NULL;
}
- ctrla = ATC_DEFAULT_CTRLA | atslave->ctrla;
+ ctrla = atslave->ctrla;
ctrlb = ATC_IEN;
switch (direction) {
@@ -799,7 +797,7 @@ atc_dma_cyclic_fill_desc(struct dma_chan *chan, struct at_desc *desc,
u32 ctrla;
/* prepare common CRTLA value */
- ctrla = ATC_DEFAULT_CTRLA | atslave->ctrla
+ ctrla = atslave->ctrla
| ATC_DST_WIDTH(reg_width)
| ATC_SRC_WIDTH(reg_width)
| period_len >> reg_width;
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] dmaengine: at_hdmac: take maxburst from slave configuration
2012-05-10 10:17 [PATCH 0/3] dmaengine: at_hdmac: slave configuration Nicolas Ferre
2012-05-10 10:17 ` [PATCH 1/3] dmaengine: at_hdmac: remove some at_dma_slave comments Nicolas Ferre
2012-05-10 10:17 ` [PATCH 2/3] dmaengine: at_hdmac: remove ATC_DEFAULT_CTRLA constant Nicolas Ferre
@ 2012-05-10 10:17 ` Nicolas Ferre
2012-05-15 3:18 ` [PATCH 0/3] dmaengine: at_hdmac: " Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2012-05-10 10:17 UTC (permalink / raw)
To: linux-arm-kernel
The maxburst/chunk size was taken from the private slave DMA data structure.
Use the common API provided by DMA_SLAVE_CONFIG to setup src/dst maxburst
values.
The ctrla field is not needed anymore in the slave private structure nor the
header constants that were located in an architecture specific directory.
The at91sam9g45_devices.c file that was using this platform data is also
modified to remove this now useless data.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/mach-at91/at91sam9g45_devices.c | 1 -
arch/arm/mach-at91/include/mach/at_hdmac.h | 21 ---------------------
drivers/dma/at_hdmac.c | 7 ++++---
drivers/dma/at_hdmac_regs.h | 21 ++++++++++++++++++++-
4 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 6b008ae..b3d2e19 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -441,7 +441,6 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
atslave->dma_dev = &at_hdmac_device.dev;
atslave->cfg = ATC_FIFOCFG_HALFFIFO
| ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW;
- atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16;
if (mmc_id == 0) /* MCI0 */
atslave->cfg |= ATC_SRC_PER(AT_DMA_ID_MCI0)
| ATC_DST_PER(AT_DMA_ID_MCI0);
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index 810a13e..cab0997 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -27,12 +27,10 @@ struct at_dma_platform_data {
* struct at_dma_slave - Controller-specific information about a slave
* @dma_dev: required DMA master device
* @cfg: Platform-specific initializer for the CFG register
- * @ctrla: Platform-specific initializer for the CTRLA register
*/
struct at_dma_slave {
struct device *dma_dev;
u32 cfg;
- u32 ctrla;
};
@@ -59,24 +57,5 @@ struct at_dma_slave {
#define ATC_FIFOCFG_HALFFIFO (0x1 << 28)
#define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28)
-/* Platform-configurable bits in CTRLA */
-#define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
-#define ATC_SCSIZE_1 (0x0 << 16)
-#define ATC_SCSIZE_4 (0x1 << 16)
-#define ATC_SCSIZE_8 (0x2 << 16)
-#define ATC_SCSIZE_16 (0x3 << 16)
-#define ATC_SCSIZE_32 (0x4 << 16)
-#define ATC_SCSIZE_64 (0x5 << 16)
-#define ATC_SCSIZE_128 (0x6 << 16)
-#define ATC_SCSIZE_256 (0x7 << 16)
-#define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
-#define ATC_DCSIZE_1 (0x0 << 20)
-#define ATC_DCSIZE_4 (0x1 << 20)
-#define ATC_DCSIZE_8 (0x2 << 20)
-#define ATC_DCSIZE_16 (0x3 << 20)
-#define ATC_DCSIZE_32 (0x4 << 20)
-#define ATC_DCSIZE_64 (0x5 << 20)
-#define ATC_DCSIZE_128 (0x6 << 20)
-#define ATC_DCSIZE_256 (0x7 << 20)
#endif /* AT_HDMAC_H */
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index b3f7cbd..07eda80 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -664,7 +664,8 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
return NULL;
}
- ctrla = atslave->ctrla;
+ ctrla = ATC_SCSIZE(sconfig->src_maxburst)
+ | ATC_DCSIZE(sconfig->dst_maxburst);
ctrlb = ATC_IEN;
switch (direction) {
@@ -792,12 +793,12 @@ atc_dma_cyclic_fill_desc(struct dma_chan *chan, struct at_desc *desc,
enum dma_transfer_direction direction)
{
struct at_dma_chan *atchan = to_at_dma_chan(chan);
- struct at_dma_slave *atslave = chan->private;
struct dma_slave_config *sconfig = &atchan->dma_sconfig;
u32 ctrla;
/* prepare common CRTLA value */
- ctrla = atslave->ctrla
+ ctrla = ATC_SCSIZE(sconfig->src_maxburst)
+ | ATC_DCSIZE(sconfig->dst_maxburst)
| ATC_DST_WIDTH(reg_width)
| ATC_SRC_WIDTH(reg_width)
| period_len >> reg_width;
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index 897a8bc..8a6c8e8 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -87,7 +87,26 @@
/* Bitfields in CTRLA */
#define ATC_BTSIZE_MAX 0xFFFFUL /* Maximum Buffer Transfer Size */
#define ATC_BTSIZE(x) (ATC_BTSIZE_MAX & (x)) /* Buffer Transfer Size */
-/* Chunck Tranfer size definitions are in at_hdmac.h */
+#define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
+#define ATC_SCSIZE(x) (ATC_SCSIZE_MASK & ((x) << 16))
+#define ATC_SCSIZE_1 (0x0 << 16)
+#define ATC_SCSIZE_4 (0x1 << 16)
+#define ATC_SCSIZE_8 (0x2 << 16)
+#define ATC_SCSIZE_16 (0x3 << 16)
+#define ATC_SCSIZE_32 (0x4 << 16)
+#define ATC_SCSIZE_64 (0x5 << 16)
+#define ATC_SCSIZE_128 (0x6 << 16)
+#define ATC_SCSIZE_256 (0x7 << 16)
+#define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
+#define ATC_DCSIZE(x) (ATC_DCSIZE_MASK & ((x) << 20))
+#define ATC_DCSIZE_1 (0x0 << 20)
+#define ATC_DCSIZE_4 (0x1 << 20)
+#define ATC_DCSIZE_8 (0x2 << 20)
+#define ATC_DCSIZE_16 (0x3 << 20)
+#define ATC_DCSIZE_32 (0x4 << 20)
+#define ATC_DCSIZE_64 (0x5 << 20)
+#define ATC_DCSIZE_128 (0x6 << 20)
+#define ATC_DCSIZE_256 (0x7 << 20)
#define ATC_SRC_WIDTH_MASK (0x3 << 24) /* Source Single Transfer Size */
#define ATC_SRC_WIDTH(x) ((x) << 24)
#define ATC_SRC_WIDTH_BYTE (0x0 << 24)
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 0/3] dmaengine: at_hdmac: slave configuration
2012-05-10 10:17 [PATCH 0/3] dmaengine: at_hdmac: slave configuration Nicolas Ferre
` (2 preceding siblings ...)
2012-05-10 10:17 ` [PATCH 3/3] dmaengine: at_hdmac: take maxburst from slave configuration Nicolas Ferre
@ 2012-05-15 3:18 ` Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2012-05-15 3:18 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 2012-05-10 at 12:17 +0200, Nicolas Ferre wrote:
> This patch series is composed of two cleanup patches and one "slave
> configuration" patch. The last one uses configuration data passed through the
> slave configuration API to setup the DMA controller.
> Corresponding custom configuration is removed from the slave DMA private
> structure and its use in the AT91 files. Header definitions are then moved
> accordingly.
>
> Nicolas Ferre (3):
> dmaengine: at_hdmac: remove some at_dma_slave comments
> dmaengine: at_hdmac: remove ATC_DEFAULT_CTRLA constant
> dmaengine: at_hdmac: take maxburst from slave configuration
>
> arch/arm/mach-at91/at91sam9g45_devices.c | 1 -
> arch/arm/mach-at91/include/mach/at_hdmac.h | 26 --------------------------
> drivers/dma/at_hdmac.c | 15 +++++++--------
> drivers/dma/at_hdmac_regs.h | 21 ++++++++++++++++++++-
> 4 files changed, 27 insertions(+), 36 deletions(-)
Applied, Thanks
--
~Vinod
^ permalink raw reply [flat|nested] 5+ messages in thread