blob: 336d5ac02035b219c9f008e433a8176899f4858d [file] [log] [blame]
Ben Dooks992426b2010-02-20 23:01:33 +00001/* linux/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
Ben Dooks505788c2006-09-15 23:42:24 +01002 *
3 * Copyright (C) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
Ben Dooks992426b2010-02-20 23:01:33 +00006 * Samsung S3C24XX DMA support - per SoC functions
Ben Dooks505788c2006-09-15 23:42:24 +01007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
Ben Dooks97c1b142009-03-19 15:02:39 +000013#include <plat/dma-core.h>
14
Ben Dooks505788c2006-09-15 23:42:24 +010015extern struct sysdev_class dma_sysclass;
Ben Dooks97c1b142009-03-19 15:02:39 +000016extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
Ben Dooks505788c2006-09-15 23:42:24 +010017
18#define DMA_CH_VALID (1<<31)
Ben Dooks0c6022d2007-02-13 13:02:52 +010019#define DMA_CH_NEVER (1<<30)
Ben Dooks505788c2006-09-15 23:42:24 +010020
21struct s3c24xx_dma_addr {
22 unsigned long from;
23 unsigned long to;
24};
25
26/* struct s3c24xx_dma_map
27 *
28 * this holds the mapping information for the channel selected
29 * to be connected to the specified device
30*/
31
32struct s3c24xx_dma_map {
33 const char *name;
34 struct s3c24xx_dma_addr hw_addr;
35
Ben Dooks97c1b142009-03-19 15:02:39 +000036 unsigned long channels[S3C_DMA_CHANNELS];
37 unsigned long channels_rx[S3C_DMA_CHANNELS];
Ben Dooks505788c2006-09-15 23:42:24 +010038};
39
40struct s3c24xx_dma_selection {
41 struct s3c24xx_dma_map *map;
42 unsigned long map_size;
43 unsigned long dcon_mask;
44
45 void (*select)(struct s3c2410_dma_chan *chan,
46 struct s3c24xx_dma_map *map);
Ben Dooksc6709e82008-01-28 13:01:20 +010047
48 void (*direction)(struct s3c2410_dma_chan *chan,
49 struct s3c24xx_dma_map *map,
50 enum s3c2410_dmasrc dir);
Ben Dooks505788c2006-09-15 23:42:24 +010051};
52
53extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
Ben Dooks0c6022d2007-02-13 13:02:52 +010054
55/* struct s3c24xx_dma_order_ch
56 *
57 * channel map for one of the `enum dma_ch` dma channels. the list
58 * entry contains a set of low-level channel numbers, orred with
59 * DMA_CH_VALID, which are checked in the order in the array.
60*/
61
62struct s3c24xx_dma_order_ch {
Ben Dooks97c1b142009-03-19 15:02:39 +000063 unsigned int list[S3C_DMA_CHANNELS]; /* list of channels */
Ben Dooks0c6022d2007-02-13 13:02:52 +010064 unsigned int flags; /* flags */
65};
66
67/* struct s3c24xx_dma_order
68 *
69 * information provided by either the core or the board to give the
70 * dma system a hint on how to allocate channels
71*/
72
73struct s3c24xx_dma_order {
74 struct s3c24xx_dma_order_ch channels[DMACH_MAX];
75};
76
77extern int s3c24xx_dma_order_set(struct s3c24xx_dma_order *map);
Ben Dooks48adbcf2007-02-17 15:37:14 +010078
79/* DMA init code, called from the cpu support code */
80
81extern int s3c2410_dma_init(void);
82
83extern int s3c24xx_dma_init(unsigned int channels, unsigned int irq,
84 unsigned int stride);