[U-Boot] [PATCH v2 08/12] mtd: spi: add FTSPI020 SPI Flash controller support

Kuo-Jung Su
2013-04-22T01:51:08Z

2013/4/18 Wolfgang Denk <wd@denx.de>:
> Dear Kuo-Jung Su,
>
> In message <1366277139-29728-9-git-send-email-dantesu@gmail.com> you wrote:
> ...
>> +/* Register access macros */
>> +#define SPI_READ(r) le32_to_cpu(readl(r))
>> +#define SPI_WRITE(v, r) writel(cpu_to_le32(v), r)
>> +#define SPI_SETBITS(m, r) setbits_le32(r, m)
>> +#define SPI_CLRBITS(m, r) clrbits_le32(r, m)
>
> see before...
>

Got it, thanks

>> + struct spi_flash_info *fl = (struct spi_flash_info *)flash;
>> + return fl->chip;
>
> Please always insert a blank line between declarations and code.
>

Got it, thanks

>> +static const struct spi_flash_param sf_list[] = {
>> +
>> + /* Atmel -- some are (confusingly) marketed as "DataFlash" */
>> + { "at25fs010", 0x1f6601, 0, 32 * 1024, 4 },
>> + { "at25fs040", 0x1f6604, 0, 64 * 1024, 8 },
>> +
>> + { "at25df041a", 0x1f4401, 0, 64 * 1024, 8 },
>> + { "at25df321a", 0x1f4701, 0, 64 * 1024, 64 },
>> + { "at25df641", 0x1f4800, 0, 64 * 1024, 128 },
> ...
>
> should we not rather move this into a separate, global header file?
>

Sure, I'll make it a separate file or a global header file if possible.

>> + for (i = 0; i < ARRAY_SIZE(id32); ++i) {
>> + /* wait until rx ready */
>> + while (!(SPI_READ(&regs->sr) & SR_RFR))
>> + ;
>
> See previous note about timeouts. Please fix globally.
>
>> + /* wait until command finish */
>> + while (!(SPI_READ(&regs->isr) & ISR_CMD))
>> + ;
>
> Ditto. etc. etc.
>

Got it, thanks

> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> "Ja, mach' nur einen Plan, sei nur ein grosses Licht
> und mach' dann noch 'nen zweiten Plan, geh'n tun sie beide nicht."
> -- Bert Brecht, Dreigroschenoper

--
Best wishes,
Kuo-Jung Su