rk3026: i2s add several attempts to double confirm i2s frac effect
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk3188 / board-rk3188-ds1006h-sdmmc-config.c
1 /*****************************************************************************************
2  * arch/arm/mach-rkxx/baord-xxx-sdmmc-config.c
3  *
4  * Copyright (C) 2013 ROCKCHIP, Inc.
5  *
6  * Description: 
7  *     define the gpio for SD-MMC-SDIO-Wifi functions  according to your own projects.
8  *
9  * Author: Michael Xie
10  *         15 Jan,2013
11  * E-mail: xbw@rock-chips.com
12  *
13  ******************************************************************************************/
14
15 #define DS1006H_V1_2_SUPPORT  1
16
17 /*
18 ** If you select the macro of CONFIG_SDMMC0_RK29_WRITE_PROTECT, You must define the following values.
19 ** Otherwise, there is no need to define the following values¡£
20 */
21 //#define SDMMC0_WRITE_PROTECT_PIN                  RK30_PIN3_PB2       //According to your own project to set the value of write-protect-pin.
22 //#define SDMMC0_WRITE_PROTECT_ENABLE_VALUE     GPIO_HIGH
23
24 /*
25 ** If you select the macro of CONFIG_SDMMC1_RK29_WRITE_PROTECT, You must define the following values.
26 ** Otherwise, there is no need to define the following values¡£
27 */
28 //#define SDMMC1_WRITE_PROTECT_PIN                  RK30_PIN3_PB3       //According to your own project to set the value of write-protect-pin.
29 //#define SDMMC1_WRITE_PROTECT_ENABLE_VALUE     GPIO_HIGH
30     
31 /*
32 ** If you select the macro of CONFIG_RK29_SDIO_IRQ_FROM_GPIO, You must define the following values.
33 ** Otherwise, there is no need to define the following values¡£
34 */
35 //#define RK29SDK_WIFI_SDIO_CARD_INT         RK30_PIN3_PD2
36
37
38 /*
39 * define sdcard PowerEn-pin
40 */
41 #define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA1
42 #define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
43 int rk31sdk_get_sdmmc0_pin_io_voltage(void)
44 {
45     int voltage;
46 #define RK31SDK_SET_SDMMC0_PIN_VOLTAGE
47
48     /**************************************************************************************
49     **  Please tell me how much voltage of your SDMMC0-pin in your project. 
50     **
51     **     ÀýÈç: ÓеÄÏîÄ¿£¬ËüµÄSDMMC0ËùÔÚµÄRKÖ÷¿ØµÄIO×飬ÏëÓÃ1.8V, ¶ø¿¨±¾ÉíÓÃ3.3V, 
52     **  ¶øÖмäͨ¹ý¸öµçƽת»».ÄÇô£¬Äú´Ëʱ£¬Ó¦¸ÃÉèÖÃÏÂÃæµÄvoltageֵΪ 1.8V(¼´1800mv)
53     ***************************************************************************************/
54     voltage = 3300;  //default the voltage 3300mv. 
55
56     return voltage;
57 }
58
59 /*
60 * define the card-detect-pin.
61 */
62 #define RK29SDK_SD_CARD_DETECT_N                RK30_PIN3_PB0  //According to your own project to set the value of card-detect-pin.
63 #define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW       // set the voltage of insert-card. Please pay attention to the default setting.
64
65 #define RK30SDK_WIFI_GPIO_WIFI_INT_B                RK30_PIN3_PD2
66 #define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE   GPIO_HIGH
67
68 /*
69 * Define wifi module's power and reset gpio, and gpio sensitive level.
70 * Please set the value according to your own project.
71 *
72 * Well, you just own engineering module to set the value in the corresponding module branch.
73 * Otherwise, you do not define this macro, eliminate it.
74 *
75 */          
76 #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) || defined(CONFIG_RTL8723AU) 
77     #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0            
78     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW//GPIO_HIGH        
79     
80 #elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI) \
81         || defined(CONFIG_RTL8189ES)
82
83     #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0                 
84     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH                   
85
86     #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN2_PA7
87     #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
88
89 #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931)
90
91         #ifdef  CONFIG_MACH_RK3168_LR097 
92         #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0 
93         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
94
95         //#define RK30SDK_WIFI_GPIO_RESET_N                 RK30_PIN3_PD1
96         //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
97
98         #else
99         #if DS1006H_V1_2_SUPPORT
100       #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0
101         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
102         #else
103         #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN0_PA5
104         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
105
106         #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN3_PD1
107         #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH       
108         #endif
109         #endif
110
111 #elif defined(CONFIG_MT6620)
112     #define COMBO_MODULE_MT6620_CDT    1  // to control antsel2,antsel3 and gps_lan foot when using AcSip or Cdtech chip. 
113                                               //- 1--use Cdtech chip; 0--unuse CDT chip
114
115     //power, PMU_EN
116     #define RK30SDK_WIFI_GPIO_POWER_N                   RK30_PIN3_PC7            
117     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE        GPIO_HIGH        
118     //reset, DAIRST,SYSRST_B
119     #define RK30SDK_WIFI_GPIO_RESET_N                   RK30_PIN3_PD1
120     #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE        GPIO_HIGH 
121     //VDDIO
122     //#define RK30SDK_WIFI_GPIO_VCCIO_WL                  RK30_PIN0_PD2 //You do not get control of the foot, and you do not need to define the macro 
123     //#define RK30SDK_WIFI_GPIO_VCCIO_WL_ENABLE_VALUE     GPIO_HIGH
124     //WIFI_INT_B
125     #define RK30SDK_WIFI_GPIO_WIFI_INT_B                RK30_PIN3_PD2
126     #define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE   GPIO_HIGH 
127     //BGF_INT_B
128     #define RK30SDK_WIFI_GPIO_BGF_INT_B                 RK30_PIN6_PA7
129     #define RK30SDK_WIFI_GPIO_BGF_INT_B_ENABLE_VALUE    GPIO_HIGH 
130     //GPS_SYNC
131     #define RK30SDK_WIFI_GPIO_GPS_SYNC                  RK30_PIN3_PD0
132     #define RK30SDK_WIFI_GPIO_GPS_SYNC_ENABLE_VALUE     GPIO_HIGH 
133
134     #if COMBO_MODULE_MT6620_CDT
135     //ANTSEL2
136     #define RK30SDK_WIFI_GPIO_ANTSEL2                   RK30_PIN4_PD4
137     #define RK30SDK_WIFI_GPIO_ANTSEL2_ENABLE_VALUE      GPIO_LOW    //use 6620 in CDT chip, LOW--work; High--no work.
138     //ANTSEL3
139     #define RK30SDK_WIFI_GPIO_ANTSEL3                   RK30_PIN4_PD3
140     #define RK30SDK_WIFI_GPIO_ANTSEL3_ENABLE_VALUE      GPIO_HIGH    //use 6620 in CDT chip, High--work; Low--no work..
141     //GPS_LAN
142     #define RK30SDK_WIFI_GPIO_GPS_LAN                   RK30_PIN4_PD6
143     #define RK30SDK_WIFI_GPIO_GPS_LAN_ENABLE_VALUE      GPIO_HIGH    //use 6620 in CDT chip, High--work; Low--no work..
144     #endif // #if COMBO_MODULE_MT6620_CDT--#endif
145 #endif 
146
147 int rk31sdk_get_sdio_wifi_voltage(void)
148 {
149     int voltage;
150     
151     /******************************************************************************
152     **  Please tell me how much wifi-module uses voltage in your project.  
153     ******************************************************************************/
154 #if defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI)
155     voltage = 1800 ; //power 1800mV
156     
157 #elif defined(CONFIG_MT5931_MT6622)||defined(CONFIG_MT5931)
158     voltage = 2800 ; //power 1800V
159 #elif defined(CONFIG_MT6620) 
160     voltage = 2800 ; //power 2800V
161 #elif defined(CONFIG_RDA5990)||defined(CONFIG_RTL8723AS) || defined(CONFIG_RTL8189ES) 
162     voltage = 3300 ; //power 3300V
163 #else
164     //default, sdio use 3.0V
165     voltage = 3000 ; //power 3000V
166 #endif
167
168     return voltage;
169 }
170
171
172