840b598dee4edfb2f5cef5d5f62f4720f3fc122c
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2928 / include / mach / board.h
1 #ifndef __MACH_BOARD_H
2 #define __MACH_BOARD_H
3
4 #include <linux/device.h>
5 #include <linux/platform_device.h>
6 #include <linux/i2c.h>
7 #include <linux/types.h>
8 #include <linux/timer.h>
9 #include <linux/notifier.h>
10 #include <asm/setup.h>
11 #include <plat/board.h>
12 #include <mach/sram.h>
13 #include <linux/i2c-gpio.h>
14
15 #define GPIO_SWPORTA_DR  0x0000
16 #define GPIO_SWPORTA_DDR 0x0004
17
18 extern struct rk29_sdmmc_platform_data default_sdmmc0_data;
19 extern struct rk29_sdmmc_platform_data default_sdmmc1_data;
20
21 extern struct i2c_gpio_platform_data default_i2c_gpio_data; 
22
23 void __init rk2928_map_common_io(void);
24 void __init rk2928_init_irq(void);
25 void __init rk2928_map_io(void);
26 struct machine_desc;
27 void __init rk2928_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi);
28 void __init rk2928_clock_data_init(unsigned long gpll,unsigned long cpll,u32 flags);
29 void __init board_clock_init(void);
30 void __init rk2928_iomux_init(void);
31 void board_gpio_suspend(void);
32 void board_gpio_resume(void);
33 void __sramfunc board_pmu_suspend(void);
34 void __sramfunc board_pmu_resume(void);
35
36 extern struct sys_timer rk2928_timer;
37
38 //#if defined  CONFIG_BATTERY_RK30_ADC_FAC 
39 /* adc battery */
40 struct rk30_adc_battery_platform_data {
41         int (*io_init)(void);
42         int (*io_deinit)(void);
43         int (*is_dc_charging)(void);
44         int (*charging_ok)(void);
45
46         int (*is_usb_charging)(void);
47         int spport_usb_charging ;
48
49         int dc_det_pin;
50         int batt_low_pin;
51         int charge_ok_pin;
52         int charge_set_pin;
53
54         int dc_det_level;
55         int batt_low_level;
56         int charge_ok_level;
57         int charge_set_level;
58         
59         int adc_channel;
60
61         int dc_det_pin_pull;    //pull up/down enable/disbale
62         int batt_low_pin_pull;
63         int charge_ok_pin_pull;
64         int charge_set_pin_pull;
65
66         int low_voltage_protection; // low voltage protection
67
68         int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock
69         
70
71         int save_capacity;  //save capacity to /data/bat_last_capacity.dat,  suggested use
72
73         int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
74         int pull_up_res;      //divider resistance ,  pull-up resistor
75         int pull_down_res; //divider resistance , pull-down resistor
76
77         int time_down_discharge; //the time of capactiy drop 1% --discharge
78         int time_up_charge; //the time of capacity up 1% ---charging 
79
80
81 };
82 //#endif
83
84 #ifndef _LINUX_WLAN_PLAT_H_
85 struct wifi_platform_data {
86         int (*set_power)(int val);
87         int (*set_reset)(int val);
88         int (*set_carddetect)(int val);
89         void *(*mem_prealloc)(int section, unsigned long size);
90         int (*get_mac_addr)(unsigned char *buf);
91 };
92 #endif
93 #if defined (CONFIG_EETI_EGALAX)
94 struct eeti_egalax_platform_data{
95         u16     model;
96
97     int     (*get_pendown_state)(void);
98     int     (*init_platform_hw)(void);
99     int     (*eeti_egalax_platform_sleep)(void);
100     int     (*eeti_egalax_platform_wakeup)(void);
101     void    (*exit_platform_hw)(void);
102     int     standby_pin;
103     int     standby_value;
104     int     disp_on_pin;
105     int     disp_on_value;
106  
107 };
108 #endif
109 #if defined (CONFIG_TOUCHSCREEN_SITRONIX_A720)
110 struct ft5x0x_platform_data{
111           u16     model;
112     int     (*get_pendown_state)(void);
113     int     (*init_platform_hw)(void);
114     int     (*ft5x0x_platform_sleep)(void);
115     int     (*ft5x0x_platform_wakeup)(void);
116     void    (*exit_platform_hw)(void);
117 };
118 #endif
119
120 #if defined (CONFIG_TOUCHSCREEN_I30)
121 struct ft5306_platform_data {
122     int rest_pin;
123     int irq_pin ;
124     int     (*get_pendown_state)(void);
125     int     (*init_platform_hw)(void);
126     int     (*platform_sleep)(void);
127     int     (*platform_wakeup)(void);
128     void    (*exit_platform_hw)(void);
129 };
130 #endif
131 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
132 struct byd_platform_data {
133         u16     model;
134         int     pwr_pin;
135         int       int_pin;
136         int     rst_pin;
137         int             pwr_on_value;
138         int     *tp_flag;
139
140         uint16_t screen_max_x;
141         uint16_t screen_max_y;
142         u8 swap_xy :1;
143         u8 xpol :1;
144         u8 ypol :1;     
145 };
146 #endif
147
148
149 #if defined (CONFIG_GPIOEXP_AW9523B)
150 struct gpio_exp_platform_data {
151     int     (*init_platform_hw)(void);
152     void    (*exit_platform_hw)(void);
153 };
154 #endif
155
156 #ifdef CONFIG_INPUT_AP321XX
157 struct ap321xx_platform_data {
158         int (*init_platform_hw)(void);
159         void (*exit_platform_hw)(void);
160 };
161 #endif
162
163 enum _periph_pll {
164         periph_pll_1485mhz = 148500000,
165         periph_pll_297mhz = 297000000,
166         periph_pll_300mhz = 300000000,
167         periph_pll_1188mhz = 1188000000, /* for box*/
168 };
169 enum _codec_pll {
170         codec_pll_360mhz = 360000000, /* for HDMI */
171         codec_pll_408mhz = 408000000,
172         codec_pll_456mhz = 456000000,
173         codec_pll_504mhz = 504000000,
174         codec_pll_552mhz = 552000000, /* for HDMI */
175         codec_pll_600mhz = 600000000,
176         codec_pll_742_5khz = 742500000,
177         codec_pll_798mhz = 798000000,
178         codec_pll_1064mhz = 1064000000,
179         codec_pll_1188mhz = 1188000000,
180 };
181
182 //max i2s rate
183 #define CLK_FLG_MAX_I2S_12288KHZ        (1<<1)
184 #define CLK_FLG_MAX_I2S_22579_2KHZ      (1<<2)
185 #define CLK_FLG_MAX_I2S_24576KHZ        (1<<3)
186 #define CLK_FLG_MAX_I2S_49152KHZ        (1<<4)
187
188 #define RK30_CLOCKS_DEFAULT_FLAGS (CLK_FLG_MAX_I2S_12288KHZ/*|CLK_FLG_EXT_27MHZ*/)
189 #define periph_pll_default periph_pll_297mhz
190 #define codec_pll_default codec_pll_798mhz
191 //#define codec_pll_default codec_pll_1064mhz
192
193
194 #endif