summaryrefslogtreecommitdiffstats
path: root/meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch')
-rw-r--r--meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch415
1 files changed, 415 insertions, 0 deletions
diff --git a/meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch b/meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch
new file mode 100644
index 0000000000..79d53545e3
--- /dev/null
+++ b/meta-extras/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch
@@ -0,0 +1,415 @@
1---
2 arch/arm/mach-omap1/board-nokia770.c | 60 +++++++++++++++++++++++++++++++----
3 arch/arm/mach-omap1/mmu.c | 1
4 drivers/cbus/tahvo-usb.c | 4 +-
5 drivers/i2c/chips/isp1301_omap.c | 1
6 drivers/mtd/mtdchar.c | 6 +++
7 drivers/mtd/mtdpart.c | 5 ++
8 drivers/mtd/nand/omap-hw.c | 55 +++++++++++++++-----------------
9 drivers/serial/8250.c | 2 +
10 drivers/video/omap/omapfb_main.c | 4 +-
11 include/asm-arm/arch-omap/keypad.h | 3 +
12 include/asm-arm/arch-omap/serial.h | 16 +++++++++
13 11 files changed, 118 insertions(+), 39 deletions(-)
14
15Index: linux-g/arch/arm/mach-omap1/board-nokia770.c
16===================================================================
17--- linux-g.orig/arch/arm/mach-omap1/board-nokia770.c 2006-11-08 13:18:39.000000000 +0100
18+++ linux-g/arch/arm/mach-omap1/board-nokia770.c 2007-08-13 16:23:15.000000000 +0200
19@@ -16,6 +16,8 @@
20
21 #include <linux/spi/spi.h>
22 #include <linux/spi/ads7846.h>
23+#include <linux/workqueue.h>
24+#include <linux/delay.h>
25
26 #include <asm/hardware.h>
27 #include <asm/mach-types.h>
28@@ -33,9 +35,12 @@
29 #include <asm/arch/gpio.h>
30 #include <asm/arch/omapfb.h>
31 #include <asm/arch/hwa742.h>
32+#include <asm/arch/lcd_mipid.h>
33
34 #include "../plat-omap/dsp/dsp_common.h"
35
36+#define ADS7846_PENDOWN_GPIO 15
37+
38 static void __init omap_nokia770_init_irq(void)
39 {
40 /* On Nokia 770, the SleepX signal is masked with an
41@@ -75,9 +80,11 @@
42 };
43
44 static struct omap_kp_platform_data nokia770_kp_data = {
45- .rows = 8,
46- .cols = 8,
47- .keymap = nokia770_keymap
48+ .rows = 8,
49+ .cols = 8,
50+ .keymap = nokia770_keymap,
51+ .keymapsize = ARRAY_SIZE(nokia770_keymap),
52+ .delay = 4,
53 };
54
55 static struct platform_device nokia770_kp_device = {
56@@ -94,6 +101,41 @@
57 &nokia770_kp_device,
58 };
59
60+static void mipid_shutdown(struct mipid_platform_data *pdata)
61+{
62+ if (pdata->nreset_gpio != -1) {
63+ printk(KERN_INFO "shutdown LCD\n");
64+ omap_set_gpio_dataout(pdata->nreset_gpio, 0);
65+ msleep(120);
66+ }
67+}
68+
69+static struct mipid_platform_data nokia770_mipid_platform_data = {
70+ .shutdown = mipid_shutdown,
71+};
72+
73+static void mipid_dev_init(void)
74+{
75+ const struct omap_lcd_config *conf;
76+
77+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
78+ if (conf != NULL) {
79+ nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
80+ nokia770_mipid_platform_data.data_lines = conf->data_lines;
81+ }
82+}
83+
84+static void ads7846_dev_init(void)
85+{
86+ if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
87+ printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
88+}
89+
90+static int ads7846_get_pendown_state(void)
91+{
92+ return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
93+}
94+
95 static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
96 .x_max = 0x0fff,
97 .y_max = 0x0fff,
98@@ -101,14 +143,17 @@
99 .pressure_max = 255,
100 .debounce_max = 10,
101 .debounce_tol = 3,
102+ .debounce_rep = 1,
103+ .get_pendown_state = ads7846_get_pendown_state,
104 };
105
106 static struct spi_board_info nokia770_spi_board_info[] __initdata = {
107 [0] = {
108- .modalias = "lcd_lph8923",
109+ .modalias = "lcd_mipid",
110 .bus_num = 2,
111 .chip_select = 3,
112 .max_speed_hz = 12000000,
113+ .platform_data = &nokia770_mipid_platform_data,
114 },
115 [1] = {
116 .modalias = "ads7846",
117@@ -189,7 +234,7 @@
118 },
119 };
120
121-static struct omap_board_config_kernel nokia770_config[] = {
122+static struct omap_board_config_kernel nokia770_config[] __initdata = {
123 { OMAP_TAG_USB, NULL },
124 { OMAP_TAG_MMC, &nokia770_mmc_config },
125 };
126@@ -235,7 +280,7 @@
127 printk("HP connected\n");
128 }
129
130-static void codec_delayed_power_down(void *arg)
131+static void codec_delayed_power_down(struct work_struct *work)
132 {
133 down(&audio_pwr_sem);
134 if (audio_pwr_state == -1)
135@@ -326,9 +371,12 @@
136 ARRAY_SIZE(nokia770_spi_board_info));
137 omap_board_config = nokia770_config;
138 omap_board_config_size = ARRAY_SIZE(nokia770_config);
139+ omap_gpio_init();
140 omap_serial_init();
141 omap_dsp_init();
142 hwa742_dev_init();
143+ ads7846_dev_init();
144+ mipid_dev_init();
145 }
146
147 static void __init omap_nokia770_map_io(void)
148Index: linux-g/arch/arm/mach-omap1/mmu.c
149===================================================================
150--- linux-g.orig/arch/arm/mach-omap1/mmu.c 2007-08-13 13:54:01.000000000 +0200
151+++ linux-g/arch/arm/mach-omap1/mmu.c 2007-08-13 16:23:15.000000000 +0200
152@@ -29,6 +29,7 @@
153 #include <linux/kernel.h>
154 #include <linux/mm.h>
155 #include <linux/err.h>
156+#include <linux/delay.h>
157 #include "mmu.h"
158 #include <asm/tlbflush.h>
159
160Index: linux-g/drivers/cbus/tahvo-usb.c
161===================================================================
162--- linux-g.orig/drivers/cbus/tahvo-usb.c 2006-11-08 13:18:51.000000000 +0100
163+++ linux-g/drivers/cbus/tahvo-usb.c 2007-08-13 16:23:15.000000000 +0200
164@@ -135,8 +135,8 @@
165 if ((!(OTG_CTRL_REG & OTG_DRIVER_SEL)) &&
166 tu->otg.host && tu->otg.state == OTG_STATE_A_HOST) {
167 /* role is host */
168- usb_bus_start_enum(tu->otg.host,
169- tu->otg.host->otg_port);
170+ //usb_bus_start_enum(tu->otg.host,
171+ // tu->otg.host->otg_port);
172 }
173 OTG_IRQ_SRC_REG = DRIVER_SWITCH;
174 } else
175Index: linux-g/drivers/i2c/chips/isp1301_omap.c
176===================================================================
177--- linux-g.orig/drivers/i2c/chips/isp1301_omap.c 2006-11-08 13:18:51.000000000 +0100
178+++ linux-g/drivers/i2c/chips/isp1301_omap.c 2007-08-13 16:23:15.000000000 +0200
179@@ -32,6 +32,7 @@
180 #include <linux/usb_gadget.h>
181 #include <linux/usb.h>
182 #include <linux/usb_otg.h>
183+#include <linux/usb/otg.h>
184 #include <linux/i2c.h>
185 #include <linux/workqueue.h>
186
187Index: linux-g/drivers/mtd/mtdchar.c
188===================================================================
189--- linux-g.orig/drivers/mtd/mtdchar.c 2006-11-08 13:18:55.000000000 +0100
190+++ linux-g/drivers/mtd/mtdchar.c 2007-08-13 16:23:15.000000000 +0200
191@@ -622,6 +622,12 @@
192 break;
193 }
194
195+ case MEMSETOOBSEL:
196+ {
197+ break;
198+ }
199+
200+
201 case MEMGETBADBLOCK:
202 {
203 loff_t offs;
204Index: linux-g/drivers/mtd/mtdpart.c
205===================================================================
206--- linux-g.orig/drivers/mtd/mtdpart.c 2006-11-08 13:18:55.000000000 +0100
207+++ linux-g/drivers/mtd/mtdpart.c 2007-08-13 16:23:15.000000000 +0200
208@@ -200,6 +200,11 @@
209 return -EINVAL;
210 instr->addr += part->offset;
211 ret = part->master->erase(part->master, instr);
212+ if (ret) {
213+ if (instr->fail_addr != 0xffffffff)
214+ instr->fail_addr -= part->offset;
215+ instr->addr -= part->offset;
216+ }
217 return ret;
218 }
219
220Index: linux-g/drivers/mtd/nand/omap-hw.c
221===================================================================
222--- linux-g.orig/drivers/mtd/nand/omap-hw.c 2006-11-08 13:18:55.000000000 +0100
223+++ linux-g/drivers/mtd/nand/omap-hw.c 2007-08-13 16:23:15.000000000 +0200
224@@ -386,11 +386,6 @@
225 return nand_read_reg8(NND_ACCESS);
226 }
227
228-static void omap_nand_write_byte(struct mtd_info *mtd, u_char byte)
229-{
230- nand_write_reg8(NND_ACCESS, byte);
231-}
232-
233 static int omap_nand_dev_ready(struct mtd_info *mtd)
234 {
235 u32 l;
236@@ -425,9 +420,9 @@
237 if (command == NAND_CMD_SEQIN) {
238 int readcmd;
239
240- if (column >= mtd->oobblock) {
241+ if (column >= mtd->writesize) {
242 /* OOB area */
243- column -= mtd->oobblock;
244+ column -= mtd->writesize;
245 readcmd = NAND_CMD_READOOB;
246 } else if (column < 256) {
247 /* First 256 bytes --> READ0 */
248@@ -458,7 +453,7 @@
249 struct nand_chip *this = mtd->priv;
250
251 if (command == NAND_CMD_READOOB) {
252- column += mtd->oobblock;
253+ column += mtd->writesize;
254 command = NAND_CMD_READ0;
255 }
256 switch (command) {
257@@ -495,7 +490,8 @@
258 int n;
259 struct nand_chip *this = mtd->priv;
260
261- if (this->eccmode == NAND_ECC_HW12_2048)
262+ /* Ex NAND_ECC_HW12_2048 */
263+ if ((this->ecc.mode == NAND_ECC_HW) && (this->ecc.size == 2048))
264 n = 4;
265 else
266 n = 1;
267@@ -642,7 +638,8 @@
268 int block_count = 0, i, r;
269
270 this = mtd->priv;
271- if (this->eccmode == NAND_ECC_HW12_2048)
272+ /* Ex NAND_ECC_HW12_2048 */
273+ if ((this->ecc.mode == NAND_ECC_HW) && (this->ecc.size == 2048))
274 block_count = 4;
275 else
276 block_count = 1;
277@@ -672,12 +669,12 @@
278 {
279 static const char *part_parsers[] = { "cmdlinepart", NULL };
280 struct mtd_partition *parts;
281- const struct omap_flash_part_config *cfg;
282+ const struct omap_flash_part_str_config *cfg;
283 char *part_str = NULL;
284 size_t part_str_len;
285 int c;
286
287- cfg = omap_get_var_config(OMAP_TAG_FLASH_PART, &part_str_len);
288+ cfg = omap_get_var_config(OMAP_TAG_FLASH_PART_STR, &part_str_len);
289 if (cfg != NULL) {
290 part_str = kmalloc(part_str_len + 1, GFP_KERNEL);
291 if (part_str == NULL)
292@@ -794,19 +791,20 @@
293
294 /* Used from chip select and nand_command() */
295 this->read_byte = omap_nand_read_byte;
296- this->write_byte = omap_nand_write_byte;
297
298- this->select_chip = omap_nand_select_chip;
299- this->dev_ready = omap_nand_dev_ready;
300- this->chip_delay = 0;
301- this->eccmode = NAND_ECC_HW3_512;
302- this->cmdfunc = omap_nand_command;
303- this->write_buf = omap_nand_write_buf;
304- this->read_buf = omap_nand_read_buf;
305- this->verify_buf = omap_nand_verify_buf;
306- this->calculate_ecc = omap_nand_calculate_ecc;
307- this->correct_data = omap_nand_correct_data;
308- this->enable_hwecc = omap_nand_enable_hwecc;
309+ this->select_chip = omap_nand_select_chip;
310+ this->dev_ready = omap_nand_dev_ready;
311+ this->chip_delay = 0;
312+ this->ecc.mode = NAND_ECC_HW;
313+ this->ecc.bytes = 3;
314+ this->ecc.size = 512;
315+ this->cmdfunc = omap_nand_command;
316+ this->write_buf = omap_nand_write_buf;
317+ this->read_buf = omap_nand_read_buf;
318+ this->verify_buf = omap_nand_verify_buf;
319+ this->ecc.calculate = omap_nand_calculate_ecc;
320+ this->ecc.correct = omap_nand_correct_data;
321+ this->ecc.hwctl = omap_nand_enable_hwecc;
322
323 nand_write_reg(NND_SYSCFG, 0x1); /* Enable auto idle */
324 nand_write_reg(NND_PSC_CLK, 10);
325@@ -822,11 +820,10 @@
326 l = nand_read_reg(NND_CTRL);
327 l |= 1 << 4; /* Set the A8 bit in CTRL reg */
328 nand_write_reg(NND_CTRL, l);
329- this->eccmode = NAND_ECC_HW12_2048;
330- this->eccsteps = 1;
331- this->eccsize = 2048;
332- this->eccbytes = 12;
333- omap_mtd->eccsize = 2048;
334+ this->ecc.mode = NAND_ECC_HW;
335+ this->ecc.steps = 1;
336+ this->ecc.size = 2048;
337+ this->ecc.bytes = 12;
338 nand_write_reg(NND_ECC_SELECT, 6);
339 }
340
341Index: linux-g/drivers/serial/8250.c
342===================================================================
343--- linux-g.orig/drivers/serial/8250.c 2006-11-08 13:18:59.000000000 +0100
344+++ linux-g/drivers/serial/8250.c 2007-08-13 16:23:15.000000000 +0200
345@@ -44,6 +44,8 @@
346 #include <asm/io.h>
347 #include <asm/irq.h>
348
349+#include <asm/arch/serial.h>
350+
351 #include "8250.h"
352
353 /*
354Index: linux-g/drivers/video/omap/omapfb_main.c
355===================================================================
356--- linux-g.orig/drivers/video/omap/omapfb_main.c 2007-08-13 13:54:01.000000000 +0200
357+++ linux-g/drivers/video/omap/omapfb_main.c 2007-08-13 16:23:15.000000000 +0200
358@@ -110,7 +110,7 @@
359
360 #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
361 #ifdef CONFIG_ARCH_OMAP1
362-extern struct lcd_ctrl_extif omap1_ext_if;
363+extern struct lcd_ctrl_extif sossi_extif;
364 #else
365 extern struct lcd_ctrl_extif omap2_ext_if;
366 #endif
367@@ -1658,7 +1658,7 @@
368 #ifdef CONFIG_ARCH_OMAP1
369 fbdev->int_ctrl = &omap1_int_ctrl;
370 #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
371- fbdev->ext_if = &omap1_ext_if;
372+ fbdev->ext_if = &sossi_extif;
373 #endif
374 #else /* OMAP2 */
375 fbdev->int_ctrl = &omap2_int_ctrl;
376Index: linux-g/include/asm-arm/arch-omap/keypad.h
377===================================================================
378--- linux-g.orig/include/asm-arm/arch-omap/keypad.h 2006-11-08 13:19:11.000000000 +0100
379+++ linux-g/include/asm-arm/arch-omap/keypad.h 2007-08-13 16:23:15.000000000 +0200
380@@ -14,7 +14,10 @@
381 int rows;
382 int cols;
383 int *keymap;
384+ unsigned int keymapsize;
385 unsigned int rep:1;
386+ unsigned long delay;
387+ unsigned int dbounce:1;
388 /* specific to OMAP242x*/
389 unsigned int *row_gpios;
390 unsigned int *col_gpios;
391Index: linux-g/include/asm-arm/arch-omap/serial.h
392===================================================================
393--- linux-g.orig/include/asm-arm/arch-omap/serial.h 2007-08-13 13:54:01.000000000 +0200
394+++ linux-g/include/asm-arm/arch-omap/serial.h 2007-08-13 16:23:15.000000000 +0200
395@@ -26,4 +26,20 @@
396 #define OMAP1510_BASE_BAUD (12000000/16)
397 #define OMAP16XX_BASE_BAUD (48000000/16)
398
399+#define is_omap_port(p) ({int __ret = 0; \
400+ if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
401+ p == IO_ADDRESS(OMAP_UART2_BASE) || \
402+ p == IO_ADDRESS(OMAP_UART3_BASE)) \
403+ __ret = 1; \
404+ __ret; \
405+ })
406+
407+#define is_omap_port(p) ({int __ret = 0; \
408+ if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
409+ p == IO_ADDRESS(OMAP_UART2_BASE) || \
410+ p == IO_ADDRESS(OMAP_UART3_BASE)) \
411+ __ret = 1; \
412+ __ret; \
413+ })
414+
415 #endif