diff options
Diffstat (limited to 'packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch')
-rw-r--r-- | packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch | 415 |
1 files changed, 415 insertions, 0 deletions
diff --git a/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch b/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch new file mode 100644 index 0000000000..79d53545e3 --- /dev/null +++ b/packages/linux/linux-nokia800-2.6.18-osso40/nokia770_nand_fix.patch @@ -0,0 +1,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 |