]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/asm-arm/arch-s3c2410/dma.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[mv-sheeva.git] / include / asm-arm / arch-s3c2410 / dma.h
index 46e65409fcc5b7635b35d72a02590b4868152081..c6e8d8f64938e4e3aa0af3fb6119ec47ae8202ee 100644 (file)
@@ -1,37 +1,69 @@
-/* linux/include/asm-arm/arch-bast/dma.h
+/* linux/include/asm-arm/arch-s3c2410/dma.h
  *
- * Copyright (C) 2003,2004 Simtec Electronics
+ * Copyright (C) 2003,2004,2006 Simtec Electronics
  *     Ben Dooks <ben@simtec.co.uk>
  *
- * Samsung S3C2410X DMA support
+ * Samsung S3C241XX DMA support
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
- *
- * Changelog:
- *  ??-May-2003 BJD   Created file
- *  ??-Jun-2003 BJD   Added more dma functionality to go with arch
- *  10-Nov-2004 BJD   Added sys_device support
 */
 
 #ifndef __ASM_ARCH_DMA_H
 #define __ASM_ARCH_DMA_H __FILE__
 
 #include <linux/sysdev.h>
-#include "hardware.h"
-
+#include <asm/hardware.h>
 
 /*
  * This is the maximum DMA address(physical address) that can be DMAd to.
  *
  */
-#define MAX_DMA_ADDRESS                0x20000000
+#define MAX_DMA_ADDRESS                0x40000000
 #define MAX_DMA_TRANSFER_SIZE   0x100000 /* Data Unit is half word  */
 
+/* We use `virtual` dma channels to hide the fact we have only a limited
+ * number of DMA channels, and not of all of them (dependant on the device)
+ * can be attached to any DMA source. We therefore let the DMA core handle
+ * the allocation of hardware channels to clients.
+*/
+
+enum dma_ch {
+       DMACH_XD0,
+       DMACH_XD1,
+       DMACH_SDI,
+       DMACH_SPI0,
+       DMACH_SPI1,
+       DMACH_UART0,
+       DMACH_UART1,
+       DMACH_UART2,
+       DMACH_TIMER,
+       DMACH_I2S_IN,
+       DMACH_I2S_OUT,
+       DMACH_PCM_IN,
+       DMACH_PCM_OUT,
+       DMACH_MIC_IN,
+       DMACH_USB_EP1,
+       DMACH_USB_EP2,
+       DMACH_USB_EP3,
+       DMACH_USB_EP4,
+       DMACH_UART0_SRC2,       /* s3c2412 second uart sources */
+       DMACH_UART1_SRC2,
+       DMACH_UART2_SRC2,
+       DMACH_UART3,            /* s3c2443 has extra uart */
+       DMACH_UART3_SRC2,
+       DMACH_MAX,              /* the end entry */
+};
+
+#define DMACH_LOW_LEVEL        (1<<28) /* use this to specifiy hardware ch no */
 
 /* we have 4 dma channels */
-#define S3C2410_DMA_CHANNELS        (4)
+#ifndef CONFIG_CPU_S3C2443
+#define S3C2410_DMA_CHANNELS           (4)
+#else
+#define S3C2410_DMA_CHANNELS           (6)
+#endif
 
 /* types */
 
@@ -83,10 +115,9 @@ enum s3c2410_dma_buffresult {
        S3C2410_RES_ABORT
 };
 
-
 enum s3c2410_dmasrc {
-       S3C2410_DMASRC_HW,      /* source is memory */
-       S3C2410_DMASRC_MEM      /* source is hardware */
+       S3C2410_DMASRC_HW,              /* source is memory */
+       S3C2410_DMASRC_MEM              /* source is hardware */
 };
 
 /* enum s3c2410_chan_op
@@ -101,7 +132,7 @@ enum s3c2410_chan_op {
        S3C2410_DMAOP_PAUSE,
        S3C2410_DMAOP_RESUME,
        S3C2410_DMAOP_FLUSH,
-       S3C2410_DMAOP_TIMEOUT,           /* internal signal to handler */
+       S3C2410_DMAOP_TIMEOUT,          /* internal signal to handler */
        S3C2410_DMAOP_STARTED,          /* indicate channel started */
 };
 
