53feb9812e5b264fbb2a8c042a9fea8c2e0b6f60
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk30 / board-rk30-sdk.c
1 /* arch/arm/mach-rk30/board-rk30-sdk.c
2  *
3  * Copyright (C) 2012 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/skbuff.h>
24 #include <linux/spi/spi.h>
25 #include <linux/mmc/host.h>
26 #include <linux/ion.h>
27
28 #include <asm/setup.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/flash.h>
33 #include <asm/hardware/gic.h>
34
35 #include <mach/board.h>
36 #include <mach/hardware.h>
37 #include <mach/io.h>
38 #include <mach/gpio.h>
39 #include <mach/iomux.h>
40 /*set touchscreen different type header*/
41 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI)
42 #include "../../../drivers/input/touchscreen/xpt2046_ts.h"
43 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
44 #include "../../../drivers/input/touchscreen/xpt2046_tslib_ts.h"
45 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
46 #include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
47 #endif
48 #if defined(CONFIG_SPIM_RK29)
49 #include "../../../drivers/spi/rk29_spim.h"
50 #endif
51 #if defined(CONFIG_ANDROID_TIMED_GPIO)
52 #include "../../../drivers/staging/android/timed_gpio.h"
53 #endif
54
55 #define RK30_FB0_MEM_SIZE 8*SZ_1M
56
57
58 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
59 #define TOUCH_RESET_PIN  RK30_PIN4_PD0
60 #define TOUCH_PWR_PIN    INVALID_GPIO
61 int goodix_init_platform_hw(void)
62 {
63         int ret;
64         printk("goodix_init_platform_hw\n");
65         if(TOUCH_PWR_PIN != INVALID_GPIO)
66         {
67                 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
68                 if(ret != 0){
69                         gpio_free(TOUCH_PWR_PIN);
70                         printk("goodix power error\n");
71                         return -EIO;
72                 }
73                 gpio_direction_output(TOUCH_PWR_PIN, 0);
74                 gpio_set_value(TOUCH_PWR_PIN,GPIO_LOW);
75                 msleep(100);
76         }
77         
78         if(TOUCH_RESET_PIN != INVALID_GPIO)
79         {
80                 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
81                 if(ret != 0){
82                         gpio_free(TOUCH_RESET_PIN);
83                         printk("goodix gpio_request error\n");
84                         return -EIO;
85                 }
86                 gpio_direction_output(TOUCH_RESET_PIN, 0);
87                 gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
88                 msleep(10);
89                 gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
90                 msleep(500);
91         }
92         return 0;
93 }
94
95 struct goodix_platform_data goodix_info = {
96           .model= 8105,
97           .irq_pin = RK30_PIN4_PC2,
98           .rest_pin  = TOUCH_RESET_PIN,
99           .init_platform_hw = goodix_init_platform_hw,
100 };
101 #endif
102
103
104 /*****************************************************************************************
105  * xpt2046 touch panel
106  * author: hhb@rock-chips.com
107  *****************************************************************************************/
108 #if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_TSLIB_SPI)
109 #define XPT2046_GPIO_INT        RK30_PIN4_PC2 
110 #define DEBOUNCE_REPTIME        3
111
112
113 static struct xpt2046_platform_data xpt2046_info = {
114         .model                  = 2046,
115         .keep_vref_on           = 1,
116         .swap_xy                = 0,
117         .debounce_max           = 7,
118         .debounce_rep           = DEBOUNCE_REPTIME,
119         .debounce_tol           = 20,
120         .gpio_pendown           = XPT2046_GPIO_INT,
121         .pendown_iomux_name = GPIO4C2_SMCDATA2_TRACEDATA2_NAME, 
122         .pendown_iomux_mode = GPIO4C_GPIO4C2,   
123         .touch_virtualkey_length = 60,
124         .penirq_recheck_delay_usecs = 1,
125 #if defined(CONFIG_TOUCHSCREEN_480X800)
126         .x_min                  = 0,
127         .x_max                  = 480,
128         .y_min                  = 0,
129         .y_max                  = 800,
130         .touch_ad_top = 3940,
131         .touch_ad_bottom = 310,
132         .touch_ad_left = 3772,
133         .touch_ad_right = 340,
134 #elif defined(CONFIG_TOUCHSCREEN_800X480)
135         .x_min                  = 0,
136         .x_max                  = 800,
137         .y_min                  = 0,
138         .y_max                  = 480,
139         .touch_ad_top = 2447,
140         .touch_ad_bottom = 207,
141         .touch_ad_left = 5938,
142         .touch_ad_right = 153,
143 #elif defined(CONFIG_TOUCHSCREEN_320X480)
144         .x_min                  = 0,
145         .x_max                  = 320,
146         .y_min                  = 0,
147         .y_max                  = 480,
148         .touch_ad_top = 3166,
149         .touch_ad_bottom = 256,
150         .touch_ad_left = 3658,
151         .touch_ad_right = 380,
152 #endif  
153 };
154 #elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
155 static struct xpt2046_platform_data xpt2046_info = {
156         .model                  = 2046,
157         .keep_vref_on   = 1,
158         .swap_xy                = 0,
159         .debounce_max           = 7,
160         .debounce_rep           = DEBOUNCE_REPTIME,
161         .debounce_tol           = 20,
162         .gpio_pendown           = XPT2046_GPIO_INT,
163         .pendown_iomux_name = GPIO4C2_SMCDATA2_TRACEDATA2_NAME, 
164         .pendown_iomux_mode = GPIO4C_GPIO4C2,   
165         .touch_virtualkey_length = 60,
166         .penirq_recheck_delay_usecs = 1,
167         
168 #if defined(CONFIG_TOUCHSCREEN_480X800)
169         .x_min                  = 0,
170         .x_max                  = 480,
171         .y_min                  = 0,
172         .y_max                  = 800,
173         .screen_x = { 70,  410, 70, 410, 240},
174         .screen_y = { 50, 50,  740, 740, 400},
175         .uncali_x_default = {  3267,  831, 3139, 715, 1845 },
176         .uncali_y_default = { 3638,  3664, 564,  591, 2087 },
177 #elif defined(CONFIG_TOUCHSCREEN_800X480)
178         .x_min                  = 0,
179         .x_max                  = 800,
180         .y_min                  = 0,
181         .y_max                  = 480,
182         .screen_x[5] = { 50, 750,  50, 750, 400};
183         .screen_y[5] = { 40,  40, 440, 440, 240};
184         .uncali_x_default[5] = { 438,  565, 3507,  3631, 2105 };
185         .uncali_y_default[5] = {  3756,  489, 3792, 534, 2159 };
186 #elif defined(CONFIG_TOUCHSCREEN_320X480)
187         .x_min                  = 0,
188         .x_max                  = 320,
189         .y_min                  = 0,
190         .y_max                  = 480,
191         .screen_x[5] = { 50, 270,  50, 270, 160}; 
192         .screen_y[5] = { 40,  40, 440, 440, 240}; 
193         .uncali_x_default[5] = { 812,  3341, 851,  3371, 2183 };
194         .uncali_y_default[5] = {  442,  435, 3193, 3195, 2004 };
195 #endif  
196 };
197 #endif
198 #if defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
199 static struct rk29xx_spi_chip xpt2046_chip = {
200         //.poll_mode = 1,
201         .enable_dma = 1,
202 };
203 #endif
204 static struct spi_board_info board_spi_devices[] = {
205 #if defined(CONFIG_TOUCHSCREEN_XPT2046_SPI)
206         {
207                 .modalias       = "xpt2046_ts",
208                 .chip_select    = 1,// 2,
209                 .max_speed_hz   = 1 * 1000 * 800,/* (max sample rate @ 3V) * (cmd + data + overhead) */
210                 .bus_num        = 0,
211                 .irq            = XPT2046_GPIO_INT,
212                 .platform_data = &xpt2046_info,
213                 .controller_data = &xpt2046_chip,
214         },
215 #endif
216
217 };
218
219
220 /***********************************************************
221 *       rk30  backlight
222 ************************************************************/
223 #ifdef CONFIG_BACKLIGHT_RK29_BL
224 #define PWM_ID            0
225 #define PWM_MUX_NAME      GPIO0A3_PWM0_NAME
226 #define PWM_MUX_MODE      GPIO0A_PWM0
227 #define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
228 #define PWM_GPIO          RK30_PIN0_PA3
229 #define PWM_EFFECT_VALUE  1
230
231 #define LCD_DISP_ON_PIN
232
233 #ifdef  LCD_DISP_ON_PIN
234 //#define BL_EN_MUX_NAME    GPIOF34_UART3_SEL_NAME
235 //#define BL_EN_MUX_MODE    IOMUXB_GPIO1_B34
236
237 #define BL_EN_PIN         RK30_PIN6_PB3
238 #define BL_EN_VALUE       GPIO_HIGH
239 #endif
240 static int rk29_backlight_io_init(void)
241 {
242         int ret = 0;
243         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
244 #ifdef  LCD_DISP_ON_PIN
245         // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
246
247         ret = gpio_request(BL_EN_PIN, NULL);
248         if(ret != 0)
249         {
250                 gpio_free(BL_EN_PIN);
251         }
252
253         gpio_direction_output(BL_EN_PIN, 0);
254         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
255 #endif
256     return ret;
257 }
258
259 static int rk29_backlight_io_deinit(void)
260 {
261         int ret = 0;
262 #ifdef  LCD_DISP_ON_PIN
263         gpio_free(BL_EN_PIN);
264 #endif
265         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);   
266     return ret;
267 }
268
269 static int rk29_backlight_pwm_suspend(void)
270 {
271         int ret = 0;
272         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
273         if (gpio_request(PWM_GPIO, NULL)) {
274                 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
275                 return -1;
276         }
277         gpio_direction_output(PWM_GPIO, GPIO_LOW);
278 #ifdef  LCD_DISP_ON_PIN
279         gpio_direction_output(BL_EN_PIN, 0);
280         gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
281 #endif
282         return ret;
283 }
284
285 static int rk29_backlight_pwm_resume(void)
286 {
287         gpio_free(PWM_GPIO);
288         rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
289 #ifdef  LCD_DISP_ON_PIN
290         msleep(30);
291         gpio_direction_output(BL_EN_PIN, 1);
292         gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
293 #endif
294         return 0;
295 }
296
297 static struct rk29_bl_info rk29_bl_info = {
298     .pwm_id   = PWM_ID,
299     .bl_ref   = PWM_EFFECT_VALUE,
300     .io_init   = rk29_backlight_io_init,
301     .io_deinit = rk29_backlight_io_deinit,
302     .pwm_suspend = rk29_backlight_pwm_suspend,
303     .pwm_resume = rk29_backlight_pwm_resume,
304 };
305
306
307 static struct platform_device rk29_device_backlight = {
308         .name   = "rk29_backlight",
309         .id     = -1,
310         .dev    = {
311            .platform_data  = &rk29_bl_info,
312         }
313 };
314
315 #endif
316
317 /*MMA8452 gsensor*/
318 #if defined (CONFIG_GS_MMA8452)
319 #define MMA8452_INT_PIN   RK30_PIN4_PC0
320
321 static int mma8452_init_platform_hw(void)
322 {
323         rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
324
325         if(gpio_request(MMA8452_INT_PIN,NULL) != 0){
326                 gpio_free(MMA8452_INT_PIN);
327                 printk("mma8452_init_platform_hw gpio_request error\n");
328                 return -EIO;
329         }
330         gpio_pull_updown(MMA8452_INT_PIN, 1);
331         return 0;
332 }
333
334
335 static struct mma8452_platform_data mma8452_info = {
336         .model= 8452,
337         .swap_xy = 0,
338         .swap_xyz = 1,
339         .init_platform_hw= mma8452_init_platform_hw,
340         .orientation = { -1, 0, 0, 0, 0, 1, 0, -1, 0},
341 };
342 #endif
343 #if defined (CONFIG_COMPASS_AK8975)
344 static struct akm8975_platform_data akm8975_info =
345 {
346         .m_layout = 
347         {
348                 {
349                         {1, 0, 0 },
350                         {0, -1, 0 },
351                         {0,     0, -1 },
352                 },
353
354                 {
355                         {1, 0, 0 },
356                         {0, 1, 0 },
357                         {0,     0, 1 },
358                 },
359
360                 {
361                         {1, 0, 0 },
362                         {0, 1, 0 },
363                         {0,     0, 1 },
364                 },
365
366                 {
367                         {1, 0, 0 },
368                         {0, 1, 0 },
369                         {0,     0, 1 },
370                 },
371         }
372
373 };
374
375 #endif
376
377 #if defined(CONFIG_GYRO_L3G4200D)
378
379 #include <linux/l3g4200d.h>
380 #define L3G4200D_INT_PIN  RK30_PIN4_PC3
381
382 static int l3g4200d_init_platform_hw(void)
383 {
384         if (gpio_request(L3G4200D_INT_PIN, NULL) != 0) {
385                 gpio_free(L3G4200D_INT_PIN);
386                 printk("%s: request l3g4200d int pin error\n", __func__);
387                 return -EIO;
388         }
389         gpio_pull_updown(L3G4200D_INT_PIN, 1);
390         return 0;
391 }
392
393 static struct l3g4200d_platform_data l3g4200d_info = {
394         .fs_range = 1,
395
396         .axis_map_x = 0,
397         .axis_map_y = 1,
398         .axis_map_z = 2,
399
400         .negate_x = 1,
401         .negate_y = 1,
402         .negate_z = 0,
403
404         .init = l3g4200d_init_platform_hw,
405 };
406
407 #endif
408
409 #ifdef CONFIG_LS_CM3217
410
411 #define CM3217_POWER_PIN        INVALID_GPIO
412 #define CM3217_IRQ_PIN          INVALID_GPIO
413 static int cm3217_init_hw(void)
414 {
415 #if 0
416         if (gpio_request(CM3217_POWER_PIN, NULL) != 0) {
417         gpio_free(CM3217_POWER_PIN);
418         printk("%s: request cm3217 power pin error\n", __func__);
419         return -EIO;
420         }
421         gpio_pull_updown(CM3217_POWER_PIN, PullDisable);
422
423         if (gpio_request(CM3217_IRQ_PIN, NULL) != 0) {
424         gpio_free(CM3217_IRQ_PIN);
425         printk("%s: request cm3217 int pin error\n", __func__);
426         return -EIO;
427         }
428         gpio_pull_updown(CM3217_IRQ_PIN, PullDisable);
429 #endif
430         return 0;
431 }
432
433 static void cm3217_exit_hw(void)
434 {
435 #if 0
436         gpio_free(CM3217_POWER_PIN);
437         gpio_free(CM3217_IRQ_PIN);
438 #endif
439         return;
440 }
441
442 struct cm3217_platform_data cm3217_info = {
443         .irq_pin = CM3217_IRQ_PIN,
444         .power_pin = CM3217_POWER_PIN,
445         .init_platform_hw = cm3217_init_hw,
446         .exit_platform_hw = cm3217_exit_hw,
447 };
448 #endif
449
450
451
452 #ifdef CONFIG_FB_ROCKCHIP
453 static struct resource resource_fb[] = {
454         [0] = {
455                 .name  = "fb0 buf",
456                 .start = 0,
457                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
458                 .flags = IORESOURCE_MEM,
459         },
460         [1] = {
461                 .name  = "ipp buf",  //for rotate
462                 .start = 0,
463                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
464                 .flags = IORESOURCE_MEM,
465         },
466         [2] = {
467                 .name  = "fb2 buf",
468                 .start = 0,
469                 .end   = 0,//RK30_FB0_MEM_SIZE - 1,
470                 .flags = IORESOURCE_MEM,
471         },
472 };
473
474 static struct platform_device device_fb = {
475         .name             = "rk-fb",
476         .id               = -1,
477         .num_resources    = ARRAY_SIZE(resource_fb),
478         .resource         = resource_fb,
479 };
480 #endif
481
482 #ifdef CONFIG_ANDROID_TIMED_GPIO
483 static struct timed_gpio timed_gpios[] = {
484         {
485                 .name = "vibrator",
486                 .gpio = RK30_PIN0_PA4,
487                 .max_timeout = 1000,
488                 .active_low = 0,
489                 .adjust_time =20,      //adjust for diff product
490         },
491 };
492
493 struct timed_gpio_platform_data rk29_vibrator_info = {
494         .num_gpios = 1,
495         .gpios = timed_gpios,
496 };
497
498 struct platform_device rk29_device_vibrator ={
499         .name = "timed-gpio",
500         .id = -1,
501         .dev = {
502                 .platform_data = &rk29_vibrator_info,
503                 },
504
505 };
506 #endif 
507
508 #ifdef CONFIG_LEDS_GPIO_PLATFORM
509 struct gpio_led rk29_leds[] = {
510                 {
511                         .name = "button-backlight",
512                         .gpio = RK30_PIN4_PD7,
513                         .default_trigger = "timer",
514                         .active_low = 0,
515                         .retain_state_suspended = 0,
516                         .default_state = LEDS_GPIO_DEFSTATE_OFF,
517                 },
518 };
519
520 struct gpio_led_platform_data rk29_leds_pdata = {
521         .leds = &rk29_leds,
522         .num_leds       = ARRAY_SIZE(rk29_leds),
523 };
524
525 struct platform_device rk29_device_gpio_leds = {
526         .name   = "leds-gpio",
527         .id     = -1,
528         .dev    = {
529            .platform_data  = &rk29_leds_pdata,
530         },
531 };
532 #endif
533
534 #ifdef CONFIG_RK_IRDA
535 #define IRDA_IRQ_PIN           RK30_PIN6_PA1
536
537 int irda_iomux_init(void)
538 {
539         int ret = 0;
540
541         //irda irq pin
542         ret = gpio_request(IRDA_IRQ_PIN, NULL);
543         if(ret != 0)
544         {
545         gpio_free(IRDA_IRQ_PIN);
546         printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
547         }
548         gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
549         gpio_direction_input(IRDA_IRQ_PIN);
550
551         return 0;
552 }
553
554 int irda_iomux_deinit(void)
555 {
556         gpio_free(IRDA_IRQ_PIN);
557         return 0;
558 }
559
560 static struct irda_info rk29_irda_info = {
561         .intr_pin = IRDA_IRQ_PIN,
562         .iomux_init = irda_iomux_init,
563         .iomux_deinit = irda_iomux_deinit,
564         //.irda_pwr_ctl = bu92747guw_power_ctl,
565 };
566
567 static struct platform_device irda_device = {
568 #ifdef CONFIG_RK_IRDA_NET
569                         .name   = "rk_irda",
570 #else
571                         .name = "bu92747_irda",
572 #endif
573     .id           = -1,
574         .dev            = {
575                 .platform_data  = &rk29_irda_info,
576         }
577 };
578 #endif
579
580
581
582
583 static struct platform_device *devices[] __initdata = {
584 #ifdef CONFIG_BACKLIGHT_RK29_BL
585         &rk29_device_backlight,
586 #endif  
587 #ifdef CONFIG_FB_ROCKCHIP
588         &device_fb,
589 #endif
590 #ifdef CONFIG_ANDROID_TIMED_GPIO
591         &rk29_device_vibrator,
592 #endif
593 #ifdef CONFIG_LEDS_GPIO_PLATFORM
594         &rk29_device_gpio_leds,
595 #endif
596 #ifdef CONFIG_RK_IRDA
597         &irda_device,
598 #endif
599
600
601 };
602
603 // i2c
604 #ifdef CONFIG_I2C0_RK30
605 static struct i2c_board_info __initdata i2c0_info[] = {
606 #if defined (CONFIG_GS_MMA8452)
607             {
608               .type           = "gs_mma8452",
609               .addr           = 0x1c,
610               .flags          = 0,
611               .irq            = MMA8452_INT_PIN,
612               .platform_data  = &mma8452_info,
613             },
614 #endif
615 #if defined (CONFIG_COMPASS_AK8975)
616         {
617                 .type           = "ak8975",
618                 .addr           = 0x0d,
619                 .flags          = 0,
620                 .irq            = RK30_PIN4_PC1,
621                 .platform_data  = &akm8975_info,
622         },
623 #endif
624 #if defined (CONFIG_GYRO_L3G4200D)
625         {
626                 .type           = "l3g4200d_gryo",
627                 .addr           = 0x69,
628                 .flags          = 0,
629                 .irq            = L3G4200D_INT_PIN,
630                 .platform_data  = &l3g4200d_info,
631         },
632 #endif
633
634 #if defined (CONFIG_SND_SOC_RK1000)
635         {
636                 .type                   = "rk1000_i2c_codec",
637                 .addr           = 0x60,
638                 .flags                  = 0,
639         },
640         {
641                 .type                   = "rk1000_control",
642                 .addr                   = 0x40,
643                 .flags                  = 0,
644         },      
645 #endif
646 };
647 #endif
648
649 #ifdef CONFIG_I2C1_RK30
650 static struct i2c_board_info __initdata i2c1_info[] = {
651 };
652 #endif
653
654 #ifdef CONFIG_I2C2_RK30
655 static struct i2c_board_info __initdata i2c2_info[] = {
656 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
657                     {
658                                 .type   = "Goodix-TS",
659                                 .addr   = 0x55,
660                                 .flags      =0,
661                                 .irq            =RK30_PIN4_PC2,
662                                 .platform_data = &goodix_info,
663                     },
664 #endif
665 #if defined (CONFIG_LS_CM3217)
666         {
667                 .type           = "lightsensor",
668                 .addr           = 0x20,
669                 .flags          = 0,
670                 .irq            = CM3217_IRQ_PIN,
671                 .platform_data  = &cm3217_info,
672         },
673 #endif
674
675 };
676 #endif
677
678 #ifdef CONFIG_I2C3_RK30
679 static struct i2c_board_info __initdata i2c3_info[] = {
680 };
681 #endif
682
683 #ifdef CONFIG_I2C4_RK30
684 static struct i2c_board_info __initdata i2c4_info[] = {
685 };
686 #endif
687
688 static void __init rk30_i2c_register_board_info(void)
689 {
690 #ifdef CONFIG_I2C0_RK30
691         i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
692 #endif
693 #ifdef CONFIG_I2C1_RK30
694         i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
695 #endif
696 #ifdef CONFIG_I2C2_RK30
697         i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
698 #endif
699 #ifdef CONFIG_I2C3_RK30
700         i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
701 #endif
702 #ifdef CONFIG_I2C4_RK30
703         i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
704 #endif
705 }
706 //end of i2c
707
708 static void __init machine_rk30_board_init(void)
709 {
710         rk30_i2c_register_board_info();
711         spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
712         platform_add_devices(devices, ARRAY_SIZE(devices));
713 }
714
715 static void __init rk30_reserve(void)
716 {
717 #ifdef CONFIG_FB_ROCKCHIP
718         resource_fb[0].start = board_mem_reserve_add("fb0",RK30_FB0_MEM_SIZE);
719         resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
720         resource_fb[1].start = board_mem_reserve_add("ipp buf",RK30_FB0_MEM_SIZE);
721         resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
722         resource_fb[2].start = board_mem_reserve_add("fb2",RK30_FB0_MEM_SIZE);
723         resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;      
724 #endif
725         board_mem_reserved();
726 }
727
728 MACHINE_START(RK30, "RK30board")
729         .boot_params    = PLAT_PHYS_OFFSET + 0x800,
730         .fixup          = rk30_fixup,
731         .reserve        = &rk30_reserve,
732         .map_io         = rk30_map_io,
733         .init_irq       = rk30_init_irq,
734         .timer          = &rk30_timer,
735         .init_machine   = machine_rk30_board_init,
736 MACHINE_END