[AT9SAM] implement different ECC modes for NAND chips
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
c3fc1364d9
commit
87d4b9ec09
|
@ -44,6 +44,8 @@ static struct atmel_nand_data nand_pdata = {
|
|||
.ale = 21,
|
||||
.cle = 22,
|
||||
/* .det_pin = ... not connected */
|
||||
.ecc_base = (void __iomem *)AT91C_BASE_HECC,
|
||||
.ecc_mode = NAND_ECC_HW,
|
||||
.rdy_pin = NAND_READY_GPIO,
|
||||
.enable_pin = NAND_ENABLE_GPIO,
|
||||
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
|
||||
|
@ -86,15 +88,26 @@ static struct device_d macb_dev = {
|
|||
|
||||
static int at91sam9260ek_devices_init(void)
|
||||
{
|
||||
struct device_d *nand, *dev;
|
||||
|
||||
register_device(&sdram_dev);
|
||||
|
||||
gpio_direction_input(NAND_READY_GPIO);
|
||||
gpio_direction_output(NAND_ENABLE_GPIO, 1);
|
||||
|
||||
register_device(&nand_dev);
|
||||
register_device(&macb_dev);
|
||||
|
||||
armlinux_set_bootparams((void *)0x20000100);
|
||||
armlinux_set_architecture(MACH_TYPE_AT91SAM9260EK);
|
||||
|
||||
gpio_direction_input(NAND_READY_GPIO);
|
||||
gpio_direction_output(NAND_ENABLE_GPIO, 1);
|
||||
nand = get_device_by_path("/dev/nand0");
|
||||
dev = dev_add_partition(nand, 0x00000, 0x80000, PARTITION_FIXED, "self_raw");
|
||||
dev_add_bb_dev(dev, "self0");
|
||||
dev = dev_add_partition(nand, 0x40000, 0x40000, PARTITION_FIXED, "env_raw");
|
||||
dev_add_bb_dev(dev, "env0");
|
||||
dev_add_partition(nand, 0x00000, 0x80000, PARTITION_FIXED, "self");
|
||||
dev_add_partition(nand, 0x40000, 0x40000, PARTITION_FIXED, "env");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -399,10 +399,12 @@ static int __init atmel_nand_probe(struct device_d *dev)
|
|||
if (host->board->rdy_pin)
|
||||
nand_chip->dev_ready = atmel_nand_device_ready;
|
||||
|
||||
nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */
|
||||
if (no_ecc)
|
||||
nand_chip->ecc.mode = NAND_ECC_NONE;
|
||||
if (hard_ecc && pdata->ecc_base) {
|
||||
nand_chip->ecc.mode = pdata->ecc_mode;
|
||||
|
||||
if (pdata->ecc_mode == NAND_ECC_HW) {
|
||||
if (!pdata->ecc_base)
|
||||
return -ENODEV;
|
||||
|
||||
host->ecc = pdata->ecc_base;
|
||||
|
||||
nand_chip->ecc.mode = NAND_ECC_HW;
|
||||
|
|
|
@ -14,6 +14,7 @@ struct atmel_nand_data {
|
|||
u8 ale; /* address line number connected to ALE */
|
||||
u8 cle; /* address line number connected to CLE */
|
||||
u8 bus_width_16; /* buswidth is 16 bit */
|
||||
u8 ecc_mode; /* NAND_ECC_* */
|
||||
};
|
||||
|
||||
#endif /* __ASM_ARCH_NAND_H */
|
||||
|
|
Loading…
Reference in New Issue