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

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

Archive Download this file



interactive