public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] guys, can you see some init code for davinci's chipselect bit width driving DM9000A?
Date: Tue, 20 Jul 2010 08:20:56 +0200	[thread overview]
Message-ID: <4C454048.7040308@denx.de> (raw)
In-Reply-To: <AANLkTimRHLbylVPlDhyL0PFuoEshAg7iLbevdZme6E1D@mail.gmail.com>

yaojin liu wrote:
> thanks?you are right, it really init the chip through UBL.
> BUT, there is also one question:
> DM9000a 's driver has 8 bit accessing function:
> 
> #define CONFIG_DM9000_BASE    0x04000000   
> #define DM9000_IO            CONFIG_DM9000_BASE
> #define DM9000_DATA        (CONFIG_DM9000_BASE+2) // (BA1,it's the 16bit
> least significant bit (effective)  )
> #define DM9000_outb(d,r) ( *(volatile u8 *)r = d )
> #define DM9000_inb(r) (*(volatile u8 *)r)
> static u8 DM9000_ior(int reg)
> {
>     DM9000_outb(reg, DM9000_IO);
>     return DM9000_inb(DM9000_DATA);
> }
> 
> /*
>    Write a byte to I/O port
> */
> static void DM9000_iow(int reg, u8 value)
> {
>     DM9000_outb(reg, DM9000_IO);
>     DM9000_outb(value, DM9000_DATA);
> }
> and the davinci's chipselect space is 16bit. when accessing it as 8bit
> ,the last bit(may be A-2 ?) will be effective, but the least significant
> bit(BA1) will not be effective, am i wrong? how does it work?
> 

I think this is a no-problem, because the DM9000 has two separate area
for registers and data. As you check in the driver, the bus width is
checked and the driver has internal accessors (dm9000_outblk_*) to adapt
itself to the different bus size.

To access internal registers, it is required to write to DM9000_IO the
registers offset, and the DM9000 store the register index internally
that should be read/changed with the next access.  So registers are not
accessed directly, you have to program which you want. And the DM9000
takes the LSB of the data bus as register offset.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

      reply	other threads:[~2010-07-20  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19  2:27 [U-Boot] guys, can you see some init code for davinci's chipselect bit width driving DM9000A? yaojin liu
2010-07-19  9:46 ` Stefano Babic
2010-07-19 14:51   ` yaojin liu
2010-07-20  6:20     ` Stefano Babic [this message]

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=4C454048.7040308@denx.de \
    --to=sbabic@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