linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: John Williams <jwilliams@itee.uq.edu.au>
To: Peter Korsgaard <peter.korsgaarD@barco.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: [RFC] uartlite driver MicroBlaze compatability
Date: Thu, 03 May 2007 11:08:25 +1000	[thread overview]
Message-ID: <46393609.1010205@itee.uq.edu.au> (raw)
In-Reply-To: <87647b5ofn.fsf@sleipner.barco.com>

Hi Peter,

Peter Korsgaard wrote:

> JW> The attached patch gets your uartlite driver going on MicroBlaze.
> 
> Nice!
> 
> JW> All readb/writeb ops are converted to ioread32/iowrite32.
> 
> JW> On MicroBlaze readb/writeb are picking up the MSB, instead of LSB,
> JW> and thus reading all zeros instead of the 8-bit
> JW> control/status/FIFO registers that you intended.
> 
> I take it that the microblaze is big endian? Then you just need to add
> 3 to the base address and everything should work without your patch.

I struggle to see adding 3 to the base address in the platform driver as 
a clean solution.  The base address of the peripheral is 0x10240000, or 
whatever, not 0x10240003.

I understand the reasoning for it, but from the platform's perspective 
it seems wrong.

If you read the opb_uartlite datasheet, it says that bits 0-26 of the 
FIFO, CTRL and STATUS regs are "reserved".  It doesn't say, this is an 
8-bit peripheral that is mapped onto a 32bit bus with a stride of 4.

If you also read page 6 , under address map, it says

BASE_ADDRESS+0 : read from receive FIFO
BASE_ADDRESS+4 : write to transmit FIFO
and so on.

It is a 32-bit peripheral, it just so happens the 24 of those bits are 
currently "reserved".

Grant's recanting may have been triggered by the figure on page 4 of the 
datasheet, which is generic Xilnx IP Core datasheet material explaining 
the endian interpretation for different data widths.

> JW> Can you please confirm if this works on PPC?
> 
> It won't as ioread/write does big/little endian byte swapping. Isn't
> that done on microblaze?

Not presently, but I will fix that.

I think that's Grant's approach of using in/out_be32, and the real base 
address (ie not +3) is the only logically correct solution.

Regards,

John

  reply	other threads:[~2007-05-03  1:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01  4:55 [RFC] uartlite driver MicroBlaze compatability John Williams
2007-05-01  5:55 ` Grant Likely
2007-05-01  6:42   ` John Williams
2007-05-02  5:47     ` Grant Likely
2007-05-02  6:18       ` John Williams
2007-05-02 14:09       ` Peter Korsgaard
2007-05-02 15:59         ` Grant Likely
2007-05-02 13:59   ` Peter Korsgaard
2007-05-02 13:45 ` Peter Korsgaard
2007-05-03  1:08   ` John Williams [this message]
2007-05-03 10:22     ` David H. Lynch Jr.

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=46393609.1010205@itee.uq.edu.au \
    --to=jwilliams@itee.uq.edu.au \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=peter.korsgaarD@barco.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).