ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / board-rk3168-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 /*
16 ** If you select the macro of CONFIG_SDMMC0_RK29_WRITE_PROTECT, You must define the following values.
17 ** Otherwise, there is no need to define the following values¡£
18 */
19 //#define SDMMC0_WRITE_PROTECT_PIN                  RK30_PIN3_PB2       //According to your own project to set the value of write-protect-pin.
20 //#define SDMMC0_WRITE_PROTECT_ENABLE_VALUE     GPIO_HIGH
21
22 /*
23 ** If you select the macro of CONFIG_SDMMC1_RK29_WRITE_PROTECT, You must define the following values.
24 ** Otherwise, there is no need to define the following values¡£
25 */
26 //#define SDMMC1_WRITE_PROTECT_PIN                  RK30_PIN3_PB3       //According to your own project to set the value of write-protect-pin.
27 //#define SDMMC1_WRITE_PROTECT_ENABLE_VALUE     GPIO_HIGH
28     
29 /*
30 ** If you select the macro of CONFIG_RK29_SDIO_IRQ_FROM_GPIO, You must define the following values.
31 ** Otherwise, there is no need to define the following values¡£
32 */
33 //#define RK29SDK_WIFI_SDIO_CARD_INT         RK30_PIN3_PD2
34
35
36 /*
37 * define sdcard PowerEn-pin
38 */
39 #define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA1
40 #define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
41
42 /*
43 * define the card-detect-pin.
44 */
45 #define RK29SDK_SD_CARD_DETECT_N                RK30_PIN3_PB0  //According to your own project to set the value of card-detect-pin.
46 #define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW       // set the voltage of insert-card. Please pay attention to the default setting.
47
48 /*
49 * Define wifi module's power and reset gpio, and gpio sensitive level.
50 * Please set the value according to your own project.
51 *
52 * Well, you just own engineering module to set the value in the corresponding module branch.
53 * Otherwise, you do not define this macro, eliminate it.
54 *
55 */          
56 #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
57     #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0            
58     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW//GPIO_HIGH        
59     
60 #elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901)
61     #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0                 
62     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH                   
63
64     #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN2_PA7
65     #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
66
67 #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931)
68
69         #ifdef  CONFIG_MACH_RK3168_LR097 
70         #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0 
71         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
72
73         //#define RK30SDK_WIFI_GPIO_RESET_N                 RK30_PIN3_PD1
74         //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
75
76         #else
77         #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN0_PA5
78         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
79
80         #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN3_PD1
81         #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH       
82         #endif
83
84 #elif defined(CONFIG_MT6620)
85     #define COMBO_MODULE_MT6620_CDT    1  // to control antsel2,antsel3 and gps_lan foot when using AcSip or Cdtech chip. 
86                                               //- 1--use Cdtech chip; 0--unuse CDT chip
87
88     //power, PMU_EN
89     #define RK30SDK_WIFI_GPIO_POWER_N                   RK30_PIN3_PC7            
90     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE        GPIO_HIGH        
91     //reset, DAIRST,SYSRST_B
92     #define RK30SDK_WIFI_GPIO_RESET_N                   RK30_PIN3_PD1
93     #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE        GPIO_HIGH 
94     //VDDIO
95     //#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 
96     //#define RK30SDK_WIFI_GPIO_VCCIO_WL_ENABLE_VALUE     GPIO_HIGH
97     //WIFI_INT_B
98     #define RK30SDK_WIFI_GPIO_WIFI_INT_B                RK30_PIN3_PD2
99     #define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE   GPIO_HIGH 
100     //BGF_INT_B
101     #define RK30SDK_WIFI_GPIO_BGF_INT_B                 RK30_PIN6_PA7
102     #define RK30SDK_WIFI_GPIO_BGF_INT_B_ENABLE_VALUE    GPIO_HIGH 
103     //GPS_SYNC
104     #define RK30SDK_WIFI_GPIO_GPS_SYNC                  RK30_PIN3_PD0
105     #define RK30SDK_WIFI_GPIO_GPS_SYNC_ENABLE_VALUE     GPIO_HIGH 
106
107     #if COMBO_MODULE_MT6620_CDT
108     //ANTSEL2
109     #define RK30SDK_WIFI_GPIO_ANTSEL2                   RK30_PIN4_PD4
110     #define RK30SDK_WIFI_GPIO_ANTSEL2_ENABLE_VALUE      GPIO_LOW    //use 6620 in CDT chip, LOW--work; High--no work.
111     //ANTSEL3
112     #define RK30SDK_WIFI_GPIO_ANTSEL3                   RK30_PIN4_PD3
113     #define RK30SDK_WIFI_GPIO_ANTSEL3_ENABLE_VALUE      GPIO_HIGH    //use 6620 in CDT chip, High--work; Low--no work..
114     //GPS_LAN
115     #define RK30SDK_WIFI_GPIO_GPS_LAN                   RK30_PIN4_PD6
116     #define RK30SDK_WIFI_GPIO_GPS_LAN_ENABLE_VALUE      GPIO_HIGH    //use 6620 in CDT chip, High--work; Low--no work..
117     #endif // #if COMBO_MODULE_MT6620_CDT--#endif
118 #endif 
119
120 double rk31sdk_get_sdio_wifi_voltage(void)
121 {
122     double voltage;
123     
124     /******************************************************************************
125     **  Please tell me how much wifi-module uses voltage in your project.  
126     ******************************************************************************/
127 #if defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901)
128     voltage = 1.8 ; //power 1.8V
129     
130 #elif defined(CONFIG_MT5931_MT6622)||defined(CONFIG_MT5931)||defined(CONFIG_MT6620)
131     voltage = 2.8 ; //power 2.8V
132 #elif defined(CONFIG_RDA5990)||defined(CONFIG_RTL8723AS)  
133     voltage = 3.3 ; //power 3.3V
134 #else
135     //default, sdio use 3.0V
136     voltage = 3.0 ; //power 3.0V
137 #endif
138
139     return voltage;
140 }
141
142
143