[PATCH 4/8] atmel_nand: Clean up and fix probe() error path

Richard Genoud richard.genoud at gmail.com
Mon Jun 9 03:04:54 EDT 2008


hi !

>> The driver currently ioremap()'s the ECC controller's registers, but
>> on the AT91 the ECC controller is part of the System Peripherals and
>> so it is already mapped at startup.
>> I don't think it can/should be remapped twice.
>
> I don't see why that's really a problem -- it may get a different
> virtual address and possibly waste a TLB entry, but it should work.

Hmm, it reminds me something :
http://article.gmane.org/gmane.linux.ports.arm.kernel/38834

>> The AT91 patch (on maxim.org.za) current does:
>>     regs = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>>          ....
>>     host->ecc = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS);
>>     host->ecc += regs->start;
>> instead of the ioremap().  But this is not portable to the AVR32.
>
> How about sticking a "void __iomem *ecc_regs" field in struct
> atmel_nand_data and allow platforms to specify a pre-mapped pointer?
> Then the driver can do
>
>        if (host->board->ecc_regs)
>                host->ecc = host->board->ecc_regs;
>        else if (regs)
>                host->ecc = ioremap(regs->start, regs->end - regs->start + 1);
>
>        if (hard_ecc && !host->ecc)
>                printk("Hardware ECC not available\n");
>
> Right? I think we use a similar trick in the atmel_serial driver too.

It may be the best solution indeed.

richard.



More information about the linux-mtd mailing list