public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/3] mpc52xx: Add SPI driver.
Date: Wed, 10 Jun 2009 13:33:51 +0200	[thread overview]
Message-ID: <m2ocsw2uhs.fsf@ohwell.denx.de> (raw)
In-Reply-To: <1244549692-68089-1-git-send-email-gjb@semihalf.com> (Grzegorz Bernacki's message of "Tue, 9 Jun 2009 14:14:50 +0200")

Hi Grzegorz,

> Signed-off-by: Grzegorz Bernacki <gjb@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

  parent reply	other threads:[~2009-06-10 11:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 12:14 [U-Boot] [PATCH v2 1/3] mpc52xx: Add SPI driver Grzegorz Bernacki
2009-06-09 12:14 ` [U-Boot] [PATCH v2 2/3] digsy MTC: Add SPI support Grzegorz Bernacki
2009-06-10 11:39   ` Detlev Zundel
2009-06-10 14:03     ` Grzegorz Bernacki
2009-06-09 12:14 ` [U-Boot] [PATCH v2 3/3] digsy MTC: Add 'mtc' command Grzegorz Bernacki
2009-06-10 11:33 ` Detlev Zundel [this message]
2009-06-10 12:50   ` [U-Boot] [PATCH v2 1/3] mpc52xx: Add SPI driver Grzegorz Bernacki
2009-06-10 13:29     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ocsw2uhs.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox