Skip to content

Commit

Permalink
S3C: DMA: Add api driver for PL330
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Jassi Brar authored and Ben Dooks committed May 18, 2010
1 parent 7ebd467 commit d800ede
Show file tree
Hide file tree
Showing 5 changed files with 1,342 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/arm/plat-samsung/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/plat-samsung/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
78 changes: 78 additions & 0 deletions arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2010 Samsung Electronics Co. Ltd.
* Jaswinder Singh <jassi.brar@samsung.com>
*
* 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.
*/

#ifndef __S3C_DMA_PL330_H_
#define __S3C_DMA_PL330_H_

#define S3C2410_DMAF_AUTOSTART (1 << 0)
#define S3C2410_DMAF_CIRCULAR (1 << 1)

/*
* PL330 can assign any channel to communicate with
* any of the peripherals attched to the DMAC.
* For the sake of consistency across client drivers,
* We keep the channel names unchanged and only add
* missing peripherals are added.
* Order is not important since S3C PL330 API driver
* use these just as IDs.
*/
enum dma_ch {
DMACH_UART0_RX,
DMACH_UART0_TX,
DMACH_UART1_RX,
DMACH_UART1_TX,
DMACH_UART2_RX,
DMACH_UART2_TX,
DMACH_UART3_RX,
DMACH_UART3_TX,
DMACH_IRDA,
DMACH_I2S0_RX,
DMACH_I2S0_TX,
DMACH_I2S0S_TX,
DMACH_I2S1_RX,
DMACH_I2S1_TX,
DMACH_I2S2_RX,
DMACH_I2S2_TX,
DMACH_SPI0_RX,
DMACH_SPI0_TX,
DMACH_SPI1_RX,
DMACH_SPI1_TX,
DMACH_SPI2_RX,
DMACH_SPI2_TX,
DMACH_AC97_MICIN,
DMACH_AC97_PCMIN,
DMACH_AC97_PCMOUT,
DMACH_EXTERNAL,
DMACH_PWM,
DMACH_SPDIF,
DMACH_HSI_RX,
DMACH_HSI_TX,
DMACH_PCM0_TX,
DMACH_PCM0_RX,
DMACH_PCM1_TX,
DMACH_PCM1_RX,
DMACH_PCM2_TX,
DMACH_PCM2_RX,
DMACH_MSM_REQ3,
DMACH_MSM_REQ2,
DMACH_MSM_REQ1,
DMACH_MSM_REQ0,
/* END Marker, also used to denote a reserved channel */
DMACH_MAX,
};

static inline bool s3c_dma_has_circular(void)
{
return true;
}

#include <plat/dma.h>

#endif /* __S3C_DMA_PL330_H_ */
32 changes: 32 additions & 0 deletions arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* linux/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h
*
* Copyright (C) 2010 Samsung Electronics Co. Ltd.
* Jaswinder Singh <jassi.brar@samsung.com>
*
* 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.
*/

#ifndef __S3C_PL330_PDATA_H
#define __S3C_PL330_PDATA_H

#include <plat/s3c-dma-pl330.h>

/*
* Every PL330 DMAC has max 32 peripheral interfaces,
* of which some may be not be really used in your
* DMAC's configuration.
* Populate this array of 32 peri i/fs with relevant
* channel IDs for used peri i/f and DMACH_MAX for
* those unused.
*
* 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 */
Loading

0 comments on commit d800ede

Please sign in to comment.