Commit bdf0fabd authored by 邱宗炽's avatar 邱宗炽

large page nand flash support

parent 6a2fda26
...@@ -100,20 +100,20 @@ static struct platform_device ntosd_644xa_norflash_device = { ...@@ -100,20 +100,20 @@ static struct platform_device ntosd_644xa_norflash_device = {
}; };
#if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE) #if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
#define UBOOT_START 0x18000 #define UBOOT_START 0xc0000
struct mtd_partition ntosd_644xa_nandflash_partition[] = { struct mtd_partition ntosd_644xa_nandflash_partition[] = {
/* uboot parameter */ /* uboot parameter */
{ {
.name = "u-boot-parameter", .name = "u-boot-parameter",
.offset = 0, .offset = 0,
.size = 1 * SZ_16K, .size = 1 * SZ_128K,
.mask_flags = 0, .mask_flags = 0,
}, },
/* ubl */ /* ubl */
{ {
.name = "ubl", .name = "ubl",
.offset = 1 * SZ_16K, .offset = 1 * SZ_128K,
.size = 5 * SZ_16K, .size = 5 * SZ_128K,
.mask_flags = 0, .mask_flags = 0,
}, },
/* 1 MB space from bootloader start for bootloader */ /* 1 MB space from bootloader start for bootloader */
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#ifdef CONFIG_NAND_FLASH_HW_ECC #ifdef CONFIG_NAND_FLASH_HW_ECC
#ifdef CONFIG_MACH_NTOSD_644XA #ifdef CONFIG_MACH_NTOSD_644XA
#define DAVINCI_NAND_ECC_MODE NAND_ECC_HW4_512 #define DAVINCI_NAND_ECC_MODE NAND_ECC_HW16_2048
#else #else
#define DAVINCI_NAND_ECC_MODE NAND_ECC_HW3_512 #define DAVINCI_NAND_ECC_MODE NAND_ECC_HW3_512
#endif #endif
......
...@@ -52,6 +52,11 @@ ...@@ -52,6 +52,11 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#endif #endif
#ifdef CONFIG_MACH_NTOSD_644XA
#define DM6446_NAND_ECC_SIZE 512
#define DM6446_NAND_ECC_BYTES 4
#endif
/* Define default oob placement schemes for large and small page devices */ /* Define default oob placement schemes for large and small page devices */
static struct nand_ecclayout nand_oob_8 = { static struct nand_ecclayout nand_oob_8 = {
.eccbytes = 3, .eccbytes = 3,
...@@ -808,9 +813,16 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -808,9 +813,16 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
uint8_t *buf) uint8_t *buf)
{ {
#ifdef CONFIG_MACH_NTOSD_644XA
/* every 512 bytes generate 4 bytes ecc */
int i, eccsize = DM6446_NAND_ECC_SIZE;
int eccbytes = DM6446_NAND_ECC_BYTES;
int eccsteps = chip->ecc.size / eccsize;
#else
int i, eccsize = chip->ecc.size; int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
#endif
uint8_t *p = buf; uint8_t *p = buf;
uint8_t *ecc_calc = chip->buffers->ecccalc; uint8_t *ecc_calc = chip->buffers->ecccalc;
uint8_t *ecc_code = chip->buffers->ecccode; uint8_t *ecc_code = chip->buffers->ecccode;
...@@ -1441,9 +1453,16 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1441,9 +1453,16 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf) const uint8_t *buf)
{ {
#ifdef CONFIG_MACH_NTOSD_644XA
/* every 512 bytes generate 4 bytes ecc */
int i, eccsize = DM6446_NAND_ECC_SIZE;
int eccbytes = DM6446_NAND_ECC_BYTES;
int eccsteps = chip->ecc.size / eccsize;
#else
int i, eccsize = chip->ecc.size; int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
#endif
uint8_t *ecc_calc = chip->buffers->ecccalc; uint8_t *ecc_calc = chip->buffers->ecccalc;
const uint8_t *p = buf; const uint8_t *p = buf;
uint32_t *eccpos = chip->ecc.layout->eccpos; uint32_t *eccpos = chip->ecc.layout->eccpos;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment