summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch
blob: 79d53545e36b37adec50cfe542e53e293de114d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
---
 arch/arm/mach-omap1/board-nokia770.c |   60 +++++++++++++++++++++++++++++++----
 arch/arm/mach-omap1/mmu.c            |    1 
 drivers/cbus/tahvo-usb.c             |    4 +-
 drivers/i2c/chips/isp1301_omap.c     |    1 
 drivers/mtd/mtdchar.c                |    6 +++
 drivers/mtd/mtdpart.c                |    5 ++
 drivers/mtd/nand/omap-hw.c           |   55 +++++++++++++++-----------------
 drivers/serial/8250.c                |    2 +
 drivers/video/omap/omapfb_main.c     |    4 +-
 include/asm-arm/arch-omap/keypad.h   |    3 +
 include/asm-arm/arch-omap/serial.h   |   16 +++++++++
 11 files changed, 118 insertions(+), 39 deletions(-)

Index: linux-g/arch/arm/mach-omap1/board-nokia770.c
===================================================================
--- linux-g.orig/arch/arm/mach-omap1/board-nokia770.c	2006-11-08 13:18:39.000000000 +0100
+++ linux-g/arch/arm/mach-omap1/board-nokia770.c	2007-08-13 16:23:15.000000000 +0200
@@ -16,6 +16,8 @@
 
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
+#include <linux/workqueue.h>
+#include <linux/delay.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
@@ -33,9 +35,12 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/omapfb.h>
 #include <asm/arch/hwa742.h>
+#include <asm/arch/lcd_mipid.h>
 
 #include "../plat-omap/dsp/dsp_common.h"
 
+#define ADS7846_PENDOWN_GPIO	15
+
 static void __init omap_nokia770_init_irq(void)
 {
 	/* On Nokia 770, the SleepX signal is masked with an
@@ -75,9 +80,11 @@
 };
 
 static struct omap_kp_platform_data nokia770_kp_data = {
-	.rows   = 8,
-	.cols   = 8,
-	.keymap = nokia770_keymap
+	.rows		= 8,
+	.cols		= 8,
+	.keymap		= nokia770_keymap,
+	.keymapsize	= ARRAY_SIZE(nokia770_keymap),
+	.delay		= 4,
 };
 
 static struct platform_device nokia770_kp_device = {
@@ -94,6 +101,41 @@
 	&nokia770_kp_device,
 };
 
+static void mipid_shutdown(struct mipid_platform_data *pdata)
+{
+	if (pdata->nreset_gpio != -1) {
+		printk(KERN_INFO "shutdown LCD\n");
+		omap_set_gpio_dataout(pdata->nreset_gpio, 0);
+		msleep(120);
+	}
+}
+
+static struct mipid_platform_data nokia770_mipid_platform_data = {
+	.shutdown = mipid_shutdown,
+};
+
+static void mipid_dev_init(void)
+{
+	const struct omap_lcd_config *conf;
+
+	conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
+	if (conf != NULL) {
+		nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
+		nokia770_mipid_platform_data.data_lines = conf->data_lines;
+	}
+}
+
+static void ads7846_dev_init(void)
+{
+	if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
+		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
+}
+
+static int ads7846_get_pendown_state(void)
+{
+	return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
+}
+
 static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
 	.x_max		= 0x0fff,
 	.y_max		= 0x0fff,
@@ -101,14 +143,17 @@
 	.pressure_max	= 255,
 	.debounce_max	= 10,
 	.debounce_tol	= 3,
+	.debounce_rep	= 1,
+	.get_pendown_state	= ads7846_get_pendown_state,
 };
 
 static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	[0] = {
-		.modalias       = "lcd_lph8923",
+		.modalias       = "lcd_mipid",
 		.bus_num        = 2,
 		.chip_select    = 3,
 		.max_speed_hz   = 12000000,
+		.platform_data	= &nokia770_mipid_platform_data,
 	},
 	[1] = {
 		.modalias       = "ads7846",
@@ -189,7 +234,7 @@
 	},
 };
 
-static struct omap_board_config_kernel nokia770_config[] = {
+static struct omap_board_config_kernel nokia770_config[] __initdata = {
 	{ OMAP_TAG_USB,		NULL },
 	{ OMAP_TAG_MMC,		&nokia770_mmc_config },
 };
@@ -235,7 +280,7 @@
 		printk("HP connected\n");
 }
 
-static void codec_delayed_power_down(void *arg)
+static void codec_delayed_power_down(struct work_struct *work)
 {
 	down(&audio_pwr_sem);
 	if (audio_pwr_state == -1)
@@ -326,9 +371,12 @@
 				ARRAY_SIZE(nokia770_spi_board_info));
 	omap_board_config = nokia770_config;
 	omap_board_config_size = ARRAY_SIZE(nokia770_config);
+	omap_gpio_init();
 	omap_serial_init();
 	omap_dsp_init();
 	hwa742_dev_init();
+	ads7846_dev_init();
+	mipid_dev_init();
 }
 
 static void __init omap_nokia770_map_io(void)
Index: linux-g/arch/arm/mach-omap1/mmu.c
===================================================================
--- linux-g.orig/arch/arm/mach-omap1/mmu.c	2007-08-13 13:54:01.000000000 +0200
+++ linux-g/arch/arm/mach-omap1/mmu.c	2007-08-13 16:23:15.000000000 +0200
@@ -29,6 +29,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/err.h>
+#include <linux/delay.h>
 #include "mmu.h"
 #include <asm/tlbflush.h>
 
Index: linux-g/drivers/cbus/tahvo-usb.c
===================================================================
--- linux-g.orig/drivers/cbus/tahvo-usb.c	2006-11-08 13:18:51.000000000 +0100
+++ linux-g/drivers/cbus/tahvo-usb.c	2007-08-13 16:23:15.000000000 +0200
@@ -135,8 +135,8 @@
 		if ((!(OTG_CTRL_REG & OTG_DRIVER_SEL)) &&
 		   tu->otg.host && tu->otg.state == OTG_STATE_A_HOST) {
 			/* role is host */
-			usb_bus_start_enum(tu->otg.host,
-					   tu->otg.host->otg_port);
+			//usb_bus_start_enum(tu->otg.host,
+			//		   tu->otg.host->otg_port);
 		}
 		OTG_IRQ_SRC_REG = DRIVER_SWITCH;
 	} else
