netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Socketcan-core@lists.berlios.de,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH V2] CAN: Add Flexcan CAN controller driver
Date: Tue, 28 Jul 2009 16:48:34 +0200	[thread overview]
Message-ID: <4A6F0FC2.1060605@hartkopp.net> (raw)
In-Reply-To: <20090728142452.GW2714@pengutronix.de>

Sascha Hauer wrote:
> On Tue, Jul 28, 2009 at 04:12:10PM +0200, Oliver Hartkopp wrote:
>> Oliver Hartkopp wrote:
>>> Sascha Hauer wrote:
>>>>>> +
>>>>>> +	if (frame->can_id & CAN_RTR_FLAG)
>>>>>> +		dlc |= MB_CNT_RTR;
>>>>>> +
>>>>>> +	writel(dlc, &regs->cantxfg[TX_BUF_ID].can_dlc);
>>>>>> +	writel(can_id, &regs->cantxfg[TX_BUF_ID].can_id);
>> Are you sure, that this is correct?
> 
> Yes, I am sure, at least on my hardware.

I looked into the writel() macro which does a cpu_to_le32() to the value -
sorry that i did not check this before ...

> 
>> Indeed i wonder, if it would make sense to skip the entire struct flexcan_mb
>> approach and fiddle byte-by-byte inside the registers ...
> 
> You'll have to to 32 bit accesses to get it right on little and big
> endian.
> 
> what we can do is:
> 
> writel(can_data[0] << 24 | can_data[1] << 16 | can_data[2] << 8 | can_data[3],
> 	msg_buf + 0x8);

This looks easier to understand and makes things clear, when you look into the
specification.

Regards,
Oliver

  reply	other threads:[~2009-07-28 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-28 12:06 [PATCH V2] CAN: Add Flexcan CAN controller driver Sascha Hauer
2009-07-28 13:21 ` Oliver Hartkopp
2009-07-28 13:37   ` Sascha Hauer
2009-07-28 13:50     ` Oliver Hartkopp
2009-07-28 14:12       ` Oliver Hartkopp
2009-07-28 14:24         ` Sascha Hauer
2009-07-28 14:48           ` Oliver Hartkopp [this message]
2009-07-28 14:53             ` Sascha Hauer
2009-07-28 19:41               ` Wolfgang Grandegger
2009-07-28 14:18       ` Sascha Hauer

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=4A6F0FC2.1060605@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=Socketcan-core@lists.berlios.de \
    --cc=netdev@vger.kernel.org \
    --cc=s.hauer@pengutronix.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;
as well as URLs for NNTP newsgroup(s).