netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Zang Roy-r61911 <tie-fei.zang@freescale.com>
Cc: Roland Dreier <rdreier@cisco.com>, Andrew Morton <akpm@osdl.org>,
	netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
Date: Thu, 21 Sep 2006 02:30:17 -0400	[thread overview]
Message-ID: <45123179.8090903@pobox.com> (raw)
In-Reply-To: <1158817598.11110.7.camel@localhost.localdomain>

Zang Roy-r61911 wrote:
> On Thu, 2006-09-21 at 12:26, Jeff Garzik wrote:
>> Zang Roy-r61911 wrote:
>>> +#define TSI108_ETH_WRITE_REG(offset, val) \
>>> +     writel(le32_to_cpu(val),data->regs + (offset))
>>> +
>>> +#define TSI108_ETH_READ_REG(offset) \
>>> +     le32_to_cpu(readl(data->regs + (offset)))
>>> +
>>> +#define TSI108_ETH_WRITE_PHYREG(offset, val) \
>>> +     writel(le32_to_cpu(val), data->phyregs + (offset))
>>> +
>>> +#define TSI108_ETH_READ_PHYREG(offset) \
>>> +     le32_to_cpu(readl(data->phyregs + (offset)))
>>
>> NAK:
>>
>> 1) writel() and readl() are defined to be little endian.
>>
>> If your platform is different, then your platform should have its own 
>> foobus_writel() and foobus_readl().
> 
> Tsi108 bridge is designed for powerpc platform. Originally, I use
> out_be32() and in_be32(). While there is no obvious reason to object
> using this bridge in a little endian system. Maybe some extra hardware
> logic needed for the bus interface. le32_to_cpu() can  be aware the
> endian difference.

To restate, readl() should read a little endian value, and return a 
CPU-endian value.  writel() should receive a CPU-endian value, and write 
a little endian value.

If your platform's readl/writel doesn't do that, it's broken.

That's why normal PCI drivers can use readl() and writel() on either 
big-endian or little-endian machines, without needing to use le32_to_cpu().

	Jeff




  reply	other threads:[~2006-09-21  6:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A0CDBA58F226D911B202000BDBAD46730A1B1410@zch01exm23.fsl.freescale.net>
     [not found] ` <1157962200.10526.10.camel@localhost.localdomain>
2006-09-12  8:55   ` [patch 0/3] Add tsi108 On chip Ethernet device driver support Zang Roy-r61911
2006-09-21  4:04     ` [patch 0/3 v2] " Zang Roy-r61911
2006-09-12  8:55   ` [patch 1/3] Add tsi108 on Chip " Zang Roy-r61911
2006-09-21  4:04     ` [patch 1/3 v2] Add tsi108 On " Zang Roy-r61911
2006-09-12  8:55   ` [patch 3/3] " Zang Roy-r61911
2006-09-12 10:07     ` Arjan van de Ven
2006-09-19  7:39       ` Zang Roy-r61911
2006-09-20  8:45         ` Arjan van de Ven
2006-09-12 14:33     ` Roland Dreier
2006-09-12 14:43       ` Jeff Garzik
2006-09-14  2:51         ` Zang Roy-r61911
     [not found]         ` <1158749825.7973.9.camel@localhost.localdomain>
2006-09-21  4:26           ` Jeff Garzik
2006-09-21  5:46             ` Zang Roy-r61911
2006-09-21  6:30               ` Jeff Garzik [this message]
2006-09-21  4:46           ` Jeff Garzik
2006-09-29  7:36             ` Zang Roy-r61911
2006-09-29  7:47               ` Jeff Garzik
2006-10-17  7:18             ` Zang Roy-r61911
2006-10-30  5:19               ` Add tsi108/9 " Zang Roy-r61911
2006-10-31  2:26                 ` [PATCH] " Zang Roy-r61911
2006-10-23  2:09             ` [patch 3/3] Add tsi108 " Zang Roy-r61911
2006-10-26  2:50               ` Zang Roy-r61911
2006-09-21  4:05     ` [patch 3/3 v2] " Zang Roy-r61911

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=45123179.8090903@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=tie-fei.zang@freescale.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).