[brcm63xx] add support for USR9108 LEDs (#9372)
[openwrt.git] / target / linux / xburst / patches-2.6.36 / 006-add-n516-board-support.patch
1 From c8e520077c339cbc623aa629588865c7c3ff2937 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sat, 24 Apr 2010 17:25:01 +0200
4 Subject: [PATCH] Add n516 board support
5
6 ---
7 arch/mips/include/asm/mach-jz4740/board-n516.h | 39 +++
8 arch/mips/jz4740/Kconfig | 3 +
9 arch/mips/jz4740/Makefile | 1 +
10 arch/mips/jz4740/board-n516-display.c | 394 ++++++++++++++++++++++++
11 arch/mips/jz4740/board-n516.c | 182 +++++++++++
12 5 files changed, 619 insertions(+), 0 deletions(-)
13 create mode 100644 arch/mips/include/asm/mach-jz4740/board-n516.h
14 create mode 100644 arch/mips/jz4740/board-n516-display.c
15 create mode 100644 arch/mips/jz4740/board-n516.c
16
17 --- /dev/null
18 +++ b/arch/mips/include/asm/mach-jz4740/board-n516.h
19 @@ -0,0 +1,39 @@
20 +/*
21 + * linux/include/asm-mips/mach-jz4740/board-n516.h
22 + *
23 + * JZ4730-based N516 board definition.
24 + *
25 + * Copyright (C) 2009, Yauhen Kharuzhy <jekhor@gmail.com>
26 + *
27 + * This program is free software; you can redistribute it and/or modify
28 + * it under the terms of the GNU General Public License as published by
29 + * the Free Software Foundation; either version 2 of the License, or
30 + * (at your option) any later version.
31 + */
32 +
33 +#ifndef __ASM_JZ4740_N516_H__
34 +#define __ASM_JZ4740_N516_H__
35 +
36 +#include <asm/mach-jz4740/gpio.h>
37 +
38 +/*
39 + * GPIO
40 + */
41 +#define GPIO_SD_VCC_EN_N JZ_GPIO_PORTD(17)
42 +#define GPIO_SD_CD_N JZ_GPIO_PORTD(7)
43 +#define GPIO_SD_WP JZ_GPIO_PORTD(15)
44 +#define GPIO_USB_DETECT JZ_GPIO_PORTD(19)
45 +#define GPIO_CHARG_STAT_N JZ_GPIO_PORTD(16)
46 +#define GPIO_LED_ENABLE JZ_GPIO_PORTD(28)
47 +#define GPIO_LPC_INT JZ_GPIO_PORTD(14)
48 +#define GPIO_HPHONE_DETECT JZ_GPIO_PORTD(20)
49 +#define GPIO_SPEAKER_ENABLE JZ_GPIO_PORTD(21)
50 +
51 +/* Display */
52 +#define GPIO_DISPLAY_RST_L JZ_GPIO_PORTB(18)
53 +#define GPIO_DISPLAY_RDY JZ_GPIO_PORTB(17)
54 +#define GPIO_DISPLAY_STBY JZ_GPIO_PORTC(22)
55 +#define GPIO_DISPLAY_ERR JZ_GPIO_PORTC(23)
56 +#define GPIO_DISPLAY_OFF_N JZ_GPIO_PORTD(1)
57 +
58 +#endif /* __ASM_JZ4740_N516_H__ */
59 --- a/arch/mips/jz4740/Kconfig
60 +++ b/arch/mips/jz4740/Kconfig
61 @@ -6,6 +6,9 @@ choice
62 config JZ4740_QI_LB60
63 bool "Qi Hardware Ben NanoNote"
64
65 +config JZ4740_N516
66 + bool "Hanvon n516 eBook reader"
67 +
68 endchoice
69
70 config HAVE_PWM
71 --- a/arch/mips/jz4740/Makefile
72 +++ b/arch/mips/jz4740/Makefile
73 @@ -12,6 +12,7 @@ obj-$(CONFIG_DEBUG_FS) += clock-debugfs.
74 # board specific support
75
76 obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o
77 +obj-$(CONFIG_JZ4740_N516) += board-n516.o board-n516-display.o
78
79 # PM support
80
81 --- /dev/null
82 +++ b/arch/mips/jz4740/board-n516-display.c
83 @@ -0,0 +1,394 @@
84 +/*
85 + * board-n516-display.c -- Platform device for N516 display
86 + *
87 + * Copyright (C) 2009, Yauhen Kharuzhy <jekhor@gmail.com>
88 + *
89 + * This file is subject to the terms and conditions of the GNU General Public
90 + * License. See the file COPYING in the main directory of this archive for
91 + * more details.
92 + */
93 +
94 +#include <linux/module.h>
95 +#include <linux/kernel.h>
96 +#include <linux/errno.h>
97 +#include <linux/string.h>
98 +#include <linux/delay.h>
99 +#include <linux/interrupt.h>
100 +#include <linux/fb.h>
101 +#include <linux/init.h>
102 +#include <linux/platform_device.h>
103 +#include <linux/irq.h>
104 +#include <linux/gpio.h>
105 +
106 +#include <asm/mach-jz4740/jz4740_fb.h>
107 +
108 +#include <asm/mach-jz4740/platform.h>
109 +#include <asm/mach-jz4740/board-n516.h>
110 +
111 +#include <video/metronomefb.h>
112 +#include <linux/console.h>
113 +
114 +static struct fb_videomode n516_fb_modes[] = {
115 + [0] = {
116 + .name = "Metronome 800x600",
117 + .refresh = 50,
118 + .xres = 400,
119 + .yres = 624,
120 + .hsync_len = 31,
121 + .vsync_len = 23,
122 + .right_margin = 31,
123 + .left_margin = 5,
124 + .upper_margin = 1,
125 + .lower_margin = 2,
126 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
127 + },
128 +};
129 +
130 +static struct jz4740_fb_platform_data n516_fb_pdata = {
131 + .num_modes = ARRAY_SIZE(n516_fb_modes),
132 + .modes = n516_fb_modes,
133 + .bpp = 16,
134 + .lcd_type = JZ_LCD_TYPE_GENERIC_16_BIT,
135 +};
136 +
137 +struct n516_board_info {
138 + uint8_t *metromem;
139 + size_t wfm_size;
140 + struct fb_info *host_fbinfo; /* the host LCD controller's fbi */
141 + unsigned int fw;
142 + unsigned int fh;
143 +};
144 +
145 +static struct platform_device *n516_device;
146 +static struct n516_board_info n516_board_info;
147 +
148 +static int metronome_gpios[] = {
149 + GPIO_DISPLAY_STBY,
150 + GPIO_DISPLAY_RST_L,
151 + GPIO_DISPLAY_RDY,
152 + GPIO_DISPLAY_ERR,
153 +/* GPIO_DISPLAY_OFF_N,*/
154 +};
155 +
156 +static const char *metronome_gpio_names[] = {
157 + "Metronome STDBY",
158 + "Metronome RST",
159 + "Metronome RDY",
160 + "Metronome ERR",
161 +/* "Metronone OFF",*/
162 +};
163 +
164 +static int n516_enable_hostfb(bool enable)
165 +{
166 + int ret;
167 + int blank = enable ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
168 +
169 + acquire_console_sem();
170 + ret = fb_blank(n516_board_info.host_fbinfo, blank);
171 + release_console_sem();
172 +
173 + return ret;
174 +}
175 +
176 +static int n516_init_metronome_gpios(struct metronomefb_par *par)
177 +{
178 + int i;
179 + int ret;
180 +
181 + for (i = 0; i < ARRAY_SIZE(metronome_gpios); ++i) {
182 + ret = gpio_request(metronome_gpios[i], metronome_gpio_names[i]);
183 + if (ret)
184 + goto err;
185 + }
186 +
187 + gpio_direction_output(GPIO_DISPLAY_OFF_N, 0);
188 + gpio_direction_output(GPIO_DISPLAY_RST_L, 0);
189 + gpio_direction_output(GPIO_DISPLAY_STBY, 0);
190 + gpio_direction_input(GPIO_DISPLAY_RDY);
191 + gpio_direction_input(GPIO_DISPLAY_ERR);
192 +
193 + return 0;
194 +err:
195 + for (--i; i >= 0; --i)
196 + gpio_free(metronome_gpios[i]);
197 +
198 + return ret;
199 +}
200 +
201 +static int n516_share_video_mem(struct fb_info *info)
202 +{
203 + int ret;
204 +
205 + dev_dbg(&n516_device->dev, "ENTER %s\n", __func__);
206 + dev_dbg(&n516_device->dev, "%s, info->var.xres = %u, info->var.yres = %u\n", __func__, info->var.xres, info->var.yres);
207 + /* rough check if this is our desired fb and not something else */
208 + if ((info->var.xres != n516_fb_pdata.modes[0].xres)
209 + || (info->var.yres != n516_fb_pdata.modes[0].yres))
210 + return 0;
211 +
212 + /* we've now been notified that we have our new fb */
213 + n516_board_info.metromem = info->screen_base;
214 + n516_board_info.host_fbinfo = info;
215 +
216 + n516_enable_hostfb(false);
217 + /* try to refcount host drv since we are the consumer after this */
218 + if (!try_module_get(info->fbops->owner))
219 + return -ENODEV;
220 +
221 + /* this _add binds metronomefb to n516. metronomefb refcounts n516 */
222 + ret = platform_device_add(n516_device);
223 +
224 + if (ret) {
225 + platform_device_put(n516_device);
226 + return ret;
227 + }
228 +
229 + /* request our platform independent driver */
230 + request_module("metronomefb");
231 +
232 + return 0;
233 +}
234 +
235 +static int n516_unshare_video_mem(struct fb_info *info)
236 +{
237 + dev_dbg(&n516_device->dev, "ENTER %s\n", __func__);
238 +
239 + if (info != n516_board_info.host_fbinfo)
240 + return 0;
241 +
242 + module_put(n516_board_info.host_fbinfo->fbops->owner);
243 + return 0;
244 +}
245 +
246 +static int n516_fb_notifier_callback(struct notifier_block *self,
247 + unsigned long event, void *data)
248 +{
249 + struct fb_event *evdata = data;
250 + struct fb_info *info = evdata->info;
251 +
252 + dev_dbg(&n516_device->dev, "ENTER %s\n", __func__);
253 +
254 + if (event == FB_EVENT_FB_REGISTERED)
255 + return n516_share_video_mem(info);
256 + else if (event == FB_EVENT_FB_UNREGISTERED)
257 + return n516_unshare_video_mem(info);
258 +
259 + return 0;
260 +}
261 +
262 +static struct notifier_block n516_fb_notif = {
263 + .notifier_call = n516_fb_notifier_callback,
264 +};
265 +
266 +/* this gets called as part of our init. these steps must be done now so
267 + * that we can use set_pxa_fb_info */
268 +static void __init n516_presetup_fb(void)
269 +{
270 + int padding_size;
271 + int totalsize;
272 +
273 + /* the frame buffer is divided as follows:
274 + command | CRC | padding
275 + 16kb waveform data | CRC | padding
276 + image data | CRC
277 + */
278 +
279 + n516_board_info.fw = 800;
280 + n516_board_info.fh = 624;
281 +
282 + /* waveform must be 16k + 2 for checksum */
283 + n516_board_info.wfm_size = roundup(16*1024 + 2, n516_board_info.fw);
284 +
285 + padding_size = PAGE_SIZE + (4 * n516_board_info.fw);
286 +
287 + /* total is 1 cmd , 1 wfm, padding and image */
288 + totalsize = n516_board_info.fw + n516_board_info.wfm_size;
289 + totalsize += padding_size + (n516_board_info.fw*n516_board_info.fh);
290 +
291 + /* save this off because we're manipulating fw after this and
292 + * we'll need it when we're ready to setup the framebuffer */
293 +
294 + /* the reason we do this adjustment is because we want to acquire
295 + * more framebuffer memory without imposing custom awareness on the
296 + * underlying driver */
297 + n516_fb_pdata.modes[0].yres = DIV_ROUND_UP(totalsize, n516_board_info.fw);
298 +
299 + jz4740_framebuffer_device.dev.platform_data = &n516_fb_pdata;
300 + platform_device_register(&jz4740_framebuffer_device);
301 +}
302 +
303 +/* this gets called by metronomefb as part of its init, in our case, we
304 + * have already completed initial framebuffer init in presetup_fb so we
305 + * can just setup the fb access pointers */
306 +static int n516_setup_fb(struct metronomefb_par *par)
307 +{
308 + /* metromem was set up by the notifier in share_video_mem so now
309 + * we can use its value to calculate the other entries */
310 + par->metromem_cmd = (struct metromem_cmd *) n516_board_info.metromem;
311 + par->metromem_wfm = n516_board_info.metromem + n516_board_info.fw;
312 + par->metromem_img = par->metromem_wfm + n516_board_info.wfm_size;
313 + par->metromem_img_csum = (u16 *) (par->metromem_img + (n516_board_info.fw * n516_board_info.fh));
314 + par->metromem_dma = n516_board_info.host_fbinfo->fix.smem_start;
315 +
316 + return 0;
317 +}
318 +
319 +static int n516_get_panel_type(void)
320 +{
321 + return 5;
322 +}
323 +
324 +static irqreturn_t n516_handle_irq(int irq, void *dev_id)
325 +{
326 + struct metronomefb_par *par = dev_id;
327 +
328 + dev_dbg(&par->pdev->dev, "Metronome IRQ! RDY=%d\n", gpio_get_value(GPIO_DISPLAY_RDY));
329 + wake_up_all(&par->waitq);
330 +
331 + return IRQ_HANDLED;
332 +}
333 +
334 +static void n516_power_ctl(struct metronomefb_par *par, int cmd)
335 +{
336 + switch (cmd) {
337 + case METRONOME_POWER_OFF:
338 + gpio_set_value(GPIO_DISPLAY_OFF_N, 1);
339 + n516_enable_hostfb(false);
340 + break;
341 + case METRONOME_POWER_ON:
342 + gpio_set_value(GPIO_DISPLAY_OFF_N, 0);
343 + n516_enable_hostfb(true);
344 + break;
345 + }
346 +}
347 +
348 +static int n516_get_rdy(struct metronomefb_par *par)
349 +{
350 + return gpio_get_value(GPIO_DISPLAY_RDY);
351 +}
352 +
353 +static int n516_get_err(struct metronomefb_par *par)
354 +{
355 + return gpio_get_value(GPIO_DISPLAY_ERR);
356 +}
357 +
358 +static int n516_setup_irq(struct fb_info *info)
359 +{
360 + int ret;
361 +
362 + dev_dbg(&n516_device->dev, "ENTER %s\n", __func__);
363 +
364 + ret = request_irq(gpio_to_irq(GPIO_DISPLAY_RDY), n516_handle_irq,
365 + IRQF_TRIGGER_RISING,
366 + "n516", info->par);
367 + if (ret)
368 + dev_err(&n516_device->dev, "request_irq failed: %d\n", ret);
369 +
370 + return ret;
371 +}
372 +
373 +static void n516_set_rst(struct metronomefb_par *par, int state)
374 +{
375 + dev_dbg(&n516_device->dev, "ENTER %s, RDY=%d\n", __func__, gpio_get_value(GPIO_DISPLAY_RDY));
376 + if (state)
377 + gpio_set_value(GPIO_DISPLAY_RST_L, 1);
378 + else
379 + gpio_set_value(GPIO_DISPLAY_RST_L, 0);
380 +}
381 +
382 +static void n516_set_stdby(struct metronomefb_par *par, int state)
383 +{
384 + dev_dbg(&n516_device->dev, "ENTER %s, RDY=%d\n", __func__, gpio_get_value(GPIO_DISPLAY_RDY));
385 + if (state)
386 + gpio_set_value(GPIO_DISPLAY_STBY, 1);
387 + else
388 + gpio_set_value(GPIO_DISPLAY_STBY, 0);
389 +}
390 +
391 +static int n516_wait_event(struct metronomefb_par *par)
392 +{
393 + unsigned long timeout = jiffies + HZ / 20;
394 +
395 + dev_dbg(&n516_device->dev, "ENTER1 %s, RDY=%d\n",
396 + __func__, gpio_get_value(GPIO_DISPLAY_RDY));
397 + while (n516_get_rdy(par) && time_before(jiffies, timeout))
398 + schedule();
399 +
400 + dev_dbg(&n516_device->dev, "ENTER2 %s, RDY=%d\n",
401 + __func__, gpio_get_value(GPIO_DISPLAY_RDY));
402 + return wait_event_timeout(par->waitq,
403 + n516_get_rdy(par), HZ * 2) ? 0 : -EIO;
404 +}
405 +
406 +static int n516_wait_event_intr(struct metronomefb_par *par)
407 +{
408 + unsigned long timeout = jiffies + HZ/20;
409 +
410 + dev_dbg(&n516_device->dev, "ENTER1 %s, RDY=%d\n",
411 + __func__, gpio_get_value(GPIO_DISPLAY_RDY));
412 + while (n516_get_rdy(par) && time_before(jiffies, timeout))
413 + schedule();
414 +
415 + dev_dbg(&n516_device->dev, "ENTER2 %s, RDY=%d\n",
416 + __func__, gpio_get_value(GPIO_DISPLAY_RDY));
417 + return wait_event_interruptible_timeout(par->waitq,
418 + n516_get_rdy(par), HZ * 2) ? 0 : -EIO;
419 +}
420 +
421 +static void n516_cleanup(struct metronomefb_par *par)
422 +{
423 + int i;
424 +
425 + free_irq(gpio_to_irq(GPIO_DISPLAY_RDY), par);
426 + for (i = 0; i < ARRAY_SIZE(metronome_gpios); ++i)
427 + gpio_free(metronome_gpios[i]);
428 +}
429 +
430 +static struct metronome_board n516_board __initdata = {
431 + .owner = THIS_MODULE,
432 + .power_ctl = n516_power_ctl,
433 + .setup_irq = n516_setup_irq,
434 + .setup_io = n516_init_metronome_gpios,
435 + .setup_fb = n516_setup_fb,
436 + .set_rst = n516_set_rst,
437 + .get_err = n516_get_err,
438 + .get_rdy = n516_get_rdy,
439 + .set_stdby = n516_set_stdby,
440 + .met_wait_event = n516_wait_event,
441 + .met_wait_event_intr = n516_wait_event_intr,
442 + .get_panel_type = n516_get_panel_type,
443 + .cleanup = n516_cleanup,
444 +};
445 +
446 +static int __init n516_init(void)
447 +{
448 + int ret;
449 +
450 + /* Keep the metronome off, until its driver is loaded */
451 + ret = gpio_request(GPIO_DISPLAY_OFF_N, "Display off");
452 + if (ret)
453 + return ret;
454 +
455 + gpio_direction_output(GPIO_DISPLAY_OFF_N, 1);
456 +
457 + /* before anything else, we request notification for any fb
458 + * creation events */
459 + fb_register_client(&n516_fb_notif);
460 +
461 + n516_device = platform_device_alloc("metronomefb", -1);
462 + if (!n516_device)
463 + return -ENOMEM;
464 +
465 + /* the n516_board that will be seen by metronomefb is a copy */
466 + platform_device_add_data(n516_device, &n516_board,
467 + sizeof(n516_board));
468 +
469 + n516_presetup_fb();
470 +
471 + return 0;
472 +}
473 +module_init(n516_init);
474 +
475 +MODULE_DESCRIPTION("board driver for n516 display");
476 +MODULE_AUTHOR("Yauhen Kharuzhy");
477 +MODULE_LICENSE("GPL");
478 --- /dev/null
479 +++ b/arch/mips/jz4740/board-n516.c
480 @@ -0,0 +1,182 @@
481 +/*
482 + * linux/arch/mips/jz4740/board-516.c
483 + *
484 + * JZ4740 n516 board setup routines.
485 + *
486 + * Copyright (c) 2009, Yauhen Kharuzhy <jekhor@gmail.com>
487 + *
488 + * This program is free software; you can redistribute it and/or modify
489 + * it under the terms of the GNU General Public License as published by
490 + * the Free Software Foundation; either version 2 of the License, or
491 + * (at your option) any later version.
492 + */
493 +
494 +#include <linux/init.h>
495 +#include <linux/sched.h>
496 +#include <linux/ioport.h>
497 +#include <linux/mm.h>
498 +#include <linux/console.h>
499 +#include <linux/delay.h>
500 +#include <linux/i2c.h>
501 +#include <linux/platform_device.h>
502 +#include <linux/mtd/mtd.h>
503 +#include <linux/leds.h>
504 +
505 +#include <linux/power_supply.h>
506 +#include <linux/power/gpio-charger.h>
507 +
508 +#include <linux/i2c.h>
509 +
510 +#include <asm/mach-jz4740/jz4740_mmc.h>
511 +#include <asm/mach-jz4740/jz4740_nand.h>
512 +
513 +#include <asm/mach-jz4740/board-n516.h>
514 +#include <asm/mach-jz4740/platform.h>
515 +
516 +#include "clock.h"
517 +
518 +static long n516_panic_blink(int state)
519 +{
520 + gpio_set_value(GPIO_LED_ENABLE, state ? 1 : 0);
521 + return 0;
522 +}
523 +
524 +static void __init board_gpio_setup(void)
525 +{
526 +/* jz_gpio_enable_pullup(JZ_GPIO_PORTD(23));
527 + jz_gpio_enable_pullup(JZ_GPIO_PORTD(24));*/
528 +}
529 +
530 +static const struct i2c_board_info n516_i2c_board_info[] = {
531 + {
532 + .type = "LPC524",
533 + .addr = 0x54,
534 + },
535 + {
536 + .type = "lm75a",
537 + .addr = 0x48,
538 + }
539 +};
540 +
541 +static struct jz4740_mmc_platform_data n516_mmc_pdata = {
542 + .gpio_card_detect = GPIO_SD_CD_N,
543 + .card_detect_active_low = 1,
544 + .gpio_read_only = -1,
545 + .gpio_power = GPIO_SD_VCC_EN_N,
546 + .power_active_low = 1,
547 +};
548 +
549 +static struct gpio_led n516_leds[] = {
550 + {
551 + .name = "n516:blue:power",
552 + .gpio = GPIO_LED_ENABLE,
553 + .default_state = LEDS_GPIO_DEFSTATE_ON,
554 + .default_trigger = "nand-disk",
555 + }
556 +};
557 +
558 +static struct gpio_led_platform_data n516_leds_pdata = {
559 + .leds = n516_leds,
560 + .num_leds = ARRAY_SIZE(n516_leds),
561 +};
562 +
563 +static struct platform_device n516_leds_device = {
564 + .name = "leds-gpio",
565 + .id = -1,
566 + .dev = {
567 + .platform_data = &n516_leds_pdata,
568 + },
569 +};
570 +
571 +static struct mtd_partition n516_partitions[] = {
572 + { .name = "NAND BOOT partition",
573 + .offset = 0 * 0x100000,
574 + .size = 4 * 0x100000,
575 + },
576 + { .name = "NAND KERNEL partition",
577 + .offset = 4 * 0x100000,
578 + .size = 4 * 0x100000,
579 + },
580 + { .name = "NAND ROOTFS partition",
581 + .offset = 8 * 0x100000,
582 + .size = 504 * 0x100000,
583 + },
584 +};
585 +
586 +static struct nand_ecclayout n516_ecclayout = {
587 +/* .eccbytes = 36,
588 + .eccpos = {
589 + 6, 7, 8, 9, 10, 11, 12, 13, 14,
590 + 15, 16, 17, 18, 19, 20, 21, 22, 23,
591 + 24, 25, 26, 27, 28, 29, 30, 31, 32,
592 + 33, 34, 35, 36, 37, 38, 39, 40, 41,
593 + },*/
594 + .oobfree = {
595 + {
596 + .offset = 2,
597 + .length = 4
598 + },
599 + {
600 + .offset = 42,
601 + .length = 22,
602 + }
603 + }
604 +};
605 +
606 +static struct jz_nand_platform_data n516_nand_pdata = {
607 + .ecc_layout = &n516_ecclayout,
608 + .partitions = n516_partitions,
609 + .num_partitions = ARRAY_SIZE(n516_partitions),
610 + .busy_gpio = 94,
611 +};
612 +
613 +static char *n516_batteries[] = {
614 + "n516_battery",
615 +};
616 +
617 +static struct gpio_charger_platform_data n516_charger_pdata = {
618 + .name = "usb",
619 + .type = POWER_SUPPLY_TYPE_USB,
620 + .gpio = GPIO_USB_DETECT,
621 + .gpio_active_low = 1,
622 + .batteries = n516_batteries,
623 + .num_batteries = ARRAY_SIZE(n516_batteries),
624 +};
625 +
626 +static struct platform_device n516_charger_device = {
627 + .name = "gpio-charger",
628 + .dev = {
629 + .platform_data = &n516_charger_pdata,
630 + },
631 +};
632 +
633 +static struct platform_device *n516_devices[] __initdata = {
634 + &jz4740_nand_device,
635 + &n516_leds_device,
636 + &jz4740_mmc_device,
637 + &jz4740_i2s_device,
638 + &jz4740_codec_device,
639 + &jz4740_rtc_device,
640 + &jz4740_udc_device,
641 + &jz4740_i2c_device,
642 + &n516_charger_device,
643 +};
644 +
645 +struct jz4740_clock_board_data jz4740_clock_bdata = {
646 + .ext_rate = 12000000,
647 + .rtc_rate = 32768,
648 +};
649 +
650 +static int n516_setup_platform(void)
651 +{
652 + jz4740_serial_device_register();
653 + board_gpio_setup();
654 +
655 + panic_blink = n516_panic_blink;
656 + i2c_register_board_info(0, n516_i2c_board_info, ARRAY_SIZE(n516_i2c_board_info));
657 + jz4740_mmc_device.dev.platform_data = &n516_mmc_pdata;
658 + jz4740_nand_device.dev.platform_data = &n516_nand_pdata;
659 +
660 + return platform_add_devices(n516_devices, ARRAY_SIZE(n516_devices));
661 +}
662 +arch_initcall(n516_setup_platform);
This page took 0.066808 seconds and 5 git commands to generate.