1 #ifndef _INCLUDE_CERF_H_
2 #define _INCLUDE_CERF_H_
3 
4 #include <linux/config.h>
5 
6 #ifdef CONFIG_SA1100_CERF_CPLD
7 
8 
9 // Map sa1100fb.c to sa1100_frontlight.c - Not pretty, but necessary.
10 #define CERF_BACKLIGHT_ENABLE   sa1100_fl_enable
11 #define CERF_BACKLIGHT_DISABLE  sa1100_fl_disable
12 
13 //
14 // IO Pins for devices
15 //
16 
17 #define CERF_PDA_CPLD             0xf1000000
18 #define CERF_PDA_CPLD_WRCLRINT    (0x0)
19 #define CERF_PDA_CPLD_BACKLIGHT   (0x2)
20 #define CERF_PDA_CPLD_SOUND_FREQ  (0x4)
21 #define CERF_PDA_CPLD_KEYPAD_A    (0x6)
22 #define CERF_PDA_CPLD_BATTFAULT   (0x8)
23 #define CERF_PDA_CPLD_KEYPAD_B    (0xa)
24 #define CERF_PDA_CPLD_SOUND_ENA   (0xc)
25 #define CERF_PDA_CPLD_SOUND_RESET (0xe)
26 
27 #define GPIO_CF_BVD2              GPIO_GPIO (5)
28 #define GPIO_CF_BVD1              GPIO_GPIO (6)
29 #define GPIO_CF_RESET             GPIO_GPIO (7)
30 #define GPIO_CF_IRQ               GPIO_GPIO (8)
31 #define GPIO_CF_CD                GPIO_GPIO (9)
32 
33 #define GPIO_PWR_SHUTDOWN         GPIO_GPIO (25)
34 
35 #define UCB1200_GPIO_CONT_CS      0x0001
36 #define UCB1200_GPIO_CONT_DOWN    0x0002
37 #define UCB1200_GPIO_CONT_INC     0x0004
38 #define UCB1200_GPIO_CONT_ENA     0x0008
39 #define UCB1200_GPIO_LCD_RESET    0x0010
40 #define UCB1200_GPIO_IRDA_ENABLE  0x0020
41 #define UCB1200_GPIO_BT_ENABLE    0x0040
42 #define UCB1200_GPIO_L3_DATA      0x0080
43 #define UCB1200_GPIO_L3_CLOCK     0x0100
44 #define UCB1200_GPIO_L3_MODE      0x0200
45 
46 //
47 // IRQ for devices
48 //
49 
50 #define IRQ_UCB1200_CONT_CS     IRQ_UCB1200_IO0
51 #define IRQ_UCB1200_CONT_DOWN   IRQ_UCB1200_IO1
52 #define IRQ_UCB1200_CONT_INC    IRQ_UCB1200_IO2
53 #define IRQ_UCB1200_CONT_ENA    IRQ_UCB1200_IO3
54 #define IRQ_UCB1200_LCD_RESET   IRQ_UCB1200_IO4
55 #define IRQ_UCB1200_IRDA_ENABLE IRQ_UCB1200_IO5
56 #define IRQ_UCB1200_BT_ENABLE   IRQ_UCB1200_IO6
57 #define IRQ_UCB1200_L3_DATA     IRQ_UCB1200_IO7
58 #define IRQ_UCB1200_L3_CLOCK    IRQ_UCB1200_IO8
59 #define IRQ_UCB1200_L3_MODE     IRQ_UCB1200_IO9
60 
61 #define IRQ_GPIO_CF_BVD2        IRQ_GPIO5
62 #define IRQ_GPIO_CF_BVD1        IRQ_GPIO6
63 #define IRQ_GPIO_CF_IRQ         IRQ_GPIO8
64 #define IRQ_GPIO_CF_CD          IRQ_GPIO9
65 
66 //
67 // Device parameters
68 //
69 
70 #define CERF_PDA_CPLD_SOUND_FREQ_8000  (0x01)
71 #define CERF_PDA_CPLD_SOUND_FREQ_11025 (0x05)
72 #define CERF_PDA_CPLD_SOUND_FREQ_16000 (0x02)
73 #define CERF_PDA_CPLD_SOUND_FREQ_22050 (0x06)
74 #define CERF_PDA_CPLD_SOUND_FREQ_32000 (0x03)
75 #define CERF_PDA_CPLD_SOUND_FREQ_44100 (0x07)
76 #define CERF_PDA_CPLD_SOUND_FREQ_48000 (0x0b)
77 
78 //
79 // General Functions
80 //
81 
82 #define CERF_PDA_CPLD_Get(x, y)      (*((char*)(CERF_PDA_CPLD + (x))) & (y))
83 #define CERF_PDA_CPLD_Set(x, y, z)   (*((char*)(CERF_PDA_CPLD + (x))) = (*((char*)(CERF_PDA_CPLD + (x))) & ~(z)) | (y))
84 #define CERF_PDA_CPLD_UnSet(x, y, z) (*((char*)(CERF_PDA_CPLD + (x))) = (*((char*)(CERF_PDA_CPLD + (x))) & ~(z)) & ~(y))
85 
86 
87 #else // CONFIG_SA1100_CERF_CPLD
88 
89 
90 #define GPIO_CF_BVD2            GPIO_GPIO (19)
91 #define GPIO_CF_BVD1            GPIO_GPIO (20)
92 #define GPIO_CF_RESET           0
93 #define GPIO_CF_IRQ             GPIO_GPIO (22)
94 #define GPIO_CF_CD              GPIO_GPIO (23)
95 
96 #define GPIO_LCD_RESET          GPIO_GPIO (15)
97 
98 #define IRQ_GPIO_CF_BVD2        IRQ_GPIO19
99 #define IRQ_GPIO_CF_BVD1        IRQ_GPIO20
100 #define IRQ_GPIO_CF_IRQ         IRQ_GPIO22
101 #define IRQ_GPIO_CF_CD          IRQ_GPIO23
102 
103 
104 #endif // CONFIG_SA1100_CERF_CPLD
105 
106 
107 #define GPIO_UCB1200_IRQ        GPIO_GPIO (18)
108 #define IRQ_GPIO_UCB1200_IRQ    IRQ_GPIO18
109 
110 #endif // _INCLUDE_CERF_H_
111