patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / ide / pci / cy82c693.h
1 #ifndef CY82C693_H
2 #define CY82C693_H
3
4 #include <linux/config.h>
5 #include <linux/pci.h>
6 #include <linux/ide.h>
7
8 /* the current version */
9 #define CY82_VERSION    "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)"
10
11 /*
12  *      The following are used to debug the driver.
13  */
14 #define CY82C693_DEBUG_LOGS     0
15 #define CY82C693_DEBUG_INFO     0
16
17 /* define CY82C693_SETDMA_CLOCK to set DMA Controller Clock Speed to ATCLK */
18 #undef CY82C693_SETDMA_CLOCK
19
20 /*
21  *      NOTE: the value for busmaster timeout is tricky and I got it by
22  *       trial and error!  By using a to low value will cause DMA timeouts
23  *       and drop IDE performance, and by using a to high value will cause
24  *       audio playback to scatter.
25  *       If you know a better value or how to calc it, please let me know.
26  */
27
28 /* twice the value written in cy82c693ub datasheet */
29 #define BUSMASTER_TIMEOUT       0x50
30 /*
31  * the value above was tested on my machine and it seems to work okay
32  */
33
34 /* here are the offset definitions for the registers */
35 #define CY82_IDE_CMDREG         0x04
36 #define CY82_IDE_ADDRSETUP      0x48
37 #define CY82_IDE_MASTER_IOR     0x4C    
38 #define CY82_IDE_MASTER_IOW     0x4D    
39 #define CY82_IDE_SLAVE_IOR      0x4E    
40 #define CY82_IDE_SLAVE_IOW      0x4F
41 #define CY82_IDE_MASTER_8BIT    0x50    
42 #define CY82_IDE_SLAVE_8BIT     0x51    
43
44 #define CY82_INDEX_PORT         0x22
45 #define CY82_DATA_PORT          0x23
46
47 #define CY82_INDEX_CTRLREG1     0x01
48 #define CY82_INDEX_CHANNEL0     0x30
49 #define CY82_INDEX_CHANNEL1     0x31
50 #define CY82_INDEX_TIMEOUT      0x32
51
52 /* the max PIO mode - from datasheet */
53 #define CY82C693_MAX_PIO        4
54
55 /* the min and max PCI bus speed in MHz - from datasheet */
56 #define CY82C963_MIN_BUS_SPEED  25
57 #define CY82C963_MAX_BUS_SPEED  33
58
59 /* the struct for the PIO mode timings */
60 typedef struct pio_clocks_s {
61         u8      address_time;   /* Address setup (clocks) */
62         u8      time_16r;       /* clocks for 16bit IOR (0xF0=Active/data, 0x0F=Recovery) */
63         u8      time_16w;       /* clocks for 16bit IOW (0xF0=Active/data, 0x0F=Recovery) */
64         u8      time_8;         /* clocks for 8bit (0xF0=Active/data, 0x0F=Recovery) */
65 } pio_clocks_t;
66
67 static unsigned int init_chipset_cy82c693(struct pci_dev *, const char *);
68 static void init_hwif_cy82c693(ide_hwif_t *);
69 static void init_iops_cy82c693(ide_hwif_t *);
70
71 static ide_pci_device_t cy82c693_chipsets[] __devinitdata = {
72         {       /* 0 */
73                 .name           = "CY82C693",
74                 .init_chipset   = init_chipset_cy82c693,
75                 .init_iops      = init_iops_cy82c693,
76                 .init_hwif      = init_hwif_cy82c693,
77                 .channels       = 1,
78                 .autodma        = AUTODMA,
79                 .bootable       = ON_BOARD,
80         }
81 };
82
83 #endif /* CY82C693_H */