Index: linux-g/drivers/i2c/chips/isp1301_omap.c
===================================================================
--- linux-g.orig/drivers/i2c/chips/isp1301_omap.c	2006-11-08 13:18:51.000000000 +0100
+++ linux-g/drivers/i2c/chips/isp1301_omap.c	2007-08-13 16:23:15.000000000 +0200
@@ -32,6 +32,7 @@
 #include <linux/usb_gadget.h>
 #include <linux/usb.h>
 #include <linux/usb_otg.h>
+#include <linux/usb/otg.h>
 #include <linux/i2c.h>
 #include <linux/workqueue.h>
 
Index: linux-g/drivers/mtd/mtdchar.c
===================================================================
--- linux-g.orig/drivers/mtd/mtdchar.c	2006-11-08 13:18:55.000000000 +0100
+++ linux-g/drivers/mtd/mtdchar.c	2007-08-13 16:23:15.000000000 +0200
@@ -622,6 +622,12 @@
 		break;
 	}
 
+        case MEMSETOOBSEL:
+        {
+                break;
+        }
+
+
 	case MEMGETBADBLOCK:
 	{
 		loff_t offs;
Index: linux-g/drivers/mtd/mtdpart.c
===================================================================
--- linux-g.orig/drivers/mtd/mtdpart.c	2006-11-08 13:18:55.000000000 +0100
+++ linux-g/drivers/mtd/mtdpart.c	2007-08-13 16:23:15.000000000 +0200
@@ -200,6 +200,11 @@
 		return -EINVAL;
 	instr->addr += part->offset;
 	ret = part->master->erase(part->master, instr);
+	if (ret) {
+		if (instr->fail_addr != 0xffffffff)
+			instr->fail_addr -= part->offset;
+		instr->addr -= part->offset;
+	}
 	return ret;
 }
 
