Root/target/linux/xburst/patches-3.0/0004-MIPS-JZ4740-Add-id800wt-board.patch

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

Archive Download this file



interactive