Re: [PATCH v6 1/2] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)
On 03-07-18, 10:52, Angelo Dureghello wrote: > On Tue, Jul 03, 2018 at 11:19:25AM +0530, Vinod wrote: > > On 01-07-18, 18:33, Angelo Dureghello wrote: > > > This patch adds a new fsl-edma-common module to allow new > > > mcf-edma module code to use most of the fsl-edma code. > > > > > > Due to some differences between ColdFire edma (64 channels) and > > > fsl-edma (32 channels), as register set offsets and some other > > > points as the different interrupt organization and other minor > > > things, a common module can collect most of the code for both > > > 32 and 64 channel edma module versions. > > > > I have applied these, thanks. > > > > While applying I saw a trailing whitespace error, have fixed that up as > > below. > > > Strange checkpatch.pl is not signalling it .. > > > Also, I saw sparse complain a lot, care to fix those too? > > > > Sure. Can send a new version soon. Not a new version as I have applied this, but updates on top of applied changes -- ~Vinod -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 1/2] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)
Hi Vinod, many thanks ! On Tue, Jul 03, 2018 at 11:19:25AM +0530, Vinod wrote: > On 01-07-18, 18:33, Angelo Dureghello wrote: > > This patch adds a new fsl-edma-common module to allow new > > mcf-edma module code to use most of the fsl-edma code. > > > > Due to some differences between ColdFire edma (64 channels) and > > fsl-edma (32 channels), as register set offsets and some other > > points as the different interrupt organization and other minor > > things, a common module can collect most of the code for both > > 32 and 64 channel edma module versions. > > I have applied these, thanks. > > While applying I saw a trailing whitespace error, have fixed that up as > below. > Strange checkpatch.pl is not signalling it .. > Also, I saw sparse complain a lot, care to fix those too? > Sure. Can send a new version soon. Regards, Angelo > -->8 > > commit 15efb0b488596a929bc00ce23aeb746ee6a7c14d > Author: Vinod Koul > Date: Tue Jul 3 11:16:46 2018 +0530 > > dmaengine: fsl-edma: fix trailing whitespace > > Signed-off-by: Vinod Koul > > diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h > index e87c2bec882b..8e3c609c62fa 100644 > --- a/drivers/dma/fsl-edma-common.h > +++ b/drivers/dma/fsl-edma-common.h > @@ -159,4 +159,3 @@ int fsl_edma_terminate_all(struct dma_chan *chan); > void fsl_edma_issue_pending(struct dma_chan *chan); > > #endif /* _FSL_EDMA_COMMON_H_ */ > - > > -- > ~Vinod > -- > To unsubscribe from this list: send the line "unsubscribe linux-m68k" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 1/2] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)
On 01-07-18, 18:33, Angelo Dureghello wrote: > This patch adds a new fsl-edma-common module to allow new > mcf-edma module code to use most of the fsl-edma code. > > Due to some differences between ColdFire edma (64 channels) and > fsl-edma (32 channels), as register set offsets and some other > points as the different interrupt organization and other minor > things, a common module can collect most of the code for both > 32 and 64 channel edma module versions. I have applied these, thanks. While applying I saw a trailing whitespace error, have fixed that up as below. Also, I saw sparse complain a lot, care to fix those too? -->8 commit 15efb0b488596a929bc00ce23aeb746ee6a7c14d Author: Vinod Koul Date: Tue Jul 3 11:16:46 2018 +0530 dmaengine: fsl-edma: fix trailing whitespace Signed-off-by: Vinod Koul diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index e87c2bec882b..8e3c609c62fa 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -159,4 +159,3 @@ int fsl_edma_terminate_all(struct dma_chan *chan); void fsl_edma_issue_pending(struct dma_chan *chan); #endif /* _FSL_EDMA_COMMON_H_ */ - -- ~Vinod -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 1/2] dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)
This patch adds a new fsl-edma-common module to allow new mcf-edma module code to use most of the fsl-edma code. Due to some differences between ColdFire edma (64 channels) and fsl-edma (32 channels), as register set offsets and some other points as the different interrupt organization and other minor things, a common module can collect most of the code for both 32 and 64 channel edma module versions. Signed-off-by: Angelo Dureghello --- Changes for v2: - patch splitted into 4 - add fsl-edma-common module Changes for v3: none Changes for v4: - patch simplified from 4/4 into 2/2 - collecting all the fsl-edma-related changes Changes for v5: - add EXPORT_SYMBOL_GPL for all common functions Changes for v6: - adjusted comment header - we need to free the interrupts at remove(), so removed all devm_ interrupt related calls --- drivers/dma/Makefile | 2 +- drivers/dma/fsl-edma-common.c | 670 ++ drivers/dma/fsl-edma-common.h | 162 drivers/dma/fsl-edma.c| 753 ++ 4 files changed, 871 insertions(+), 716 deletions(-) create mode 100644 drivers/dma/fsl-edma-common.c create mode 100644 drivers/dma/fsl-edma-common.h diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index 203a99d68315..66022f59fca4 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -31,7 +31,7 @@ obj-$(CONFIG_DW_AXI_DMAC) += dw-axi-dmac/ obj-$(CONFIG_DW_DMAC_CORE) += dw/ obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o obj-$(CONFIG_FSL_DMA) += fsldma.o -obj-$(CONFIG_FSL_EDMA) += fsl-edma.o +obj-$(CONFIG_FSL_EDMA) += fsl-edma.o fsl-edma-common.o obj-$(CONFIG_FSL_RAID) += fsl_raid.o obj-$(CONFIG_HSU_DMA) += hsu/ obj-$(CONFIG_IMG_MDC_DMA) += img-mdc-dma.o diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c new file mode 100644 index ..17d677bd11f9 --- /dev/null +++ b/drivers/dma/fsl-edma-common.c @@ -0,0 +1,670 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (c) 2013-2014 Freescale Semiconductor, Inc +// Copyright (c) 2017 Sysam, Angelo Dureghello + +#include +#include + +#include "fsl-edma-common.h" + +#define EDMA_CR0x00 +#define EDMA_ES0x04 +#define EDMA_ERQ 0x0C +#define EDMA_EEI 0x14 +#define EDMA_CEEI 0x18 +#define EDMA_SEEI 0x19 +#define EDMA_CERQ 0x1A +#define EDMA_SERQ 0x1B +#define EDMA_CINT 0x1F +#define EDMA_CERR 0x1E +#define EDMA_SSRT 0x1D +#define EDMA_CDNE 0x1C +#define EDMA_INTR 0x24 +#define EDMA_ERR 0x2C + +#define EDMA64_ERQH0x08 +#define EDMA64_EEIH0x10 +#define EDMA64_SERQ0x18 +#define EDMA64_CERQ0x19 +#define EDMA64_SEEI0x1a +#define EDMA64_CEEI0x1b +#define EDMA64_CINT0x1c +#define EDMA64_CERR0x1d +#define EDMA64_SSRT0x1e +#define EDMA64_CDNE0x1f +#define EDMA64_INTH0x20 +#define EDMA64_INTL0x24 +#define EDMA64_ERRH0x28 +#define EDMA64_ERRL0x2c + +#define EDMA_TCD 0x1000 +#define EDMA_TCD_SIZE 32 +#define EDMA_TCD_MEM_ALIGN EDMA_TCD_SIZE + +#define EDMA_TCD_ATTR_SSIZE_8BIT 0 +#define EDMA_TCD_ATTR_SSIZE_16BIT BIT(0) +#define EDMA_TCD_ATTR_SSIZE_32BIT BIT(1) +#define EDMA_TCD_ATTR_SSIZE_64BIT (BIT(1) | BIT(0)) +#define EDMA_TCD_ATTR_SSIZE_16BYTE BIT(2) +#define EDMA_TCD_ATTR_SSIZE_32BYTE (BIT(2) | BIT(0)) +#define EDMA_TCD_ATTR_DSIZE_8BIT (EDMA_TCD_ATTR_SSIZE_8BIT << 8) +#define EDMA_TCD_ATTR_DSIZE_16BIT (EDMA_TCD_ATTR_SSIZE_16BIT << 8) +#define EDMA_TCD_ATTR_DSIZE_32BIT (EDMA_TCD_ATTR_SSIZE_32BIT << 8) +#define EDMA_TCD_ATTR_DSIZE_64BIT (EDMA_TCD_ATTR_SSIZE_64BIT << 8) +#define EDMA_TCD_ATTR_DSIZE_16BYTE (EDMA_TCD_ATTR_SSIZE_16BYTE << 8) +#define EDMA_TCD_ATTR_DSIZE_32BYTE (EDMA_TCD_ATTR_SSIZE_32BYTE << 8) + +#define EDMA_TCD_CITER_CITER(x)((x) & GENMASK(14, 0)) +#define EDMA_TCD_BITER_BITER(x)((x) & GENMASK(14, 0)) + +#define EDMA_TCD_CSR_START BIT(0) +#define EDMA_TCD_CSR_INT_MAJOR BIT(1) +#define EDMA_TCD_CSR_INT_HALF BIT(2) +#define EDMA_TCD_CSR_D_REQ BIT(3) +#define EDMA_TCD_CSR_E_SG BIT(4) +#define EDMA_TCD_CSR_E_LINKBIT(5) +#define EDMA_TCD_CSR_ACTIVEBIT(6) +#define EDMA_TCD_CSR_DONE BIT(7) + +struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan) +{ + return container_of(chan, struct fsl_edma_chan, vchan.chan); +} +EXPORT_SYMBOL_GPL(to_fsl_edma_chan); + +struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) +{ + return container_of(vd, struct fsl_edma_desc, vdesc); +} +EXPORT_SYMBOL_GPL(to_fsl_edma_desc); + +/* + * R/W functions for big- or little-endian