@@ -125,12 +156,12 @@ struct s3c2410_dma_client {
 
 struct s3c2410_dma_buf;
 struct s3c2410_dma_buf {
-       struct s3c2410_dma_buf   *next;
-       int                  magic;        /* magic */
-       int                  size;         /* buffer size in bytes */
-       dma_addr_t           data;         /* start of DMA data */
-       dma_addr_t           ptr;          /* where the DMA got to [1] */
-       void                *id;           /* client's id */
+       struct s3c2410_dma_buf  *next;
+       int                      magic;         /* magic */
+       int                      size;          /* buffer size in bytes */
+       dma_addr_t               data;          /* start of DMA data */
+       dma_addr_t               ptr;           /* where the DMA got to [1] */
+       void                    *id;            /* client's id */
 };
 
 /* [1] is this updated for both recv/send modes? */
@@ -150,13 +181,15 @@ typedef int  (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
                                   enum s3c2410_chan_op );
 
 struct s3c2410_dma_stats {
-       unsigned long          loads;
-       unsigned long          timeout_longest;
-       unsigned long          timeout_shortest;
-       unsigned long          timeout_avg;
-       unsigned long          timeout_failed;
+       unsigned long           loads;
+       unsigned long           timeout_longest;
+       unsigned long           timeout_shortest;
+       unsigned long           timeout_avg;
+       unsigned long           timeout_failed;
 };
 
+struct s3c2410_dma_map;
+
 /* struct s3c2410_dma_chan
  *
  * full state information for each DMA channel
@@ -164,42 +197,44 @@ struct s3c2410_dma_stats {
 
 struct s3c2410_dma_chan {
        /* channel state flags and information */
-       unsigned char          number;      /* number of this dma channel */
-       unsigned char          in_use;      /* channel allocated */
-       unsigned char          irq_claimed; /* irq claimed for channel */
-       unsigned char          irq_enabled; /* irq enabled for channel */
-       unsigned char          xfer_unit;   /* size of an transfer */
+       unsigned char            number;      /* number of this dma channel */
+       unsigned char            in_use;      /* channel allocated */
+       unsigned char            irq_claimed; /* irq claimed for channel */
+       unsigned char            irq_enabled; /* irq enabled for channel */
+       unsigned char            xfer_unit;   /* size of an transfer */
 
        /* channel state */
 
-       enum s3c2410_dma_state    state;
-       enum s3c2410_dma_loadst   load_state;
-       struct s3c2410_dma_client  *client;
+       enum s3c2410_dma_state   state;
+       enum s3c2410_dma_loadst  load_state;
+       struct s3c2410_dma_client *client;
 
        /* channel configuration */
-       enum s3c2410_dmasrc       source;
-       unsigned long          dev_addr;
-       unsigned long          load_timeout;
-       unsigned int           flags;        /* channel flags */
+       enum s3c2410_dmasrc      source;
+       unsigned long            dev_addr;
+       unsigned long            load_timeout;
+       unsigned int             flags;         /* channel flags */
+
+       struct s3c24xx_dma_map  *map;           /* channel hw maps */
 
        /* channel's hardware position and configuration */
-       void __iomem           *regs;        /* channels registers */
-       void __iomem           *addr_reg;    /* data address register */
-       unsigned int           irq;          /* channel irq */
-       unsigned long          dcon;         /* default value of DCON */
+       void __iomem            *regs;          /* channels registers */
+       void __iomem            *addr_reg;      /* data address register */
+       unsigned int             irq;           /* channel irq */
+       unsigned long            dcon;          /* default value of DCON */
 
        /* driver handles */
-       s3c2410_dma_cbfn_t     callback_fn;  /* buffer done callback */
-       s3c2410_dma_opfn_t     op_fn;        /* channel operation callback */
+       s3c2410_dma_cbfn_t       callback_fn;   /* buffer done callback */
+       s3c2410_dma_opfn_t       op_fn;         /* channel op callback */
 
        /* stats gathering */
-       struct s3c2410_dma_stats   *stats;
-       struct s3c2410_dma_stats    stats_store;
+       struct s3c2410_dma_stats *stats;
+       struct s3c2410_dma_stats  stats_store;
 
        /* buffer list and information */
-       struct s3c2410_dma_buf      *curr;        /* current dma buffer */
-       struct s3c2410_dma_buf      *next;        /* next buffer to load */
-       struct s3c2410_dma_buf      *end;         /* end of queue */
+       struct s3c2410_dma_buf  *curr;          /* current dma buffer */
+       struct s3c2410_dma_buf  *next;          /* next buffer to load */
+       struct s3c2410_dma_buf  *end;           /* end of queue */
 
        /* system device */
        struct sys_device       dev;
@@ -291,6 +326,8 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
 #define S3C2410_DMA_DCSRC       (0x18)
 #define S3C2410_DMA_DCDST       (0x1C)
 #define S3C2410_DMA_DMASKTRIG   (0x20)
+#define S3C2412_DMA_DMAREQSEL  (0x24)
+#define S3C2443_DMA_DMAREQSEL  (0x24)
 
 #define S3C2410_DISRCC_INC     (1<<0)
 #define S3C2410_DISRCC_APB     (1<<1)
@@ -357,4 +394,59 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
 #define S3C2440_DCON_CH3_PCMOUT        (6<<24)
 #endif
 
+#ifdef CONFIG_CPU_S3C2412
+
+#define S3C2412_DMAREQSEL_SRC(x)       ((x)<<1)
+
+#define S3C2412_DMAREQSEL_HW           (1)
+
+#define S3C2412_DMAREQSEL_SPI0TX       S3C2412_DMAREQSEL_SRC(0)
+#define S3C2412_DMAREQSEL_SPI0RX       S3C2412_DMAREQSEL_SRC(1)
+#define S3C2412_DMAREQSEL_SPI1TX       S3C2412_DMAREQSEL_SRC(2)
+#define S3C2412_DMAREQSEL_SPI1RX       S3C2412_DMAREQSEL_SRC(3)
+#define S3C2412_DMAREQSEL_I2STX                S3C2412_DMAREQSEL_SRC(4)
+#define S3C2412_DMAREQSEL_I2SRX                S3C2412_DMAREQSEL_SRC(5)
+#define S3C2412_DMAREQSEL_TIMER                S3C2412_DMAREQSEL_SRC(9)
+#define S3C2412_DMAREQSEL_SDI          S3C2412_DMAREQSEL_SRC(10)
+#define S3C2412_DMAREQSEL_USBEP1       S3C2412_DMAREQSEL_SRC(13)
+#define S3C2412_DMAREQSEL_USBEP2       S3C2412_DMAREQSEL_SRC(14)
+#define S3C2412_DMAREQSEL_USBEP3       S3C2412_DMAREQSEL_SRC(15)
+#define S3C2412_DMAREQSEL_USBEP4       S3C2412_DMAREQSEL_SRC(16)
+#define S3C2412_DMAREQSEL_XDREQ0       S3C2412_DMAREQSEL_SRC(17)
+#define S3C2412_DMAREQSEL_XDREQ1       S3C2412_DMAREQSEL_SRC(18)
+#define S3C2412_DMAREQSEL_UART0_0      S3C2412_DMAREQSEL_SRC(19)
+#define S3C2412_DMAREQSEL_UART0_1      S3C2412_DMAREQSEL_SRC(20)
+#define S3C2412_DMAREQSEL_UART1_0      S3C2412_DMAREQSEL_SRC(21)
+#define S3C2412_DMAREQSEL_UART1_1      S3C2412_DMAREQSEL_SRC(22)
+#define S3C2412_DMAREQSEL_UART2_0      S3C2412_DMAREQSEL_SRC(23)
+#define S3C2412_DMAREQSEL_UART2_1      S3C2412_DMAREQSEL_SRC(24)
+
+#endif
+
+#define S3C2443_DMAREQSEL_SRC(x)       ((x)<<1)
+
+#define S3C2443_DMAREQSEL_HW           (1)
+
+#define S3C2443_DMAREQSEL_SPI0TX       S3C2443_DMAREQSEL_SRC(0)
+#define S3C2443_DMAREQSEL_SPI0RX       S3C2443_DMAREQSEL_SRC(1)
+#define S3C2443_DMAREQSEL_SPI1TX       S3C2443_DMAREQSEL_SRC(2)
+#define S3C2443_DMAREQSEL_SPI1RX       S3C2443_DMAREQSEL_SRC(3)
+#define S3C2443_DMAREQSEL_I2STX                S3C2443_DMAREQSEL_SRC(4)
+#define S3C2443_DMAREQSEL_I2SRX                S3C2443_DMAREQSEL_SRC(5)
+#define S3C2443_DMAREQSEL_TIMER                S3C2443_DMAREQSEL_SRC(9)
+#define S3C2443_DMAREQSEL_SDI          S3C2443_DMAREQSEL_SRC(10)
+#define S3C2443_DMAREQSEL_XDREQ0       S3C2443_DMAREQSEL_SRC(17)
+#define S3C2443_DMAREQSEL_XDREQ1       S3C2443_DMAREQSEL_SRC(18)
+#define S3C2443_DMAREQSEL_UART0_0      S3C2443_DMAREQSEL_SRC(19)
+#define S3C2443_DMAREQSEL_UART0_1      S3C2443_DMAREQSEL_SRC(20)
+#define S3C2443_DMAREQSEL_UART1_0      S3C2443_DMAREQSEL_SRC(21)
+#define S3C2443_DMAREQSEL_UART1_1      S3C2443_DMAREQSEL_SRC(22)
+#define S3C2443_DMAREQSEL_UART2_0      S3C2443_DMAREQSEL_SRC(23)
+#define S3C2443_DMAREQSEL_UART2_1      S3C2443_DMAREQSEL_SRC(24)
+#define S3C2443_DMAREQSEL_UART3_0      S3C2443_DMAREQSEL_SRC(25)
+#define S3C2443_DMAREQSEL_UART3_1      S3C2443_DMAREQSEL_SRC(26)
+#define S3C2443_DMAREQSEL_PCMOUT       S3C2443_DMAREQSEL_SRC(27)
+#define S3C2443_DMAREQSEL_PCMIN        S3C2443_DMAREQSEL_SRC(28)
+#define S3C2443_DMAREQSEL_MICIN                S3C2443_DMAREQSEL_SRC(29)
+
 #endif /* __ASM_ARCH_DMA_H */