ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / arch-sa1100 / stork.h
1 /*
2         stork.h
3
4 */
5
6 #ifndef STORK_SA1100_H
7 #define STORK_SA1100_H
8
9 /* ugly - this will make sure we build sa1100fb for the Nec display not the Kyocera */
10 #define STORK_TFT       1
11
12
13 #define GPIO_STORK_SWITCH_1             (1 << 0)    /* Switch 1 - input */
14 #define GPIO_STORK_SWITCH_2             (1 << 1)    /* Switch 2 - input */
15 #define GPIO_STORK_TOUCH_SCREEN_BUSY    (1 << 10)   /* TOUCH_SCREEN_BUSY - input */
16 #define GPIO_STORK_TOUCH_SCREEN_DATA    (1 << 11)   /* TOUCH_SCREEN_DATA - input */
17 #define GPIO_STORK_CODEC_AGCSTAT        (1 << 12)   /* CODEC_AGCSTAT -input */
18 #define GPIO_STORK_RS232_ON             (1 << 13)   /* enable RS232 (UART1) */
19 #define GPIO_STORK_TEST_POINT           (1 << 14)   /* to test point */
20 #define GPIO_STORK_L3_I2C_SDA           (1 << 15)   /* L3_I2C_SDA - bidirectional */
21 #define GPIO_STORK_PSU_SYNC_MODE        (1 << 16)   /* PSU_SYNC_MODE - output */
22 #define GPIO_STORK_L3_MODE              (1 << 17)   /* L3 mode - output (??) */
23 #define GPIO_STORK_L3_I2C_SCL           (1 << 18)   /* L3_I2C_SCL - bidirectional */
24 #define GPIO_STORK_AUDIO_CLK            (1 << 19)   /* SSP external clock (Audio clock) - input */
25 #define GPIO_STORK_PCMCIA_A_CARD_DETECT (1 << 20)   /* PCMCIA_A_CARD_DETECT - input */
26 #define GPIO_STORK_PCMCIA_B_CARD_DETECT (1 << 21)   /* PCMCIA_B_CARD_DETECT - input */
27 #define GPIO_STORK_PCMCIA_A_RDY         (1 << 22)   /* PCMCIA_A_RDY - input */
28 #define GPIO_STORK_PCMCIA_B_RDY         (1 << 23)   /* PCMCIA_B_RDY - input */
29 #define GPIO_STORK_SWITCH_EXTRA_IRQ     (1 << 24)   /* Extra IRQ from switch detect logic - input  */
30 #define GPIO_STORK_SWITCH_IRQ           (1 << 25)   /* Sitch irq - input */
31 #define GPIO_STORK_BATTERY_LOW_IRQ      (1 << 26)   /* BATTERY_LOW_IRQ - input */
32 #define GPIO_STORK_TOUCH_SCREEN_PEN_IRQ (1 << 27)   /* TOUCH_SCREEN_PEN_IRQ -input */
33
34 #define IRQ_GPIO_STORK_PCMCIA_A_CARD_DETECT     IRQ_GPIO20   /* PCMCIA_A_CARD_DETECT - input */
35 #define IRQ_GPIO_STORK_PCMCIA_B_CARD_DETECT     IRQ_GPIO21   /* PCMCIA_B_CARD_DETECT - input */
36
37 #define IRQ_GPIO_STORK_SWITCH_1                 IRQ_GPIO0    /* Switch 1 - input - active low */
38 #define IRQ_GPIO_STORK_SWITCH_2                 IRQ_GPIO1    /* Switch 2 - input - active low */
39 #define IRQ_GPIO_STORK_SWITCH_EXTRA_IRQ         IRQ_GPIO24   /* Extra IRQ from switch detect logic - input - active low  */
40 #define IRQ_GPIO_STORK_SWITCH_IRQ               IRQ_GPIO25   /* Switch irq - input- active low  */
41 #define IRQ_GPIO_STORK_BATTERY_LOW_IRQ          IRQ_GPIO26   /* BATTERY_LOW_IRQ - input - active low */
42 #define IRQ_GPIO_STORK_TOUCH_SCREEN_PEN_IRQ     IRQ_GPIO27   /* TOUCH_SCREEN_PEN_IRQ -input - goes low when it happens */
43
44 /* this may be bogus - no it's not the RDY line becomes the IRQ line when we're up as an IO device */
45 #define IRQ_GPIO_STORK_PCMCIA_A_RDY             IRQ_GPIO22   /* PCMCIA_A_RDY - input */
46 #define IRQ_GPIO_STORK_PCMCIA_B_RDY             IRQ_GPIO23   /* PCMCIA_B_RDY - input */
47
48 /* the default outputs, others are optional - I'll set these in the bootldr for now */
49 #define GPIO_STORK_OUTPUT_BITS (GPIO_STORK_RS232_ON | GPIO_STORK_PSU_SYNC_MODE | GPIO_STORK_L3_MODE)
50
51 #define STORK_LATCH_A_ADDR              0x08000000  /* cs1 A5 = 0 */
52 #define STORK_LATCH_B_ADDR              0x08000020  /* cs1 A5 = 1 */
53
54 #define STORK_LCDCPLD_BASE_ADDR         0x10000000  /* cs2 A5 = 0 */
55
56 /* bit defs for latch A - these are write only and will need to be mirrored!  */
57
58 #define STORK_TEMP_IC_POWER_ON          (1 << 0)
59 #define STORK_SED1386_POWER_ON          (1 << 1)
60 #define STORK_LCD_3V3_POWER_ON          (1 << 2)
61 #define STORK_LCD_5V_POWER_ON           (1 << 3)
62 #define STORK_LCD_BACKLIGHT_INVERTER_ON (1 << 4)
63 #define STORK_PCMCIA_PULL_UPS_POWER_ON  (1 << 5)
64 #define STORK_PCMCIA_A_POWER_ON         (1 << 6)
65 #define STORK_PCMCIA_B_POWER_ON         (1 << 7)
66 #define STORK_AUDIO_POWER_ON            (1 << 8)
67 #define STORK_AUDIO_AMP_ON              (1 << 9)
68 #define STORK_BAR_CODE_POWER_ON         (1 << 10)
69 #define STORK_BATTERY_CHARGER_ON        (1 << 11)
70 #define STORK_SED1386_RESET             (1 << 12)
71 #define STORK_IRDA_FREQUENCY_SELECT     (1 << 13)
72 #define STORK_IRDA_MODE_0               (1 << 14)
73 #define STORK_IRDA_MODE_1               (1 << 15)
74
75 /* and for B */
76
77 #define STORK_AUX_AD_SEL_0              (1 << 0)
78 #define STORK_AUX_AD_SEL_1              (1 << 1)
79 #define STORK_TOUCH_SCREEN_DCLK         (1 << 2)
80 #define STORK_TOUCH_SCREEN_DIN          (1 << 3)
81 #define STORK_TOUCH_SCREEN_CS           (1 << 4)
82 #define STORK_DA_CS                     (1 << 5)
83 #define STORK_DA_LD                     (1 << 6)
84 #define STORK_RED_LED                   (1 << 7)        /* active LOW */
85 #define STORK_GREEN_LED                 (1 << 8)        /* active LOW */
86 #define STORK_YELLOW_LED                (1 << 9)        /* active LOW */
87 #define STORK_PCMCIA_B_RESET            (1 << 10)
88 #define STORK_PCMCIA_A_RESET            (1 << 11)
89 #define STORK_AUDIO_CODEC_RESET         (1 << 12)
90 #define STORK_CODEC_QMUTE               (1 << 13)
91 #define STORK_AUDIO_CLOCK_SEL0          (1 << 14)
92 #define STORK_AUDIO_CLOCK_SEL1          (1 << 15)
93
94
95 /*
96
97     There are 8 control bits in the touch screen controller (AD7873)
98
99     S A2 A1 A0 MODE SER/DFR# PD1 PD0
100
101     S           Start bit, always one.
102     A2 - A0     Channel select bits
103     MODE        0 => 12 bit resolution, 1 => 8 bit
104     SER/DFR#    Single ender/Differential Reference Select bit
105     PD1, PD0    Power management bits (usually 10)
106
107
108 From Table 1.
109
110         A2-A0
111
112         0 Temp0 (SER must be 1)
113         1 X+ (is this a typo? - is this X- really?)
114         2 VBAT,
115         3 read X+ (Z1),
116         4 read Y- (Z2), 5 => read Y+,
117
118 */
119
120 #define AD7873_START            0x80            /* all commands need this to be set */
121 #define AD7873_ADDR_BITS        4               /* ie shift by this */
122 #define AD7873_8BITMODE         0x08            /* 0 => 12 bit convertions */
123 #define AD7873_SER_DFR          0x04
124 #define AD7873_PD1              0x02
125 #define AD7873_PD0              0x01
126
127 #define AD7873_TEMP0            AD7873_SER_DFR
128 #define AD7873_X                (1 << AD7873_ADDR_BITS)
129 #define AD7873_VBAT             ((2 << AD7873_ADDR_BITS) | AD7873_SER_DFR)
130 #define AD7873_X_Z1             (3 << AD7873_ADDR_BITS)
131 #define AD7873_Y_Z2             (4 << AD7873_ADDR_BITS)
132 #define AD7873_Y                (5 << AD7873_ADDR_BITS)
133 #define AD7873_AUX              ((6 << AD7873_ADDR_BITS) | AD7873_SER_DFR)
134 #define AD7873_TEMP1            ((7 << AD7873_ADDR_BITS) | AD7873_SER_DFR)
135
136 #ifndef __ASSEMBLY__
137
138 extern int storkSetLatchA(int bits);
139 extern int storkClearLatchA(int bits);
140
141 extern int storkSetLatchB(int bits);
142 extern int storkClearLatchB(int bits);
143
144 extern int storkSetLCDCPLD(int which, int bits);
145 extern int storkClearLCDCPLD(int which, int bits);
146
147 extern void storkSetGPIO(int bits);
148 extern void storkClearGPIO(int bits);
149
150 extern int storkGetGPIO(void);
151
152 extern void storkClockShortToDtoA(int word);
153 extern int storkClockByteToTS(int byte);
154
155
156 /* this will return the current state of the hardware ANDED with the given bits
157    so NE => at least one bit was set, but maybe not all of them! */
158
159 extern int storkTestGPIO(int bits);
160
161
162 #endif
163
164 #endif