1 /* arch/arm/mach-rk29/include/mach/board.h
3 * Copyright (C) 2010 ROCKCHIP, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef __ASM_ARCH_RK29_BOARD_H
16 #define __ASM_ARCH_RK29_BOARD_H
18 #include <linux/device.h>
19 #include <linux/platform_device.h>
20 #include <linux/i2c.h>
21 #include <linux/types.h>
22 #include <linux/timer.h>
23 #include <linux/notifier.h>
27 int (*iomux_init)(void);
28 int (*iomux_deinit)(void);
29 int (*irda_pwr_ctl)(int en);
32 struct rk29_button_light_info{
36 int (*io_deinit)(void);
44 unsigned int cs_iomux_mode;
47 struct rk29xx_spi_platform_data {
48 int (*io_init)(struct spi_cs_gpio*, int);
49 int (*io_deinit)(struct spi_cs_gpio*, int);
50 int (*io_fix_leakage_bug)(void);
51 int (*io_resume_leakage_bug)(void);
52 struct spi_cs_gpio *chipselect_gpios;
57 struct rk29_vmac_platform_data {
58 int (*vmac_register_set)(void);
59 int (*rmii_io_init)(void);
60 int (*rmii_io_deinit)(void);
61 int (*rmii_power_control)(int enable);
64 #define INVALID_GPIO -1
72 int (*io_deinit)(void);
75 struct rk29_fb_setting_info{
87 struct rk29lcd_info *lcd_info;
88 int (*io_init)(struct rk29_fb_setting_info *fb_setting);
89 int (*io_deinit)(void);
90 int (*io_enable)(void);
91 int (*io_disable)(void);
98 int (*io_deinit)(void);
99 int (*pwm_suspend)(void);
100 int (*pwm_resume)(void);
101 int min_brightness; /* 0 ~ 255 */
102 unsigned int delay_ms; /* in milliseconds */
105 struct wifi_platform_data {
106 int (*set_power)(int val);
107 int (*set_reset)(int val);
108 int (*set_carddetect)(int val);
109 void *(*mem_prealloc)(int section, unsigned long size);
110 int (*get_mac_addr)(unsigned char *buf);
113 struct rk29_sdmmc_platform_data {
114 unsigned int host_caps;
115 unsigned int host_ocr_avail;
116 unsigned int use_dma:1;
118 int (*io_init)(void);
119 int (*io_deinit)(void);
120 int (*status)(struct device *);
121 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
123 int enable_sd_wakeup;
125 struct rk29_i2c_platform_data {
128 unsigned int slave_addr;
129 unsigned long scl_rate;
130 #define I2C_MODE_IRQ 0
131 #define I2C_MODE_POLL 1
133 int (*io_init)(void);
134 int (*io_deinit)(void);
137 struct bq27510_platform_data {
138 int (*init_dc_check_pin)(void);
139 unsigned int dc_check_pin;
140 unsigned int bat_num;
144 struct rk29_i2s_platform_data {
145 int (*io_init)(void);
146 int (*io_deinit)(void);
150 struct p1003_platform_data {
153 int (*get_pendown_state)(void);
154 int (*init_platform_hw)(void);
155 int (*p1003_platform_sleep)(void);
156 int (*p1003_platform_wakeup)(void);
157 void (*exit_platform_hw)(void);
159 struct eeti_egalax_platform_data{
162 int (*get_pendown_state)(void);
163 int (*init_platform_hw)(void);
164 int (*eeti_egalax_platform_sleep)(void);
165 int (*eeti_egalax_platform_wakeup)(void);
166 void (*exit_platform_hw)(void);
175 struct sintek_platform_data {
178 int (*get_pendown_state)(void);
179 int (*init_platform_hw)(void);
180 int (*sintek_platform_sleep)(void);
181 int (*sintek_platform_wakeup)(void);
182 void (*exit_platform_hw)(void);
186 struct synaptics_platform_data {
189 int (*get_pendown_state)(void);
190 int (*init_platform_hw)(void);
191 int (*sintek_platform_sleep)(void);
192 int (*sintek_platform_wakeup)(void);
193 void (*exit_platform_hw)(void);
196 struct mma8452_platform_data {
200 signed char orientation[9];
201 int (*get_pendown_state)(void);
202 int (*init_platform_hw)(void);
203 int (*mma8452_platform_sleep)(void);
204 int (*mma8452_platform_wakeup)(void);
205 void (*exit_platform_hw)(void);
208 struct cm3202_platform_data {
211 int (*init_platform_hw)(void);
212 void (*exit_platform_hw)(void);
216 struct it7260_platform_data {
217 int (*get_pendown_state)(void);
218 int (*init_platform_hw)(void);
219 int (*it7260_platform_sleep)(void);
220 int (*it7260_platform_wakeup)(void);
221 void (*exit_platform_hw)(void);
224 struct ft5406_platform_data {
225 int (*get_pendown_state)(void);
226 int (*init_platform_hw)(void);
227 int (*platform_sleep)(void);
228 int (*platform_wakeup)(void);
229 void (*exit_platform_hw)(void);
232 struct goodix_platform_data {
233 int (*get_pendown_state)(void);
234 int (*init_platform_hw)(void);
235 int (*platform_sleep)(void);
236 int (*platform_wakeup)(void);
237 void (*exit_platform_hw)(void);
240 struct cs42l52_platform_data {
241 int (*get_pendown_state)(void);
242 int (*init_platform_hw)(void);
243 int (*platform_sleep)(void);
244 int (*platform_wakeup)(void);
245 void (*exit_platform_hw)(void);
249 struct akm8975_platform_data {
251 char project_name[64];
255 struct rk29_gpio_expander_info {
256 unsigned int gpio_num;
257 unsigned int pin_type;//GPIO_IN or GPIO_OUT
258 unsigned int pin_value;//GPIO_HIGH or GPIO_LOW
260 struct rk29_newton_data {
263 struct tca6424_platform_data {
264 /* the first extern gpio number in all of gpio groups */
265 unsigned int gpio_base;
266 unsigned int gpio_pin_num;
267 /* the first gpio irq number in all of irq source */
269 unsigned int gpio_irq_start;
270 unsigned int irq_pin_num; //number of interrupt
271 unsigned int tca6424_irq_pin; //rk29 gpio
272 unsigned int expand_port_group;
273 unsigned int expand_port_pinnum;
274 unsigned int rk_irq_mode;
275 unsigned int rk_irq_gpio_pull_up_down;
277 /* initial polarity inversion setting */
279 struct rk29_gpio_expander_info *settinginfo;
281 void *context; /* param to setup/teardown */
283 int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
284 int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
286 void (*reseti2cpin)(void);
289 void __init rk29_setup_early_printk(void);
290 void __init rk29_map_common_io(void);
291 void __init board_power_init(void);
293 #define BOOT_MODE_NORMAL 0
294 #define BOOT_MODE_FACTORY2 1
295 #define BOOT_MODE_RECOVERY 2
296 #define BOOT_MODE_CHARGE 3
297 #define BOOT_MODE_POWER_TEST 4
298 #define BOOT_MODE_OFFMODE_CHARGING 5
299 int board_boot_mode(void);
302 periph_pll_96mhz = 96000000, /* save more power */
303 periph_pll_144mhz = 144000000,
304 periph_pll_288mhz = 288000000, /* for USB 1.1 */
305 periph_pll_300mhz = 300000000, /* for Ethernet */
306 #if defined(CONFIG_RK29_VMAC) && defined(CONFIG_USB20_HOST_EN)
307 periph_pll_default = periph_pll_300mhz,
309 periph_pll_default = periph_pll_288mhz,
314 codec_pll_297mhz = 297000000, /* for HDMI */
315 codec_pll_300mhz = 300000000,
316 codec_pll_445mhz = 445500000, /* for HDMI */
317 codec_pll_504mhz = 504000000,
318 codec_pll_552mhz = 552000000,
319 codec_pll_594mhz = 594000000, /* for HDMI */
320 codec_pll_600mhz = 600000000,
323 void __init rk29_clock_init(enum periph_pll ppll_rate); /* codec pll is 445.5MHz, has xin27m */
324 void __init rk29_clock_init2(enum periph_pll ppll_rate, enum codec_pll cpll_rate, bool has_xin27m);
326 /* for USB detection */
327 #ifdef CONFIG_USB_GADGET
328 int board_usb_detect_init(unsigned gpio);
330 static int inline board_usb_detect_init(unsigned gpio) { return 0; }
333 /* for wakeup Android */
334 void rk28_send_wakeup_key(void);