3 Copyright 1996,2002 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan,
4 Jason Lapenta, Scott Smedley
6 This file is part of the DT3155 Device Driver.
8 The DT3155 Device Driver is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 The DT3155 Device Driver is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with the DT3155 Device Driver; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 Date Programmer Description of changes made
27 -------------------------------------------------------------------
28 24-Jul-2002 SS GPL licence.
32 /* This code is a modified version of examples provided by Data Translations.*/
37 /***************** 32 bit register globals **************/
39 /* offsets for 32-bit memory mapped registers */
41 #define EVEN_DMA_START 0x000
42 #define ODD_DMA_START 0x00C
43 #define EVEN_DMA_STRIDE 0x018
44 #define ODD_DMA_STRIDE 0x024
45 #define EVEN_PIXEL_FMT 0x030
46 #define ODD_PIXEL_FMT 0x034
47 #define FIFO_TRIGGER 0x038
48 #define XFER_MODE 0x03C
50 #define RETRY_WAIT_CNT 0x044
52 #define EVEN_FLD_MASK 0x04C
53 #define ODD_FLD_MASK 0x050
54 #define MASK_LENGTH 0x054
55 #define FIFO_FLAG_CNT 0x058
56 #define IIC_CLK_DUR 0x05C
57 #define IIC_CSR1 0x060
58 #define IIC_CSR2 0x064
59 #define EVEN_DMA_UPPR_LMT 0x08C
60 #define ODD_DMA_UPPR_LMT 0x090
62 #define CLK_DUR_VAL 0x01010101
66 /******** Assignments and Typedefs for 32 bit Memory Mapped Registers ********/
68 typedef union fifo_trigger_tag {
78 typedef union xfer_mode_tag {
89 typedef union csr1_tag {
110 typedef union retry_wait_cnt_tag {
118 typedef union int_csr_tag {
125 u32 FLD_END_EVE_EN:1;
126 u32 FLD_END_ODD_EN:1;
132 typedef union mask_length_tag {
142 typedef union fifo_flag_cnt_tag {
152 typedef union iic_clk_dur {
162 typedef union iic_csr1_tag {
180 /**********************************
183 typedef union iic_csr2_tag {
195 /* use for both EVEN and ODD DMA UPPER LIMITS */
200 typedef union dma_upper_lmt_tag {
203 u32 DMA_UPPER_LMT_VAL:24;
210 * Global declarations of local copies of boards' 32 bit registers
212 extern u32 even_dma_start_r; /* bit 0 should always be 0 */
213 extern u32 odd_dma_start_r; /* .. */
214 extern u32 even_dma_stride_r; /* bits 0&1 should always be 0 */
215 extern u32 odd_dma_stride_r; /* .. */
216 extern u32 even_pixel_fmt_r;
217 extern u32 odd_pixel_fmt_r;
219 extern FIFO_TRIGGER_R fifo_trigger_r;
220 extern XFER_MODE_R xfer_mode_r;
221 extern CSR1_R csr1_r;
222 extern RETRY_WAIT_CNT_R retry_wait_cnt_r;
223 extern INT_CSR_R int_csr_r;
225 extern u32 even_fld_mask_r;
226 extern u32 odd_fld_mask_r;
228 extern MASK_LENGTH_R mask_length_r;
229 extern FIFO_FLAG_CNT_R fifo_flag_cnt_r;
230 extern IIC_CLK_DUR_R iic_clk_dur_r;
231 extern IIC_CSR1_R iic_csr1_r;
232 extern IIC_CSR2_R iic_csr2_r;
233 extern DMA_UPPER_LMT_R even_dma_upper_lmt_r;
234 extern DMA_UPPER_LMT_R odd_dma_upper_lmt_r;
238 /***************** 8 bit I2C register globals ***********/
239 #define CSR2 0x010 /* indices of 8-bit I2C mapped reg's*/
240 #define EVEN_CSR 0x011
241 #define ODD_CSR 0x012
244 #define X_CLIP_START 0x020
245 #define Y_CLIP_START 0x022
246 #define X_CLIP_END 0x024
247 #define Y_CLIP_END 0x026
248 #define AD_ADDR 0x030
251 #define DIG_OUT 0x040
252 #define PM_LUT_ADDR 0x050
253 #define PM_LUT_DATA 0x051
256 /******** Assignments and Typedefs for 8 bit I2C Registers********************/
258 typedef union i2c_csr2_tag {
271 typedef union i2c_even_csr_tag {
281 typedef union i2c_odd_csr_tag {
291 typedef union i2c_config_tag {
305 typedef union i2c_ad_cmd_tag {
306 /* bits can have 3 different meanings depending on value of AD_ADDR */
308 /* Bt252 Command Register if AD_ADDR = 00h */
313 u8 DIGITIZE_CNL_SEL1:2;
316 /* Bt252 IOUT0 register if AD_ADDR = 01h */
321 /* BT252 IOUT1 register if AD_ADDR = 02h */
328 /***** Global declarations of local copies of boards' 8 bit I2C registers ***/
330 extern I2C_CSR2 i2c_csr2;
331 extern I2C_EVEN_CSR i2c_even_csr;
332 extern I2C_ODD_CSR i2c_odd_csr;
333 extern I2C_CONFIG i2c_config;
335 extern u8 i2c_x_clip_start;
336 extern u8 i2c_y_clip_start;
337 extern u8 i2c_x_clip_end;
338 extern u8 i2c_y_clip_end;
339 extern u8 i2c_ad_addr;
340 extern u8 i2c_ad_lut;
341 extern I2C_AD_CMD i2c_ad_cmd;
342 extern u8 i2c_dig_out;
343 extern u8 i2c_pm_lut_addr;
344 extern u8 i2c_pm_lut_data;
346 /* Functions for Global use */
348 /* access 8-bit IIC registers */
350 extern int ReadI2C(void __iomem *mmio, u_short wIregIndex, u8 *byVal);
351 extern int WriteI2C(void __iomem *mmio, u_short wIregIndex, u8 byVal);