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>
25 struct led_newton_pwm {
30 unsigned int pwm_iomux_pwm;
31 unsigned int pwm_iomux_gpio;
32 unsigned int freq;/**/
33 unsigned int period;/*1-100*/
36 struct led_newton_pwm_platform_data {
38 struct led_newton_pwm* leds;
43 int (*iomux_init)(void);
44 int (*iomux_deinit)(void);
45 int (*irda_pwr_ctl)(int en);
48 struct rk29_button_light_info{
52 int (*io_deinit)(void);
60 unsigned int cs_iomux_mode;
63 struct rk29xx_spi_platform_data {
64 int (*io_init)(struct spi_cs_gpio*, int);
65 int (*io_deinit)(struct spi_cs_gpio*, int);
66 int (*io_fix_leakage_bug)(void);
67 int (*io_resume_leakage_bug)(void);
68 struct spi_cs_gpio *chipselect_gpios;
73 struct rk29_vmac_platform_data {
74 int (*vmac_register_set)(void);
75 int (*rmii_io_init)(void);
76 int (*rmii_io_deinit)(void);
77 int (*rmii_power_control)(int enable);
80 #define INVALID_GPIO -1
88 int (*io_deinit)(void);
91 struct rk29_fb_setting_info{
103 struct rk29lcd_info *lcd_info;
104 int (*io_init)(struct rk29_fb_setting_info *fb_setting);
105 int (*io_deinit)(void);
106 int (*io_enable)(void);
107 int (*io_disable)(void);
113 int (*io_init)(void);
114 int (*io_deinit)(void);
115 int (*pwm_suspend)(void);
116 int (*pwm_resume)(void);
117 int min_brightness; /* 0 ~ 255 */
118 unsigned int delay_ms; /* in milliseconds */
121 struct wifi_platform_data {
122 int (*set_power)(int val);
123 int (*set_reset)(int val);
124 int (*set_carddetect)(int val);
125 void *(*mem_prealloc)(int section, unsigned long size);
126 int (*get_mac_addr)(unsigned char *buf);
129 struct rk29_sdmmc_platform_data {
130 unsigned int host_caps;
131 unsigned int host_ocr_avail;
132 unsigned int use_dma:1;
134 int (*io_init)(void);
135 int (*io_deinit)(void);
136 int (*status)(struct device *);
137 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
139 int enable_sd_wakeup;
141 struct rk29_i2c_platform_data {
144 unsigned int slave_addr;
145 unsigned long scl_rate;
146 #define I2C_MODE_IRQ 0
147 #define I2C_MODE_POLL 1
149 int (*io_init)(void);
150 int (*io_deinit)(void);
153 struct bq27510_platform_data {
154 int (*init_dc_check_pin)(void);
155 unsigned int dc_check_pin;
156 unsigned int bat_num;
160 struct rk29_i2s_platform_data {
161 int (*io_init)(void);
162 int (*io_deinit)(void);
166 struct p1003_platform_data {
169 int (*get_pendown_state)(void);
170 int (*init_platform_hw)(void);
171 int (*p1003_platform_sleep)(void);
172 int (*p1003_platform_wakeup)(void);
173 void (*exit_platform_hw)(void);
175 struct eeti_egalax_platform_data{
178 int (*get_pendown_state)(void);
179 int (*init_platform_hw)(void);
180 int (*eeti_egalax_platform_sleep)(void);
181 int (*eeti_egalax_platform_wakeup)(void);
182 void (*exit_platform_hw)(void);
191 struct sintek_platform_data {
194 int (*get_pendown_state)(void);
195 int (*init_platform_hw)(void);
196 int (*sintek_platform_sleep)(void);
197 int (*sintek_platform_wakeup)(void);
198 void (*exit_platform_hw)(void);
202 struct synaptics_platform_data {
205 int (*get_pendown_state)(void);
206 int (*init_platform_hw)(void);
207 int (*sintek_platform_sleep)(void);
208 int (*sintek_platform_wakeup)(void);
209 void (*exit_platform_hw)(void);
212 struct mma8452_platform_data {
216 signed char orientation[9];
217 int (*get_pendown_state)(void);
218 int (*init_platform_hw)(void);
219 int (*mma8452_platform_sleep)(void);
220 int (*mma8452_platform_wakeup)(void);
221 void (*exit_platform_hw)(void);
224 struct cm3202_platform_data {
227 int (*init_platform_hw)(void);
228 void (*exit_platform_hw)(void);
232 struct it7260_platform_data {
233 int (*get_pendown_state)(void);
234 int (*init_platform_hw)(void);
235 int (*it7260_platform_sleep)(void);
236 int (*it7260_platform_wakeup)(void);
237 void (*exit_platform_hw)(void);
240 struct ft5406_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);
248 struct goodix_platform_data {
249 int (*get_pendown_state)(void);
250 int (*init_platform_hw)(void);
251 int (*platform_sleep)(void);
252 int (*platform_wakeup)(void);
253 void (*exit_platform_hw)(void);
256 struct cs42l52_platform_data {
257 int (*get_pendown_state)(void);
258 int (*init_platform_hw)(void);
259 int (*platform_sleep)(void);
260 int (*platform_wakeup)(void);
261 void (*exit_platform_hw)(void);
265 struct akm8975_platform_data {
267 char project_name[64];
271 struct rk29_gpio_expander_info {
272 unsigned int gpio_num;
273 unsigned int pin_type;//GPIO_IN or GPIO_OUT
274 unsigned int pin_value;//GPIO_HIGH or GPIO_LOW
276 struct rk29_newton_data {
279 struct tca6424_platform_data {
280 /* the first extern gpio number in all of gpio groups */
281 unsigned int gpio_base;
282 unsigned int gpio_pin_num;
283 /* the first gpio irq number in all of irq source */
285 unsigned int gpio_irq_start;
286 unsigned int irq_pin_num; //number of interrupt
287 unsigned int tca6424_irq_pin; //rk29 gpio
288 unsigned int expand_port_group;
289 unsigned int expand_port_pinnum;
290 unsigned int rk_irq_mode;
291 unsigned int rk_irq_gpio_pull_up_down;
293 /* initial polarity inversion setting */
295 struct rk29_gpio_expander_info *settinginfo;
297 void *context; /* param to setup/teardown */
299 int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
300 int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
302 void (*reseti2cpin)(void);
305 void __init rk29_setup_early_printk(void);
306 void __init rk29_map_common_io(void);
307 void __init board_power_init(void);
309 #define BOOT_MODE_NORMAL 0
310 #define BOOT_MODE_FACTORY2 1
311 #define BOOT_MODE_RECOVERY 2
312 #define BOOT_MODE_CHARGE 3
313 #define BOOT_MODE_POWER_TEST 4
314 #define BOOT_MODE_OFFMODE_CHARGING 5
315 int board_boot_mode(void);
318 periph_pll_96mhz = 96000000, /* save more power */
319 periph_pll_144mhz = 144000000,
320 periph_pll_288mhz = 288000000, /* for USB 1.1 */
321 periph_pll_300mhz = 300000000, /* for Ethernet */
322 #if defined(CONFIG_RK29_VMAC) && defined(CONFIG_USB20_HOST_EN)
323 periph_pll_default = periph_pll_300mhz,
325 periph_pll_default = periph_pll_288mhz,
330 codec_pll_297mhz = 297000000, /* for HDMI */
331 codec_pll_300mhz = 300000000,
332 codec_pll_445mhz = 445500000, /* for HDMI */
333 codec_pll_504mhz = 504000000,
334 codec_pll_552mhz = 552000000,
335 codec_pll_594mhz = 594000000, /* for HDMI */
336 codec_pll_600mhz = 600000000,
339 void __init rk29_clock_init(enum periph_pll ppll_rate); /* codec pll is 445.5MHz, has xin27m */
340 void __init rk29_clock_init2(enum periph_pll ppll_rate, enum codec_pll cpll_rate, bool has_xin27m);
342 /* for USB detection */
343 #ifdef CONFIG_USB_GADGET
344 int board_usb_detect_init(unsigned gpio);
346 static int inline board_usb_detect_init(unsigned gpio) { return 0; }
349 /* for wakeup Android */
350 void rk28_send_wakeup_key(void);