[U-Boot] [PATCH v2 05/12] spi: add Faraday FTSPI010 SPI controller support

Wolfgang Denk wd at denx.de
Thu Apr 18 12:56:36 CEST 2013


Dear Kuo-Jung Su,

In message <1366277139-29728-6-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)

Ad before: drop these.

> +#ifdef CONFIG_FTSSP010_GPIO_BASE
> +#define SPI_GPIO_READ(p, r)	\
> +	le32_to_cpu(readl((p)->gpio.iobase + (r)))
> +#define SPI_GPIO_WRITE(p, v, r)	\
> +	writel(cpu_to_le32(v), (p)->gpio.iobase + (r))
> +#define SPI_GPIO_SETBITS(p, m, r)	\
> +	setbits_le32((p)->gpio.iobase + (r), m)
> +#define SPI_GPIO_CLRBITS(p, m, r)	\
> +	clrbits_le32((p)->gpio.iobase + (r), m)
> +#endif /* #ifdef CONFIG_FTSSP010_GPIO_BASE */

We do not allos I/O accesses throug base addrss plus offset.
Please use proper C structs instead.


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
Sorry, but my karma just ran over your dogma.


More information about the U-Boot mailing list