From 5b983412c73ee4e51e17e013bdfaadeec8a23542 Mon Sep 17 00:00:00 2001 From: Xiangfu Liu Date: Sat, 29 Aug 2009 00:35:35 +0800 Subject: [PATCH] add-2gb-nand-support Signed-off-by: Xiangfu Liu --- .../220-add-2gb-nand-support.patch | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 target/linux/xburst/patches-2.6.31/220-add-2gb-nand-support.patch diff --git a/target/linux/xburst/patches-2.6.31/220-add-2gb-nand-support.patch b/target/linux/xburst/patches-2.6.31/220-add-2gb-nand-support.patch new file mode 100644 index 000000000..0e5774768 --- /dev/null +++ b/target/linux/xburst/patches-2.6.31/220-add-2gb-nand-support.patch @@ -0,0 +1,166 @@ +diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c +index 6a129e7..3c069d8 100644 +--- a/arch/mips/jz4740/platform.c ++++ b/arch/mips/jz4740/platform.c +@@ -164,6 +164,45 @@ static struct resource jz_nand_resources[] = { + }, + }; + ++#ifdef QI_LB60_2GB_NAND ++static struct nand_ecclayout qi_lb60_ecclayout = { ++ .eccbytes = 72, ++ .eccpos = { ++ 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}, ++ .oobfree = { ++ {.offset = 2, ++ .length = 10}, ++ {.offset = 84, ++ .length = 44}} ++}; ++ ++static struct mtd_partition qi_lb60_partitions[] = { ++ { .name = "NAND BOOT partition", ++ .offset = 0 * 0x100000, ++ .size = 4 * 0x100000, ++ }, ++ { .name = "NAND KERNEL partition", ++ .offset = 4 * 0x100000, ++ .size = 4 * 0x100000, ++ }, ++ { .name = "NAND ROOTFS partition", ++ .offset = 8 * 0x100000, ++ .size = 504 * 0x100000, ++ }, ++ { .name = "NAND DATA partition", ++ .offset = 512 * 0x100000, ++ .size = (512 + 1024) * 0x100000, ++ }, ++}; ++#else + static struct nand_ecclayout qi_lb60_ecclayout = { + .eccbytes = 36, + .eccpos = { +@@ -180,29 +219,30 @@ static struct nand_ecclayout qi_lb60_ecclayout = { + }; + + static struct mtd_partition qi_lb60_partitions[] = { +- { .name = "NAND BOOT partition", +- .offset = 0 * 0x100000, +- .size = 4 * 0x100000, +- }, +- { .name = "NAND KERNEL partition", +- .offset = 4 * 0x100000, +- .size = 4 * 0x100000, +- }, +- { .name = "NAND ROOTFS partition", +- .offset = 8 * 0x100000, +- .size = 20 * 0x100000, +- }, +- { .name = "NAND DATA partition", +- .offset = 100 * 0x100000, +- .size = 20 * 0x100000, +- }, ++ { .name = "NAND BOOT partition", ++ .offset = 0 * 0x100000, ++ .size = 4 * 0x100000, ++ }, ++ { .name = "NAND KERNEL partition", ++ .offset = 4 * 0x100000, ++ .size = 4 * 0x100000, ++ }, ++ { .name = "NAND ROOTFS partition", ++ .offset = 8 * 0x100000, ++ .size = 504 * 0x100000, ++ }, ++ { .name = "NAND DATA partition", ++ .offset = 512 * 0x100000, ++ .size = 512 * 0x100000, ++ }, + }; ++#endif /* QI_LB60_2GB_NAND */ + + static struct jz_nand_platform_data jz_nand_platform_data = { + .num_partitions = ARRAY_SIZE(qi_lb60_partitions), + .partitions = qi_lb60_partitions, + .ecc_layout = &qi_lb60_ecclayout, +- .busy_gpio = 94, ++ .busy_gpio = 94, + }; + + static struct platform_device jz_nand_device = { +@@ -213,7 +253,9 @@ static struct platform_device jz_nand_device = { + .platform_data = &jz_nand_platform_data, + } + }; +-#define KEEP_UART_ALIVE ++/* #define KEEP_UART_ALIVE ++ * don't define this. the keyboard and keyboard both work ++ */ + + #define KEY_QI_QI KEY_F13 + #define KEY_QI_UPRED KEY_F14 +@@ -286,8 +328,8 @@ static const uint32_t qi_lb60_keymap[] = { + }; + + static const struct matrix_keymap_data qi_lb60_keymap_data = { +- .keymap = qi_lb60_keymap, +- .keymap_size = ARRAY_SIZE(qi_lb60_keymap), ++ .keymap = qi_lb60_keymap, ++ .keymap_size = ARRAY_SIZE(qi_lb60_keymap), + }; + + static const unsigned int qi_lb60_keypad_cols[] = { +@@ -297,12 +339,12 @@ static const unsigned int qi_lb60_keypad_cols[] = { + static const unsigned int qi_lb60_keypad_rows[] = { + 114, 115, 116, 117, 118, 119, 120, + #ifndef KEEP_UART_ALIVE +- 122, ++ 122, + #endif + }; + + static struct matrix_keypad_platform_data qi_lb60_pdata = { +- .keymap_data = &qi_lb60_keymap_data, ++ .keymap_data = &qi_lb60_keymap_data, + .col_gpios = qi_lb60_keypad_cols, + .row_gpios = qi_lb60_keypad_rows, + .num_col_gpios = ARRAY_SIZE(qi_lb60_keypad_cols), +@@ -310,7 +352,7 @@ static struct matrix_keypad_platform_data qi_lb60_pdata = { + .col_scan_delay_us = 10, + .debounce_ms = 10, + .wakeup = 1, +- .active_low = 1, ++ .active_low = 1, + }; + + static struct platform_device qi_lb60_keypad = { +@@ -375,7 +417,7 @@ static struct platform_device *jz_platform_devices[] __initdata = { + &jz_mmc_device, + &jz_nand_device, + &jz_i2c_device, +- &qi_lb60_keypad, ++ &qi_lb60_keypad, + &qi_lb60_fb, + }; + +diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h +index f86db5a..b19fffa 100644 +--- a/include/mtd/mtd-abi.h ++++ b/include/mtd/mtd-abi.h +@@ -135,7 +135,7 @@ struct nand_oobfree { + */ + struct nand_ecclayout { + __u32 eccbytes; +- __u32 eccpos[64]; ++ __u32 eccpos[72]; + __u32 oobavail; + struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; + };