1 /* arch/arm/mach-rk2818/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.
16 #ifndef __ASM_ARCH_RK2818_BOARD_H
17 #define __ASM_ARCH_RK2818_BOARD_H
19 #include <linux/types.h>
20 #include <linux/timer.h>
21 #include <linux/notifier.h>
25 #define INVALID_GPIO -1
28 struct rk2818_io_cfg {
29 int (*io_init)(void *);
30 int (*io_deinit)(void *);
33 /* platform device data structures */
34 struct platform_device;
36 struct rk2818_sdmmc_platform_data {
37 unsigned int host_caps;
38 unsigned int host_ocr_avail;
39 unsigned int use_dma:1;
40 unsigned int no_detect:1;
43 int (*io_deinit)(void);
46 struct rk2818_i2c_spi_data {
49 unsigned int slave_addr;
50 unsigned long scl_rate;
52 struct rk2818_i2c_platform_data {
55 unsigned int slave_addr;
56 unsigned long scl_rate;
57 #define I2C_MODE_IRQ 0
58 #define I2C_MODE_POLL 1
61 int (*io_deinit)(void);
64 struct rk2818_fb_gpio{
70 struct rk2818_fb_iomux{
79 struct rk2818_fb_mach_info {
80 struct rk2818_fb_gpio *gpio;
81 struct rk2818_fb_iomux *iomux;
84 struct rk2818_bl_info{
88 int (*io_deinit)(void);
89 struct timer_list timer;
90 struct notifier_block freq_transition;
93 struct rk2818_gpio_expander_info {
94 unsigned int gpio_num;// ³õʼ»¯µÄpin ½Åºê¶¨Òå È磺RK2818_PIN_PI0
95 unsigned int pin_type;//³õʼ»¯µÄpin ΪÊäÈëpin»¹ÊÇÊä³öpin È磺GPIO_IN
96 unsigned int pin_value;//Èç¹ûΪ output pin ÉèÖõçƽ£¬È磺GPIO_HIGH
100 struct pca9554_platform_data {
101 /* the first extern gpio number in all of gpio groups */
103 unsigned gpio_pin_num;
104 /* the first gpio irq number in all of irq source */
106 unsigned gpio_irq_start;
107 unsigned irq_pin_num; //ÖжϵĸöÊý
108 unsigned pca9954_irq_pin; //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
109 /* initial polarity inversion setting */
111 struct rk2818_gpio_expander_info *settinginfo;
113 void *context; /* param to setup/teardown */
115 int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
116 int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
120 struct tca6424_platform_data {
121 /* the first extern gpio number in all of gpio groups */
123 unsigned gpio_pin_num;
124 /* the first gpio irq number in all of irq source */
126 unsigned gpio_irq_start;
127 unsigned irq_pin_num; //ÖжϵĸöÊý
128 unsigned tca6424_irq_pin; //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio
129 /* initial polarity inversion setting */
131 struct rk2818_gpio_expander_info *settinginfo;
133 void *context; /* param to setup/teardown */
135 int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
136 int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
142 struct lcd_td043mgea1_data{
146 void (*screen_set_iomux)(u8 enable);
150 struct rk2818_battery_platform_data {
151 int (*io_init)(void);
152 int (*io_deinit)(void);
157 struct rk2818_gs_platform_data {
158 int (*io_init)(void);
159 int (*io_deinit)(void);
164 struct rk2818_serial_platform_data {
165 int (*io_init)(void);
166 int (*io_deinit)(void);
170 struct rk2818_i2s_platform_data {
171 int (*io_init)(void);
172 int (*io_deinit)(void);
178 unsigned int cs_gpio;
181 struct rk2818_spi_platform_data {
182 int (*io_init)(void);
183 int (*io_deinit)(void);
184 struct spi_cs_gpio *chipselect_gpios;
188 //ROCKCHIP AD KEY CODE ,for demo board
190 #define AD2KEY1 114 ///VOLUME_DOWN
191 #define AD2KEY2 115 ///VOLUME_UP
192 #define AD2KEY3 59 ///MENU
193 #define AD2KEY4 102 ///HOME
194 #define AD2KEY5 158 ///BACK
195 #define AD2KEY6 61 ///CALL
196 #define AD2KEY7 127 ///SEARCH
198 #define KEYSTART 28 //ENTER
199 #define KEYMENU AD2KEY6 ///CALL
200 #define KEY_PLAY_SHORT_PRESS KEYSTART //code for short press the play key
201 #define KEY_PLAY_LONG_PRESS ENDCALL //code for long press the play key
204 typedef struct tagADC_keyst
206 unsigned int adc_value;
207 unsigned int adc_keycode;
208 }ADC_keyst,*pADC_keyst;
218 ADC_keyst * adc_key_table;
219 unsigned char *initKeyCode;
223 struct rk2818_adckey_platform_data {
224 int (*io_init)(void);
225 int (*io_deinit)(void);
226 struct adc_key_data *adc_key;
229 /* common init routines for use by arch/arm/mach-msm/board-*.c */
230 void __init rk2818_add_devices(void);
231 void __init rk2818_map_common_io(void);
232 void __init rk2818_init_irq(void);
233 void __init rk2818_init_gpio(void);
234 void __init rk2818_clock_init(void);