SAMSUNG: PL330: DMA API: Add S3C DMA API driver for PL330
Subsystems (2)
PATCH 3/7 SAMSUNG: PL330: DMA API: Add S3C DMA API driver for PL330
From: Jassi Brar <[email protected]>
Latest Samsung SoCs have one or more PL330 as their DMACs. This patch implements the S3C DMA API for PL330 core driver.
The design has been kept as generic as possible while keeping effort to add support for new SoCs to the minimum possible level.
Some of the salient features of this driver are:-
o Automatic scheduling of client requests onto DMAC if more than one DMAC can reach the peripheral. Factors, such as current load and number of exclusive but inactive peripherals that are supported by the DMAC, are used to decide suitability of a DMAC for a particular client.
o CIRCULAR buffer option is supported.
o The driver scales transparently with the number of DMACs and total peripherals in the platform, since all peripherals are added to the peripheral pool and DMACs to the controller pool.
For most conservative use of memory, smallest driver size and best performance, we don't employ legacy data structures of the S3C DMA API. That should not have any affect since those data structures are completely invisible to the DMA clients.
--- arch/arm/plat-samsung/Kconfig | 6 + arch/arm/plat-samsung/Makefile | 2 + arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h | 87 ++ .../plat-samsung/include/plat/s3c-pl330-pdata.h | 34 + arch/arm/plat-samsung/s3c-pl330.c | 1221 ++++++++++++++++++++ 5 files changed, 1350 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h create mode 100644 arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h create mode 100644 arch/arm/plat-samsung/s3c-pl330.c
arch/arm/plat-samsung/Kconfig +6 -0
@@ -198,6 +198,12 @@ config S3C_DMA help Internal configuration for S3C DMA core +config S3C_PL330_DMA + bool + select PL330 + help + S3C DMA API Driver for PL330 DMAC. + comment "Power management" config SAMSUNG_PM_DEBUG
arch/arm/plat-samsung/Makefile +2 -0
@@ -45,6 +45,8 @@ obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o obj-$(CONFIG_S3C_DMA) += dma.o +obj-$(CONFIG_S3C_PL330_DMA) += s3c-pl330.o + # PM support obj-$(CONFIG_PM) += pm.o
arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h new file +87 -0
87 lines not on this page · raw message
arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h new file +34 -0
@@ -0,0 +1,34 @@ +/* linux/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h +* +* Copyright (C) 2010 Samsung Electronics Co. Ltd. +* Jaswinder Singh <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __S3C_PL330_PDATA_H +#define __S3C_PL330_PDATA_H + +#include <plat/s3c-dma-pl330.h> + +/* +* The platforms just need to provide this info +* to the S3C DMA API driver for PL330. +*/ +struct s3c_pl330_platdata { +enum dma_ch peri[32 ]; +}; + +#endif /* __S3C_PL330_PDATA_H */
arch/arm/plat-samsung/s3c-pl330.c new file +1221 -0
1,221 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 3/7 SAMSUNG: PL330: DMA API: Add S3C DMA API driver for PL330
Quoted 1 line · On Wed, Apr 21, 2010 at 4:40 PM, <[email protected]> wrote:
From: Jassi Brar <[email protected]>
....
Quoted 18 lines
(quoted diff) +18
-0+int s3c2410_dma_ctrl(enum dma_ch id, enum s3c2410_chan_op op) +{ + ? ? ? struct s3c_pl330_chan *ch; + ? ? ? unsigned long flags; + ? ? ? enum pl330_chan_op pl330op; + ? ? ? int idx, ret; + + ? ? ? spin_lock_irqsave(&res_lock, flags); + + ? ? ? ch = id_to_chan(id); + + ? ? ? if (!ch || chan_free(ch)) { + ? ? ? ? ? ? ? ret = -EINVAL; + ? ? ? ? ? ? ? goto ctrl_exit; + ? ? ? } + + ? ? ? switch (op) { + ? ? ? case S3C2410_DMAOP_START:
Review
Quoted 10 lines
(quoted diff) +10
-0+ ? ? ? ? ? ? ? pl330op = PL330_OP_START; + ? ? ? ? ? ? ? break; + + ? ? ? case S3C2410_DMAOP_STOP: + ? ? ? ? ? ? ? pl330op = PL330_OP_ABORT; + ? ? ? ? ? ? ? break; + + ? ? ? case S3C2410_DMAOP_FLUSH: + ? ? ? ? ? ? ? pl330op = PL330_OP_FLUSH; + ? ? ? ? ? ? ? break;
Seems the NOP cases S3C2410_DMAOP_PAUSE, RESUME, TIMEOUT and STARTED went missing. Those are needed here just for the sake of completeness and have no effect on the overall functioning.