OneNAND: Enabling ECC in main area
Kyungmin Park
kmpark at infradead.org
Sun Feb 25 19:16:46 EST 2007
Hi,
>
> The bootloader on the board we use (LogicPD PXA270) does not
> have ECC enabled during its operation. Hence, we need to
> enable it sometime during the OneNAND device driver setup.
> This is the code that is inserted in the onenand_probe
> function, just after the first wait call.
>
> // Contains old value of sysconfig register from bootloader
> syscfg = syscfg & 0xfeff; // ~0x0100;
>
> this->write_word (syscfg,
> this->base + ONENAND_REG_SYS_CFG1);
>
>
> // Reset the command after enabling the ECC.
> this->write_word (ONENAND_CMD_RESET,
> this->base + ONENAND_BOOTRAM);
>
> // Wait reset.
> this->wait (mtd,
> FL_RESETING);
The order is wrong.
The Reset command set syscfg1 value to default.
If you want to keep the bootloader value you don't need to insert reset
command.
/* Save system configuration 1 */
syscfg = this->read_word(this->base + ONENAND_REG_SYS_CFG1);
/* Clear Sync. Burst Read mode to read BootRAM */
this->write_word((syscfg & ~ONENAND_SYS_CFG1_SYNC_READ), this->base
+ ONENAND_REG_SYS_CFG1);
/* Send the command for reading device ID from BootRAM */
this->write_word(ONENAND_CMD_READID, this->base + ONENAND_BOOTRAM);
/* Read manufacturer and device IDs from BootRAM */
bram_maf_id = this->read_word(this->base + ONENAND_BOOTRAM + 0x0);
bram_dev_id = this->read_word(this->base + ONENAND_BOOTRAM + 0x2);
/* Reset OneNAND to read default register values */
this->write_word(ONENAND_CMD_RESET, this->base + ONENAND_BOOTRAM);
/* Wait reset */
this->wait(mtd, FL_RESETING);
=> syscfg &= ~ONENAND_SYS_CFG1_NO_ECC;
/* Restore system configuration 1 */
this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
Thank you,
Kyungmin Park
More information about the linux-mtd
mailing list