gt819 and ft5406 update fw and modiry suspend wake up
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk29 / board-rk29-newton.c
1 /* arch/arm/mach-rk29/board-rk29.c
2  *
3  * Copyright (C) 2010 ROCKCHIP, Inc.
4  *
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.
8  *
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.
13  *
14  */
15
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/input.h>
20 #include <linux/io.h>
21 #include <linux/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/spi/spi.h>
24 #include <linux/mmc/host.h>
25 #include <linux/android_pmem.h>
26 #include <linux/usb/android_composite.h>
27
28 #include <mach/hardware.h>
29 #include <asm/setup.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/flash.h>
34 #include <asm/hardware/gic.h>
35
36 #include <mach/iomux.h>
37 #include <mach/gpio.h>
38 #include <mach/irqs.h>
39 #include <mach/rk29_iomap.h>
40 #include <mach/board.h>
41 #include <mach/rk29_nand.h>
42 #include <mach/rk29_camera.h>                          /* ddl@rock-chips.com : camera support */
43 #include <media/soc_camera.h>                               /* ddl@rock-chips.com : camera support */
44 #include <mach/vpu_mem.h>
45 #include <mach/sram.h>
46 #include <mach/ddr.h>
47 #include <mach/cpufreq.h>
48 #include <mach/rk29_smc.h>
49
50 #include <linux/regulator/rk29-pwm-regulator.h>
51 #include <linux/regulator/machine.h>
52
53 #include <linux/mtd/nand.h>
54 #include <linux/mtd/partitions.h>
55 #include <linux/i2c-gpio.h>
56
57 #include "devices.h"
58 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
59
60 #ifdef CONFIG_BU92747GUW_CIR
61 #include "../../../drivers/cir/bu92747guw_cir.h"
62 #endif
63
64 #ifdef CONFIG_VIDEO_RK29
65 /*---------------- Camera Sensor Macro Define Begin  ------------------------*/
66 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
67 #define CONFIG_SENSOR_0                   RK29_CAM_SENSOR_OV2655         /* back camera sensor */
68 #define CONFIG_SENSOR_IIC_ADDR_0              0//0x60
69 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0    1
70 #define CONFIG_SENSOR_POWER_PIN_0         INVALID_GPIO
71 #define CONFIG_SENSOR_RESET_PIN_0         INVALID_GPIO
72 #define CONFIG_SENSOR_POWERDN_PIN_0       INVALID_GPIO
73 #define CONFIG_SENSOR_FALSH_PIN_0         INVALID_GPIO
74 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
75 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
76 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
77 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
78
79 #define CONFIG_SENSOR_1                   RK29_CAM_SENSOR_OV3640                     /* front camera sensor */
80 #define CONFIG_SENSOR_IIC_ADDR_1              0x78
81 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1    1
82 #define CONFIG_SENSOR_POWER_PIN_1         INVALID_GPIO
83 #define CONFIG_SENSOR_RESET_PIN_1         INVALID_GPIO
84 #define CONFIG_SENSOR_POWERDN_PIN_1       RK29_PIN5_PD7
85 #define CONFIG_SENSOR_FALSH_PIN_1         INVALID_GPIO
86 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
87 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
88 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
89 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
90 #endif  //#ifdef CONFIG_VIDEO_RK29
91 /*---------------- Camera Sensor Configuration Macro End------------------------*/
92 #include "../../../drivers/media/video/rk29_camera.c"
93 /*---------------- Camera Sensor Macro Define End  ------------------------*/
94
95 /* Set memory size of pmem */
96 #ifdef CONFIG_RK29_MEM_SIZE_M
97 #define SDRAM_SIZE          (CONFIG_RK29_MEM_SIZE_M * SZ_1M)
98 #else
99 #define SDRAM_SIZE          SZ_512M
100 #endif
101 #define PMEM_GPU_SIZE       SZ_64M
102 #define PMEM_UI_SIZE        SZ_32M
103 #define PMEM_VPU_SIZE       SZ_64M
104 #define PMEM_CAM_SIZE       PMEM_CAM_NECESSARY
105 #ifdef CONFIG_VIDEO_RK29_WORK_IPP
106 #define MEM_CAMIPP_SIZE     SZ_4M
107 #else
108 #define MEM_CAMIPP_SIZE     0
109 #endif
110 #define MEM_FB_SIZE         (3*SZ_2M)
111 #ifdef CONFIG_FB_WORK_IPP
112 #define MEM_FBIPP_SIZE      SZ_8M   //1920 x 1080 x 2 x 2  //RGB565 = x2;RGB888 = x4
113 #else
114 #define MEM_FBIPP_SIZE      0
115 #endif
116 #if SDRAM_SIZE > SZ_512M
117 #define PMEM_GPU_BASE       (RK29_SDRAM_PHYS + SZ_512M - PMEM_GPU_SIZE)
118 #else
119 #define PMEM_GPU_BASE       (RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
120 #endif
121 #define PMEM_UI_BASE        (PMEM_GPU_BASE - PMEM_UI_SIZE)
122 #define PMEM_VPU_BASE       (PMEM_UI_BASE - PMEM_VPU_SIZE)
123 #define PMEM_CAM_BASE       (PMEM_VPU_BASE - PMEM_CAM_SIZE)
124 #define MEM_CAMIPP_BASE     (PMEM_CAM_BASE - MEM_CAMIPP_SIZE)
125 #define MEM_FB_BASE         (MEM_CAMIPP_BASE - MEM_FB_SIZE)
126 #define MEM_FBIPP_BASE      (MEM_FB_BASE - MEM_FBIPP_SIZE)
127 #define LINUX_SIZE          (MEM_FBIPP_BASE - RK29_SDRAM_PHYS)
128
129 #define PREALLOC_WLAN_SEC_NUM           4
130 #define PREALLOC_WLAN_BUF_NUM           160
131 #define PREALLOC_WLAN_SECTION_HEADER    24
132
133 #define WLAN_SECTION_SIZE_0     (PREALLOC_WLAN_BUF_NUM * 128)
134 #define WLAN_SECTION_SIZE_1     (PREALLOC_WLAN_BUF_NUM * 128)
135 #define WLAN_SECTION_SIZE_2     (PREALLOC_WLAN_BUF_NUM * 512)
136 #define WLAN_SECTION_SIZE_3     (PREALLOC_WLAN_BUF_NUM * 1024)
137
138 #define WLAN_SKB_BUF_NUM        16
139
140 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
141
142 struct wifi_mem_prealloc {
143         void *mem_ptr;
144         unsigned long size;
145 };
146
147 extern struct sys_timer rk29_timer;
148
149 static int rk29_nand_io_init(void)
150 {
151     return 0;
152 }
153
154 struct rk29_nand_platform_data rk29_nand_data = {
155     .width      = 1,     /* data bus width in bytes */
156     .hw_ecc     = 1,     /* hw ecc 0: soft ecc */
157     .num_flash    = 1,
158     .io_init   = rk29_nand_io_init,
159 };
160
161 #define TOUCH_SCREEN_STANDBY_PIN          RK29_PIN6_PD1
162 #define TOUCH_SCREEN_STANDBY_VALUE        GPIO_HIGH
163 #define TOUCH_SCREEN_DISPLAY_PIN          INVALID_GPIO
164 #define TOUCH_SCREEN_DISPLAY_VALUE        GPIO_HIGH
165 #ifdef CONFIG_FB_RK29
166 /*****************************************************************************************
167  * lcd  devices
168  * author: zyw@rock-chips.com
169  *****************************************************************************************/
170 //#ifdef  CONFIG_LCD_TD043MGEA1
171 #define LCD_TXD_PIN          INVALID_GPIO
172 #define LCD_CLK_PIN          INVALID_GPIO
173 #define LCD_CS_PIN           INVALID_GPIO
174 /*****************************************************************************************
175 * frame buffe  devices
176 * author: zyw@rock-chips.com
177 *****************************************************************************************/
178 #define FB_ID                       0
179 #define FB_DISPLAY_ON_PIN           RK29_PIN6_PD1
180 #define FB_LCD_STANDBY_PIN          RK29_PIN1_PD6
181 #define FB_LCD_CABC_EN_PIN          RK29_PIN6_PD2
182 #define FB_MCU_FMK_PIN              INVALID_GPIO
183
184 #define FB_DISPLAY_ON_VALUE         GPIO_HIGH
185 #define FB_LCD_STANDBY_VALUE        GPIO_HIGH
186 //#define FB_LCD_STANDBY_VALUE        GPIO_LOW
187
188
189 #define NEWTON_LCD_DISP                         RK29_PIN1_PD6
190 #define NEWTON_LCD_EN                           RK29_PIN6_PD1
191 static int rk29_lcd_io_init(void)
192 {
193     int ret = 0;
194     return ret;
195 }
196
197 static int rk29_lcd_io_deinit(void)
198 {
199     int ret = 0;
200     return ret;
201 }
202
203 static struct rk29lcd_info rk29_lcd_info = {
204     .txd_pin  = LCD_TXD_PIN,
205     .clk_pin = LCD_CLK_PIN,
206     .cs_pin = LCD_CS_PIN,
207     .io_init   = rk29_lcd_io_init,
208     .io_deinit = rk29_lcd_io_deinit,
209 };
210
211 int rk29_fb_io_enable(void)
212 {
213         gpio_direction_output(NEWTON_LCD_DISP, 0);
214         gpio_set_value(NEWTON_LCD_DISP,GPIO_HIGH);
215         gpio_direction_output(NEWTON_LCD_EN, 0);
216         gpio_set_value(NEWTON_LCD_EN,GPIO_LOW);
217     return 0;
218 }
219
220 int rk29_fb_io_disable(void)
221 {
222         gpio_direction_output(NEWTON_LCD_DISP, 0);
223         gpio_set_value(NEWTON_LCD_DISP,GPIO_LOW);
224         gpio_direction_output(NEWTON_LCD_EN, 0);
225         gpio_set_value(NEWTON_LCD_EN,GPIO_HIGH);
226     return 0;
227 }
228
229 static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
230 {
231     if(gpio_request(NEWTON_LCD_DISP,NULL) != 0){
232       gpio_free(NEWTON_LCD_DISP);
233       printk("NEWTON_LCD_DISP gpio_request error\n");
234       return -EIO;
235     }
236     if(gpio_request(NEWTON_LCD_EN,NULL) != 0){
237       gpio_free(NEWTON_LCD_EN);
238       printk("NEWTON_LCD_EN gpio_request error\n");
239       return -EIO;
240     }
241     rk29_fb_io_enable();   //enable it
242     return 0;
243 }
244
245
246 static struct rk29fb_info rk29_fb_info = {
247     .fb_id   = FB_ID,
248     .mcu_fmk_pin = FB_MCU_FMK_PIN,
249     .lcd_info = &rk29_lcd_info,
250     .io_init   = rk29_fb_io_init,
251     .io_enable = rk29_fb_io_enable,
252     .io_disable = rk29_fb_io_disable,
253 };
254
255 /* rk29 fb resource */
256 static struct resource rk29_fb_resource[] = {
257         [0] = {
258         .name  = "lcdc reg",
259                 .start = RK29_LCDC_PHYS,
260                 .end   = RK29_LCDC_PHYS + RK29_LCDC_SIZE - 1,
261                 .flags = IORESOURCE_MEM,
262         },
263         [1] = {
264             .name  = "lcdc irq",
265                 .start = IRQ_LCDC,
266                 .end   = IRQ_LCDC,
267                 .flags = IORESOURCE_IRQ,
268         },
269         [2] = {
270             .name   = "win1 buf",
271         .start  = MEM_FB_BASE,
272         .end    = MEM_FB_BASE + MEM_FB_SIZE - 1,
273         .flags  = IORESOURCE_MEM,
274     },
275     #ifdef CONFIG_FB_WORK_IPP
276     [3] = {
277             .name   = "win1 ipp buf",
278         .start  = MEM_FBIPP_BASE,
279         .end    = MEM_FBIPP_BASE + MEM_FBIPP_SIZE - 1,
280         .flags  = IORESOURCE_MEM,
281     },
282     #endif
283 };
284
285 /*platform_device*/
286 struct platform_device rk29_device_fb = {
287         .name             = "rk29-fb",
288         .id               = 4,
289         .num_resources    = ARRAY_SIZE(rk29_fb_resource),
290         .resource         = rk29_fb_resource,
291         .dev            = {
292                 .platform_data  = &rk29_fb_info,
293         }
294 };
295
296 struct platform_device rk29_device_dma_cpy = {
297         .name             = "dma_memcpy",
298         .id               = 4,
299
300 };
301
302 #endif
303
304 #if defined(CONFIG_RK_IRDA) || defined(CONFIG_BU92747GUW_CIR)
305 #define BU92747GUW_RESET_PIN         RK29_PIN3_PD4// INVALID_GPIO //
306 #define BU92747GUW_RESET_MUX_NAME    GPIO3D4_HOSTWRN_NAME//NULL //
307 #define BU92747GUW_RESET_MUX_MODE    GPIO3H_GPIO3D4//NULL //
308
309 #define BU92747GUW_PWDN_PIN          RK29_PIN3_PD3//RK29_PIN5_PA7 //
310 #define BU92747GUW_PWDN_MUX_NAME     GPIO3D3_HOSTRDN_NAME//GPIO5A7_HSADCDATA2_NAME //
311 #define BU92747GUW_PWDN_MUX_MODE     GPIO3H_GPIO3D3//GPIO5L_GPIO5A7  //
312
313 static int bu92747guw_io_init(void)
314 {
315         int ret;
316         
317         //reset pin
318     if(BU92747GUW_RESET_MUX_NAME != NULL)
319     {
320         rk29_mux_api_set(BU92747GUW_RESET_MUX_NAME, BU92747GUW_RESET_MUX_MODE);
321     }
322         ret = gpio_request(BU92747GUW_RESET_PIN, NULL);
323         if(ret != 0)
324         {
325                 gpio_free(BU92747GUW_RESET_PIN);
326                 printk(">>>>>> BU92747GUW_RESET_PIN gpio_request err \n ");
327         }
328         gpio_direction_output(BU92747GUW_RESET_PIN, GPIO_HIGH);
329
330         //power down pin
331     if(BU92747GUW_PWDN_MUX_NAME != NULL)
332     {
333         rk29_mux_api_set(BU92747GUW_PWDN_MUX_NAME, BU92747GUW_PWDN_MUX_MODE);
334     }
335         ret = gpio_request(BU92747GUW_PWDN_PIN, NULL);
336         if(ret != 0)
337         {
338                 gpio_free(BU92747GUW_PWDN_PIN);
339                 printk(">>>>>> BU92747GUW_PWDN_PIN gpio_request err \n ");
340         }
341
342         //power down as default
343         gpio_direction_output(BU92747GUW_PWDN_PIN, GPIO_LOW);
344         
345         return 0;
346 }
347
348
349 static int bu92747guw_io_deinit(void)
350 {
351         gpio_free(BU92747GUW_PWDN_PIN);
352         gpio_free(BU92747GUW_RESET_PIN);
353         return 0;
354 }
355
356 //power ctl func is share with irda and remote
357 static int nPowerOnCount = 0;
358 static DEFINE_MUTEX(bu92747_power_mutex);
359
360 //1---power on;  0---power off
361 static int bu92747guw_power_ctl(int enable)
362 {
363     printk("%s \n",__FUNCTION__);
364
365         mutex_lock(&bu92747_power_mutex);
366         if (enable) {
367                 nPowerOnCount++;
368                 if (nPowerOnCount == 1) {//power on first       
369                         //smc0_init(NULL);
370                         gpio_set_value(BU92747GUW_PWDN_PIN, GPIO_HIGH);
371                         gpio_set_value(BU92747GUW_RESET_PIN, GPIO_LOW);
372                         mdelay(5);
373                         gpio_set_value(BU92747GUW_RESET_PIN, GPIO_HIGH);
374                         mdelay(5);
375                 }
376         }
377         else {
378                 nPowerOnCount--;
379                 if (nPowerOnCount <= 0) {//power down final
380                         nPowerOnCount = 0;
381                         //smc0_exit();
382                         gpio_set_value(BU92747GUW_PWDN_PIN, GPIO_LOW);
383                 }
384         }
385         mutex_unlock(&bu92747_power_mutex);
386         return 0;
387 }
388 #endif
389
390 #ifdef CONFIG_RK_IRDA
391 #define IRDA_IRQ_PIN           RK29_PIN5_PB2
392 #define IRDA_IRQ_MUX_NAME      GPIO5B2_HSADCDATA5_NAME
393 #define IRDA_IRQ_MUX_MODE      GPIO5L_GPIO5B2
394
395 int irda_iomux_init(void)
396 {
397     int ret = 0;
398
399         //irda irq pin
400     if(IRDA_IRQ_MUX_NAME != NULL)
401     {
402         rk29_mux_api_set(IRDA_IRQ_MUX_NAME, IRDA_IRQ_MUX_MODE);
403     }
404         ret = gpio_request(IRDA_IRQ_PIN, NULL);
405         if(ret != 0)
406         {
407                 gpio_free(IRDA_IRQ_PIN);
408                 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
409         }
410         gpio_pull_updown(IRDA_IRQ_PIN, GPIO_HIGH);
411         gpio_direction_input(IRDA_IRQ_PIN);
412
413     return 0;
414 }
415
416 int irda_iomux_deinit(void)
417 {
418         gpio_free(IRDA_IRQ_PIN);
419         return 0;
420 }
421
422 static struct irda_info rk29_irda_info = {
423     .intr_pin = IRDA_IRQ_PIN,
424     .iomux_init = irda_iomux_init,
425     .iomux_deinit = irda_iomux_deinit,
426         .irda_pwr_ctl = bu92747guw_power_ctl,
427 };
428
429 static struct platform_device irda_device = {
430 #ifdef CONFIG_RK_IRDA_NET
431                         .name   = "rk_irda",
432 #else
433                         .name = "bu92747_irda",
434 #endif
435     .id           = -1,
436         .dev            = {
437                 .platform_data  = &rk29_irda_info,
438         }
439 };
440 #endif
441
442 #ifdef CONFIG_BU92747GUW_CIR
443 #define BU92747_CIR_IRQ_PIN RK29_PIN5_PB0
444 #define CIR_IRQ_PIN_IOMUX_NAME GPIO5B0_HSADCDATA3_NAME
445 #define CIR_IRQ_PIN_IOMUX_VALUE GPIO5L_GPIO5B0
446 static int cir_iomux_init(void)
447 {
448         if (CIR_IRQ_PIN_IOMUX_NAME)
449                 rk29_mux_api_set(CIR_IRQ_PIN_IOMUX_NAME, CIR_IRQ_PIN_IOMUX_VALUE);
450         rk29_mux_api_set(GPIO5A7_HSADCDATA2_NAME, GPIO5L_GPIO5A7);
451         return 0;
452 }
453
454 static struct  bu92747guw_platform_data bu92747guw_pdata = {
455         .intr_pin = BU92747_CIR_IRQ_PIN,
456         .iomux_init = cir_iomux_init,
457         .iomux_deinit = NULL,
458         .cir_pwr_ctl = bu92747guw_power_ctl,
459 };  
460 #endif
461 #ifdef CONFIG_RK29_NEWTON
462 struct rk29_newton_data rk29_newton_info = {    
463 };
464 struct platform_device rk29_device_newton = {
465         .name          = "rk29_newton",
466         .id            = -1,            
467         .dev               = {
468         .platform_data = &rk29_newton_info,     
469                 }           
470         };
471 #endif
472 #if defined (CONFIG_TOUCHSCREEN_FT5406)
473 #define TOUCH_RESET_PIN RK29_PIN6_PC3
474 #define TOUCH_INT_PIN   RK29_PIN0_PA2
475 int ft5406_init_platform_hw(void)
476 {
477         printk("ft5406_init_platform_hw\n");
478     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
479       gpio_free(TOUCH_RESET_PIN);
480       printk("ft5406_init_platform_hw gpio_request error\n");
481       return -EIO;
482     }
483
484     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
485       gpio_free(TOUCH_INT_PIN);
486       printk("ift5406_init_platform_hw gpio_request error\n");
487       return -EIO;
488     }
489
490         gpio_direction_output(TOUCH_RESET_PIN, 0);
491         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
492         mdelay(10);
493         gpio_direction_input(TOUCH_INT_PIN);
494         mdelay(10);
495         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
496         msleep(300);
497     return 0;
498 }
499
500 void ft5406_exit_platform_hw(void)
501 {
502         printk("ft5406_exit_platform_hw\n");
503         gpio_free(TOUCH_RESET_PIN);
504         gpio_free(TOUCH_INT_PIN);
505 }
506
507 int ft5406_platform_sleep(void)
508 {
509         printk("ft5406_platform_sleep\n");
510         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
511         return 0;
512 }
513
514 int ft5406_platform_wakeup(void)
515 {
516         printk("ft5406_platform_wakeup\n");
517         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
518         msleep(300);
519         return 0;
520 }
521
522 struct ft5406_platform_data ft5406_info = {
523
524   .init_platform_hw= ft5406_init_platform_hw,
525   .exit_platform_hw= ft5406_exit_platform_hw,
526   .platform_sleep  = ft5406_platform_sleep,
527   .platform_wakeup = ft5406_platform_wakeup,
528
529 };
530 #endif
531
532 #if defined(CONFIG_TOUCHSCREEN_GT819)
533 #define TOUCH_RESET_PIN RK29_PIN6_PC3
534 #define TOUCH_INT_PIN   RK29_PIN0_PA2
535 int gt819_init_platform_hw(void)
536 {
537         printk("gt819_init_platform_hw\n");
538     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
539       gpio_free(TOUCH_RESET_PIN);
540       printk("gt819_init_platform_hw gpio_request error\n");
541       return -EIO;
542     }
543
544     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
545       gpio_free(TOUCH_INT_PIN);
546       printk("gt819_init_platform_hw gpio_request error\n");
547       return -EIO;
548     }
549         gpio_direction_output(TOUCH_RESET_PIN, 0);
550         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
551         mdelay(10);
552 //      gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
553 //      mdelay(10);
554 //      gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
555         gpio_direction_input(TOUCH_INT_PIN);
556 //      mdelay(10);
557         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
558         msleep(300);
559     return 0;
560 }
561
562
563 void gt819_exit_platform_hw(void)
564 {
565         printk("gt819_exit_platform_hw\n");
566         gpio_free(TOUCH_RESET_PIN);
567         gpio_free(TOUCH_INT_PIN);
568 }
569
570 int gt819_platform_sleep(void)
571 {
572         printk("gt819_platform_sleep\n");
573         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
574         return 0;
575 }
576
577 int gt819_platform_wakeup(void)
578 {
579         printk("gt819_platform_wakeup\n");
580         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
581         //msleep(5);
582         //gpio_set_value(TOUCH_INT_PIN, GPIO_LOW); 
583         //msleep(20);
584         //gpio_set_value(TOUCH_INT_PIN, GPIO_HIGH);
585         return 0;
586 }
587 struct goodix_platform_data goodix_info = {
588
589   .init_platform_hw= gt819_init_platform_hw,
590   .exit_platform_hw= gt819_exit_platform_hw,
591   .platform_sleep  = gt819_platform_sleep,
592   .platform_wakeup = gt819_platform_wakeup,
593
594 };
595 #endif
596
597
598 #if defined (CONFIG_SND_SOC_CS42L52)
599
600 int cs42l52_init_platform_hw()
601 {
602         printk("cs42l52_init_platform_hw\n");
603     if(gpio_request(RK29_PIN6_PB6,NULL) != 0){
604       gpio_free(RK29_PIN6_PB6);
605       printk("cs42l52_init_platform_hw gpio_request error\n");
606       return -EIO;
607     }
608     gpio_direction_output(RK29_PIN6_PB6, 0);
609         gpio_set_value(RK29_PIN6_PB6,GPIO_HIGH);
610         return 0;
611 }
612 struct cs42l52_platform_data cs42l52_info = {
613
614   .init_platform_hw= cs42l52_init_platform_hw,
615
616 };
617 #endif
618 #if defined (CONFIG_BATTERY_BQ27541)
619 #define DC_CHECK_PIN    RK29_PIN4_PA1
620 #define LI_LION_BAT_NUM 1
621 #define CHG_OK RK29_PIN4_PA3
622 #define BAT_LOW RK29_PIN4_PA2
623
624 static int bq27541_init_dc_check_pin(void){     
625         if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){      
626                 gpio_free(DC_CHECK_PIN);      
627                 printk("bq27541 init dc check pin request error\n");      
628                 return -EIO;    
629         }       
630         gpio_direction_input(DC_CHECK_PIN);     
631         return 0;
632 }
633
634 struct bq27541_platform_data bq27541_info = {   
635         .init_dc_check_pin = bq27541_init_dc_check_pin, 
636         .dc_check_pin =  DC_CHECK_PIN,          
637         .bat_num = LI_LION_BAT_NUM,
638         .chgok_check_pin =  CHG_OK,
639         .bat_check_pin =  BAT_LOW,
640 };
641 #endif
642 static struct android_pmem_platform_data android_pmem_pdata = {
643         .name           = "pmem",
644         .start          = PMEM_UI_BASE,
645         .size           = PMEM_UI_SIZE,
646         .no_allocator   = 0,
647         .cached         = 1,
648 };
649
650 static struct platform_device android_pmem_device = {
651         .name           = "android_pmem",
652         .id             = 0,
653         .dev            = {
654                 .platform_data = &android_pmem_pdata,
655         },
656 };
657
658
659 static struct vpu_mem_platform_data vpu_mem_pdata = {
660         .name           = "vpu_mem",
661         .start          = PMEM_VPU_BASE,
662         .size           = PMEM_VPU_SIZE,
663         .cached         = 1,
664 };
665
666 static struct platform_device rk29_vpu_mem_device = {
667         .name           = "vpu_mem",
668         .id                 = 2,
669         .dev            = {
670         .platform_data = &vpu_mem_pdata,
671         },
672 };
673 #ifdef CONFIG_VIDEO_RK29XX_VOUT
674 static struct platform_device rk29_v4l2_output_devce = {
675         .name           = "rk29_vout",
676 };
677 #endif
678 /*HANNSTAR_P1003 touch*/
679 #if defined (CONFIG_HANNSTAR_P1003)
680 #define TOUCH_RESET_PIN RK29_PIN6_PC3
681 #define TOUCH_INT_PIN   RK29_PIN0_PA2
682
683 int p1003_init_platform_hw(void)
684 {
685     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
686       gpio_free(TOUCH_RESET_PIN);
687       printk("p1003_init_platform_hw gpio_request error\n");
688       return -EIO;
689     }
690
691     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
692       gpio_free(TOUCH_INT_PIN);
693       printk("p1003_init_platform_hw gpio_request error\n");
694       return -EIO;
695     }
696     gpio_pull_updown(TOUCH_INT_PIN, 1);
697     gpio_direction_output(TOUCH_RESET_PIN, 0);
698     msleep(500);
699     gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
700     msleep(500);
701     gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
702
703     return 0;
704 }
705
706
707 struct p1003_platform_data p1003_info = {
708   .model= 1003,
709   .init_platform_hw= p1003_init_platform_hw,
710
711 };
712 #endif
713 #if defined (CONFIG_EETI_EGALAX)
714 #define TOUCH_RESET_PIN RK29_PIN6_PC3
715 #define TOUCH_INT_PIN   RK29_PIN0_PA2
716
717 static int EETI_EGALAX_init_platform_hw(void)
718 {
719     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
720       gpio_free(TOUCH_RESET_PIN);
721       printk("p1003_init_platform_hw gpio_request error\n");
722       return -EIO;
723     }
724
725     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
726       gpio_free(TOUCH_INT_PIN);
727       printk("p1003_init_platform_hw gpio_request error\n");
728       return -EIO;
729     }
730     gpio_pull_updown(TOUCH_INT_PIN, 1);
731     gpio_direction_output(TOUCH_RESET_PIN, 0);
732     msleep(500);
733     gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
734     msleep(500);
735     gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
736
737     return 0;
738 }
739
740
741 static struct eeti_egalax_platform_data eeti_egalax_info = {
742   .model= 1003,
743   .init_platform_hw= EETI_EGALAX_init_platform_hw,
744   .standby_pin = TOUCH_SCREEN_STANDBY_PIN,
745   .standby_value = TOUCH_SCREEN_STANDBY_VALUE,
746   .disp_on_pin = TOUCH_SCREEN_DISPLAY_PIN,
747   .disp_on_value = TOUCH_SCREEN_DISPLAY_VALUE,
748 };
749 #endif
750 /*MMA8452 gsensor*/
751 #if defined (CONFIG_GS_MMA8452)
752 #define MMA8452_INT_PIN   RK29_PIN0_PA3
753
754 static int mma8452_init_platform_hw(void)
755 {
756
757     if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
758       gpio_free(MMA8452_INT_PIN);
759       printk("mma8452_init_platform_hw gpio_request error\n");
760       return -EIO;
761     }
762     gpio_pull_updown(MMA8452_INT_PIN, 1);
763     return 0;
764 }
765
766
767 static struct mma8452_platform_data mma8452_info = {
768   .model= 8452,
769   .swap_xy = 0,
770   .init_platform_hw= mma8452_init_platform_hw,
771
772 };
773 #endif
774 #if defined (CONFIG_MPU_SENSORS_MPU3050)
775 /*mpu3050*/
776 static struct mpu3050_platform_data mpu3050_data = {
777                 .int_config = 0x10,
778                 //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
779                 //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
780                 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
781                 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
782                 .level_shifter = 0,
783 #if defined (CONFIG_MPU_SENSORS_KXTF9)
784                 .accel = {
785 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
786                                 .get_slave_descr = NULL ,
787 #else
788                                 .get_slave_descr = get_accel_slave_descr ,                      
789 #endif
790                                 .adapt_num = 0, // The i2c bus to which the mpu device is
791                                 // connected
792                                 //.irq = RK29_PIN0_PA3,
793                                 .bus = EXT_SLAVE_BUS_SECONDARY,  //The secondary I2C of MPU
794                                 .address = 0x0f,
795                                 //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
796                                 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
797                                 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
798                                 .orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
799                 },
800 #endif
801 #if defined (CONFIG_MPU_SENSORS_AK8975)
802                 .compass = {
803 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
804                                 .get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
805 #else
806                                 .get_slave_descr = get_compass_slave_descr,
807 #endif                                          
808                                 .adapt_num = 0, // The i2c bus to which the compass device is. 
809                                 // It can be difference with mpu
810                                 // connected
811                                 //.irq = RK29_PIN0_PA4,
812                                 .bus = EXT_SLAVE_BUS_PRIMARY,
813                                 .address = 0x0d,
814                                 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
815                                 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
816                                 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
817                                 //.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
818                                 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
819                 },
820 };
821 #endif
822 #endif
823 #if defined (CONFIG_BATTERY_BQ27510)
824 #define DC_CHECK_PIN    RK29_PIN4_PA1
825 #define LI_LION_BAT_NUM 2
826 static int bq27510_init_dc_check_pin(void){     
827         if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){      
828                 gpio_free(DC_CHECK_PIN);      
829                 printk("bq27510 init dc check pin request error\n");      
830                 return -EIO;    
831         }       
832         gpio_direction_input(DC_CHECK_PIN);     
833         return 0;
834 }
835
836 struct bq27510_platform_data bq27510_info = {   
837         .init_dc_check_pin = bq27510_init_dc_check_pin, 
838         .dc_check_pin =  DC_CHECK_PIN,          
839         .bat_num = LI_LION_BAT_NUM,
840 };
841 #endif
842
843
844 /*****************************************************************************************
845  * i2c devices
846  * author: kfx@rock-chips.com
847 *****************************************************************************************/
848 static int rk29_i2c0_io_init(void)
849 {
850 #ifdef CONFIG_RK29_I2C0_CONTROLLER
851         rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
852         rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
853 #else
854         rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
855         rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
856 #endif
857         return 0;
858 }
859
860 static int rk29_i2c1_io_init(void)
861 {
862 #ifdef CONFIG_RK29_I2C1_CONTROLLER
863         rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
864         rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
865 #else
866         rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
867         rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
868 #endif
869         return 0;
870 }
871 static int rk29_i2c2_io_init(void)
872 {
873 #ifdef CONFIG_RK29_I2C2_CONTROLLER
874         rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
875         rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
876 #else
877         rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
878         rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
879 #endif
880         return 0;
881 }
882
883 static int rk29_i2c3_io_init(void)
884 {
885 #ifdef CONFIG_RK29_I2C3_CONTROLLER
886         rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
887         rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
888 #else
889         rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
890         rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
891 #endif
892         return 0;
893 }
894 #ifdef CONFIG_RK29_I2C0_CONTROLLER
895 struct rk29_i2c_platform_data default_i2c0_data = {
896         .bus_num    = 0,
897         .flags      = 0,
898         .slave_addr = 0xff,
899         .scl_rate  = 400*1000,
900         .mode           = I2C_MODE_IRQ,
901         .io_init = rk29_i2c0_io_init,
902 };
903 #else
904 struct i2c_gpio_platform_data default_i2c0_data = {
905        .sda_pin = RK29_PIN2_PB6,
906        .scl_pin = RK29_PIN2_PB7,
907        .udelay = 5, // clk = 500/udelay = 100Khz
908        .timeout = 100,//msecs_to_jiffies(200),
909        .bus_num    = 0,
910        .io_init = rk29_i2c0_io_init,
911 };
912 #endif
913 #ifdef CONFIG_RK29_I2C1_CONTROLLER
914 struct rk29_i2c_platform_data default_i2c1_data = {
915         .bus_num    = 1,
916         .flags      = 0,
917         .slave_addr = 0xff,
918         .scl_rate  = 400*1000,
919         .mode           = I2C_MODE_IRQ,
920         .io_init = rk29_i2c1_io_init,
921 };
922 #else
923 struct i2c_gpio_platform_data default_i2c1_data = {
924        .sda_pin = RK29_PIN1_PA6,
925        .scl_pin = RK29_PIN1_PA7,
926        .udelay = 5, // clk = 500/udelay = 100Khz
927        .timeout = 100,//msecs_to_jiffies(200),
928        .bus_num    = 1,
929        .io_init = rk29_i2c1_io_init,
930 };
931 #endif
932 #ifdef CONFIG_RK29_I2C2_CONTROLLER
933 struct rk29_i2c_platform_data default_i2c2_data = {
934         .bus_num    = 2,
935         .flags      = 0,
936         .slave_addr = 0xff,
937         .scl_rate  = 400*1000,
938         .mode           = I2C_MODE_IRQ,
939         .io_init = rk29_i2c2_io_init,
940 };
941 #else
942 struct i2c_gpio_platform_data default_i2c2_data = {
943        .sda_pin = RK29_PIN5_PD3,
944        .scl_pin = RK29_PIN5_PD4,
945        .udelay = 5, // clk = 500/udelay = 100Khz
946        .timeout = 100,//msecs_to_jiffies(200),
947        .bus_num    = 2,
948        .io_init = rk29_i2c2_io_init,
949 };
950 #endif
951 #ifdef CONFIG_RK29_I2C3_CONTROLLER
952 struct rk29_i2c_platform_data default_i2c3_data = {
953         .bus_num    = 3,
954         .flags      = 0,
955         .slave_addr = 0xff,
956         .scl_rate  = 400*1000,
957         .mode           = I2C_MODE_IRQ,
958         .io_init = rk29_i2c3_io_init,
959 };
960 #else
961 struct i2c_gpio_platform_data default_i2c3_data = {
962        .sda_pin = RK29_PIN5_PB5,
963        .scl_pin = RK29_PIN5_PB4,
964        .udelay = 5, // clk = 500/udelay = 100Khz
965        .timeout = 100,//msecs_to_jiffies(200),
966        .bus_num    = 3,
967        .io_init = rk29_i2c3_io_init,
968 };
969 #endif
970 #ifdef CONFIG_I2C0_RK29
971 static struct i2c_board_info __initdata board_i2c0_devices[] = {
972 #if defined (CONFIG_RK1000_CONTROL)
973         {
974                 .type                   = "rk1000_control",
975                 .addr           = 0x40,
976                 .flags                  = 0,
977         },
978 #endif
979 #if defined (CONFIG_SND_SOC_alc5621)
980         {
981                 .type                   = "ALC5621",
982                 .addr                   = 0x1a,
983                 .flags                  = 0,
984         },
985 #endif
986 #if defined (CONFIG_SND_SOC_alc5631)
987         {
988                 .type                   = "rt5631",
989                 .addr                   = 0x1a,
990                 .flags                  = 0,
991         },
992 #endif
993 #if defined (CONFIG_SND_SOC_RK1000)
994         {
995                 .type                   = "rk1000_i2c_codec",
996                 .addr           = 0x60,
997                 .flags                  = 0,
998         },
999 #endif
1000 #if defined (CONFIG_SND_SOC_WM8900)
1001         {
1002                 .type                   = "wm8900",
1003                 .addr           = 0x1A,
1004                 .flags                  = 0,
1005         },
1006 #endif
1007 #if defined (CONFIG_BATTERY_STC3100)
1008         {
1009                 .type                   = "stc3100",
1010                 .addr           = 0x70,
1011                 .flags                  = 0,
1012         },
1013 #endif
1014 #if defined (CONFIG_BATTERY_BQ27510)
1015         {
1016                 .type                   = "bq27510",
1017                 .addr           = 0x55,
1018                 .flags                  = 0,
1019                 .platform_data  = &bq27510_info,
1020         },
1021 #endif
1022 #if defined (CONFIG_RTC_HYM8563)
1023         {
1024                 .type                   = "rtc_hym8563",
1025                 .addr           = 0x51,
1026                 .flags                  = 0,
1027                 .irq            = RK29_PIN0_PA1,
1028         },
1029 #endif
1030 #if defined (CONFIG_GS_MMA8452)
1031     {
1032       .type           = "gs_mma8452",
1033       .addr           = 0x1c,
1034       .flags          = 0,
1035       .irq            = MMA8452_INT_PIN,
1036       .platform_data  = &mma8452_info,
1037     },
1038 #endif
1039 #if defined (CONFIG_COMPASS_AK8973)
1040         {
1041                 .type                   = "ak8973",
1042                 .addr           = 0x1d,
1043                 .flags                  = 0,
1044                 .irq                    = RK29_PIN0_PA4,
1045         },
1046 #endif
1047 #if defined (CONFIG_COMPASS_AK8975)
1048         {
1049                 .type                   = "ak8975",
1050                 .addr           = 0x0d,
1051                 .flags                  = 0,
1052                 .irq                    = RK29_PIN0_PA4,
1053         },
1054 #endif
1055 /*mpu3050*/
1056 #if defined (CONFIG_MPU_SENSORS_MPU3050) 
1057         {
1058                 .type                   = "mpu3050",
1059                 .addr                   = 0x68,
1060                 .flags                  = 0,
1061                 .irq                    = RK29_PIN5_PA3,
1062                 .platform_data  = &mpu3050_data,
1063         },
1064 #endif
1065
1066 #if defined (CONFIG_SND_SOC_CS42L52)
1067         {
1068                 .type                   = "cs42l52",
1069                 .addr           = 0x4A,
1070                 .flags                  = 0,
1071                 .platform_data  = &cs42l52_info,
1072         },
1073 #endif
1074 #if defined (CONFIG_RTC_M41T66)
1075         {
1076                 .type           = "rtc-M41T66",
1077                 .addr           = 0x68,
1078                 .flags          = 0,
1079                 .irq            = RK29_PIN0_PA1,
1080         },
1081 #endif
1082 };
1083 #endif
1084
1085 #ifdef CONFIG_I2C1_RK29
1086 static struct i2c_board_info __initdata board_i2c1_devices[] = {
1087 #if defined (CONFIG_RK1000_CONTROL1)
1088         {
1089                 .type                   = "rk1000_control",
1090                 .addr                   = 0x40,
1091                 .flags                  = 0,
1092         },
1093 #endif
1094 #if defined (CONFIG_ANX7150) || defined (CONFIG_ANX7150_NEW)
1095     {
1096                 .type           = "anx7150",
1097         .addr           = 0x39,             //0x39, 0x3d
1098         .flags          = 0,
1099         .irq            = RK29_PIN1_PD7,
1100     },
1101 #endif
1102 #ifdef CONFIG_BU92747GUW_CIR
1103     {
1104         .type   ="bu92747_cir",
1105         .addr   = 0x77,    
1106         .flags      =0,
1107         .irq            = BU92747_CIR_IRQ_PIN,
1108         .platform_data = &bu92747guw_pdata,
1109     },
1110 #endif
1111
1112 };
1113 #endif
1114
1115 #ifdef CONFIG_I2C2_RK29
1116 static struct i2c_board_info __initdata board_i2c2_devices[] = {
1117 #if defined (CONFIG_HANNSTAR_P1003)
1118     {
1119       .type           = "p1003_touch",
1120       .addr           = 0x04,
1121       .flags          = 0, //I2C_M_NEED_DELAY
1122       .irq            = RK29_PIN0_PA2,
1123       .platform_data  = &p1003_info,
1124       //.udelay           = 100
1125     },
1126 #endif
1127 #if defined (CONFIG_EETI_EGALAX)
1128     {
1129       .type           = "egalax_i2c",
1130       .addr           = 0x04,
1131       .flags          = 0,
1132       .irq            = RK29_PIN0_PA2,
1133       .platform_data  = &eeti_egalax_info,
1134     },
1135 #endif
1136 #if defined (CONFIG_TOUCHSCREEN_GT819)
1137     {
1138                 .type   = "Goodix-TS",
1139                 .addr   = 0x55,
1140                 .flags      =0,
1141                 .irq            =RK29_PIN0_PA2,
1142                 .platform_data = &goodix_info,
1143     },
1144 #endif
1145 #if defined (CONFIG_TOUCHSCREEN_FT5406)
1146     {
1147                 .type   ="ft5x0x_ts",
1148                 .addr   = 0x38,    //0x70,
1149                 .flags      =0,
1150                 .irq            =RK29_PIN0_PA2, // support goodix tp detect, 20110706
1151                 .platform_data = &ft5406_info,
1152     },
1153 #endif
1154 };
1155 #endif
1156
1157 #ifdef CONFIG_I2C3_RK29
1158 static struct i2c_board_info __initdata board_i2c3_devices[] = {
1159         #if defined (CONFIG_BATTERY_BQ27541)
1160         {
1161                 .type                   = "bq27541",
1162                 .addr           = 0x55,
1163                 .flags                  = 0,
1164                 .platform_data  = &bq27541_info,
1165         },
1166 #endif
1167 };
1168 #endif
1169
1170 /*****************************************************************************************
1171  * camera  devices
1172  * author: ddl@rock-chips.com
1173  *****************************************************************************************/
1174 #ifdef CONFIG_VIDEO_RK29
1175 #define CONFIG_SENSOR_POWER_IOCTL_USR      0
1176 #define CONFIG_SENSOR_RESET_IOCTL_USR      0
1177 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR      0
1178 #define CONFIG_SENSOR_FLASH_IOCTL_USR      0
1179
1180 #if CONFIG_SENSOR_POWER_IOCTL_USR
1181 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
1182 {
1183     #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
1184 }
1185 #endif
1186
1187 #if CONFIG_SENSOR_RESET_IOCTL_USR
1188 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
1189 {
1190     #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
1191 }
1192 #endif
1193
1194 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1195 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
1196 {
1197     #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
1198 }
1199 #endif
1200
1201 #if CONFIG_SENSOR_FLASH_IOCTL_USR
1202 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
1203 {
1204     #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
1205 }
1206 #endif
1207
1208 static struct rk29camera_platform_ioctl_cb  sensor_ioctl_cb = {
1209     #if CONFIG_SENSOR_POWER_IOCTL_USR
1210     .sensor_power_cb = sensor_power_usr_cb,
1211     #else
1212     .sensor_power_cb = NULL,
1213     #endif
1214
1215     #if CONFIG_SENSOR_RESET_IOCTL_USR
1216     .sensor_reset_cb = sensor_reset_usr_cb,
1217     #else
1218     .sensor_reset_cb = NULL,
1219     #endif
1220
1221     #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1222     .sensor_powerdown_cb = sensor_powerdown_usr_cb,
1223     #else
1224     .sensor_powerdown_cb = NULL,
1225     #endif
1226
1227     #if CONFIG_SENSOR_FLASH_IOCTL_USR
1228     .sensor_flash_cb = sensor_flash_usr_cb,
1229     #else
1230     .sensor_flash_cb = NULL,
1231     #endif
1232 };
1233 #include "../../../drivers/media/video/rk29_camera.c"
1234 #endif
1235 /*****************************************************************************************
1236  * backlight  devices
1237  * author: nzy@rock-chips.com
1238  *****************************************************************************************/
1239 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1240  /*
1241  GPIO1B5_PWM0_NAME,       GPIO1L_PWM0
1242  GPIO5D2_PWM1_UART1SIRIN_NAME,  GPIO5H_PWM1
1243  GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME,   GPIO2L_PWM2
1244  GPIO1A5_EMMCPWREN_PWM3_NAME,     GPIO1L_PWM3
1245  */
1246
1247 #define PWM_ID            0
1248 #define PWM_MUX_NAME      GPIO1B5_PWM0_NAME
1249 #define PWM_MUX_MODE      GPIO1L_PWM0
1250 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
1251 #define PWM_GPIO RK29_PIN1_PB5
1252 #define PWM_EFFECT_VALUE  0
1253 #define BACKLIGHT_MINVALUE 52
1254 #define LCD_DISP_ON_PIN
1255
1256 #ifdef  LCD_DISP_ON_PIN
1257 //#define BL_EN_MUX_NAME    GPIOF34_UART3_SEL_NAME
1258 //#define BL_EN_MUX_MODE    IOMUXB_GPIO1_B34
1259
1260 #define BL_EN_PIN         RK29_PIN6_PD0
1261 #define BL_EN_VALUE       GPIO_HIGH
1262 #endif
1263 static int rk29_backlight_io_init(void)
1264 {
1265     int ret = 0;
1266
1267     rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1268         #ifdef  LCD_DISP_ON_PIN
1269    // rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
1270
1271     ret = gpio_request(BL_EN_PIN, NULL);
1272     if(ret != 0)
1273     {
1274         gpio_free(BL_EN_PIN);
1275     }
1276
1277     gpio_direction_output(BL_EN_PIN, 0);
1278     gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1279         #endif
1280     return ret;
1281 }
1282
1283 static int rk29_backlight_io_deinit(void)
1284 {
1285     int ret = 0;
1286     #ifdef  LCD_DISP_ON_PIN
1287     gpio_free(BL_EN_PIN);
1288     #endif
1289     rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1290     
1291     return ret;
1292 }
1293
1294 static int rk29_backlight_pwm_suspend(void)
1295 {
1296         int ret = 0;
1297         rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1298         if (gpio_request(PWM_GPIO, NULL)) {
1299                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
1300                 return -1;
1301         }
1302         gpio_direction_output(PWM_GPIO, GPIO_HIGH);
1303         //gpio_direction_output(PWM_GPIO, GPIO_LOW);
1304    #ifdef  LCD_DISP_ON_PIN
1305     gpio_direction_output(BL_EN_PIN, 0);
1306     gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1307    #endif
1308         return ret;
1309 }
1310
1311 static int rk29_backlight_pwm_resume(void)
1312 {
1313         gpio_free(PWM_GPIO);
1314         rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1315
1316     #ifdef  LCD_DISP_ON_PIN
1317     msleep(30);
1318     gpio_direction_output(BL_EN_PIN, 1);
1319     gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
1320     #endif
1321         return 0;
1322 }
1323
1324 struct rk29_bl_info rk29_bl_info = {
1325     .pwm_id   = PWM_ID,
1326     .bl_ref   = PWM_EFFECT_VALUE,
1327     .io_init   = rk29_backlight_io_init,
1328     .io_deinit = rk29_backlight_io_deinit,
1329     .pwm_suspend = rk29_backlight_pwm_suspend,
1330     .pwm_resume = rk29_backlight_pwm_resume,
1331     .min_brightness = BACKLIGHT_MINVALUE,
1332 };
1333 struct platform_device rk29_device_backlight = {
1334                 .name   = "rk29_backlight",
1335                 .id     = -1,
1336         .dev    = {
1337            .platform_data  = &rk29_bl_info,
1338         }
1339 };
1340 #endif
1341 /*****************************************************************************************
1342 * pwm voltage regulator devices
1343 ******************************************************************************************/
1344 #if defined (CONFIG_RK29_PWM_REGULATOR)
1345
1346 #define REGULATOR_PWM_ID                                        2
1347 #define REGULATOR_PWM_MUX_NAME                  GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
1348 #define REGULATOR_PWM_MUX_MODE                                          GPIO2L_PWM2
1349 #define REGULATOR_PWM_MUX_MODE_GPIO                             GPIO2L_GPIO2A3
1350 #define REGULATOR_PWM_GPIO                              RK29_PIN2_PA3
1351
1352 static struct regulator_consumer_supply pwm_consumers[] = {
1353         {
1354                 .supply = "vcore",
1355         }
1356 };
1357
1358 static struct regulator_init_data rk29_pwm_regulator_data = {
1359         .constraints = {
1360                 .name = "PWM2",
1361                 .min_uV =  950000,
1362                 .max_uV = 1400000,
1363                 .apply_uV = 1,
1364                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1365         },
1366         .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
1367         .consumer_supplies = pwm_consumers,
1368 };
1369
1370 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
1371         .pwm_id = REGULATOR_PWM_ID,
1372         .pwm_gpio = REGULATOR_PWM_GPIO,
1373         //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
1374         .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
1375         .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
1376         .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
1377         .init_data  = &rk29_pwm_regulator_data,
1378 };
1379
1380 static struct platform_device rk29_device_pwm_regulator = {
1381         .name = "pwm-voltage-regulator",
1382         .id   = -1,
1383         .dev  = {
1384                 .platform_data = &rk29_regulator_pwm_platform_data,
1385         },
1386 };
1387
1388 #endif
1389
1390 /*****************************************************************************************
1391  * SDMMC devices
1392 *****************************************************************************************/
1393 #ifdef CONFIG_SDMMC0_RK29
1394 static int rk29_sdmmc0_cfg_gpio(void)
1395 {
1396         rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
1397         rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
1398         rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
1399         rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
1400         rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
1401         rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
1402
1403 #ifdef CONFIG_SDMMC_RK29_OLD    
1404         rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
1405 #else
1406         rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);//Modifyed by xbw.
1407 #endif
1408
1409         rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5);   ///GPIO5H_SDMMC0_PWR_EN);  ///GPIO5H_GPIO5D5);
1410         gpio_request(RK29_PIN5_PD5,"sdmmc");
1411 #if 0
1412         gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
1413         mdelay(100);
1414         gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
1415 #else
1416         gpio_direction_output(RK29_PIN5_PD5,GPIO_LOW);
1417 #endif
1418         return 0;
1419 }
1420
1421 #define CONFIG_SDMMC0_USE_DMA
1422 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1423         .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
1424                                            MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
1425                                            MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
1426         .host_caps      = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1427         .io_init = rk29_sdmmc0_cfg_gpio,
1428         .dma_name = "sd_mmc",
1429 #ifdef CONFIG_SDMMC0_USE_DMA
1430         .use_dma  = 1,
1431 #else
1432         .use_dma = 0,
1433 #endif
1434         .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO
1435         .enable_sd_wakeup = 0,
1436 };
1437 #endif
1438 #ifdef CONFIG_SDMMC1_RK29
1439 #define CONFIG_SDMMC1_USE_DMA
1440 static int rk29_sdmmc1_cfg_gpio(void)
1441 {
1442         rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
1443         rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
1444         rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
1445         rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
1446         rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
1447         rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
1448         //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
1449         return 0;
1450 }
1451
1452 #ifdef CONFIG_WIFI_CONTROL_FUNC
1453 static int rk29sdk_wifi_status(struct device *dev);
1454 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
1455 #endif
1456
1457 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N    RK29_PIN1_PD6
1458
1459 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1460         .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
1461                                            MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
1462                                            MMC_VDD_32_33|MMC_VDD_33_34),
1463         .host_caps      = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
1464                                    MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1465         .io_init = rk29_sdmmc1_cfg_gpio,
1466         .dma_name = "sdio",
1467 #ifdef CONFIG_SDMMC1_USE_DMA
1468         .use_dma  = 1,
1469 #else
1470         .use_dma = 0,
1471 #endif
1472 #ifdef CONFIG_WIFI_CONTROL_FUNC
1473         .status = rk29sdk_wifi_status,
1474         .register_status_notify = rk29sdk_wifi_status_register,
1475 #endif
1476 #if 0
1477         .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1478 #endif
1479 };
1480 #endif
1481
1482 #ifdef CONFIG_WIFI_CONTROL_FUNC
1483 #define RK29SDK_WIFI_BT_GPIO_POWER_N       RK29_PIN5_PD6
1484 #define RK29SDK_WIFI_GPIO_RESET_N          RK29_PIN6_PC0
1485 #define RK29SDK_BT_GPIO_RESET_N            RK29_PIN6_PC4
1486
1487 static int rk29sdk_wifi_cd = 0;   /* wifi virtual 'card detect' status */
1488 static void (*wifi_status_cb)(int card_present, void *dev_id);
1489 static void *wifi_status_cb_devid;
1490 int rk29sdk_wifi_power_state = 0;
1491 int rk29sdk_bt_power_state = 0;
1492
1493 static int rk29sdk_wifi_status(struct device *dev)
1494 {
1495         return rk29sdk_wifi_cd;
1496 }
1497
1498 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
1499 {
1500         if(wifi_status_cb)
1501                 return -EAGAIN;
1502         wifi_status_cb = callback;
1503         wifi_status_cb_devid = dev_id;
1504         return 0;
1505 }
1506
1507 static int rk29sdk_wifi_bt_gpio_control_init(void)
1508 {
1509     if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
1510            pr_info("%s: request wifi_bt power gpio failed\n", __func__);
1511            return -1;
1512     }
1513
1514     if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
1515            pr_info("%s: request wifi reset gpio failed\n", __func__);
1516            gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
1517            return -1;
1518     }
1519
1520     if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
1521           pr_info("%s: request bt reset gpio failed\n", __func__);
1522           gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
1523           return -1;
1524     }
1525
1526     gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1527     gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N,    GPIO_LOW);
1528     gpio_direction_output(RK29SDK_BT_GPIO_RESET_N,      GPIO_LOW);
1529
1530     pr_info("%s: init finished\n",__func__);
1531
1532     return 0;
1533 }
1534
1535 static int rk29sdk_wifi_power(int on)
1536 {
1537         pr_info("%s: %d\n", __func__, on);
1538         if (on){
1539                 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
1540                 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
1541                 mdelay(100);
1542                 pr_info("wifi turn on power\n");
1543         }else{
1544                 if (!rk29sdk_bt_power_state){
1545                         gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1546                         mdelay(100);
1547                         pr_info("wifi shut off power\n");
1548                 }else
1549                 {
1550                         pr_info("wifi shouldn't shut off power, bt is using it!\n");
1551                 }
1552                 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1553
1554         }
1555
1556         rk29sdk_wifi_power_state = on;
1557         return 0;
1558 }
1559
1560 static int rk29sdk_wifi_reset_state;
1561 static int rk29sdk_wifi_reset(int on)
1562 {
1563         pr_info("%s: %d\n", __func__, on);
1564         gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
1565         mdelay(100);
1566         rk29sdk_wifi_reset_state = on;
1567         return 0;
1568 }
1569
1570 int rk29sdk_wifi_set_carddetect(int val)
1571 {
1572         pr_info("%s:%d\n", __func__, val);
1573         rk29sdk_wifi_cd = val;
1574         if (wifi_status_cb){
1575                 wifi_status_cb(val, wifi_status_cb_devid);
1576         }else {
1577                 pr_warning("%s, nobody to notify\n", __func__);
1578         }
1579         return 0;
1580 }
1581 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
1582
1583 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
1584         {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
1585         {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
1586         {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
1587         {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
1588 };
1589
1590 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
1591 {
1592         if (section == PREALLOC_WLAN_SEC_NUM)
1593                 return wlan_static_skb;
1594
1595         if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
1596                 return NULL;
1597
1598         if (wifi_mem_array[section].size < size)
1599                 return NULL;
1600
1601         return wifi_mem_array[section].mem_ptr;
1602 }
1603
1604 int __init rk29sdk_init_wifi_mem(void)
1605 {
1606         int i;
1607         int j;
1608
1609         for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
1610                 wlan_static_skb[i] = dev_alloc_skb(
1611                                 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
1612
1613                 if (!wlan_static_skb[i])
1614                         goto err_skb_alloc;
1615         }
1616
1617         for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
1618                 wifi_mem_array[i].mem_ptr =
1619                                 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
1620
1621                 if (!wifi_mem_array[i].mem_ptr)
1622                         goto err_mem_alloc;
1623         }
1624         return 0;
1625
1626 err_mem_alloc:
1627         pr_err("Failed to mem_alloc for WLAN\n");
1628         for (j = 0 ; j < i ; j++)
1629                kfree(wifi_mem_array[j].mem_ptr);
1630
1631         i = WLAN_SKB_BUF_NUM;
1632
1633 err_skb_alloc:
1634         pr_err("Failed to skb_alloc for WLAN\n");
1635         for (j = 0 ; j < i ; j++)
1636                 dev_kfree_skb(wlan_static_skb[j]);
1637
1638         return -ENOMEM;
1639 }
1640
1641 static struct wifi_platform_data rk29sdk_wifi_control = {
1642         .set_power = rk29sdk_wifi_power,
1643         .set_reset = rk29sdk_wifi_reset,
1644         .set_carddetect = rk29sdk_wifi_set_carddetect,
1645         .mem_prealloc   = rk29sdk_mem_prealloc,
1646 };
1647 static struct platform_device rk29sdk_wifi_device = {
1648         .name = "bcm4329_wlan",
1649         .id = 1,
1650         .dev = {
1651                 .platform_data = &rk29sdk_wifi_control,
1652          },
1653 };
1654 #endif
1655
1656
1657 /* bluetooth rfkill device */
1658 static struct platform_device rk29sdk_rfkill = {
1659         .name = "rk29sdk_rfkill",
1660         .id = -1,
1661 };
1662
1663
1664 #ifdef CONFIG_VIVANTE
1665 #define GPU_HIGH_CLOCK        552
1666 #define GPU_LOW_CLOCK         (periph_pll_default / 1000000) /* same as general pll clock rate below */
1667 static struct resource resources_gpu[] = {
1668     [0] = {
1669                 .name   = "gpu_irq",
1670         .start  = IRQ_GPU,
1671         .end    = IRQ_GPU,
1672         .flags  = IORESOURCE_IRQ,
1673     },
1674     [1] = {
1675                 .name   = "gpu_base",
1676         .start  = RK29_GPU_PHYS,
1677         .end    = RK29_GPU_PHYS + RK29_GPU_SIZE - 1,
1678         .flags  = IORESOURCE_MEM,
1679     },
1680     [2] = {
1681                 .name   = "gpu_mem",
1682         .start  = PMEM_GPU_BASE,
1683         .end    = PMEM_GPU_BASE + PMEM_GPU_SIZE - 1,
1684         .flags  = IORESOURCE_MEM,
1685     },
1686     [3] = {
1687                 .name   = "gpu_clk",
1688         .start  = GPU_LOW_CLOCK,
1689         .end    = GPU_HIGH_CLOCK,
1690         .flags  = IORESOURCE_IO,
1691     },
1692 };
1693 static struct platform_device rk29_device_gpu = {
1694     .name             = "galcore",
1695     .id               = 0,
1696     .num_resources    = ARRAY_SIZE(resources_gpu),
1697     .resource         = resources_gpu,
1698 };
1699 #endif
1700
1701 #ifdef CONFIG_KEYS_RK29_NEWTON
1702 extern struct rk29_keys_platform_data rk29_keys_pdata;
1703 static struct platform_device rk29_device_keys = {
1704         .name           = "rk29-keypad",
1705         .id             = -1,
1706         .dev            = {
1707                 .platform_data  = &rk29_keys_pdata,
1708         },
1709 };
1710 #endif
1711
1712 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1713 struct gpio_led rk29_leds[] = {
1714                 {
1715                         .name = "rk29_red_led",
1716                         .gpio = RK29_PIN4_PB2,
1717                         .default_trigger = "timer",
1718                         .active_low = 0,
1719                         .retain_state_suspended = 1,
1720                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1721                 },
1722                 {
1723                         .name = "rk29_green_led",
1724                         .gpio = RK29_PIN4_PB1,
1725                         .default_trigger = "timer",
1726                         .active_low = 0,
1727                         .retain_state_suspended = 1,
1728                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1729                 },
1730                 {
1731                         .name = "rk29_blue_led",
1732                         .gpio = RK29_PIN4_PB0,
1733                         .default_trigger = "timer",
1734                         .active_low = 0,
1735                         .retain_state_suspended = 1,
1736                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1737                 },
1738 };
1739
1740 struct gpio_led_platform_data rk29_leds_pdata = {
1741         .leds = &rk29_leds,
1742         .num_leds       = ARRAY_SIZE(rk29_leds),
1743 };
1744
1745 struct platform_device rk29_device_gpio_leds = {
1746         .name   = "leds-gpio",
1747         .id     = -1,
1748         .dev    = {
1749            .platform_data  = &rk29_leds_pdata,
1750         },
1751 };
1752 #endif
1753
1754 #ifdef CONFIG_LEDS_NEWTON_PWM
1755 static struct led_newton_pwm rk29_pwm_leds[] = {
1756                 {
1757                         .name = "power_led",
1758                         .pwm_id = 1,
1759                         .pwm_gpio = RK29_PIN5_PD2,
1760                         .pwm_iomux_name = GPIO5D2_PWM1_UART1SIRIN_NAME,
1761                         .pwm_iomux_pwm = GPIO5H_PWM1,
1762                         .pwm_iomux_gpio = GPIO5H_GPIO5D2,
1763                         .freq = 1000,
1764                         .period = 255,
1765                 },
1766 };
1767
1768 static struct led_newton_pwm_platform_data rk29_pwm_leds_pdata = {
1769         .leds = &rk29_pwm_leds,
1770         .num_leds       = ARRAY_SIZE(rk29_pwm_leds),
1771 };
1772
1773 static struct platform_device rk29_device_pwm_leds = {
1774         .name   = "leds_newton_pwm",
1775         .id     = -1,
1776         .dev    = {
1777            .platform_data  = &rk29_pwm_leds_pdata,
1778         },
1779 };
1780 \r#endif
1781         
1782 #ifdef CONFIG_USB_ANDROID
1783 struct usb_mass_storage_platform_data newton_mass_storage_pdata = {
1784         .nluns          = 1,
1785         .vendor         = "RockChip",
1786         .product        = "rk29 sdk",
1787         .release        = 0x0100,
1788 };
1789
1790 //static 
1791 struct platform_device newton_usb_mass_storage_device = {
1792         .name   = "usb_mass_storage",
1793         .id     = -1,
1794         .dev    = {
1795                 .platform_data = &newton_mass_storage_pdata,
1796         },
1797 };
1798 #endif
1799 static struct platform_device  rk29_cs42l52_device = {
1800         .name           = "rk29_cs42l52",
1801         .id                 = -1,
1802 };
1803
1804 static void __init rk29_board_iomux_init(void)
1805 {
1806         #ifdef CONFIG_RK29_PWM_REGULATOR
1807         rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
1808         #endif
1809         #ifdef CONFIG_LEDS_GPIO_PLATFORM
1810         rk29_mux_api_set(GPIO4B0_FLASHDATA8_NAME,GPIO4L_GPIO4B0);
1811         rk29_mux_api_set(GPIO4B1_FLASHDATA9_NAME,GPIO4L_GPIO4B1);
1812         rk29_mux_api_set(GPIO4B2_FLASHDATA10_NAME,GPIO4L_GPIO4B2);
1813         #endif
1814         #ifdef CONFIG_LEDS_NEWTON_PWM
1815         rk29_mux_api_set(GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_GPIO5D2);
1816         #endif
1817 }
1818
1819 static struct platform_device *devices[] __initdata = {
1820
1821 #ifdef CONFIG_RK29_WATCHDOG
1822         &rk29_device_wdt,
1823 #endif
1824
1825 #ifdef CONFIG_UART1_RK29
1826         &rk29_device_uart1,
1827 #endif
1828 #ifdef CONFIG_UART0_RK29
1829         &rk29_device_uart0,
1830 #endif
1831 #ifdef CONFIG_UART2_RK29
1832         &rk29_device_uart2,
1833 #endif
1834 #ifdef CONFIG_UART3_RK29
1835         &rk29_device_uart3,
1836 #endif
1837
1838 #ifdef CONFIG_RK29_PWM_REGULATOR
1839         &rk29_device_pwm_regulator,
1840 #endif
1841 #ifdef CONFIG_SPIM0_RK29
1842     &rk29xx_device_spi0m,
1843 #endif
1844 #ifdef CONFIG_SPIM1_RK29
1845     &rk29xx_device_spi1m,
1846 #endif
1847 #ifdef CONFIG_ADC_RK29
1848         &rk29_device_adc,
1849 #endif
1850 #ifdef CONFIG_I2C0_RK29
1851         &rk29_device_i2c0,
1852 #endif
1853 #ifdef CONFIG_I2C1_RK29
1854         &rk29_device_i2c1,
1855 #endif
1856 #ifdef CONFIG_I2C2_RK29
1857         &rk29_device_i2c2,
1858 #endif
1859 #ifdef CONFIG_I2C3_RK29
1860         &rk29_device_i2c3,
1861 #endif
1862
1863 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
1864         &rk29_device_iis_2ch,
1865 #endif
1866 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
1867         &rk29_device_iis_8ch,
1868 #endif
1869
1870 #ifdef CONFIG_KEYS_RK29_NEWTON
1871         &rk29_device_keys,
1872 #endif
1873 #ifdef CONFIG_SDMMC0_RK29
1874         &rk29_device_sdmmc0,
1875 #endif
1876 #ifdef CONFIG_SDMMC1_RK29
1877         &rk29_device_sdmmc1,
1878 #endif
1879
1880 #ifdef CONFIG_MTD_NAND_RK29XX
1881         &rk29xx_device_nand,
1882 #endif
1883
1884 #ifdef CONFIG_WIFI_CONTROL_FUNC
1885         &rk29sdk_wifi_device,
1886 #endif
1887
1888 #ifdef CONFIG_BT
1889         &rk29sdk_rfkill,
1890 #endif
1891
1892 #ifdef CONFIG_MTD_NAND_RK29
1893         &rk29_device_nand,
1894 #endif
1895
1896 #ifdef CONFIG_FB_RK29
1897         &rk29_device_fb,
1898         &rk29_device_dma_cpy,
1899 #endif
1900 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1901         &rk29_device_backlight,
1902 #endif
1903 #ifdef CONFIG_RK29_VMAC
1904         &rk29_device_vmac,
1905 #endif
1906 #ifdef CONFIG_VIVANTE
1907         &rk29_device_gpu,
1908 #endif
1909 #ifdef CONFIG_VIDEO_RK29
1910         &rk29_device_camera,      /* ddl@rock-chips.com : camera support  */
1911         #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
1912         &rk29_soc_camera_pdrv_0,
1913         #endif
1914         &rk29_soc_camera_pdrv_1,
1915         &android_pmem_cam_device,
1916 #endif
1917         &android_pmem_device,
1918         &rk29_vpu_mem_device,
1919 #ifdef CONFIG_USB20_OTG
1920         &rk29_device_usb20_otg,
1921 #endif
1922 #ifdef CONFIG_USB20_HOST
1923         &rk29_device_usb20_host,
1924 #endif
1925 #ifdef CONFIG_USB11_HOST
1926         &rk29_device_usb11_host,
1927 #endif
1928 #ifdef CONFIG_USB_ANDROID
1929         &android_usb_device,
1930         &newton_usb_mass_storage_device,
1931 #endif
1932 #ifdef CONFIG_USB_ANDROID_RNDIS
1933     &rk29_device_rndis,
1934 #endif
1935 #ifdef CONFIG_RK29_IPP
1936         &rk29_device_ipp,
1937 #endif
1938 #ifdef CONFIG_VIDEO_RK29XX_VOUT
1939         &rk29_v4l2_output_devce,
1940 #endif
1941 #ifdef CONFIG_RK29_NEWTON
1942         &rk29_device_newton,
1943 #endif
1944 #ifdef CONFIG_RK_IRDA
1945     &irda_device,
1946 #endif
1947 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1948         &rk29_device_gpio_leds,
1949 #endif
1950 #ifdef CONFIG_LEDS_NEWTON_PWM
1951         &rk29_device_pwm_leds,
1952 #endif
1953 #ifdef CONFIG_SND_RK29_SOC_CS42L52
1954         &rk29_cs42l52_device,
1955 #endif
1956 };
1957
1958 /*****************************************************************************************
1959  * spi devices
1960  * author: cmc@rock-chips.com
1961  *****************************************************************************************/
1962 static int rk29_vmac_register_set(void)
1963 {
1964         //config rk29 vmac as rmii, 100MHz
1965         u32 value= readl(RK29_GRF_BASE + 0xbc);
1966         value = (value & 0xfff7ff) | (0x400);
1967         writel(value, RK29_GRF_BASE + 0xbc);
1968         return 0;
1969 }
1970
1971 static int rk29_rmii_io_init(void)
1972 {
1973         int err;
1974
1975         //phy power gpio
1976         err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
1977         if (err) {
1978                 gpio_free(RK29_PIN6_PB0);
1979                 printk("-------request RK29_PIN6_PB0 fail--------\n");
1980                 return -1;
1981         }
1982         //phy power down
1983         gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1984         gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1985
1986         return 0;
1987 }
1988
1989 static int rk29_rmii_io_deinit(void)
1990 {
1991         //phy power down
1992         gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1993         gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1994         //free
1995         gpio_free(RK29_PIN6_PB0);
1996         return 0;
1997 }
1998
1999 static int rk29_rmii_power_control(int enable)
2000 {
2001         if (enable) {
2002                 //enable phy power
2003                 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
2004                 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
2005         }
2006         else {
2007                 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2008                 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2009         }
2010         return 0;
2011 }
2012
2013 struct rk29_vmac_platform_data rk29_vmac_pdata = {
2014         .vmac_register_set = rk29_vmac_register_set,
2015         .rmii_io_init = rk29_rmii_io_init,
2016         .rmii_io_deinit = rk29_rmii_io_deinit,
2017         .rmii_power_control = rk29_rmii_power_control,
2018 };
2019
2020 /*****************************************************************************************
2021  * spi devices
2022  * author: cmc@rock-chips.com
2023  *****************************************************************************************/
2024 #define SPI_CHIPSELECT_NUM 2
2025 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
2026     {
2027                 .name = "spi0 cs0",
2028                 .cs_gpio = RK29_PIN2_PC1,
2029                 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
2030                 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
2031         },
2032         {
2033                 .name = "spi0 cs1",
2034                 .cs_gpio = RK29_PIN1_PA4,
2035                 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
2036                 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
2037         }
2038 };
2039
2040 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
2041     {
2042                 .name = "spi1 cs0",
2043                 .cs_gpio = RK29_PIN2_PC5,
2044                 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
2045                 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
2046         },
2047         {
2048                 .name = "spi1 cs1",
2049                 .cs_gpio = RK29_PIN1_PA3,
2050                 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
2051                 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
2052         }
2053 };
2054
2055 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
2056 {
2057 #if 1
2058         int i;
2059         if (cs_gpios) {
2060                 for (i=0; i<cs_num; i++) {
2061                         rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
2062                 }
2063         }
2064 #endif
2065         return 0;
2066 }
2067
2068 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
2069 {
2070         return 0;
2071 }
2072
2073 static int spi_io_fix_leakage_bug(void)
2074 {
2075 #if 0
2076         gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
2077 #endif
2078         return 0;
2079 }
2080
2081 static int spi_io_resume_leakage_bug(void)
2082 {
2083 #if 0
2084         gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
2085 #endif
2086         return 0;
2087 }
2088
2089 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
2090         .num_chipselect = SPI_CHIPSELECT_NUM,
2091         .chipselect_gpios = rk29xx_spi0_cs_gpios,
2092         .io_init = spi_io_init,
2093         .io_deinit = spi_io_deinit,
2094         .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2095         .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2096 };
2097
2098 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
2099         .num_chipselect = SPI_CHIPSELECT_NUM,
2100         .chipselect_gpios = rk29xx_spi1_cs_gpios,
2101         .io_init = spi_io_init,
2102         .io_deinit = spi_io_deinit,
2103         .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2104         .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2105 };
2106
2107 /*****************************************************************************************
2108  * xpt2046 touch panel
2109  * author: cmc@rock-chips.com
2110  *****************************************************************************************/
2111 #define XPT2046_GPIO_INT           RK29_PIN0_PA3
2112 #define DEBOUNCE_REPTIME  3
2113
2114 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI)
2115 static struct xpt2046_platform_data xpt2046_info = {
2116         .model                  = 2046,
2117         .keep_vref_on   = 1,
2118         .swap_xy                = 0,
2119         .x_min                  = 0,
2120         .x_max                  = 320,
2121         .y_min                  = 0,
2122         .y_max                  = 480,
2123         .debounce_max           = 7,
2124         .debounce_rep           = DEBOUNCE_REPTIME,
2125         .debounce_tol           = 20,
2126         .gpio_pendown           = XPT2046_GPIO_INT,
2127         .penirq_recheck_delay_usecs = 1,
2128 };
2129 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
2130 static struct xpt2046_platform_data xpt2046_info = {
2131         .model                  = 2046,
2132         .keep_vref_on   = 1,
2133         .swap_xy                = 0,
2134         .x_min                  = 0,
2135         .x_max                  = 320,
2136         .y_min                  = 0,
2137         .y_max                  = 480,
2138         .debounce_max           = 7,
2139         .debounce_rep           = DEBOUNCE_REPTIME,
2140         .debounce_tol           = 20,
2141         .gpio_pendown           = XPT2046_GPIO_INT,
2142         .penirq_recheck_delay_usecs = 1,
2143 };
2144 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2145 static struct xpt2046_platform_data xpt2046_info = {
2146         .model                  = 2046,
2147         .keep_vref_on   = 1,
2148         .swap_xy                = 1,
2149         .x_min                  = 0,
2150         .x_max                  = 800,
2151         .y_min                  = 0,
2152         .y_max                  = 480,
2153         .debounce_max           = 7,
2154         .debounce_rep           = DEBOUNCE_REPTIME,
2155         .debounce_tol           = 20,
2156         .gpio_pendown           = XPT2046_GPIO_INT,
2157
2158         .penirq_recheck_delay_usecs = 1,
2159 };
2160 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2161 static struct xpt2046_platform_data xpt2046_info = {
2162         .model                  = 2046,
2163         .keep_vref_on   = 1,
2164         .swap_xy                = 1,
2165         .x_min                  = 0,
2166         .x_max                  = 800,
2167         .y_min                  = 0,
2168         .y_max                  = 480,
2169         .debounce_max           = 7,
2170         .debounce_rep           = DEBOUNCE_REPTIME,
2171         .debounce_tol           = 20,
2172         .gpio_pendown           = XPT2046_GPIO_INT,
2173
2174         .penirq_recheck_delay_usecs = 1,
2175 };
2176 #endif
2177
2178 static struct spi_board_info board_spi_devices[] = {
2179 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\
2180     ||defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2181         {
2182                 .modalias       = "xpt2046_ts",
2183                 .chip_select    = 0,
2184                 .max_speed_hz   = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
2185                 .bus_num        = 0,
2186                 .irq = XPT2046_GPIO_INT,
2187                 .platform_data = &xpt2046_info,
2188         },
2189 #endif
2190 };
2191
2192
2193 static void __init rk29_gic_init_irq(void)
2194 {
2195         gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
2196         gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
2197 }
2198
2199 static void __init machine_rk29_init_irq(void)
2200 {
2201         rk29_gic_init_irq();
2202         rk29_gpio_init();
2203 }
2204
2205 static struct cpufreq_frequency_table freq_table[] = {
2206         { .index = 1200000, .frequency =  408000 },
2207         { .index = 1200000, .frequency =  816000 },
2208         { .index = 1300000, .frequency = 1008000 },
2209         { .frequency = CPUFREQ_TABLE_END },
2210 };
2211
2212
2213 static void __init machine_rk29_board_init(void)
2214 {
2215         rk29_board_iomux_init();
2216
2217         board_power_init();
2218         board_update_cpufreq_table(freq_table);
2219
2220                 platform_add_devices(devices, ARRAY_SIZE(devices));
2221 #ifdef CONFIG_I2C0_RK29
2222         i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
2223                         ARRAY_SIZE(board_i2c0_devices));
2224 #endif
2225 #ifdef CONFIG_I2C1_RK29
2226         i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
2227                         ARRAY_SIZE(board_i2c1_devices));
2228 #endif
2229 #ifdef CONFIG_I2C2_RK29
2230         i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
2231                         ARRAY_SIZE(board_i2c2_devices));
2232 #endif
2233 #ifdef CONFIG_I2C3_RK29
2234         i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
2235                         ARRAY_SIZE(board_i2c3_devices));
2236 #endif
2237
2238         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2239         
2240 #ifdef CONFIG_WIFI_CONTROL_FUNC
2241         rk29sdk_wifi_bt_gpio_control_init();
2242         rk29sdk_init_wifi_mem();
2243 #endif
2244
2245         board_usb_detect_init(RK29_PIN0_PA0);
2246
2247 #if defined(CONFIG_RK_IRDA) || defined(CONFIG_BU92747GUW_CIR)
2248         smc0_init(NULL);
2249         bu92747guw_io_init();
2250 #endif
2251
2252 }
2253
2254 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
2255                                         char **cmdline, struct meminfo *mi)
2256 {
2257         mi->nr_banks = 1;
2258         mi->bank[0].start = RK29_SDRAM_PHYS;
2259         mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
2260         mi->bank[0].size = LINUX_SIZE;
2261 #if SDRAM_SIZE > SZ_512M
2262         mi->nr_banks = 2;
2263         mi->bank[1].start = RK29_SDRAM_PHYS + SZ_512M;
2264         mi->bank[1].size = SDRAM_SIZE - SZ_512M;
2265 #endif
2266 }
2267
2268 static void __init machine_rk29_mapio(void)
2269 {
2270         rk29_map_common_io();
2271         rk29_setup_early_printk();
2272         rk29_sram_init();
2273         rk29_clock_init(periph_pll_default);
2274         rk29_iomux_init();
2275     ddr_init(DDR_TYPE,DDR_FREQ);  // DDR3_1333H, 400
2276 }
2277
2278 MACHINE_START(RK29, "RK29board")
2279         /* UART for LL DEBUG */
2280         .phys_io        = RK29_UART1_PHYS & 0xfff00000,
2281         .io_pg_offst    = ((RK29_UART1_BASE) >> 18) & 0xfffc,
2282         .boot_params    = RK29_SDRAM_PHYS + 0x88000,
2283         .fixup          = machine_rk29_fixup,
2284         .map_io         = machine_rk29_mapio,
2285         .init_irq       = machine_rk29_init_irq,
2286         .init_machine   = machine_rk29_board_init,
2287         .timer          = &rk29_timer,
2288 MACHINE_END