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

Wolfgang Denk wd at denx.de
Thu Apr 18 13:08:18 CEST 2013


Dear Kuo-Jung Su,

In message <1366277139-29728-9-git-send-email-dantesu at 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...

> +	struct spi_flash_info *fl = (struct spi_flash_info *)flash;
> +	return fl->chip;

Please always insert a blank line between declarations and code.

> +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?

> +	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.

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


More information about the U-Boot mailing list