1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*
* Copyright c Realtek Semiconductor Corporation, 2008
* All rights reserved.
*
* Program : GPIO Header File
* Abstract :
* Author :
*
*/
#ifndef __GPIO_8972B_H
#define __GPIO_8972B_H
////// For 8982B QA Board /////
#ifdef CONFIG_RTK_VOIP_GPIO_8982B_QA
#define GPIO "E"
/* Slic used */
#define PIN_RESET1 GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CS1 GPIO_ID(GPIO_PORT_E,1) //output
#define PIN_CLK GPIO_ID(GPIO_PORT_E,3) //output
#define PIN_DI GPIO_ID(GPIO_PORT_E,2) //input
#if defined(CONFIG_RTK_VOIP_DRIVERS_SLIC_SI3215) || defined(CONFIG_RTK_VOIP_DRIVERS_SLIC_SI3226) || defined(CONFIG_RTK_VOIP_DRIVERS_SLIC_SI3217x)
#define PIN_DO GPIO_ID(GPIO_PORT_E,4) //output for Si3215 daugher board
#elif defined CONFIG_RTK_VOIP_DRIVERS_SLIC_LE88221
#define PIN_DO GPIO_ID(GPIO_PORT_E,4) //output for Le88221 daughter board
#endif
/* DAA used (Reserved)*/
#define PIN_RESET3_DAA GPIO_ID(GPIO_PORT_D,0) //output
#define PIN_CS3_DAA GPIO_ID(GPIO_PORT_D,1) //output
#define PIN_CLK_DAA GPIO_ID(GPIO_PORT_D,2) //output
#define PIN_DI_DAA GPIO_ID(GPIO_PORT_D,3) //input
#define PIN_DO_DAA GPIO_ID(GPIO_PORT_D,4) //output
#endif
////// For 8972B EV Board /////
#ifdef CONFIG_RTK_VOIP_GPIO_8972B
//#define GPIO_OC
#define GPIO "E"
/* SLIC used */
#ifdef CONFIG_RTK_VOIP_DRIVERS_SLIC_LE89116 // for RTL89116 SLIC card
#define PIN_RESET1 GPIO_ID(GPIO_PORT_D,7) //output
#define PIN_CS1 GPIO_ID(GPIO_PORT_D,4) //output
#define PIN_CLK GPIO_ID(GPIO_PORT_D,3) //output
#define PIN_DI GPIO_ID(GPIO_PORT_D,5) //input
#define PIN_DO GPIO_ID(GPIO_PORT_D,6) //output
#else // for Silab SLIC
#ifdef GPIO_OC
#define PIN_RESET1 GPIO_ID(GPIO_PORT_E,6) //output
#define PIN_CS1 GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CLK GPIO_ID(GPIO_PORT_E,5) //output
#define PIN_DI GPIO_ID(GPIO_PORT_D,0) //input
#define PIN_DO GPIO_ID(GPIO_PORT_E,3) //output
#else
#ifdef CONFIG_RTK_VOIP_DECT_SPI_SUPPORT
//#define PIN_RESET1 GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CS1 GPIO_ID(GPIO_PORT_D,3) //output
#define PIN_CLK GPIO_ID(GPIO_PORT_D,4) //output
#define PIN_DI GPIO_ID(GPIO_PORT_D,5) //input
#define PIN_DO GPIO_ID(GPIO_PORT_D,6) //output
#define PIN_INT GPIO_ID(GPIO_PORT_D,7) //intput
#else
#define PIN_RESET1 GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CS1 GPIO_ID(GPIO_PORT_E,1) //output
#ifdef CONFIG_RTK_VOIP_MULTIPLE_SI32178
#define PIN_CS2 GPIO_ID(GPIO_PORT_D,5) //output
#define PIN_CS3 GPIO_ID(GPIO_PORT_F,2) //output
#define PIN_CS4 GPIO_ID(GPIO_PORT_D,0) //output
#endif
#define PIN_CLK GPIO_ID(GPIO_PORT_E,3) //output
#define PIN_DI GPIO_ID(GPIO_PORT_E,4) //input
#define PIN_DO GPIO_ID(GPIO_PORT_E,2) //output
#endif //!GPIO_DECT
#endif //!GPIO_OC
#endif //!CONFIG_RTK_VOIP_DRIVERS_SLIC_LE89116
//#define PIN_INT1 GPIO_ID(GPIO_PORT_E,2) //input
/* DAA used */
#define PIN_RESET3_DAA GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CS3_DAA GPIO_ID(GPIO_PORT_G,0) //output
#define PIN_CLK_DAA GPIO_ID(GPIO_PORT_G,1) //output
#define PIN_DI_DAA GPIO_ID(GPIO_PORT_G,7) //input
#define PIN_DO_DAA GPIO_ID(GPIO_PORT_G,6) //output
/* LED */
#define PIN_VOIP1_LED GPIO_ID(GPIO_PORT_D,1) //output
#define PIN_VOIP2_LED GPIO_ID(GPIO_PORT_D,2) //output
#define PIN_VOIP3_LED GPIO_ID(GPIO_PORT_D,3) //output
#define PIN_VOIP4_LED GPIO_ID(GPIO_PORT_D,4) //output
#define PIN_PSTN_LED GPIO_ID(GPIO_PORT_F,5) //output
#endif
////// For IP Phone /////
#ifdef CONFIG_RTK_VOIP_DRIVERS_IP_PHONE
/* To be modified!! */
#define GPIO "A"
/* SLIC Si3226 */
#define PIN_RESET1 GPIO_ID(GPIO_PORT_H,7) //output
#define PIN_INT1 GPIO_ID(GPIO_PORT_E,2) //input
#define PIN_CS1 GPIO_ID(GPIO_PORT_H,6) //output
#define PIN_CLK GPIO_ID(GPIO_PORT_E,1) //output
#define PIN_DI GPIO_ID(GPIO_PORT_G,3) //input
#define PIN_DO GPIO_ID(GPIO_PORT_G,2) //output
/* DAA used */
#define PIN_RESET3_DAA GPIO_ID(GPIO_PORT_E,0) //output
#define PIN_CS3_DAA GPIO_ID(GPIO_PORT_G,0) //output
#define PIN_CLK_DAA GPIO_ID(GPIO_PORT_G,1) //output
#define PIN_DI_DAA GPIO_ID(GPIO_PORT_G,7) //input
#define PIN_DO_DAA GPIO_ID(GPIO_PORT_G,6) //output
/* LED */
#define PIN_VOIP1_LED GPIO_ID(GPIO_PORT_F,4) //output
#define PIN_VOIP2_LED GPIO_ID(GPIO_PORT_F,2) //output
#define PIN_PSTN_LED GPIO_ID(GPIO_PORT_F,5) //output
#endif
/*==================== FOR RTL8972B Family ==================*/
#ifdef CONFIG_RTK_VOIP_DRIVERS_PCM8972B_FAMILY
/******** GPIO define ********/
/* define GPIO port */
enum GPIO_PORT
{
GPIO_PORT_A = 0,
GPIO_PORT_B,
GPIO_PORT_C,
GPIO_PORT_D,
GPIO_PORT_E,
GPIO_PORT_F,
GPIO_PORT_G,
GPIO_PORT_H,
GPIO_PORT_MAX,
};
/* define GPIO control pin */
enum GPIO_CONTROL
{
GPIO_CONT_GPIO = 0,
GPIO_CONT_PERI = 0x1,
};
/* define GPIO direction */
enum GPIO_DIRECTION
{
GPIO_DIR_IN = 0,
GPIO_DIR_OUT =1,
};
/* define GPIO Interrupt Type */
enum GPIO_INTERRUPT_TYPE
{
GPIO_INT_DISABLE = 0,
GPIO_INT_FALLING_EDGE,
GPIO_INT_RISING_EDGE,
GPIO_INT_BOTH_EDGE,
};
/*************** Define RTL8972B Family GPIO Register Set ************************/
#define GPABCDCNR 0xB8003500
#define GPABCDDIR 0xB8003508
#define GPABCDDATA 0xB800350C
#define GPABCDISR 0xB8003510
#define GPABIMR 0xB8003514
#define GPCDIMR 0xB8003518
#define GPEFGHCNR 0xB800351C
#define GPEFGHDIR 0xB8003524
#define GPEFGHDATA 0xB8003528
#define GPEFGHISR 0xB800352C
#define GPEFIMR 0xB8003530
#define GPGHIMR 0xB8003534
/**************************************************************************/
/* Register access macro (REG*()).*/
#define REG32(reg) (*((volatile uint32 *)(reg)))
#define REG16(reg) (*((volatile uint16 *)(reg)))
#define REG8(reg) (*((volatile uint8 *)(reg)))
/********************* Function Prototype in gpio.c ***********************/
int32 _rtl8972B_initGpioPin(uint32 gpioId, enum GPIO_CONTROL dedicate,
enum GPIO_DIRECTION,
enum GPIO_INTERRUPT_TYPE interruptEnable );
int32 _rtl8972B_getGpioDataBit( uint32 gpioId, uint32* pData );
int32 _rtl8972B_setGpioDataBit( uint32 gpioId, uint32 data );
#endif//CONFIG_RTK_VOIP_DRIVERS_PCM8972B_FAMILY
#endif /* __GPIO_8972B_H */
|