[U-Boot] [PATCH v2 1/3] mpc52xx: Add SPI driver.
Detlev Zundel
dzu at denx.de
Wed Jun 10 13:33:51 CEST 2009
Hi Grzegorz,
> Signed-off-by: Grzegorz Bernacki <gjb at semihalf.com>
> ---
> v2:
> - use accessor macros
>
[...]
> + out8((u32)&spi->ddr, 0x0F); /* set all SPI pins as output */
> + out8((u32)&spi->pdr, 0x00); /* set SS low */
> + /* SPI is master, SS is general purpose output */
> + out8((u32)&spi->cr1, SPI_CR_MSTR | SPI_CR_SPE);
> + out8((u32)&spi->cr2, 0x00); /* normal operation */
> + out8((u32)&spi->brr, 0x77); /* baud rate: IPB clock / 2048 */
Ok, we're actually using the accessor macros, but I fail to see why a
(u32) cast is needed here - it even actively prevents one of the
"features" of the macros, namely type checking.
Why exactly are they needed?
Thanks
Detlev
--
Irrationality is the square root of all evil.
-- Douglas Hofstadter
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
More information about the U-Boot
mailing list