[xburst] core fixes
[openwrt.git] / target / linux / xburst / patches-2.6.34 / 005-add-qi_lb60-board-support.patch
1 From eb15b4f5046dbb1a530ec3e6134b1b68753e1f31 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sat, 24 Apr 2010 17:24:26 +0200
4 Subject: [PATCH] Add qi_lb60 board support
5
6 ---
7  arch/mips/include/asm/mach-jz4740/board-qi_lb60.h |   51 +++
8  arch/mips/jz4740/Kconfig                          |    4 +
9  arch/mips/jz4740/Makefile                         |    2 +
10  arch/mips/jz4740/board-qi_lb60.c                  |  486 +++++++++++++++++++++
11  4 files changed, 543 insertions(+), 0 deletions(-)
12  create mode 100644 arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
13  create mode 100644 arch/mips/jz4740/board-qi_lb60.c
14
15 diff --git a/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h b/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
16 new file mode 100644
17 index 0000000..cfbf073
18 --- /dev/null
19 +++ b/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
20 @@ -0,0 +1,51 @@
21 +/*
22 + * Copyright (c) 2009 Qi Hardware Inc.,
23 + * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
24 + *
25 + * This program is free software: you can redistribute it and/or modify
26 + * it under the terms of the GNU General Public License as published by
27 + * the Free Software Foundation, either version 3 of the License, or
28 + * (at your option) any later version.
29 + *
30 + * This program is distributed in the hope that it will be useful,
31 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33 + * GNU General Public License for more details.
34 + *
35 + * You should have received a copy of the GNU General Public License
36 + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
37 + */
38 +
39 +#ifndef __ASM_JZ4740_QI_LB60_H__
40 +#define __ASM_JZ4740_QI_LB60_H__
41 +
42 +#include <linux/gpio.h>
43 +
44 +/*
45 + * GPIO
46 + */
47 +#define GPIO_DC_DETE_N          JZ_GPIO_PORTC(26)
48 +#define GPIO_CHARG_STAT_N       JZ_GPIO_PORTC(27)
49 +#define GPIO_LED_EN             JZ_GPIO_PORTC(28)
50 +#define GPIO_LCD_CS             JZ_GPIO_PORTC(21)
51 +#define GPIO_DISP_OFF_N         JZ_GPIO_PORTD(21)
52 +#define GPIO_PWM                JZ_GPIO_PORTD(27)
53 +#define GPIO_WAKEUP_N           JZ_GPIO_PORTD(29)
54 +
55 +#define GPIO_AMP_EN             JZ_GPIO_PORTD(4)
56 +
57 +#define GPIO_SD_CD_N            JZ_GPIO_PORTD(0)
58 +#define GPIO_SD_VCC_EN_N        JZ_GPIO_PORTD(2)
59 +
60 +#define GPIO_USB_DETE           JZ_GPIO_PORTD(28)
61 +#define GPIO_BUZZ_PWM           JZ_GPIO_PORTD(27)
62 +#define GPIO_UDC_HOTPLUG        GPIO_USB_DETE
63 +
64 +#define GPIO_AUDIO_POP          JZ_GPIO_PORTB(29)
65 +#define GPIO_COB_TEST           JZ_GPIO_PORTB(30)
66 +
67 +#define GPIO_KEYOUT_BASE        JZ_GPIO_PORTC(10)
68 +#define GPIO_KEYIN_BASE         JZ_GPIO_PORTD(18)
69 +#define GPIO_KEYIN_8            JZ_GPIO_PORTD(26)
70 +
71 +#endif /* __ASM_JZ4740_QI_LB60_H__ */
72 diff --git a/arch/mips/jz4740/Kconfig b/arch/mips/jz4740/Kconfig
73 index b959769..a255c1a 100644
74 --- a/arch/mips/jz4740/Kconfig
75 +++ b/arch/mips/jz4740/Kconfig
76 @@ -3,6 +3,10 @@ choice
77         depends on MACH_JZ
78         default JZ4740_QI_LB60
79  
80 +config JZ4740_QI_LB60
81 +       bool "Qi Hardware Ben NanoNote"
82 +       select SOC_JZ4740
83 +
84  endchoice
85  
86  config HAVE_PWM
87 diff --git a/arch/mips/jz4740/Makefile b/arch/mips/jz4740/Makefile
88 index 398ee91..dd27b49 100644
89 --- a/arch/mips/jz4740/Makefile
90 +++ b/arch/mips/jz4740/Makefile
91 @@ -11,6 +11,8 @@ obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o
92  
93  # board specific support
94  
95 +obj-$(CONFIG_JZ4740_QI_LB60)   += board-qi_lb60.o
96 +
97  # PM support
98  
99  obj-$(CONFIG_PM) += pm.o
100 diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
101 new file mode 100644
102 index 0000000..b3cc308
103 --- /dev/null
104 +++ b/arch/mips/jz4740/board-qi_lb60.c
105 @@ -0,0 +1,486 @@
106 +/*
107 + * linux/arch/mips/jz4740/board-qi_lb60.c
108 + *
109 + * QI_LB60 setup routines.
110 + *
111 + * Copyright (c) 2009 Qi Hardware inc.,
112 + * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
113 + *
114 + * This program is free software; you can redistribute it and/or modify
115 + * it under the terms of the GNU General Public License version 2 or later
116 + * as published by the Free Software Foundation.
117 + */
118 +
119 +#include <linux/kernel.h>
120 +#include <linux/init.h>
121 +#include <linux/gpio.h>
122 +
123 +#include <asm/mach-jz4740/board-qi_lb60.h>
124 +#include <asm/mach-jz4740/platform.h>
125 +
126 +#include <linux/input.h>
127 +#include <linux/gpio_keys.h>
128 +#include <linux/mtd/jz4740_nand.h>
129 +#include <linux/jz4740_fb.h>
130 +#include <linux/input/matrix_keypad.h>
131 +#include <linux/mtd/jz4740_nand.h>
132 +#include <linux/spi/spi.h>
133 +#include <linux/spi/spi_gpio.h>
134 +#include <linux/power_supply.h>
135 +#include <linux/power/jz4740-battery.h>
136 +#include <linux/power/gpio-charger.h>
137 +#include <linux/mmc/jz4740_mmc.h>
138 +
139 +#include <linux/regulator/fixed.h>
140 +#include <linux/regulator/machine.h>
141 +
142 +#include <linux/leds_pwm.h>
143 +
144 +#include "clock.h"
145 +
146 +static bool is_avt2;
147 +
148 +/* NAND */
149 +static struct nand_ecclayout qi_lb60_ecclayout_1gb = {
150 +       .eccbytes = 36,
151 +       .eccpos = {
152 +               6,  7,  8,  9,  10, 11, 12, 13,
153 +               14, 15, 16, 17, 18, 19, 20, 21,
154 +               22, 23, 24, 25, 26, 27, 28, 29,
155 +               30, 31, 32, 33, 34, 35, 36, 37,
156 +               38, 39, 40, 41},
157 +       .oobfree = {
158 +               {.offset = 2,
159 +                .length = 4},
160 +               {.offset = 42,
161 +                .length = 22}}
162 +};
163 +
164 +static struct mtd_partition qi_lb60_partitions_1gb[] = {
165 +       { .name = "NAND BOOT partition",
166 +         .offset = 0 * 0x100000,
167 +         .size = 4 * 0x100000,
168 +       },
169 +       { .name = "NAND KERNEL partition",
170 +         .offset = 4 * 0x100000,
171 +         .size = 4 * 0x100000,
172 +       },
173 +       { .name = "NAND ROOTFS partition",
174 +         .offset = 8 * 0x100000,
175 +         .size = (504 + 512) * 0x100000,
176 +       },
177 +};
178 +
179 +static struct nand_ecclayout qi_lb60_ecclayout_2gb = {
180 +       .eccbytes = 72,
181 +       .eccpos = {
182 +               12, 13, 14, 15, 16, 17, 18, 19,
183 +               20, 21, 22, 23, 24, 25, 26, 27,
184 +               28, 29, 30, 31, 32, 33, 34, 35,
185 +               36, 37, 38, 39, 40, 41, 42, 43,
186 +               44, 45, 46, 47, 48, 49, 50, 51,
187 +               52, 53, 54, 55, 56, 57, 58, 59,
188 +               60, 61, 62, 63, 64, 65, 66, 67,
189 +               68, 69, 70, 71, 72, 73, 74, 75,
190 +               76, 77, 78, 79, 80, 81, 82, 83},
191 +       .oobfree = {
192 +               { .offset = 2, .length = 10},
193 +               { .offset = 84, .length = 44},
194 +       },
195 +};
196 +
197 +static struct mtd_partition qi_lb60_partitions_2gb[] = {
198 +       { .name = "NAND BOOT partition",
199 +         .offset = 0 * 0x100000,
200 +         .size = 4 * 0x100000,
201 +       },
202 +       { .name = "NAND KERNEL partition",
203 +         .offset = 4 * 0x100000,
204 +         .size = 4 * 0x100000,
205 +       },
206 +       { .name = "NAND ROOTFS partition",
207 +         .offset = 8 * 0x100000,
208 +         .size = (504 + 512 + 1024) * 0x100000,
209 +       },
210 +};
211 +
212 +static void qi_lb60_nand_ident(struct platform_device *pdev,
213 +               struct nand_chip *chip, struct mtd_partition **partitions,
214 +               int *num_partitions)
215 +{
216 +       if (chip->page_shift == 12) {
217 +               chip->ecc.layout = &qi_lb60_ecclayout_2gb;
218 +               *partitions = qi_lb60_partitions_2gb;
219 +               *num_partitions = ARRAY_SIZE(qi_lb60_partitions_2gb);
220 +       } else {
221 +               chip->ecc.layout = &qi_lb60_ecclayout_1gb;
222 +               *partitions = qi_lb60_partitions_1gb;
223 +               *num_partitions = ARRAY_SIZE(qi_lb60_partitions_1gb);
224 +       }
225 +}
226 +
227 +static struct jz_nand_platform_data qi_lb60_nand_pdata = {
228 +       .ident_callback = qi_lb60_nand_ident,
229 +       .busy_gpio = 94,
230 +};
231 +
232 +/* Keyboard*/
233 +
234 +/* #define KEEP_UART_ALIVE
235 + * don't define this. the keyboard and keyboard both work
236 + */
237 +
238 +#define KEY_QI_QI      KEY_F13
239 +#define KEY_QI_UPRED   KEY_RIGHTALT
240 +#define KEY_QI_VOLUP   KEY_VOLUMEUP
241 +#define KEY_QI_VOLDOWN KEY_VOLUMEDOWN
242 +#define KEY_QI_FN      KEY_LEFTCTRL
243 +
244 +static const uint32_t qi_lb60_keymap[] = {
245 +       KEY(0, 0, KEY_F1),      /* S2 */
246 +       KEY(0, 1, KEY_F2),      /* S3 */
247 +       KEY(0, 2, KEY_F3),      /* S4 */
248 +       KEY(0, 3, KEY_F4),      /* S5 */
249 +       KEY(0, 4, KEY_F5),      /* S6 */
250 +       KEY(0, 5, KEY_F6),      /* S7 */
251 +       KEY(0, 6, KEY_F7),      /* S8 */
252 +
253 +       KEY(1, 0, KEY_Q),       /* S10 */
254 +       KEY(1, 1, KEY_W),       /* S11 */
255 +       KEY(1, 2, KEY_E),       /* S12 */
256 +       KEY(1, 3, KEY_R),       /* S13 */
257 +       KEY(1, 4, KEY_T),       /* S14 */
258 +       KEY(1, 5, KEY_Y),       /* S15 */
259 +       KEY(1, 6, KEY_U),       /* S16 */
260 +       KEY(1, 7, KEY_I),       /* S17 */
261 +       KEY(2, 0, KEY_A),       /* S18 */
262 +       KEY(2, 1, KEY_S),       /* S19 */
263 +       KEY(2, 2, KEY_D),       /* S20 */
264 +       KEY(2, 3, KEY_F),       /* S21 */
265 +       KEY(2, 4, KEY_G),       /* S22 */
266 +       KEY(2, 5, KEY_H),       /* S23 */
267 +       KEY(2, 6, KEY_J),       /* S24 */
268 +       KEY(2, 7, KEY_K),       /* S25 */
269 +       KEY(3, 0, KEY_ESC),     /* S26 */
270 +       KEY(3, 1, KEY_Z),       /* S27 */
271 +       KEY(3, 2, KEY_X),       /* S28 */
272 +       KEY(3, 3, KEY_C),       /* S29 */
273 +       KEY(3, 4, KEY_V),       /* S30 */
274 +       KEY(3, 5, KEY_B),       /* S31 */
275 +       KEY(3, 6, KEY_N),       /* S32 */
276 +       KEY(3, 7, KEY_M),       /* S33 */
277 +       KEY(4, 0, KEY_TAB),     /* S34 */
278 +       KEY(4, 1, KEY_CAPSLOCK),        /* S35 */
279 +       KEY(4, 2, KEY_BACKSLASH),       /* S36 */
280 +       KEY(4, 3, KEY_APOSTROPHE),      /* S37 */
281 +       KEY(4, 4, KEY_COMMA),   /* S38 */
282 +       KEY(4, 5, KEY_DOT),     /* S39 */
283 +       KEY(4, 6, KEY_SLASH),   /* S40 */
284 +       KEY(4, 7, KEY_UP),      /* S41 */
285 +       KEY(5, 0, KEY_O),       /* S42 */
286 +       KEY(5, 1, KEY_L),       /* S43 */
287 +       KEY(5, 2, KEY_EQUAL),   /* S44 */
288 +       KEY(5, 3, KEY_QI_UPRED),        /* S45 */
289 +       KEY(5, 4, KEY_SPACE),   /* S46 */
290 +       KEY(5, 5, KEY_QI_QI),   /* S47 */
291 +       KEY(5, 6, KEY_RIGHTCTRL),       /* S48 */
292 +       KEY(5, 7, KEY_LEFT),    /* S49 */
293 +       KEY(6, 0, KEY_F8),      /* S50 */
294 +       KEY(6, 1, KEY_P),       /* S51 */
295 +       KEY(6, 2, KEY_BACKSPACE),/* S52 */
296 +       KEY(6, 3, KEY_ENTER),   /* S53 */
297 +       KEY(6, 4, KEY_QI_VOLUP),        /* S54 */
298 +       KEY(6, 5, KEY_QI_VOLDOWN),      /* S55 */
299 +       KEY(6, 6, KEY_DOWN),    /* S56 */
300 +       KEY(6, 7, KEY_RIGHT),   /* S57 */
301 +
302 +#ifndef KEEP_UART_ALIVE
303 +       KEY(7, 0, KEY_LEFTSHIFT),       /* S58 */
304 +       KEY(7, 1, KEY_LEFTALT), /* S59 */
305 +       KEY(7, 2, KEY_QI_FN),   /* S60 */
306 +#endif
307 +};
308 +
309 +static const struct matrix_keymap_data qi_lb60_keymap_data = {
310 +       .keymap         = qi_lb60_keymap,
311 +       .keymap_size    = ARRAY_SIZE(qi_lb60_keymap),
312 +};
313 +
314 +static const unsigned int qi_lb60_keypad_cols[] = {
315 +       74, 75, 76, 77, 78, 79, 80, 81,
316 +};
317 +
318 +static const unsigned int qi_lb60_keypad_rows[] = {
319 +       114, 115, 116, 117, 118, 119, 120,
320 +#ifndef KEEP_UART_ALIVE
321 +       122,
322 +#endif
323 +};
324 +
325 +static struct matrix_keypad_platform_data qi_lb60_pdata = {
326 +       .keymap_data = &qi_lb60_keymap_data,
327 +       .col_gpios      = qi_lb60_keypad_cols,
328 +       .row_gpios      = qi_lb60_keypad_rows,
329 +       .num_col_gpios  = ARRAY_SIZE(qi_lb60_keypad_cols),
330 +       .num_row_gpios  = ARRAY_SIZE(qi_lb60_keypad_rows),
331 +       .col_scan_delay_us      = 10,
332 +       .debounce_ms            = 10,
333 +       .wakeup                 = 1,
334 +       .active_low             = 1,
335 +};
336 +
337 +static struct platform_device qi_lb60_keypad = {
338 +       .name           = "matrix-keypad",
339 +       .id             = -1,
340 +       .dev            = {
341 +               .platform_data = &qi_lb60_pdata,
342 +       },
343 +};
344 +
345 +/* Display */
346 +static struct fb_videomode qi_lb60_video_modes[] = {
347 +       {
348 +               .name = "320x240",
349 +               .xres = 320,
350 +               .yres = 240,
351 +               .refresh = 30,
352 +               .left_margin = 140,
353 +               .right_margin = 273,
354 +               .upper_margin = 20,
355 +               .lower_margin = 2,
356 +               .hsync_len = 1,
357 +               .vsync_len = 1,
358 +               .sync = 0,
359 +               .vmode = FB_VMODE_NONINTERLACED,
360 +       },
361 +};
362 +
363 +static struct jz4740_fb_platform_data qi_lb60_fb_pdata = {
364 +       .width          = 60,
365 +       .height         = 45,
366 +       .num_modes      = ARRAY_SIZE(qi_lb60_video_modes),
367 +       .modes          = qi_lb60_video_modes,
368 +       .bpp            = 24,
369 +       .lcd_type       = JZ_LCD_TYPE_8BIT_SERIAL,
370 +       .pixclk_falling_edge = 1,
371 +};
372 +
373 +
374 +struct spi_gpio_platform_data spigpio_platform_data = {
375 +       .sck = JZ_GPIO_PORTC(23),
376 +       .mosi = JZ_GPIO_PORTC(22),
377 +       .miso = -1,
378 +       .num_chipselect = 1,
379 +};
380 +
381 +static struct platform_device spigpio_device = {
382 +       .name = "spi_gpio",
383 +       .id   = 1,
384 +       .dev = {
385 +               .platform_data = &spigpio_platform_data,
386 +       },
387 +};
388 +
389 +static struct spi_board_info qi_lb60_spi_board_info[] = {
390 +       {
391 +               .modalias = "gpm940b0",
392 +               .controller_data = (void *)JZ_GPIO_PORTC(21),
393 +               .chip_select = 0,
394 +               .bus_num = 1,
395 +               .max_speed_hz = 30 * 1000,
396 +               .mode = SPI_3WIRE,
397 +       },
398 +};
399 +
400 +/* Battery */
401 +static struct jz_battery_platform_data qi_lb60_battery_pdata = {
402 +       .gpio_charge = GPIO_CHARG_STAT_N,
403 +       .gpio_charge_active_low = 1,
404 +       .info = {
405 +               .name = "battery",
406 +               .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
407 +               .voltage_max_design = 4200000,
408 +               .voltage_min_design = 3600000,
409 +       },
410 +};
411 +
412 +static char *qi_lb60_batteries[] = {
413 +       "battery",
414 +};
415 +
416 +static struct gpio_charger_platform_data qi_lb60_charger_pdata = {
417 +       .name = "USB",
418 +       .type = POWER_SUPPLY_TYPE_USB,
419 +       .gpio = GPIO_USB_DETE,
420 +       .gpio_active_low = 1,
421 +       .batteries = qi_lb60_batteries,
422 +       .num_batteries = ARRAY_SIZE(qi_lb60_batteries),
423 +};
424 +
425 +static struct platform_device qi_lb60_charger_device = {
426 +       .name = "gpio-charger",
427 +       .dev = {
428 +               .platform_data = &qi_lb60_charger_pdata,
429 +       },
430 +};
431 +
432 +/* GPIO Key: power */
433 +static struct gpio_keys_button qi_lb60_gpio_keys_buttons[] = {
434 +       [0] = {
435 +               .code           = KEY_POWER,
436 +               .gpio           = GPIO_WAKEUP_N,
437 +               .active_low     = 1,
438 +               .desc           = "Power",
439 +               .wakeup         = 1,
440 +       },
441 +};
442 +
443 +static struct gpio_keys_platform_data qi_lb60_gpio_keys_data = {
444 +       .nbuttons = ARRAY_SIZE(qi_lb60_gpio_keys_buttons),
445 +       .buttons = qi_lb60_gpio_keys_buttons,
446 +};
447 +
448 +static struct platform_device qi_lb60_gpio_keys = {
449 +       .name = "gpio-keys",
450 +       .id =   -1,
451 +       .dev = {
452 +               .platform_data = &qi_lb60_gpio_keys_data,
453 +       }
454 +};
455 +
456 +static struct jz4740_mmc_platform_data qi_lb60_mmc_pdata = {
457 +       .gpio_card_detect       = JZ_GPIO_PORTD(0),
458 +       .gpio_read_only         = -1,
459 +       .gpio_power             = JZ_GPIO_PORTD(2),
460 +       .power_active_low       = 1,
461 +};
462 +
463 +static struct regulator_consumer_supply avt2_usb_regulator_consumer =
464 +       REGULATOR_SUPPLY("vbus", "jz4740-ohci");
465 +
466 +static struct regulator_init_data avt2_usb_regulator_init_data = {
467 +       .num_consumer_supplies = 1,
468 +       .consumer_supplies = &avt2_usb_regulator_consumer,
469 +       .constraints = {
470 +               .name = "USB power",
471 +               .min_uV = 5000000,
472 +               .max_uV = 5000000,
473 +               .valid_modes_mask = REGULATOR_MODE_NORMAL,
474 +               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
475 +       },
476 +};
477 +
478 +static struct fixed_voltage_config avt2_usb_regulator_data = {
479 +       .supply_name = "USB power",
480 +       .microvolts = 5000000,
481 +       .gpio = JZ_GPIO_PORTB(17),
482 +       .init_data = &avt2_usb_regulator_init_data,
483 +};
484 +
485 +static struct platform_device avt2_usb_regulator_device = {
486 +       .name = "reg-fixed-voltage",
487 +       .id = -1,
488 +       .dev = {
489 +               .platform_data = &avt2_usb_regulator_data,
490 +       }
491 +};
492 +
493 +static struct led_pwm qi_lb60_pizo_led = {
494 +       .name = "nanonote::pizo",
495 +       .pwm_id = 4,
496 +       .max_brightness = 255,
497 +       .pwm_period_ns = 1000000,
498 +};
499 +
500 +static struct led_pwm_platform_data qi_lb60_pizo_data = {
501 +       .num_leds = 1,
502 +       .leds = &qi_lb60_pizo_led,
503 +};
504 +
505 +static struct platform_device qi_lb60_pizo_device = {
506 +       .name = "leds_pwm",
507 +       .id = -1,
508 +       .dev = {
509 +               .platform_data = &qi_lb60_pizo_data,
510 +       }
511 +};
512 +
513 +static struct platform_device *jz_platform_devices[] __initdata = {
514 +       &jz4740_usb_gdt_device,
515 +       &jz4740_mmc_device,
516 +       &jz4740_nand_device,
517 +       &qi_lb60_keypad,
518 +       &spigpio_device,
519 +       &jz4740_framebuffer_device,
520 +       &jz4740_i2s_device,
521 +       &jz4740_codec_device,
522 +       &jz4740_rtc_device,
523 +       &jz4740_adc_device,
524 +       &jz4740_battery_device,
525 +       &qi_lb60_gpio_keys,
526 +       &qi_lb60_charger_device,
527 +       &qi_lb60_pizo_device,
528 +};
529 +
530 +static void __init board_gpio_setup(void)
531 +{
532 +       /* We only need to enable/disable pullup here for pins used in generic
533 +        * drivers. Everything else is done by the drivers themselfs. */
534 +       jz_gpio_disable_pullup(GPIO_SD_VCC_EN_N);
535 +       jz_gpio_disable_pullup(GPIO_SD_CD_N);
536 +}
537 +
538 +static int __init qi_lb60_init_platform_devices(void)
539 +{
540 +       jz4740_framebuffer_device.dev.platform_data = &qi_lb60_fb_pdata;
541 +       jz4740_nand_device.dev.platform_data = &qi_lb60_nand_pdata;
542 +       jz4740_battery_device.dev.platform_data = &qi_lb60_battery_pdata;
543 +       jz4740_mmc_device.dev.platform_data = &qi_lb60_mmc_pdata;
544 +
545 +       spi_register_board_info(qi_lb60_spi_board_info,
546 +                               ARRAY_SIZE(qi_lb60_spi_board_info));
547 +
548 +       if (is_avt2) {
549 +               platform_device_register(&avt2_usb_regulator_device);
550 +               platform_device_register(&jz4740_usb_ohci_device);
551 +       }
552 +
553 +       return platform_add_devices(jz_platform_devices,
554 +                                       ARRAY_SIZE(jz_platform_devices));
555 +
556 +}
557 +
558 +struct jz4740_clock_board_data jz4740_clock_bdata = {
559 +       .ext_rate = 12000000,
560 +       .rtc_rate = 32768,
561 +};
562 +
563 +extern int jz_gpiolib_init(void);
564 +
565 +static __init int board_avt2(char *str)
566 +{
567 +       qi_lb60_mmc_pdata.card_detect_active_low = 1;
568 +       qi_lb60_mmc_pdata.power_active_low      = 1;
569 +       is_avt2 = true;
570 +
571 +       return 1;
572 +}
573 +
574 +__setup("avt2", board_avt2);
575 +
576 +static int __init qi_lb60_board_setup(void)
577 +{
578 +       printk(KERN_INFO "Qi Hardware JZ4740 QI_LB60 setup\n");
579 +       if (jz_gpiolib_init())
580 +               panic("Failed to initalize jz gpio\n");
581 +
582 +       jz4740_clock_init();
583 +       board_gpio_setup();
584 +
585 +       if (qi_lb60_init_platform_devices())
586 +               panic("Failed to initalize platform devices\n");
587 +
588 +       return 0;
589 +}
590 +
591 +arch_initcall(qi_lb60_board_setup);
592 -- 
593 1.5.6.5
594