Merge current mainline tree into linux-omap tree
[pandora-kernel.git] / drivers / media / video / omap / omap16xxcam.h
1 /*
2  *  drivers/media/video/omap/omap16xxcam.h
3  *
4  * Copyright (C) 2004 Texas Instruments, Inc. 
5  * 
6  * This package is free software; you can redistribute it and/or modify 
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation. 
9  * 
10  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 
11  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 
12  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
13  */
14  
15 #ifndef OMAP_16XX_CAM_H
16 #define OMAP_16XX_CAM_H
17
18 #define DMA_ELEM_SIZE   4
19 #define FIFO_TRIGGER_LVL (32)
20
21 /*
22  * ---------------------------------------------------------------------------
23  *  OMAP1610 Camera Interface
24  * ---------------------------------------------------------------------------
25  */
26
27 #ifdef CONFIG_MACH_OMAP_H3
28 #define CAMERA_BASE          (0x2007d800)
29 #else
30 #define CAMERA_BASE          (IO_PHYS + 0x6800)
31 #endif
32
33 #define CAM_CTRLCLOCK_REG    (CAMERA_BASE + 0x00)
34 #define CAM_IT_STATUS_REG    (CAMERA_BASE + 0x04)
35 #define CAM_MODE_REG         (CAMERA_BASE + 0x08)
36 #define CAM_STATUS_REG       (CAMERA_BASE + 0x0C)
37 #define CAM_CAMDATA_REG      (CAMERA_BASE + 0x10)
38 #define CAM_GPIO_REG         (CAMERA_BASE + 0x14)
39 #define CAM_PEAK_CTR_REG     (CAMERA_BASE + 0x18)
40 #define CAMERA_IOSIZE        0x1C
41
42 /* CTRLCLOCK bit shifts */
43 #define FOSCMOD_BIT             0
44 #define FOSCMOD_MASK            (0x7 << FOSCMOD_BIT)
45 #define FOSCMOD_12MHz           0x0
46 #define FOSCMOD_6MHz            0x2
47 #define FOSCMOD_9_6MHz          0x4
48 #define FOSCMOD_24MHz           0x5
49 #define FOSCMOD_8MHz            0x6
50 #define FOSCMOD_TC2_CK2         0x3
51 #define FOSCMOD_TC2_CK3         0x1
52 #define FOSCMOD_TC2_CK4         0x5
53 #define FOSCMOD_TC2_CK8         0x0
54 #define FOSCMOD_TC2_CK10        0x4
55 #define FOSCMOD_TC2_CK12        0x6
56 #define FOSCMOD_TC2_CK16        0x2
57 #define POLCLK                  (1<<3)
58 #define CAMEXCLK_EN             (1<<4)
59 #define MCLK_EN                 (1<<5)
60 #define DPLL_EN                 (1<<6)
61 #define LCLK_EN                 (1<<7)
62
63 /* IT_STATUS bit shifts */
64 #define V_UP           (1<<0)
65 #define V_DOWN         (1<<1)
66 #define H_UP           (1<<2)
67 #define H_DOWN         (1<<3)
68 #define FIFO_FULL      (1<<4)
69 #define DATA_XFER      (1<<5)
70
71 /* MODE bit shifts */
72 #define CAMOSC         (1<<0)
73 #define IMGSIZE_BIT    1
74 #define IMGSIZE_MASK   (0x3 << IMGSIZE_BIT)
75 #define IMGSIZE_CIF      (0x0 << IMGSIZE_BIT)    /* 352x288 */
76 #define IMGSIZE_QCIF     (0x1 << IMGSIZE_BIT)    /* 176x144 */
77 #define IMGSIZE_VGA      (0x2 << IMGSIZE_BIT)    /* 640x480 */
78 #define IMGSIZE_QVGA     (0x3 << IMGSIZE_BIT)    /* 320x240 */
79 #define ORDERCAMD      (1<<3)
80 #define EN_V_UP        (1<<4)
81 #define EN_V_DOWN      (1<<5)
82 #define EN_H_UP        (1<<6)
83 #define EN_H_DOWN      (1<<7)
84 #define EN_DMA         (1<<8)
85 #define THRESHOLD      (1<<9)
86 #define THRESHOLD_BIT  9
87 #define THRESHOLD_MASK (0x7f<<9)
88 #define EN_NIRQ        (1<<16)
89 #define EN_FIFO_FULL   (1<<17)
90 #define RAZ_FIFO       (1<<18)
91
92 /* STATUS bit shifts */
93 #define VSTATUS        (1<<0)
94 #define HSTATUS        (1<<1)
95
96 /* GPIO bit shifts */
97 #define CAM_RST        (1<<0)
98
99
100 #define XCLK_6MHZ     6000000
101 #define XCLK_8MHZ     8000000
102 #define XCLK_9_6MHZ   9000000
103 #define XCLK_12MHZ   12000000
104 #define XCLK_24MHZ   24000000
105
106 #endif /* OMAP_16XX_CAM_H */