newton:add newton backlight
[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         return 0;
519 }
520
521 struct ft5406_platform_data ft5406_info = {
522
523   .init_platform_hw= ft5406_init_platform_hw,
524   .exit_platform_hw= ft5406_exit_platform_hw,
525   .platform_sleep  = ft5406_platform_sleep,
526   .platform_wakeup = ft5406_platform_wakeup,
527
528 };
529 #endif
530
531 #if defined(CONFIG_TOUCHSCREEN_GT819)
532 #define TOUCH_RESET_PIN RK29_PIN6_PC3
533 #define TOUCH_INT_PIN   RK29_PIN0_PA2
534 int gt819_init_platform_hw(void)
535 {
536         printk("gt819_init_platform_hw\n");
537     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
538       gpio_free(TOUCH_RESET_PIN);
539       printk("gt819_init_platform_hw gpio_request error\n");
540       return -EIO;
541     }
542
543     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
544       gpio_free(TOUCH_INT_PIN);
545       printk("gt819_init_platform_hw gpio_request error\n");
546       return -EIO;
547     }
548         gpio_direction_output(TOUCH_RESET_PIN, 0);
549         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
550         mdelay(10);
551         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
552         mdelay(10);
553         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
554         gpio_direction_input(TOUCH_INT_PIN);
555         mdelay(10);
556         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
557         msleep(300);
558     return 0;
559 }
560
561
562 void gt819_exit_platform_hw(void)
563 {
564         printk("gt819_exit_platform_hw\n");
565         gpio_free(TOUCH_RESET_PIN);
566         gpio_free(TOUCH_INT_PIN);
567 }
568
569 int gt819_platform_sleep(void)
570 {
571         printk("gt819_platform_sleep\n");
572         gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
573         return 0;
574 }
575
576 int gt819_platform_wakeup(void)
577 {
578         printk("gt819_platform_wakeup\n");
579         gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
580         //msleep(5);
581         //gpio_set_value(TOUCH_INT_PIN, GPIO_LOW); 
582         //msleep(20);
583         //gpio_set_value(TOUCH_INT_PIN, GPIO_HIGH);
584         return 0;
585 }
586 struct goodix_platform_data goodix_info = {
587
588   .init_platform_hw= gt819_init_platform_hw,
589   .exit_platform_hw= gt819_exit_platform_hw,
590   .platform_sleep  = gt819_platform_sleep,
591   .platform_wakeup = gt819_platform_wakeup,
592
593 };
594 #endif
595
596
597 #if defined (CONFIG_SND_SOC_CS42L52)
598
599 int cs42l52_init_platform_hw()
600 {
601         printk("cs42l52_init_platform_hw\n");
602     if(gpio_request(RK29_PIN6_PB6,NULL) != 0){
603       gpio_free(RK29_PIN6_PB6);
604       printk("cs42l52_init_platform_hw gpio_request error\n");
605       return -EIO;
606     }
607     gpio_direction_output(RK29_PIN6_PB6, 0);
608         gpio_set_value(RK29_PIN6_PB6,GPIO_HIGH);
609         return 0;
610 }
611 struct cs42l52_platform_data cs42l52_info = {
612
613   .init_platform_hw= cs42l52_init_platform_hw,
614
615 };
616 #endif
617 #if defined (CONFIG_BATTERY_BQ27541)
618 #define DC_CHECK_PIN    RK29_PIN4_PA1
619 #define LI_LION_BAT_NUM 1
620 static int bq27541_init_dc_check_pin(void){     
621         if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){      
622                 gpio_free(DC_CHECK_PIN);      
623                 printk("bq27541 init dc check pin request error\n");      
624                 return -EIO;    
625         }       
626         gpio_direction_input(DC_CHECK_PIN);     
627         return 0;
628 }
629
630 struct bq27541_platform_data bq27541_info = {   
631         .init_dc_check_pin = bq27541_init_dc_check_pin, 
632         .dc_check_pin =  DC_CHECK_PIN,          
633         .bat_num = LI_LION_BAT_NUM,
634 };
635 #endif
636 static struct android_pmem_platform_data android_pmem_pdata = {
637         .name           = "pmem",
638         .start          = PMEM_UI_BASE,
639         .size           = PMEM_UI_SIZE,
640         .no_allocator   = 0,
641         .cached         = 1,
642 };
643
644 static struct platform_device android_pmem_device = {
645         .name           = "android_pmem",
646         .id             = 0,
647         .dev            = {
648                 .platform_data = &android_pmem_pdata,
649         },
650 };
651
652
653 static struct vpu_mem_platform_data vpu_mem_pdata = {
654         .name           = "vpu_mem",
655         .start          = PMEM_VPU_BASE,
656         .size           = PMEM_VPU_SIZE,
657         .cached         = 1,
658 };
659
660 static struct platform_device rk29_vpu_mem_device = {
661         .name           = "vpu_mem",
662         .id                 = 2,
663         .dev            = {
664         .platform_data = &vpu_mem_pdata,
665         },
666 };
667 #ifdef CONFIG_VIDEO_RK29XX_VOUT
668 static struct platform_device rk29_v4l2_output_devce = {
669         .name           = "rk29_vout",
670 };
671 #endif
672 /*HANNSTAR_P1003 touch*/
673 #if defined (CONFIG_HANNSTAR_P1003)
674 #define TOUCH_RESET_PIN RK29_PIN6_PC3
675 #define TOUCH_INT_PIN   RK29_PIN0_PA2
676
677 int p1003_init_platform_hw(void)
678 {
679     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
680       gpio_free(TOUCH_RESET_PIN);
681       printk("p1003_init_platform_hw gpio_request error\n");
682       return -EIO;
683     }
684
685     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
686       gpio_free(TOUCH_INT_PIN);
687       printk("p1003_init_platform_hw gpio_request error\n");
688       return -EIO;
689     }
690     gpio_pull_updown(TOUCH_INT_PIN, 1);
691     gpio_direction_output(TOUCH_RESET_PIN, 0);
692     msleep(500);
693     gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
694     msleep(500);
695     gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
696
697     return 0;
698 }
699
700
701 struct p1003_platform_data p1003_info = {
702   .model= 1003,
703   .init_platform_hw= p1003_init_platform_hw,
704
705 };
706 #endif
707 #if defined (CONFIG_EETI_EGALAX)
708 #define TOUCH_RESET_PIN RK29_PIN6_PC3
709 #define TOUCH_INT_PIN   RK29_PIN0_PA2
710
711 static int EETI_EGALAX_init_platform_hw(void)
712 {
713     if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
714       gpio_free(TOUCH_RESET_PIN);
715       printk("p1003_init_platform_hw gpio_request error\n");
716       return -EIO;
717     }
718
719     if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
720       gpio_free(TOUCH_INT_PIN);
721       printk("p1003_init_platform_hw gpio_request error\n");
722       return -EIO;
723     }
724     gpio_pull_updown(TOUCH_INT_PIN, 1);
725     gpio_direction_output(TOUCH_RESET_PIN, 0);
726     msleep(500);
727     gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
728     msleep(500);
729     gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
730
731     return 0;
732 }
733
734
735 static struct eeti_egalax_platform_data eeti_egalax_info = {
736   .model= 1003,
737   .init_platform_hw= EETI_EGALAX_init_platform_hw,
738   .standby_pin = TOUCH_SCREEN_STANDBY_PIN,
739   .standby_value = TOUCH_SCREEN_STANDBY_VALUE,
740   .disp_on_pin = TOUCH_SCREEN_DISPLAY_PIN,
741   .disp_on_value = TOUCH_SCREEN_DISPLAY_VALUE,
742 };
743 #endif
744 /*MMA8452 gsensor*/
745 #if defined (CONFIG_GS_MMA8452)
746 #define MMA8452_INT_PIN   RK29_PIN0_PA3
747
748 static int mma8452_init_platform_hw(void)
749 {
750
751     if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
752       gpio_free(MMA8452_INT_PIN);
753       printk("mma8452_init_platform_hw gpio_request error\n");
754       return -EIO;
755     }
756     gpio_pull_updown(MMA8452_INT_PIN, 1);
757     return 0;
758 }
759
760
761 static struct mma8452_platform_data mma8452_info = {
762   .model= 8452,
763   .swap_xy = 0,
764   .init_platform_hw= mma8452_init_platform_hw,
765
766 };
767 #endif
768 #if defined (CONFIG_MPU_SENSORS_MPU3050)
769 /*mpu3050*/
770 static struct mpu3050_platform_data mpu3050_data = {
771                 .int_config = 0x10,
772                 //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
773                 //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
774                 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
775                 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
776                 .level_shifter = 0,
777 #if defined (CONFIG_MPU_SENSORS_KXTF9)
778                 .accel = {
779 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
780                                 .get_slave_descr = NULL ,
781 #else
782                                 .get_slave_descr = get_accel_slave_descr ,                      
783 #endif
784                                 .adapt_num = 0, // The i2c bus to which the mpu device is
785                                 // connected
786                                 //.irq = RK29_PIN0_PA3,
787                                 .bus = EXT_SLAVE_BUS_SECONDARY,  //The secondary I2C of MPU
788                                 .address = 0x0f,
789                                 //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
790                                 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
791                                 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
792                                 .orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
793                 },
794 #endif
795 #if defined (CONFIG_MPU_SENSORS_AK8975)
796                 .compass = {
797 #ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
798                                 .get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
799 #else
800                                 .get_slave_descr = get_compass_slave_descr,
801 #endif                                          
802                                 .adapt_num = 0, // The i2c bus to which the compass device is. 
803                                 // It can be difference with mpu
804                                 // connected
805                                 //.irq = RK29_PIN0_PA4,
806                                 .bus = EXT_SLAVE_BUS_PRIMARY,
807                                 .address = 0x0d,
808                                 //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
809                                 //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
810                                 //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
811                                 //.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
812                                 .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
813                 },
814 };
815 #endif
816 #endif
817 #if defined (CONFIG_BATTERY_BQ27510)
818 #define DC_CHECK_PIN    RK29_PIN4_PA1
819 #define LI_LION_BAT_NUM 2
820 static int bq27510_init_dc_check_pin(void){     
821         if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){      
822                 gpio_free(DC_CHECK_PIN);      
823                 printk("bq27510 init dc check pin request error\n");      
824                 return -EIO;    
825         }       
826         gpio_direction_input(DC_CHECK_PIN);     
827         return 0;
828 }
829
830 struct bq27510_platform_data bq27510_info = {   
831         .init_dc_check_pin = bq27510_init_dc_check_pin, 
832         .dc_check_pin =  DC_CHECK_PIN,          
833         .bat_num = LI_LION_BAT_NUM,
834 };
835 #endif
836
837
838 /*****************************************************************************************
839  * i2c devices
840  * author: kfx@rock-chips.com
841 *****************************************************************************************/
842 static int rk29_i2c0_io_init(void)
843 {
844 #ifdef CONFIG_RK29_I2C0_CONTROLLER
845         rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
846         rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
847 #else
848         rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
849         rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
850 #endif
851         return 0;
852 }
853
854 static int rk29_i2c1_io_init(void)
855 {
856 #ifdef CONFIG_RK29_I2C1_CONTROLLER
857         rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
858         rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
859 #else
860         rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
861         rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
862 #endif
863         return 0;
864 }
865 static int rk29_i2c2_io_init(void)
866 {
867 #ifdef CONFIG_RK29_I2C2_CONTROLLER
868         rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
869         rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
870 #else
871         rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
872         rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
873 #endif
874         return 0;
875 }
876
877 static int rk29_i2c3_io_init(void)
878 {
879 #ifdef CONFIG_RK29_I2C3_CONTROLLER
880         rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
881         rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
882 #else
883         rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
884         rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
885 #endif
886         return 0;
887 }
888 #ifdef CONFIG_RK29_I2C0_CONTROLLER
889 struct rk29_i2c_platform_data default_i2c0_data = {
890         .bus_num    = 0,
891         .flags      = 0,
892         .slave_addr = 0xff,
893         .scl_rate  = 400*1000,
894         .mode           = I2C_MODE_IRQ,
895         .io_init = rk29_i2c0_io_init,
896 };
897 #else
898 struct i2c_gpio_platform_data default_i2c0_data = {
899        .sda_pin = RK29_PIN2_PB6,
900        .scl_pin = RK29_PIN2_PB7,
901        .udelay = 5, // clk = 500/udelay = 100Khz
902        .timeout = 100,//msecs_to_jiffies(200),
903        .bus_num    = 0,
904        .io_init = rk29_i2c0_io_init,
905 };
906 #endif
907 #ifdef CONFIG_RK29_I2C1_CONTROLLER
908 struct rk29_i2c_platform_data default_i2c1_data = {
909         .bus_num    = 1,
910         .flags      = 0,
911         .slave_addr = 0xff,
912         .scl_rate  = 400*1000,
913         .mode           = I2C_MODE_IRQ,
914         .io_init = rk29_i2c1_io_init,
915 };
916 #else
917 struct i2c_gpio_platform_data default_i2c1_data = {
918        .sda_pin = RK29_PIN1_PA6,
919        .scl_pin = RK29_PIN1_PA7,
920        .udelay = 5, // clk = 500/udelay = 100Khz
921        .timeout = 100,//msecs_to_jiffies(200),
922        .bus_num    = 1,
923        .io_init = rk29_i2c1_io_init,
924 };
925 #endif
926 #ifdef CONFIG_RK29_I2C2_CONTROLLER
927 struct rk29_i2c_platform_data default_i2c2_data = {
928         .bus_num    = 2,
929         .flags      = 0,
930         .slave_addr = 0xff,
931         .scl_rate  = 400*1000,
932         .mode           = I2C_MODE_IRQ,
933         .io_init = rk29_i2c2_io_init,
934 };
935 #else
936 struct i2c_gpio_platform_data default_i2c2_data = {
937        .sda_pin = RK29_PIN5_PD3,
938        .scl_pin = RK29_PIN5_PD4,
939        .udelay = 5, // clk = 500/udelay = 100Khz
940        .timeout = 100,//msecs_to_jiffies(200),
941        .bus_num    = 2,
942        .io_init = rk29_i2c2_io_init,
943 };
944 #endif
945 #ifdef CONFIG_RK29_I2C3_CONTROLLER
946 struct rk29_i2c_platform_data default_i2c3_data = {
947         .bus_num    = 3,
948         .flags      = 0,
949         .slave_addr = 0xff,
950         .scl_rate  = 400*1000,
951         .mode           = I2C_MODE_IRQ,
952         .io_init = rk29_i2c3_io_init,
953 };
954 #else
955 struct i2c_gpio_platform_data default_i2c3_data = {
956        .sda_pin = RK29_PIN5_PB5,
957        .scl_pin = RK29_PIN5_PB4,
958        .udelay = 5, // clk = 500/udelay = 100Khz
959        .timeout = 100,//msecs_to_jiffies(200),
960        .bus_num    = 3,
961        .io_init = rk29_i2c3_io_init,
962 };
963 #endif
964 #ifdef CONFIG_I2C0_RK29
965 static struct i2c_board_info __initdata board_i2c0_devices[] = {
966 #if defined (CONFIG_RK1000_CONTROL)
967         {
968                 .type                   = "rk1000_control",
969                 .addr           = 0x40,
970                 .flags                  = 0,
971         },
972 #endif
973 #if defined (CONFIG_SND_SOC_alc5621)
974         {
975                 .type                   = "ALC5621",
976                 .addr                   = 0x1a,
977                 .flags                  = 0,
978         },
979 #endif
980 #if defined (CONFIG_SND_SOC_alc5631)
981         {
982                 .type                   = "rt5631",
983                 .addr                   = 0x1a,
984                 .flags                  = 0,
985         },
986 #endif
987 #if defined (CONFIG_SND_SOC_RK1000)
988         {
989                 .type                   = "rk1000_i2c_codec",
990                 .addr           = 0x60,
991                 .flags                  = 0,
992         },
993 #endif
994 #if defined (CONFIG_SND_SOC_WM8900)
995         {
996                 .type                   = "wm8900",
997                 .addr           = 0x1A,
998                 .flags                  = 0,
999         },
1000 #endif
1001 #if defined (CONFIG_BATTERY_STC3100)
1002         {
1003                 .type                   = "stc3100",
1004                 .addr           = 0x70,
1005                 .flags                  = 0,
1006         },
1007 #endif
1008 #if defined (CONFIG_BATTERY_BQ27510)
1009         {
1010                 .type                   = "bq27510",
1011                 .addr           = 0x55,
1012                 .flags                  = 0,
1013                 .platform_data  = &bq27510_info,
1014         },
1015 #endif
1016 #if defined (CONFIG_RTC_HYM8563)
1017         {
1018                 .type                   = "rtc_hym8563",
1019                 .addr           = 0x51,
1020                 .flags                  = 0,
1021                 .irq            = RK29_PIN0_PA1,
1022         },
1023 #endif
1024 #if defined (CONFIG_GS_MMA8452)
1025     {
1026       .type           = "gs_mma8452",
1027       .addr           = 0x1c,
1028       .flags          = 0,
1029       .irq            = MMA8452_INT_PIN,
1030       .platform_data  = &mma8452_info,
1031     },
1032 #endif
1033 #if defined (CONFIG_COMPASS_AK8973)
1034         {
1035                 .type                   = "ak8973",
1036                 .addr           = 0x1d,
1037                 .flags                  = 0,
1038                 .irq                    = RK29_PIN0_PA4,
1039         },
1040 #endif
1041 #if defined (CONFIG_COMPASS_AK8975)
1042         {
1043                 .type                   = "ak8975",
1044                 .addr           = 0x0d,
1045                 .flags                  = 0,
1046                 .irq                    = RK29_PIN0_PA4,
1047         },
1048 #endif
1049 /*mpu3050*/
1050 #if defined (CONFIG_MPU_SENSORS_MPU3050) 
1051         {
1052                 .type                   = "mpu3050",
1053                 .addr                   = 0x68,
1054                 .flags                  = 0,
1055                 .irq                    = RK29_PIN5_PA3,
1056                 .platform_data  = &mpu3050_data,
1057         },
1058 #endif
1059
1060 #if defined (CONFIG_SND_SOC_CS42L52)
1061         {
1062                 .type                   = "cs42l52",
1063                 .addr           = 0x4A,
1064                 .flags                  = 0,
1065                 .platform_data  = &cs42l52_info,
1066         },
1067 #endif
1068 #if defined (CONFIG_RTC_M41T66)
1069         {
1070                 .type           = "rtc-M41T66",
1071                 .addr           = 0x68,
1072                 .flags          = 0,
1073                 .irq            = RK29_PIN0_PA1,
1074         },
1075 #endif
1076 };
1077 #endif
1078
1079 #ifdef CONFIG_I2C1_RK29
1080 static struct i2c_board_info __initdata board_i2c1_devices[] = {
1081 #if defined (CONFIG_RK1000_CONTROL1)
1082         {
1083                 .type                   = "rk1000_control",
1084                 .addr                   = 0x40,
1085                 .flags                  = 0,
1086         },
1087 #endif
1088 #if defined (CONFIG_ANX7150) || defined (CONFIG_ANX7150_NEW)
1089     {
1090                 .type           = "anx7150",
1091         .addr           = 0x39,             //0x39, 0x3d
1092         .flags          = 0,
1093         .irq            = RK29_PIN1_PD7,
1094     },
1095 #endif
1096 #ifdef CONFIG_BU92747GUW_CIR
1097     {
1098         .type   ="bu92747_cir",
1099         .addr   = 0x77,    
1100         .flags      =0,
1101         .irq            = BU92747_CIR_IRQ_PIN,
1102         .platform_data = &bu92747guw_pdata,
1103     },
1104 #endif
1105
1106 };
1107 #endif
1108
1109 #ifdef CONFIG_I2C2_RK29
1110 static struct i2c_board_info __initdata board_i2c2_devices[] = {
1111 #if defined (CONFIG_HANNSTAR_P1003)
1112     {
1113       .type           = "p1003_touch",
1114       .addr           = 0x04,
1115       .flags          = 0, //I2C_M_NEED_DELAY
1116       .irq            = RK29_PIN0_PA2,
1117       .platform_data  = &p1003_info,
1118       //.udelay           = 100
1119     },
1120 #endif
1121 #if defined (CONFIG_EETI_EGALAX)
1122     {
1123       .type           = "egalax_i2c",
1124       .addr           = 0x04,
1125       .flags          = 0,
1126       .irq            = RK29_PIN0_PA2,
1127       .platform_data  = &eeti_egalax_info,
1128     },
1129 #endif
1130 #if defined (CONFIG_TOUCHSCREEN_GT819)
1131     {
1132                 .type   = "Goodix-TS",
1133                 .addr   = 0x55,
1134                 .flags      =0,
1135                 .irq            =RK29_PIN0_PA2,
1136                 .platform_data = &goodix_info,
1137     },
1138 #endif
1139 #if defined (CONFIG_TOUCHSCREEN_FT5406)
1140     {
1141                 .type   ="ft5x0x_ts",
1142                 .addr   = 0x38,    //0x70,
1143                 .flags      =0,
1144                 .irq            =RK29_PIN0_PA2, // support goodix tp detect, 20110706
1145                 .platform_data = &ft5406_info,
1146     },
1147 #endif
1148 };
1149 #endif
1150
1151 #ifdef CONFIG_I2C3_RK29
1152 static struct i2c_board_info __initdata board_i2c3_devices[] = {
1153         #if defined (CONFIG_BATTERY_BQ27541)
1154         {
1155                 .type                   = "bq27541",
1156                 .addr           = 0x55,
1157                 .flags                  = 0,
1158                 .platform_data  = &bq27541_info,
1159         },
1160 #endif
1161 };
1162 #endif
1163
1164 /*****************************************************************************************
1165  * camera  devices
1166  * author: ddl@rock-chips.com
1167  *****************************************************************************************/
1168 #ifdef CONFIG_VIDEO_RK29
1169 #define CONFIG_SENSOR_POWER_IOCTL_USR      0
1170 #define CONFIG_SENSOR_RESET_IOCTL_USR      0
1171 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR      0
1172 #define CONFIG_SENSOR_FLASH_IOCTL_USR      0
1173
1174 #if CONFIG_SENSOR_POWER_IOCTL_USR
1175 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
1176 {
1177     #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
1178 }
1179 #endif
1180
1181 #if CONFIG_SENSOR_RESET_IOCTL_USR
1182 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
1183 {
1184     #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
1185 }
1186 #endif
1187
1188 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1189 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
1190 {
1191     #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
1192 }
1193 #endif
1194
1195 #if CONFIG_SENSOR_FLASH_IOCTL_USR
1196 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
1197 {
1198     #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
1199 }
1200 #endif
1201
1202 static struct rk29camera_platform_ioctl_cb  sensor_ioctl_cb = {
1203     #if CONFIG_SENSOR_POWER_IOCTL_USR
1204     .sensor_power_cb = sensor_power_usr_cb,
1205     #else
1206     .sensor_power_cb = NULL,
1207     #endif
1208
1209     #if CONFIG_SENSOR_RESET_IOCTL_USR
1210     .sensor_reset_cb = sensor_reset_usr_cb,
1211     #else
1212     .sensor_reset_cb = NULL,
1213     #endif
1214
1215     #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
1216     .sensor_powerdown_cb = sensor_powerdown_usr_cb,
1217     #else
1218     .sensor_powerdown_cb = NULL,
1219     #endif
1220
1221     #if CONFIG_SENSOR_FLASH_IOCTL_USR
1222     .sensor_flash_cb = sensor_flash_usr_cb,
1223     #else
1224     .sensor_flash_cb = NULL,
1225     #endif
1226 };
1227 #include "../../../drivers/media/video/rk29_camera.c"
1228 #endif
1229 /*****************************************************************************************
1230  * backlight  devices
1231  * author: nzy@rock-chips.com
1232  *****************************************************************************************/
1233 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1234  /*
1235  GPIO1B5_PWM0_NAME,       GPIO1L_PWM0
1236  GPIO5D2_PWM1_UART1SIRIN_NAME,  GPIO5H_PWM1
1237  GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME,   GPIO2L_PWM2
1238  GPIO1A5_EMMCPWREN_PWM3_NAME,     GPIO1L_PWM3
1239  */
1240
1241 #define PWM_ID            0
1242 #define PWM_MUX_NAME      GPIO1B5_PWM0_NAME
1243 #define PWM_MUX_MODE      GPIO1L_PWM0
1244 #define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
1245 #define PWM_GPIO RK29_PIN1_PB5
1246 #define PWM_EFFECT_VALUE  0
1247 #define BACKLIGHT_MINVALUE 52
1248 #define LCD_DISP_ON_PIN
1249
1250 #ifdef  LCD_DISP_ON_PIN
1251 //#define BL_EN_MUX_NAME    GPIOF34_UART3_SEL_NAME
1252 //#define BL_EN_MUX_MODE    IOMUXB_GPIO1_B34
1253
1254 #define BL_EN_PIN         RK29_PIN6_PD0
1255 #define BL_EN_VALUE       GPIO_HIGH
1256 #endif
1257 static int rk29_backlight_io_init(void)
1258 {
1259     int ret = 0;
1260
1261     rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1262         #ifdef  LCD_DISP_ON_PIN
1263    // rk29_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
1264
1265     ret = gpio_request(BL_EN_PIN, NULL);
1266     if(ret != 0)
1267     {
1268         gpio_free(BL_EN_PIN);
1269     }
1270
1271     gpio_direction_output(BL_EN_PIN, 0);
1272     gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1273         #endif
1274     return ret;
1275 }
1276
1277 static int rk29_backlight_io_deinit(void)
1278 {
1279     int ret = 0;
1280     #ifdef  LCD_DISP_ON_PIN
1281     gpio_free(BL_EN_PIN);
1282     #endif
1283     rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1284     
1285     return ret;
1286 }
1287
1288 static int rk29_backlight_pwm_suspend(void)
1289 {
1290         int ret = 0;
1291         rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
1292         if (gpio_request(PWM_GPIO, NULL)) {
1293                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
1294                 return -1;
1295         }
1296         gpio_direction_output(PWM_GPIO, GPIO_HIGH);
1297         //gpio_direction_output(PWM_GPIO, GPIO_LOW);
1298    #ifdef  LCD_DISP_ON_PIN
1299     gpio_direction_output(BL_EN_PIN, 0);
1300     gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
1301    #endif
1302         return ret;
1303 }
1304
1305 static int rk29_backlight_pwm_resume(void)
1306 {
1307         gpio_free(PWM_GPIO);
1308         rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
1309
1310     #ifdef  LCD_DISP_ON_PIN
1311     msleep(30);
1312     gpio_direction_output(BL_EN_PIN, 1);
1313     gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
1314     #endif
1315         return 0;
1316 }
1317
1318 struct rk29_bl_info rk29_bl_info = {
1319     .pwm_id   = PWM_ID,
1320     .bl_ref   = PWM_EFFECT_VALUE,
1321     .io_init   = rk29_backlight_io_init,
1322     .io_deinit = rk29_backlight_io_deinit,
1323     .pwm_suspend = rk29_backlight_pwm_suspend,
1324     .pwm_resume = rk29_backlight_pwm_resume,
1325     .min_brightness = BACKLIGHT_MINVALUE,
1326 };
1327 struct platform_device rk29_device_backlight = {
1328                 .name   = "rk29_backlight",
1329                 .id     = -1,
1330         .dev    = {
1331            .platform_data  = &rk29_bl_info,
1332         }
1333 };
1334 #endif
1335 /*****************************************************************************************
1336 * pwm voltage regulator devices
1337 ******************************************************************************************/
1338 #if defined (CONFIG_RK29_PWM_REGULATOR)
1339
1340 #define REGULATOR_PWM_ID                                        2
1341 #define REGULATOR_PWM_MUX_NAME                  GPIO2A3_SDMMC0WRITEPRT_PWM2_NAME
1342 #define REGULATOR_PWM_MUX_MODE                                          GPIO2L_PWM2
1343 #define REGULATOR_PWM_MUX_MODE_GPIO                             GPIO2L_GPIO2A3
1344 #define REGULATOR_PWM_GPIO                              RK29_PIN2_PA3
1345
1346 static struct regulator_consumer_supply pwm_consumers[] = {
1347         {
1348                 .supply = "vcore",
1349         }
1350 };
1351
1352 static struct regulator_init_data rk29_pwm_regulator_data = {
1353         .constraints = {
1354                 .name = "PWM2",
1355                 .min_uV =  950000,
1356                 .max_uV = 1400000,
1357                 .apply_uV = 1,
1358                 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1359         },
1360         .num_consumer_supplies = ARRAY_SIZE(pwm_consumers),
1361         .consumer_supplies = pwm_consumers,
1362 };
1363
1364 static struct pwm_platform_data rk29_regulator_pwm_platform_data = {
1365         .pwm_id = REGULATOR_PWM_ID,
1366         .pwm_gpio = REGULATOR_PWM_GPIO,
1367         //.pwm_iomux_name[] = REGULATOR_PWM_MUX_NAME;
1368         .pwm_iomux_name = REGULATOR_PWM_MUX_NAME,
1369         .pwm_iomux_pwm = REGULATOR_PWM_MUX_MODE,
1370         .pwm_iomux_gpio = REGULATOR_PWM_MUX_MODE_GPIO,
1371         .init_data  = &rk29_pwm_regulator_data,
1372 };
1373
1374 static struct platform_device rk29_device_pwm_regulator = {
1375         .name = "pwm-voltage-regulator",
1376         .id   = -1,
1377         .dev  = {
1378                 .platform_data = &rk29_regulator_pwm_platform_data,
1379         },
1380 };
1381
1382 #endif
1383
1384 /*****************************************************************************************
1385  * SDMMC devices
1386 *****************************************************************************************/
1387 #ifdef CONFIG_SDMMC0_RK29
1388 static int rk29_sdmmc0_cfg_gpio(void)
1389 {
1390         rk29_mux_api_set(GPIO1D1_SDMMC0CMD_NAME, GPIO1H_SDMMC0_CMD);
1391         rk29_mux_api_set(GPIO1D0_SDMMC0CLKOUT_NAME, GPIO1H_SDMMC0_CLKOUT);
1392         rk29_mux_api_set(GPIO1D2_SDMMC0DATA0_NAME, GPIO1H_SDMMC0_DATA0);
1393         rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
1394         rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
1395         rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
1396
1397 #ifdef CONFIG_SDMMC_RK29_OLD    
1398         rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
1399 #else
1400         rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);//Modifyed by xbw.
1401 #endif
1402
1403         rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5);   ///GPIO5H_SDMMC0_PWR_EN);  ///GPIO5H_GPIO5D5);
1404         gpio_request(RK29_PIN5_PD5,"sdmmc");
1405 #if 0
1406         gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
1407         mdelay(100);
1408         gpio_set_value(RK29_PIN5_PD5,GPIO_LOW);
1409 #else
1410         gpio_direction_output(RK29_PIN5_PD5,GPIO_LOW);
1411 #endif
1412         return 0;
1413 }
1414
1415 #define CONFIG_SDMMC0_USE_DMA
1416 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1417         .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
1418                                            MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33|
1419                                            MMC_VDD_33_34|MMC_VDD_34_35| MMC_VDD_35_36),
1420         .host_caps      = (MMC_CAP_4_BIT_DATA|MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1421         .io_init = rk29_sdmmc0_cfg_gpio,
1422         .dma_name = "sd_mmc",
1423 #ifdef CONFIG_SDMMC0_USE_DMA
1424         .use_dma  = 1,
1425 #else
1426         .use_dma = 0,
1427 #endif
1428         .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO
1429         .enable_sd_wakeup = 0,
1430 };
1431 #endif
1432 #ifdef CONFIG_SDMMC1_RK29
1433 #define CONFIG_SDMMC1_USE_DMA
1434 static int rk29_sdmmc1_cfg_gpio(void)
1435 {
1436         rk29_mux_api_set(GPIO1C2_SDMMC1CMD_NAME, GPIO1H_SDMMC1_CMD);
1437         rk29_mux_api_set(GPIO1C7_SDMMC1CLKOUT_NAME, GPIO1H_SDMMC1_CLKOUT);
1438         rk29_mux_api_set(GPIO1C3_SDMMC1DATA0_NAME, GPIO1H_SDMMC1_DATA0);
1439         rk29_mux_api_set(GPIO1C4_SDMMC1DATA1_NAME, GPIO1H_SDMMC1_DATA1);
1440         rk29_mux_api_set(GPIO1C5_SDMMC1DATA2_NAME, GPIO1H_SDMMC1_DATA2);
1441         rk29_mux_api_set(GPIO1C6_SDMMC1DATA3_NAME, GPIO1H_SDMMC1_DATA3);
1442         //rk29_mux_api_set(GPIO1C0_UART0CTSN_SDMMC1DETECTN_NAME, GPIO1H_SDMMC1_DETECT_N);
1443         return 0;
1444 }
1445
1446 #ifdef CONFIG_WIFI_CONTROL_FUNC
1447 static int rk29sdk_wifi_status(struct device *dev);
1448 static int rk29sdk_wifi_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id);
1449 #endif
1450
1451 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N    RK29_PIN1_PD6
1452
1453 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1454         .host_ocr_avail = (MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28|MMC_VDD_28_29|
1455                                            MMC_VDD_29_30|MMC_VDD_30_31|MMC_VDD_31_32|
1456                                            MMC_VDD_32_33|MMC_VDD_33_34),
1457         .host_caps      = (MMC_CAP_4_BIT_DATA|MMC_CAP_SDIO_IRQ|
1458                                    MMC_CAP_MMC_HIGHSPEED|MMC_CAP_SD_HIGHSPEED),
1459         .io_init = rk29_sdmmc1_cfg_gpio,
1460         .dma_name = "sdio",
1461 #ifdef CONFIG_SDMMC1_USE_DMA
1462         .use_dma  = 1,
1463 #else
1464         .use_dma = 0,
1465 #endif
1466 #ifdef CONFIG_WIFI_CONTROL_FUNC
1467         .status = rk29sdk_wifi_status,
1468         .register_status_notify = rk29sdk_wifi_status_register,
1469 #endif
1470 #if 0
1471         .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1472 #endif
1473 };
1474 #endif
1475
1476 #ifdef CONFIG_WIFI_CONTROL_FUNC
1477 #define RK29SDK_WIFI_BT_GPIO_POWER_N       RK29_PIN5_PD6
1478 #define RK29SDK_WIFI_GPIO_RESET_N          RK29_PIN6_PC0
1479 #define RK29SDK_BT_GPIO_RESET_N            RK29_PIN6_PC4
1480
1481 static int rk29sdk_wifi_cd = 0;   /* wifi virtual 'card detect' status */
1482 static void (*wifi_status_cb)(int card_present, void *dev_id);
1483 static void *wifi_status_cb_devid;
1484 int rk29sdk_wifi_power_state = 0;
1485 int rk29sdk_bt_power_state = 0;
1486
1487 static int rk29sdk_wifi_status(struct device *dev)
1488 {
1489         return rk29sdk_wifi_cd;
1490 }
1491
1492 static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id)
1493 {
1494         if(wifi_status_cb)
1495                 return -EAGAIN;
1496         wifi_status_cb = callback;
1497         wifi_status_cb_devid = dev_id;
1498         return 0;
1499 }
1500
1501 static int rk29sdk_wifi_bt_gpio_control_init(void)
1502 {
1503     if (gpio_request(RK29SDK_WIFI_BT_GPIO_POWER_N, "wifi_bt_power")) {
1504            pr_info("%s: request wifi_bt power gpio failed\n", __func__);
1505            return -1;
1506     }
1507
1508     if (gpio_request(RK29SDK_WIFI_GPIO_RESET_N, "wifi reset")) {
1509            pr_info("%s: request wifi reset gpio failed\n", __func__);
1510            gpio_free(RK29SDK_WIFI_BT_GPIO_POWER_N);
1511            return -1;
1512     }
1513
1514     if (gpio_request(RK29SDK_BT_GPIO_RESET_N, "bt reset")) {
1515           pr_info("%s: request bt reset gpio failed\n", __func__);
1516           gpio_free(RK29SDK_WIFI_GPIO_RESET_N);
1517           return -1;
1518     }
1519
1520     gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1521     gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N,    GPIO_LOW);
1522     gpio_direction_output(RK29SDK_BT_GPIO_RESET_N,      GPIO_LOW);
1523
1524     pr_info("%s: init finished\n",__func__);
1525
1526     return 0;
1527 }
1528
1529 static int rk29sdk_wifi_power(int on)
1530 {
1531         pr_info("%s: %d\n", __func__, on);
1532         if (on){
1533                 gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
1534                 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
1535                 mdelay(100);
1536                 pr_info("wifi turn on power\n");
1537         }else{
1538                 if (!rk29sdk_bt_power_state){
1539                         gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
1540                         mdelay(100);
1541                         pr_info("wifi shut off power\n");
1542                 }else
1543                 {
1544                         pr_info("wifi shouldn't shut off power, bt is using it!\n");
1545                 }
1546                 gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
1547
1548         }
1549
1550         rk29sdk_wifi_power_state = on;
1551         return 0;
1552 }
1553
1554 static int rk29sdk_wifi_reset_state;
1555 static int rk29sdk_wifi_reset(int on)
1556 {
1557         pr_info("%s: %d\n", __func__, on);
1558         gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, on);
1559         mdelay(100);
1560         rk29sdk_wifi_reset_state = on;
1561         return 0;
1562 }
1563
1564 int rk29sdk_wifi_set_carddetect(int val)
1565 {
1566         pr_info("%s:%d\n", __func__, val);
1567         rk29sdk_wifi_cd = val;
1568         if (wifi_status_cb){
1569                 wifi_status_cb(val, wifi_status_cb_devid);
1570         }else {
1571                 pr_warning("%s, nobody to notify\n", __func__);
1572         }
1573         return 0;
1574 }
1575 EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect);
1576
1577 static struct wifi_mem_prealloc wifi_mem_array[PREALLOC_WLAN_SEC_NUM] = {
1578         {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
1579         {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
1580         {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
1581         {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)}
1582 };
1583
1584 static void *rk29sdk_mem_prealloc(int section, unsigned long size)
1585 {
1586         if (section == PREALLOC_WLAN_SEC_NUM)
1587                 return wlan_static_skb;
1588
1589         if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM))
1590                 return NULL;
1591
1592         if (wifi_mem_array[section].size < size)
1593                 return NULL;
1594
1595         return wifi_mem_array[section].mem_ptr;
1596 }
1597
1598 int __init rk29sdk_init_wifi_mem(void)
1599 {
1600         int i;
1601         int j;
1602
1603         for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
1604                 wlan_static_skb[i] = dev_alloc_skb(
1605                                 ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
1606
1607                 if (!wlan_static_skb[i])
1608                         goto err_skb_alloc;
1609         }
1610
1611         for (i = 0 ; i < PREALLOC_WLAN_SEC_NUM ; i++) {
1612                 wifi_mem_array[i].mem_ptr =
1613                                 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
1614
1615                 if (!wifi_mem_array[i].mem_ptr)
1616                         goto err_mem_alloc;
1617         }
1618         return 0;
1619
1620 err_mem_alloc:
1621         pr_err("Failed to mem_alloc for WLAN\n");
1622         for (j = 0 ; j < i ; j++)
1623                kfree(wifi_mem_array[j].mem_ptr);
1624
1625         i = WLAN_SKB_BUF_NUM;
1626
1627 err_skb_alloc:
1628         pr_err("Failed to skb_alloc for WLAN\n");
1629         for (j = 0 ; j < i ; j++)
1630                 dev_kfree_skb(wlan_static_skb[j]);
1631
1632         return -ENOMEM;
1633 }
1634
1635 static struct wifi_platform_data rk29sdk_wifi_control = {
1636         .set_power = rk29sdk_wifi_power,
1637         .set_reset = rk29sdk_wifi_reset,
1638         .set_carddetect = rk29sdk_wifi_set_carddetect,
1639         .mem_prealloc   = rk29sdk_mem_prealloc,
1640 };
1641 static struct platform_device rk29sdk_wifi_device = {
1642         .name = "bcm4329_wlan",
1643         .id = 1,
1644         .dev = {
1645                 .platform_data = &rk29sdk_wifi_control,
1646          },
1647 };
1648 #endif
1649
1650
1651 /* bluetooth rfkill device */
1652 static struct platform_device rk29sdk_rfkill = {
1653         .name = "rk29sdk_rfkill",
1654         .id = -1,
1655 };
1656
1657
1658 #ifdef CONFIG_VIVANTE
1659 #define GPU_HIGH_CLOCK        552
1660 #define GPU_LOW_CLOCK         (periph_pll_default / 1000000) /* same as general pll clock rate below */
1661 static struct resource resources_gpu[] = {
1662     [0] = {
1663                 .name   = "gpu_irq",
1664         .start  = IRQ_GPU,
1665         .end    = IRQ_GPU,
1666         .flags  = IORESOURCE_IRQ,
1667     },
1668     [1] = {
1669                 .name   = "gpu_base",
1670         .start  = RK29_GPU_PHYS,
1671         .end    = RK29_GPU_PHYS + RK29_GPU_SIZE - 1,
1672         .flags  = IORESOURCE_MEM,
1673     },
1674     [2] = {
1675                 .name   = "gpu_mem",
1676         .start  = PMEM_GPU_BASE,
1677         .end    = PMEM_GPU_BASE + PMEM_GPU_SIZE - 1,
1678         .flags  = IORESOURCE_MEM,
1679     },
1680     [3] = {
1681                 .name   = "gpu_clk",
1682         .start  = GPU_LOW_CLOCK,
1683         .end    = GPU_HIGH_CLOCK,
1684         .flags  = IORESOURCE_IO,
1685     },
1686 };
1687 static struct platform_device rk29_device_gpu = {
1688     .name             = "galcore",
1689     .id               = 0,
1690     .num_resources    = ARRAY_SIZE(resources_gpu),
1691     .resource         = resources_gpu,
1692 };
1693 #endif
1694
1695 #ifdef CONFIG_KEYS_RK29_NEWTON
1696 extern struct rk29_keys_platform_data rk29_keys_pdata;
1697 static struct platform_device rk29_device_keys = {
1698         .name           = "rk29-keypad",
1699         .id             = -1,
1700         .dev            = {
1701                 .platform_data  = &rk29_keys_pdata,
1702         },
1703 };
1704 #endif
1705
1706 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1707 struct gpio_led rk29_leds[] = {
1708                 {
1709                         .name = "rk29_red_led",
1710                         .gpio = RK29_PIN4_PB2,
1711                         .default_trigger = "timer",
1712                         .active_low = 0,
1713                         .retain_state_suspended = 1,
1714                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1715                 },
1716                 {
1717                         .name = "rk29_green_led",
1718                         .gpio = RK29_PIN4_PB1,
1719                         .default_trigger = "timer",
1720                         .active_low = 0,
1721                         .retain_state_suspended = 1,
1722                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1723                 },
1724                 {
1725                         .name = "rk29_blue_led",
1726                         .gpio = RK29_PIN4_PB0,
1727                         .default_trigger = "timer",
1728                         .active_low = 0,
1729                         .retain_state_suspended = 1,
1730                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
1731                 },
1732 };
1733
1734 struct gpio_led_platform_data rk29_leds_pdata = {
1735         .leds = &rk29_leds,
1736         .num_leds       = ARRAY_SIZE(rk29_leds),
1737 };
1738
1739 struct platform_device rk29_device_gpio_leds = {
1740         .name   = "leds-gpio",
1741         .id     = -1,
1742         .dev    = {
1743            .platform_data  = &rk29_leds_pdata,
1744         },
1745 };
1746 #endif
1747
1748 #ifdef CONFIG_LEDS_NEWTON_PWM
1749 static struct led_newton_pwm rk29_pwm_leds[] = {
1750                 {
1751                         .name = "power_led",
1752                         .pwm_id = 1,
1753                         .pwm_gpio = RK29_PIN5_PD2,
1754                         .pwm_iomux_name = GPIO5D2_PWM1_UART1SIRIN_NAME,
1755                         .pwm_iomux_pwm = GPIO5H_PWM1,
1756                         .pwm_iomux_gpio = GPIO5H_GPIO5D2,
1757                         .freq = 1000,
1758                         .period = 255,
1759                 },
1760 };
1761
1762 static struct led_newton_pwm_platform_data rk29_pwm_leds_pdata = {
1763         .leds = &rk29_pwm_leds,
1764         .num_leds       = ARRAY_SIZE(rk29_pwm_leds),
1765 };
1766
1767 static struct platform_device rk29_device_pwm_leds = {
1768         .name   = "leds_newton_pwm",
1769         .id     = -1,
1770         .dev    = {
1771            .platform_data  = &rk29_pwm_leds_pdata,
1772         },
1773 };
1774 \r#endif
1775         
1776 #ifdef CONFIG_USB_ANDROID
1777 struct usb_mass_storage_platform_data newton_mass_storage_pdata = {
1778         .nluns          = 1,
1779         .vendor         = "RockChip",
1780         .product        = "rk29 sdk",
1781         .release        = 0x0100,
1782 };
1783
1784 //static 
1785 struct platform_device newton_usb_mass_storage_device = {
1786         .name   = "usb_mass_storage",
1787         .id     = -1,
1788         .dev    = {
1789                 .platform_data = &newton_mass_storage_pdata,
1790         },
1791 };
1792 #endif
1793 static struct platform_device  rk29_cs42l52_device = {
1794         .name           = "rk29_cs42l52",
1795         .id                 = -1,
1796 };
1797
1798 static void __init rk29_board_iomux_init(void)
1799 {
1800         #ifdef CONFIG_RK29_PWM_REGULATOR
1801         rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
1802         #endif
1803         #ifdef CONFIG_LEDS_GPIO_PLATFORM
1804         rk29_mux_api_set(GPIO4B0_FLASHDATA8_NAME,GPIO4L_GPIO4B0);
1805         rk29_mux_api_set(GPIO4B1_FLASHDATA9_NAME,GPIO4L_GPIO4B1);
1806         rk29_mux_api_set(GPIO4B2_FLASHDATA10_NAME,GPIO4L_GPIO4B2);
1807         #endif
1808         #ifdef CONFIG_LEDS_NEWTON_PWM
1809         rk29_mux_api_set(GPIO5D2_PWM1_UART1SIRIN_NAME, GPIO5H_GPIO5D2);
1810         #endif
1811 }
1812
1813 static struct platform_device *devices[] __initdata = {
1814
1815 #ifdef CONFIG_RK29_WATCHDOG
1816         &rk29_device_wdt,
1817 #endif
1818
1819 #ifdef CONFIG_UART1_RK29
1820         &rk29_device_uart1,
1821 #endif
1822 #ifdef CONFIG_UART0_RK29
1823         &rk29_device_uart0,
1824 #endif
1825 #ifdef CONFIG_UART2_RK29
1826         &rk29_device_uart2,
1827 #endif
1828 #ifdef CONFIG_UART3_RK29
1829         &rk29_device_uart3,
1830 #endif
1831
1832 #ifdef CONFIG_RK29_PWM_REGULATOR
1833         &rk29_device_pwm_regulator,
1834 #endif
1835 #ifdef CONFIG_SPIM0_RK29
1836     &rk29xx_device_spi0m,
1837 #endif
1838 #ifdef CONFIG_SPIM1_RK29
1839     &rk29xx_device_spi1m,
1840 #endif
1841 #ifdef CONFIG_ADC_RK29
1842         &rk29_device_adc,
1843 #endif
1844 #ifdef CONFIG_I2C0_RK29
1845         &rk29_device_i2c0,
1846 #endif
1847 #ifdef CONFIG_I2C1_RK29
1848         &rk29_device_i2c1,
1849 #endif
1850 #ifdef CONFIG_I2C2_RK29
1851         &rk29_device_i2c2,
1852 #endif
1853 #ifdef CONFIG_I2C3_RK29
1854         &rk29_device_i2c3,
1855 #endif
1856
1857 #ifdef CONFIG_SND_RK29_SOC_I2S_2CH
1858         &rk29_device_iis_2ch,
1859 #endif
1860 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
1861         &rk29_device_iis_8ch,
1862 #endif
1863
1864 #ifdef CONFIG_KEYS_RK29_NEWTON
1865         &rk29_device_keys,
1866 #endif
1867 #ifdef CONFIG_SDMMC0_RK29
1868         &rk29_device_sdmmc0,
1869 #endif
1870 #ifdef CONFIG_SDMMC1_RK29
1871         &rk29_device_sdmmc1,
1872 #endif
1873
1874 #ifdef CONFIG_MTD_NAND_RK29XX
1875         &rk29xx_device_nand,
1876 #endif
1877
1878 #ifdef CONFIG_WIFI_CONTROL_FUNC
1879         &rk29sdk_wifi_device,
1880 #endif
1881
1882 #ifdef CONFIG_BT
1883         &rk29sdk_rfkill,
1884 #endif
1885
1886 #ifdef CONFIG_MTD_NAND_RK29
1887         &rk29_device_nand,
1888 #endif
1889
1890 #ifdef CONFIG_FB_RK29
1891         &rk29_device_fb,
1892         &rk29_device_dma_cpy,
1893 #endif
1894 #ifdef CONFIG_BACKLIGHT_RK29_NEWTON_BL
1895         &rk29_device_backlight,
1896 #endif
1897 #ifdef CONFIG_RK29_VMAC
1898         &rk29_device_vmac,
1899 #endif
1900 #ifdef CONFIG_VIVANTE
1901         &rk29_device_gpu,
1902 #endif
1903 #ifdef CONFIG_VIDEO_RK29
1904         &rk29_device_camera,      /* ddl@rock-chips.com : camera support  */
1905         #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
1906         &rk29_soc_camera_pdrv_0,
1907         #endif
1908         &rk29_soc_camera_pdrv_1,
1909         &android_pmem_cam_device,
1910 #endif
1911         &android_pmem_device,
1912         &rk29_vpu_mem_device,
1913 #ifdef CONFIG_USB20_OTG
1914         &rk29_device_usb20_otg,
1915 #endif
1916 #ifdef CONFIG_USB20_HOST
1917         &rk29_device_usb20_host,
1918 #endif
1919 #ifdef CONFIG_USB11_HOST
1920         &rk29_device_usb11_host,
1921 #endif
1922 #ifdef CONFIG_USB_ANDROID
1923         &android_usb_device,
1924         &newton_usb_mass_storage_device,
1925 #endif
1926 #ifdef CONFIG_USB_ANDROID_RNDIS
1927     &rk29_device_rndis,
1928 #endif
1929 #ifdef CONFIG_RK29_IPP
1930         &rk29_device_ipp,
1931 #endif
1932 #ifdef CONFIG_VIDEO_RK29XX_VOUT
1933         &rk29_v4l2_output_devce,
1934 #endif
1935 #ifdef CONFIG_RK29_NEWTON
1936         &rk29_device_newton,
1937 #endif
1938 #ifdef CONFIG_RK_IRDA
1939     &irda_device,
1940 #endif
1941 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1942         &rk29_device_gpio_leds,
1943 #endif
1944 #ifdef CONFIG_LEDS_NEWTON_PWM
1945         &rk29_device_pwm_leds,
1946 #endif
1947 #ifdef CONFIG_SND_RK29_SOC_CS42L52
1948         &rk29_cs42l52_device,
1949 #endif
1950 };
1951
1952 /*****************************************************************************************
1953  * spi devices
1954  * author: cmc@rock-chips.com
1955  *****************************************************************************************/
1956 static int rk29_vmac_register_set(void)
1957 {
1958         //config rk29 vmac as rmii, 100MHz
1959         u32 value= readl(RK29_GRF_BASE + 0xbc);
1960         value = (value & 0xfff7ff) | (0x400);
1961         writel(value, RK29_GRF_BASE + 0xbc);
1962         return 0;
1963 }
1964
1965 static int rk29_rmii_io_init(void)
1966 {
1967         int err;
1968
1969         //phy power gpio
1970         err = gpio_request(RK29_PIN6_PB0, "phy_power_en");
1971         if (err) {
1972                 gpio_free(RK29_PIN6_PB0);
1973                 printk("-------request RK29_PIN6_PB0 fail--------\n");
1974                 return -1;
1975         }
1976         //phy power down
1977         gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1978         gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1979
1980         return 0;
1981 }
1982
1983 static int rk29_rmii_io_deinit(void)
1984 {
1985         //phy power down
1986         gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
1987         gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
1988         //free
1989         gpio_free(RK29_PIN6_PB0);
1990         return 0;
1991 }
1992
1993 static int rk29_rmii_power_control(int enable)
1994 {
1995         if (enable) {
1996                 //enable phy power
1997                 gpio_direction_output(RK29_PIN6_PB0, GPIO_HIGH);
1998                 gpio_set_value(RK29_PIN6_PB0, GPIO_HIGH);
1999         }
2000         else {
2001                 gpio_direction_output(RK29_PIN6_PB0, GPIO_LOW);
2002                 gpio_set_value(RK29_PIN6_PB0, GPIO_LOW);
2003         }
2004         return 0;
2005 }
2006
2007 struct rk29_vmac_platform_data rk29_vmac_pdata = {
2008         .vmac_register_set = rk29_vmac_register_set,
2009         .rmii_io_init = rk29_rmii_io_init,
2010         .rmii_io_deinit = rk29_rmii_io_deinit,
2011         .rmii_power_control = rk29_rmii_power_control,
2012 };
2013
2014 /*****************************************************************************************
2015  * spi devices
2016  * author: cmc@rock-chips.com
2017  *****************************************************************************************/
2018 #define SPI_CHIPSELECT_NUM 2
2019 static struct spi_cs_gpio rk29xx_spi0_cs_gpios[SPI_CHIPSELECT_NUM] = {
2020     {
2021                 .name = "spi0 cs0",
2022                 .cs_gpio = RK29_PIN2_PC1,
2023                 .cs_iomux_name = GPIO2C1_SPI0CSN0_NAME,
2024                 .cs_iomux_mode = GPIO2H_SPI0_CSN0,
2025         },
2026         {
2027                 .name = "spi0 cs1",
2028                 .cs_gpio = RK29_PIN1_PA4,
2029                 .cs_iomux_name = GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,//if no iomux,set it NULL
2030                 .cs_iomux_mode = GPIO1L_SPI0_CSN1,
2031         }
2032 };
2033
2034 static struct spi_cs_gpio rk29xx_spi1_cs_gpios[SPI_CHIPSELECT_NUM] = {
2035     {
2036                 .name = "spi1 cs0",
2037                 .cs_gpio = RK29_PIN2_PC5,
2038                 .cs_iomux_name = GPIO2C5_SPI1CSN0_NAME,
2039                 .cs_iomux_mode = GPIO2H_SPI1_CSN0,
2040         },
2041         {
2042                 .name = "spi1 cs1",
2043                 .cs_gpio = RK29_PIN1_PA3,
2044                 .cs_iomux_name = GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,//if no iomux,set it NULL
2045                 .cs_iomux_mode = GPIO1L_SPI1_CSN1,
2046         }
2047 };
2048
2049 static int spi_io_init(struct spi_cs_gpio *cs_gpios, int cs_num)
2050 {
2051 #if 1
2052         int i;
2053         if (cs_gpios) {
2054                 for (i=0; i<cs_num; i++) {
2055                         rk29_mux_api_set(cs_gpios[i].cs_iomux_name, cs_gpios[i].cs_iomux_mode);
2056                 }
2057         }
2058 #endif
2059         return 0;
2060 }
2061
2062 static int spi_io_deinit(struct spi_cs_gpio *cs_gpios, int cs_num)
2063 {
2064         return 0;
2065 }
2066
2067 static int spi_io_fix_leakage_bug(void)
2068 {
2069 #if 0
2070         gpio_direction_output(RK29_PIN2_PC1, GPIO_LOW);
2071 #endif
2072         return 0;
2073 }
2074
2075 static int spi_io_resume_leakage_bug(void)
2076 {
2077 #if 0
2078         gpio_direction_output(RK29_PIN2_PC1, GPIO_HIGH);
2079 #endif
2080         return 0;
2081 }
2082
2083 struct rk29xx_spi_platform_data rk29xx_spi0_platdata = {
2084         .num_chipselect = SPI_CHIPSELECT_NUM,
2085         .chipselect_gpios = rk29xx_spi0_cs_gpios,
2086         .io_init = spi_io_init,
2087         .io_deinit = spi_io_deinit,
2088         .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2089         .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2090 };
2091
2092 struct rk29xx_spi_platform_data rk29xx_spi1_platdata = {
2093         .num_chipselect = SPI_CHIPSELECT_NUM,
2094         .chipselect_gpios = rk29xx_spi1_cs_gpios,
2095         .io_init = spi_io_init,
2096         .io_deinit = spi_io_deinit,
2097         .io_fix_leakage_bug = spi_io_fix_leakage_bug,
2098         .io_resume_leakage_bug = spi_io_resume_leakage_bug,
2099 };
2100
2101 /*****************************************************************************************
2102  * xpt2046 touch panel
2103  * author: cmc@rock-chips.com
2104  *****************************************************************************************/
2105 #define XPT2046_GPIO_INT           RK29_PIN0_PA3
2106 #define DEBOUNCE_REPTIME  3
2107
2108 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI)
2109 static struct xpt2046_platform_data xpt2046_info = {
2110         .model                  = 2046,
2111         .keep_vref_on   = 1,
2112         .swap_xy                = 0,
2113         .x_min                  = 0,
2114         .x_max                  = 320,
2115         .y_min                  = 0,
2116         .y_max                  = 480,
2117         .debounce_max           = 7,
2118         .debounce_rep           = DEBOUNCE_REPTIME,
2119         .debounce_tol           = 20,
2120         .gpio_pendown           = XPT2046_GPIO_INT,
2121         .penirq_recheck_delay_usecs = 1,
2122 };
2123 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
2124 static struct xpt2046_platform_data xpt2046_info = {
2125         .model                  = 2046,
2126         .keep_vref_on   = 1,
2127         .swap_xy                = 0,
2128         .x_min                  = 0,
2129         .x_max                  = 320,
2130         .y_min                  = 0,
2131         .y_max                  = 480,
2132         .debounce_max           = 7,
2133         .debounce_rep           = DEBOUNCE_REPTIME,
2134         .debounce_tol           = 20,
2135         .gpio_pendown           = XPT2046_GPIO_INT,
2136         .penirq_recheck_delay_usecs = 1,
2137 };
2138 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
2139 static struct xpt2046_platform_data xpt2046_info = {
2140         .model                  = 2046,
2141         .keep_vref_on   = 1,
2142         .swap_xy                = 1,
2143         .x_min                  = 0,
2144         .x_max                  = 800,
2145         .y_min                  = 0,
2146         .y_max                  = 480,
2147         .debounce_max           = 7,
2148         .debounce_rep           = DEBOUNCE_REPTIME,
2149         .debounce_tol           = 20,
2150         .gpio_pendown           = XPT2046_GPIO_INT,
2151
2152         .penirq_recheck_delay_usecs = 1,
2153 };
2154 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2155 static struct xpt2046_platform_data xpt2046_info = {
2156         .model                  = 2046,
2157         .keep_vref_on   = 1,
2158         .swap_xy                = 1,
2159         .x_min                  = 0,
2160         .x_max                  = 800,
2161         .y_min                  = 0,
2162         .y_max                  = 480,
2163         .debounce_max           = 7,
2164         .debounce_rep           = DEBOUNCE_REPTIME,
2165         .debounce_tol           = 20,
2166         .gpio_pendown           = XPT2046_GPIO_INT,
2167
2168         .penirq_recheck_delay_usecs = 1,
2169 };
2170 #endif
2171
2172 static struct spi_board_info board_spi_devices[] = {
2173 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\
2174     ||defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
2175         {
2176                 .modalias       = "xpt2046_ts",
2177                 .chip_select    = 0,
2178                 .max_speed_hz   = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
2179                 .bus_num        = 0,
2180                 .irq = XPT2046_GPIO_INT,
2181                 .platform_data = &xpt2046_info,
2182         },
2183 #endif
2184 };
2185
2186
2187 static void __init rk29_gic_init_irq(void)
2188 {
2189         gic_dist_init(0, (void __iomem *)RK29_GICPERI_BASE, 32);
2190         gic_cpu_init(0, (void __iomem *)RK29_GICCPU_BASE);
2191 }
2192
2193 static void __init machine_rk29_init_irq(void)
2194 {
2195         rk29_gic_init_irq();
2196         rk29_gpio_init();
2197 }
2198
2199 static struct cpufreq_frequency_table freq_table[] = {
2200         { .index = 1200000, .frequency =  408000 },
2201         { .index = 1200000, .frequency =  816000 },
2202         { .index = 1300000, .frequency = 1008000 },
2203         { .frequency = CPUFREQ_TABLE_END },
2204 };
2205
2206 #define BAT_LOW RK29_PIN4_PA2
2207 #define POWER_ON_PIN    RK29_PIN4_PA4
2208 static void __init machine_rk29_board_init(void)
2209 {
2210         int val =0;
2211         gpio_request(BAT_LOW, NULL);
2212         gpio_direction_input(BAT_LOW);
2213         val = gpio_get_value(BAT_LOW);
2214         if (val == 0){
2215                 printk("no battery, no power up\n");
2216                 gpio_request(POWER_ON_PIN, "poweronpin");
2217                 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
2218                 while(1){
2219                         gpio_set_value(POWER_ON_PIN, GPIO_LOW);
2220                         mdelay(100);
2221                 }
2222         }
2223         gpio_free(BAT_LOW);
2224         rk29_board_iomux_init();
2225
2226         board_power_init();
2227         board_update_cpufreq_table(freq_table);
2228
2229                 platform_add_devices(devices, ARRAY_SIZE(devices));
2230 #ifdef CONFIG_I2C0_RK29
2231         i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,
2232                         ARRAY_SIZE(board_i2c0_devices));
2233 #endif
2234 #ifdef CONFIG_I2C1_RK29
2235         i2c_register_board_info(default_i2c1_data.bus_num, board_i2c1_devices,
2236                         ARRAY_SIZE(board_i2c1_devices));
2237 #endif
2238 #ifdef CONFIG_I2C2_RK29
2239         i2c_register_board_info(default_i2c2_data.bus_num, board_i2c2_devices,
2240                         ARRAY_SIZE(board_i2c2_devices));
2241 #endif
2242 #ifdef CONFIG_I2C3_RK29
2243         i2c_register_board_info(default_i2c3_data.bus_num, board_i2c3_devices,
2244                         ARRAY_SIZE(board_i2c3_devices));
2245 #endif
2246
2247         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
2248         
2249 #ifdef CONFIG_WIFI_CONTROL_FUNC
2250         rk29sdk_wifi_bt_gpio_control_init();
2251         rk29sdk_init_wifi_mem();
2252 #endif
2253
2254         board_usb_detect_init(RK29_PIN0_PA0);
2255
2256 #if defined(CONFIG_RK_IRDA) || defined(CONFIG_BU92747GUW_CIR)
2257         smc0_init(NULL);
2258         bu92747guw_io_init();
2259 #endif
2260
2261 }
2262
2263 static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
2264                                         char **cmdline, struct meminfo *mi)
2265 {
2266         mi->nr_banks = 1;
2267         mi->bank[0].start = RK29_SDRAM_PHYS;
2268         mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
2269         mi->bank[0].size = LINUX_SIZE;
2270 #if SDRAM_SIZE > SZ_512M
2271         mi->nr_banks = 2;
2272         mi->bank[1].start = RK29_SDRAM_PHYS + SZ_512M;
2273         mi->bank[1].size = SDRAM_SIZE - SZ_512M;
2274 #endif
2275 }
2276
2277 static void __init machine_rk29_mapio(void)
2278 {
2279         rk29_map_common_io();
2280         rk29_setup_early_printk();
2281         rk29_sram_init();
2282         rk29_clock_init(periph_pll_default);
2283         rk29_iomux_init();
2284     ddr_init(DDR_TYPE,DDR_FREQ);  // DDR3_1333H, 400
2285 }
2286
2287 MACHINE_START(RK29, "RK29board")
2288         /* UART for LL DEBUG */
2289         .phys_io        = RK29_UART1_PHYS & 0xfff00000,
2290         .io_pg_offst    = ((RK29_UART1_BASE) >> 18) & 0xfffc,
2291         .boot_params    = RK29_SDRAM_PHYS + 0x88000,
2292         .fixup          = machine_rk29_fixup,
2293         .map_io         = machine_rk29_mapio,
2294         .init_irq       = machine_rk29_init_irq,
2295         .init_machine   = machine_rk29_board_init,
2296         .timer          = &rk29_timer,
2297 MACHINE_END