linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: linuxppc-dev@ozlabs.org
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Sean MacLennan <smaclennan@pikatech.com>
Subject: Re: [PATCH 1/5] Warp Base Platform
Date: Sat, 12 Jan 2008 07:23:29 +0100	[thread overview]
Message-ID: <200801120723.29393.sr@denx.de> (raw)
In-Reply-To: <4787FE23.7010201@pikatech.com>

On Saturday 12 January 2008, Sean MacLennan wrote:
> Josh Boyer wrote:
> >> +		if (gpio_base == NULL) {
> >> +			printk("ERROR: Unable to remap GPIO base.\n");
> >> +			return;
> >> +		}
> >> +	}
> >> +
> >> +	leds = readl(gpio_base + 0x100);
> >
> > Do you really want readl here?  That will byte-swap.
>
> According to the docs I got from the hardware guys, this is correct.
> That does *not* mean they didn't get it wrong. Unfortunately, it was
> just on a piece of paper and I don't know if I still have it.

You are accessing the 440EP GPIO controller here right? Then you really should 
use big endian access routines. From you code I assume that you have 
connected the LED signals to GPIO00 and GPIO01. I suggest to use code that 
looks like this:

#define LED_GREEN	(0x80000000 >> 0)
#define LED_RED		(0x80000000 >> 1)

	leds = in_be32(gpio_base);

	switch (green) {
	case 0: leds &= ~LED_GREEN; break;
	case 1: leds |=  LED_GREEN; break;
	}
	switch (red) {
	case 0: leds &= ~LED_RED; break;
	case 1: leds |=  LED_RED; break;
	}

       outbe32(leds, gpio_base);

And when you change the dts to describe both GPIO controllers you should map 
the 2nd one and remove the 0x100 offset above as I have done above.

Best regards,
Stefan

  parent reply	other threads:[~2008-01-12  6:29 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 20:19 [PATCH 1/5] Warp Base Platform Sean MacLennan
2008-01-09 20:21 ` [PATCH 2/5] Warp Base Platform - dts Sean MacLennan
2008-01-10  2:47   ` David Gibson
2008-01-10  3:14     ` Sean MacLennan
2008-01-10  3:17       ` Josh Boyer
2008-01-10  3:33         ` Sean MacLennan
2008-01-10  3:35           ` David Gibson
2008-01-10  3:36           ` Josh Boyer
2008-01-10 23:59     ` Sean MacLennan
2008-01-11  0:20       ` David Gibson
2008-01-11  5:21         ` Sean MacLennan
2008-01-11  5:32           ` David Gibson
2008-01-11  6:15             ` Sean MacLennan
2008-01-11 17:54               ` Josh Boyer
2008-01-11 23:27                 ` Sean MacLennan
2008-01-12  6:13                   ` Stefan Roese
2008-01-12 20:32                     ` Sean MacLennan
2008-01-09 20:22 ` [PATCH 3/5] Warp Base Platform Sean MacLennan
2008-01-10  2:49   ` David Gibson
2008-01-10  3:17     ` Sean MacLennan
2008-01-10  3:29       ` David Gibson
2008-01-11  0:04     ` Sean MacLennan
2008-01-11  6:17       ` Sean MacLennan
2008-01-11 17:56         ` Josh Boyer
2008-01-09 20:23 ` [PATCH 4/5] Warp Base Platform - defconfig Sean MacLennan
2008-01-09 20:25 ` [PATCH 5/5] Warp Base Platform - cputable Sean MacLennan
2008-01-11  6:21 ` [PATCH 1/5] Warp Base Platform Sean MacLennan
2008-01-11  6:42 ` Stephen Rothwell
2008-01-11  7:10   ` Sean MacLennan
2008-01-11 10:02     ` Stephen Rothwell
2008-01-11 16:26       ` Sean MacLennan
2008-01-11 17:51     ` Josh Boyer
2008-01-11 23:39       ` Sean MacLennan
2008-01-12  2:40         ` Stephen Rothwell
2008-01-12  2:52           ` Sean MacLennan
2008-01-12  3:00           ` Olof Johansson
2008-01-12  2:55             ` Sean MacLennan
2008-01-12  3:47               ` Olof Johansson
2008-01-12  2:59             ` Sean MacLennan
2008-01-12  6:23         ` Stefan Roese [this message]
2008-01-12  6:35           ` Sean MacLennan
2008-01-12 20:30           ` Sean MacLennan
2008-01-12 20:42             ` Sean MacLennan
2008-01-13  0:35               ` Stephen Rothwell
2008-01-14 17:18                 ` Sean MacLennan
2008-01-16 23:29                 ` Sean MacLennan
2008-01-16 23:36                   ` Stephen Rothwell
2008-01-16 23:39                     ` Josh Boyer
2008-01-21 17:55                   ` Sean MacLennan

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=200801120723.29393.sr@denx.de \
    --to=sr@denx.de \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sfr@canb.auug.org.au \
    --cc=smaclennan@pikatech.com \
    /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;
as well as URLs for NNTP newsgroup(s).