Skip to content

Commit 1dd1ea8

Browse files
Nicolas FerreVinod Koul
authored andcommitted
dmaengine: at_hdmac: take maxburst from slave configuration
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> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
1 parent b409ebf commit 1dd1ea8

4 files changed

Lines changed: 24 additions & 26 deletions

File tree

‎arch/arm/mach-at91/at91sam9g45_devices.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
439439
atslave->dma_dev = &at_hdmac_device.dev;
440440
atslave->cfg = ATC_FIFOCFG_HALFFIFO
441441
| ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW;
442-
atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16;
443442
if (mmc_id == 0) /* MCI0 */
444443
atslave->cfg |= ATC_SRC_PER(AT_DMA_ID_MCI0)
445444
| ATC_DST_PER(AT_DMA_ID_MCI0);

‎arch/arm/mach-at91/include/mach/at_hdmac.h‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ struct at_dma_platform_data {
2727
* struct at_dma_slave - Controller-specific information about a slave
2828
* @dma_dev: required DMA master device
2929
* @cfg: Platform-specific initializer for the CFG register
30-
* @ctrla: Platform-specific initializer for the CTRLA register
3130
*/
3231
struct at_dma_slave {
3332
struct device *dma_dev;
3433
u32 cfg;
35-
u32 ctrla;
3634
};
3735

3836

@@ -59,24 +57,5 @@ struct at_dma_slave {
5957
#define ATC_FIFOCFG_HALFFIFO (0x1 << 28)
6058
#define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28)
6159

62-
/* Platform-configurable bits in CTRLA */
63-
#define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
64-
#define ATC_SCSIZE_1 (0x0 << 16)
65-
#define ATC_SCSIZE_4 (0x1 << 16)
66-
#define ATC_SCSIZE_8 (0x2 << 16)
67-
#define ATC_SCSIZE_16 (0x3 << 16)
68-
#define ATC_SCSIZE_32 (0x4 << 16)
69-
#define ATC_SCSIZE_64 (0x5 << 16)
70-
#define ATC_SCSIZE_128 (0x6 << 16)
71-
#define ATC_SCSIZE_256 (0x7 << 16)
72-
#define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
73-
#define ATC_DCSIZE_1 (0x0 << 20)
74-
#define ATC_DCSIZE_4 (0x1 << 20)
75-
#define ATC_DCSIZE_8 (0x2 << 20)
76-
#define ATC_DCSIZE_16 (0x3 << 20)
77-
#define ATC_DCSIZE_32 (0x4 << 20)
78-
#define ATC_DCSIZE_64 (0x5 << 20)
79-
#define ATC_DCSIZE_128 (0x6 << 20)
80-
#define ATC_DCSIZE_256 (0x7 << 20)
8160

8261
#endif /* AT_HDMAC_H */

‎drivers/dma/at_hdmac.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
666666
return NULL;
667667
}
668668

669-
ctrla = atslave->ctrla;
669+
ctrla = ATC_SCSIZE(sconfig->src_maxburst)
670+
| ATC_DCSIZE(sconfig->dst_maxburst);
670671
ctrlb = ATC_IEN;
671672

672673
switch (direction) {
@@ -794,12 +795,12 @@ atc_dma_cyclic_fill_desc(struct dma_chan *chan, struct at_desc *desc,
794795
enum dma_transfer_direction direction)
795796
{
796797
struct at_dma_chan *atchan = to_at_dma_chan(chan);
797-
struct at_dma_slave *atslave = chan->private;
798798
struct dma_slave_config *sconfig = &atchan->dma_sconfig;
799799
u32 ctrla;
800800

801801
/* prepare common CRTLA value */
802-
ctrla = atslave->ctrla
802+
ctrla = ATC_SCSIZE(sconfig->src_maxburst)
803+
| ATC_DCSIZE(sconfig->dst_maxburst)
803804
| ATC_DST_WIDTH(reg_width)
804805
| ATC_SRC_WIDTH(reg_width)
805806
| period_len >> reg_width;

‎drivers/dma/at_hdmac_regs.h‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,26 @@
8787
/* Bitfields in CTRLA */
8888
#define ATC_BTSIZE_MAX 0xFFFFUL /* Maximum Buffer Transfer Size */
8989
#define ATC_BTSIZE(x) (ATC_BTSIZE_MAX & (x)) /* Buffer Transfer Size */
90-
/* Chunck Tranfer size definitions are in at_hdmac.h */
90+
#define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
91+
#define ATC_SCSIZE(x) (ATC_SCSIZE_MASK & ((x) << 16))
92+
#define ATC_SCSIZE_1 (0x0 << 16)
93+
#define ATC_SCSIZE_4 (0x1 << 16)
94+
#define ATC_SCSIZE_8 (0x2 << 16)
95+
#define ATC_SCSIZE_16 (0x3 << 16)
96+
#define ATC_SCSIZE_32 (0x4 << 16)
97+
#define ATC_SCSIZE_64 (0x5 << 16)
98+
#define ATC_SCSIZE_128 (0x6 << 16)
99+
#define ATC_SCSIZE_256 (0x7 << 16)
100+
#define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
101+
#define ATC_DCSIZE(x) (ATC_DCSIZE_MASK & ((x) << 20))
102+
#define ATC_DCSIZE_1 (0x0 << 20)
103+
#define ATC_DCSIZE_4 (0x1 << 20)
104+
#define ATC_DCSIZE_8 (0x2 << 20)
105+
#define ATC_DCSIZE_16 (0x3 << 20)
106+
#define ATC_DCSIZE_32 (0x4 << 20)
107+
#define ATC_DCSIZE_64 (0x5 << 20)
108+
#define ATC_DCSIZE_128 (0x6 << 20)
109+
#define ATC_DCSIZE_256 (0x7 << 20)
91110
#define ATC_SRC_WIDTH_MASK (0x3 << 24) /* Source Single Transfer Size */
92111
#define ATC_SRC_WIDTH(x) ((x) << 24)
93112
#define ATC_SRC_WIDTH_BYTE (0x0 << 24)

0 commit comments

Comments
 (0)