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