Root/target/linux/xburst/patches-2.6.36/008-add-id800wt-board-support.patch

1From 50d9e1cc2f4b30ec6073271822c70ad22a308fda Mon Sep 17 00:00:00 2001
2From: Lars-Peter Clausen <lars@metafoo.de>
3Date: Sun, 5 Sep 2010 20:34:08 +0200
4Subject: [PATCH] MIPS: JZ4740: Add id800wt board
5
6---
7 arch/mips/jz4740/Kconfig | 3 +
8 arch/mips/jz4740/Makefile | 1 +
9 arch/mips/jz4740/board-id800wt.c | 158 ++++++++++++++++++++++++++++++++++++++
10 3 files changed, 162 insertions(+), 0 deletions(-)
11 create mode 100644 arch/mips/jz4740/board-id800wt.c
12
13--- a/arch/mips/jz4740/Kconfig
14+++ b/arch/mips/jz4740/Kconfig
15@@ -12,6 +12,9 @@ config JZ4740_N516
16 config JZ4740_N526
17     bool "Hanvon n526 eBook reader"
18 
19+config JZ4740_ID800WT
20+ bool "Sungale id800wt picture frame"
21+
22 endchoice
23 
24 config HAVE_PWM
25--- a/arch/mips/jz4740/Makefile
26+++ b/arch/mips/jz4740/Makefile
27@@ -14,6 +14,7 @@ obj-$(CONFIG_DEBUG_FS) += clock-debugfs.
28 obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o
29 obj-$(CONFIG_JZ4740_N516) += board-n516.o board-n516-display.o
30 obj-$(CONFIG_JZ4740_N526) += board-n526.o
31+obj-$(CONFIG_JZ4740_ID800WT) += board-id800wt.o
32 
33 # PM support
34 
35--- /dev/null
36+++ b/arch/mips/jz4740/board-id800wt.c
37@@ -0,0 +1,158 @@
38+/*
39+ * Copyright (C) 2010 Lars-Peter Clausen <lars@metafoo.de>
40+ *
41+ * This program is free software; you can redistribute it and/or modify
42+ * it under the terms of the GNU General Public License version 2 or later
43+ * as published by the Free Software Foundation.
44+ */
45+
46+#include <linux/kernel.h>
47+#include <linux/init.h>
48+#include <linux/gpio.h>
49+
50+#include <asm/mach-jz4740/platform.h>
51+
52+#include <linux/input.h>
53+#include <linux/power_supply.h>
54+#include <linux/pwm_backlight.h>
55+
56+#include "clock.h"
57+
58+#include <asm/mach-jz4740/jz4740_fb.h>
59+#include <asm/mach-jz4740/jz4740_nand.h>
60+
61+/* NAND */
62+static struct nand_ecclayout id800wt_ecclayout = {
63+ .oobfree = {
64+ {
65+ .offset = 2,
66+ .length = 4,
67+ },
68+ {
69+ .offset = 42,
70+ .length = 22,
71+ },
72+ }
73+};
74+
75+static struct mtd_partition id800wt_partitions[] = {
76+ { .name = "NAND BOOT partition",
77+ .offset = 0 * 0x100000,
78+ .size = 2 * 0x100000,
79+ },
80+ { .name = "NAND KERNEL partition",
81+ .offset = 2 * 0x100000,
82+ .size = 4 * 0x100000,
83+ },
84+ { .name = "NAND ROOTFS partition",
85+ .offset = 6 * 0x100000,
86+ .size = 498 * 0x100000,
87+ },
88+};
89+
90+static struct jz_nand_platform_data id800wt_nand_pdata = {
91+ .ecc_layout = &id800wt_ecclayout,
92+ .partitions = id800wt_partitions,
93+ .num_partitions = ARRAY_SIZE(id800wt_partitions),
94+ .busy_gpio = JZ_GPIO_PORTC(30),
95+};
96+
97+/* Display */
98+static struct fb_videomode id800wt_video_modes[] = {
99+ {
100+ .name = "800x600",
101+ .xres = 800,
102+ .yres = 600,
103+ .refresh = 40,
104+ .left_margin = 0,
105+ .right_margin = 255,
106+ .upper_margin = 0,
107+ .lower_margin = 35,
108+ .hsync_len = 1,
109+ .vsync_len = 1,
110+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
111+ .vmode = FB_VMODE_NONINTERLACED,
112+ },
113+};
114+
115+static struct jz4740_fb_platform_data id800wt_fb_pdata = {
116+ .width = 60,
117+ .height = 45,
118+ .num_modes = ARRAY_SIZE(id800wt_video_modes),
119+ .modes = id800wt_video_modes,
120+ .bpp = 16,
121+ .lcd_type = JZ_LCD_TYPE_SPECIAL_TFT_1,
122+ .pixclk_falling_edge = 1,
123+ .special_tft_config = {
124+ .spl = JZ4740_FB_SPECIAL_TFT_CONFIG(1051, 1053),
125+ .cls = JZ4740_FB_SPECIAL_TFT_CONFIG(631, 744),
126+ .ps = JZ4740_FB_SPECIAL_TFT_CONFIG(0, 45),
127+ .rev = JZ4740_FB_SPECIAL_TFT_CONFIG(0, 0),
128+ },
129+};
130+
131+/* Backlight */
132+static int id800wt_backlight_invert(struct device *dev, int brightness)
133+{
134+ return 255 - brightness;
135+}
136+
137+static struct platform_pwm_backlight_data id800wt_backlight_data = {
138+ .pwm_id = 7,
139+ .max_brightness = 255,
140+ .dft_brightness = 255,
141+ .pwm_period_ns = 8000000,
142+ .notify = id800wt_backlight_invert,
143+};
144+
145+static struct platform_device id800wt_backlight_device = {
146+ .name = "pwm-backlight",
147+ .id = -1,
148+ .dev = {
149+ .platform_data = &id800wt_backlight_data,
150+ .parent = &jz4740_framebuffer_device.dev,
151+ },
152+};
153+
154+static struct platform_device *jz_platform_devices[] __initdata = {
155+ &jz4740_usb_ohci_device,
156+ &jz4740_udc_device,
157+ &jz4740_nand_device,
158+ &jz4740_framebuffer_device,
159+ &jz4740_i2s_device,
160+ &jz4740_codec_device,
161+ &jz4740_pcm_device,
162+ &jz4740_rtc_device,
163+ &jz4740_adc_device,
164+ &id800wt_backlight_device,
165+};
166+
167+static int __init id800wt_init_platform_devices(void)
168+{
169+ jz4740_framebuffer_device.dev.platform_data = &id800wt_fb_pdata;
170+ jz4740_nand_device.dev.platform_data = &id800wt_nand_pdata;
171+
172+ jz4740_serial_device_register();
173+
174+ jz_gpio_enable_pullup(JZ_GPIO_LCD_PS);
175+ jz_gpio_enable_pullup(JZ_GPIO_LCD_REV);
176+
177+ return platform_add_devices(jz_platform_devices,
178+ ARRAY_SIZE(jz_platform_devices));
179+}
180+
181+struct jz4740_clock_board_data jz4740_clock_bdata = {
182+ .ext_rate = 12000000,
183+ .rtc_rate = 32768,
184+};
185+
186+static int __init id800wt_board_setup(void)
187+{
188+ printk("Sungale pictureframe id800wt setup\n");
189+
190+ if (id800wt_init_platform_devices())
191+ panic("Failed to initalize platform devices\n");
192+
193+ return 0;
194+}
195+arch_initcall(id800wt_board_setup);
196

Archive Download this file



interactive