Index: linux-g/drivers/mtd/nand/omap-hw.c
===================================================================
--- linux-g.orig/drivers/mtd/nand/omap-hw.c	2006-11-08 13:18:55.000000000 +0100
+++ linux-g/drivers/mtd/nand/omap-hw.c	2007-08-13 16:23:15.000000000 +0200
@@ -386,11 +386,6 @@
 	return nand_read_reg8(NND_ACCESS);
 }
 
-static void omap_nand_write_byte(struct mtd_info *mtd, u_char byte)
-{
-	nand_write_reg8(NND_ACCESS, byte);
-}
-
 static int omap_nand_dev_ready(struct mtd_info *mtd)
 {
 	u32 l;
@@ -425,9 +420,9 @@
 	if (command == NAND_CMD_SEQIN) {
 		int readcmd;
 
-		if (column >= mtd->oobblock) {
+		if (column >= mtd->writesize) {
 			/* OOB area */
-			column -= mtd->oobblock;
+			column -= mtd->writesize;
 			readcmd = NAND_CMD_READOOB;
 		} else if (column < 256) {
 			/* First 256 bytes --> READ0 */
@@ -458,7 +453,7 @@
 	struct nand_chip *this = mtd->priv;
 
 	if (command == NAND_CMD_READOOB) {
-		column += mtd->oobblock;
+		column += mtd->writesize;
 		command = NAND_CMD_READ0;
 	}
 	switch (command) {
@@ -495,7 +490,8 @@
 	int n;
 	struct nand_chip *this = mtd->priv;
 
-	if (this->eccmode == NAND_ECC_HW12_2048)
+	/* Ex NAND_ECC_HW12_2048 */
+	if ((this->ecc.mode == NAND_ECC_HW) && (this->ecc.size  == 2048))
 		n = 4;
 	else
 		n = 1;
@@ -642,7 +638,8 @@
 	int block_count = 0, i, r;
 
 	this = mtd->priv;
-	if (this->eccmode == NAND_ECC_HW12_2048)
+	/* Ex NAND_ECC_HW12_2048 */
+	if ((this->ecc.mode == NAND_ECC_HW) && (this->ecc.size  == 2048))
 		block_count = 4;
 	else
 		block_count = 1;
@@ -672,12 +669,12 @@
 {
 	static const char *part_parsers[] = { "cmdlinepart", NULL };
 	struct mtd_partition *parts;
-	const struct omap_flash_part_config *cfg;
+	const struct omap_flash_part_str_config *cfg;
 	char *part_str = NULL;
 	size_t part_str_len;
 	int c;
 
-	cfg = omap_get_var_config(OMAP_TAG_FLASH_PART, &part_str_len);
+	cfg = omap_get_var_config(OMAP_TAG_FLASH_PART_STR, &part_str_len);
 	if (cfg != NULL) {
 		part_str = kmalloc(part_str_len + 1, GFP_KERNEL);
 		if (part_str == NULL)
@@ -794,19 +791,20 @@
 
 	/* Used from chip select and nand_command() */
 	this->read_byte = omap_nand_read_byte;
-	this->write_byte = omap_nand_write_byte;
 
-	this->select_chip = omap_nand_select_chip;
-	this->dev_ready = omap_nand_dev_ready;
-	this->chip_delay = 0;
-	this->eccmode = NAND_ECC_HW3_512; 
-	this->cmdfunc = omap_nand_command;
-	this->write_buf = omap_nand_write_buf;
-	this->read_buf = omap_nand_read_buf;
-	this->verify_buf = omap_nand_verify_buf;
-	this->calculate_ecc = omap_nand_calculate_ecc;
-	this->correct_data = omap_nand_correct_data;
-	this->enable_hwecc = omap_nand_enable_hwecc;
+	this->select_chip   = omap_nand_select_chip;
+	this->dev_ready     = omap_nand_dev_ready;
+	this->chip_delay    = 0;
+	this->ecc.mode      = NAND_ECC_HW;
+	this->ecc.bytes     = 3;
+	this->ecc.size      = 512;
+	this->cmdfunc       = omap_nand_command;
+	this->write_buf     = omap_nand_write_buf;
+	this->read_buf      = omap_nand_read_buf;
+	this->verify_buf    = omap_nand_verify_buf;
+	this->ecc.calculate = omap_nand_calculate_ecc;
+	this->ecc.correct   = omap_nand_correct_data;
+	this->ecc.hwctl     = omap_nand_enable_hwecc;
 
 	nand_write_reg(NND_SYSCFG, 0x1); /* Enable auto idle */
 	nand_write_reg(NND_PSC_CLK, 10);
@@ -822,11 +820,10 @@
 		l = nand_read_reg(NND_CTRL);
 		l |= 1 << 4; /* Set the A8 bit in CTRL reg */
 		nand_write_reg(NND_CTRL, l);
-		this->eccmode = NAND_ECC_HW12_2048;
-		this->eccsteps = 1;
-		this->eccsize = 2048;
-		this->eccbytes = 12;
-		omap_mtd->eccsize = 2048;
+		this->ecc.mode = NAND_ECC_HW;
+		this->ecc.steps = 1;
+		this->ecc.size = 2048;
+		this->ecc.bytes = 12;
 		nand_write_reg(NND_ECC_SELECT, 6);
 	}
 
Index: linux-g/drivers/serial/8250.c
===================================================================
--- linux-g.orig/drivers/serial/8250.c	2006-11-08 13:18:59.000000000 +0100
+++ linux-g/drivers/serial/8250.c	2007-08-13 16:23:15.000000000 +0200
@@ -44,6 +44,8 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
+#include <asm/arch/serial.h>
+
 #include "8250.h"
 
 /*
Index: linux-g/drivers/video/omap/omapfb_main.c
===================================================================
--- linux-g.orig/drivers/video/omap/omapfb_main.c	2007-08-13 13:54:01.000000000 +0200
+++ linux-g/drivers/video/omap/omapfb_main.c	2007-08-13 16:23:15.000000000 +0200
@@ -110,7 +110,7 @@
 
 #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
 #ifdef CONFIG_ARCH_OMAP1
-extern struct lcd_ctrl_extif omap1_ext_if;
+extern struct lcd_ctrl_extif sossi_extif;
 #else
 extern struct lcd_ctrl_extif omap2_ext_if;
 #endif
@@ -1658,7 +1658,7 @@
 #ifdef CONFIG_ARCH_OMAP1
 	fbdev->int_ctrl = &omap1_int_ctrl;
 #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
-	fbdev->ext_if = &omap1_ext_if;
+	fbdev->ext_if = &sossi_extif;
 #endif
 #else	/* OMAP2 */
 	fbdev->int_ctrl = &omap2_int_ctrl;
Index: linux-g/include/asm-arm/arch-omap/keypad.h
===================================================================
--- linux-g.orig/include/asm-arm/arch-omap/keypad.h	2006-11-08 13:19:11.000000000 +0100
+++ linux-g/include/asm-arm/arch-omap/keypad.h	2007-08-13 16:23:15.000000000 +0200
@@ -14,7 +14,10 @@
 	int rows;
 	int cols;
 	int *keymap;
+	unsigned int keymapsize;
 	unsigned int rep:1;
+	unsigned long delay;
+	unsigned int dbounce:1;
 	/* specific to OMAP242x*/
 	unsigned int *row_gpios;
 	unsigned int *col_gpios;
Index: linux-g/include/asm-arm/arch-omap/serial.h
===================================================================
--- linux-g.orig/include/asm-arm/arch-omap/serial.h	2007-08-13 13:54:01.000000000 +0200
+++ linux-g/include/asm-arm/arch-omap/serial.h	2007-08-13 16:23:15.000000000 +0200
@@ -26,4 +26,20 @@
 #define OMAP1510_BASE_BAUD	(12000000/16)
 #define OMAP16XX_BASE_BAUD	(48000000/16)
 
+#define is_omap_port(p) ({int __ret = 0;                        \
+                         if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
+                             p == IO_ADDRESS(OMAP_UART2_BASE) || \
+                             p == IO_ADDRESS(OMAP_UART3_BASE))   \
+                                 __ret = 1;                      \
+                         __ret;                                  \
+                         })
+
+#define is_omap_port(p) ({int __ret = 0;                        \
+                         if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
+                             p == IO_ADDRESS(OMAP_UART2_BASE) || \
+                             p == IO_ADDRESS(OMAP_UART3_BASE))   \
+                                 __ret = 1;                      \
+                         __ret;                                  \
+                         })
+
 #endif