From: Federico Vaga <federico.vaga@gmail.com>
To: Bhupesh SHARMA <bhupesh.sharma@st.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Giancarlo ASNAGHI <giancarlo.asnaghi@st.com>,
Alan Cox <alan@linux.intel.com>,
Alessandro Rubini <rubini@gnudd.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
Date: Tue, 05 Jun 2012 13:19:26 +0200 [thread overview]
Message-ID: <3650428.HarNR9HfNF@harkonnen> (raw)
In-Reply-To: <D5ECB3C7A6F99444980976A8C6D896384FA5EC4B37@EAPEX1MAIL1.st.com>
> In some of these SoC's the C_CAN registers which are essentially
> 16-bit or 32-bit registers are aligned always to a 32-bit boundary
> (i.e. even a 16-bit register is aligned to 32-bit boundary).
>
> So, I had to implement two variants of the read/write reg routines. I
> am not sure your SoC implementation needs them. If it does, I will
> categorize it as flaky as well :)
My implementation is align to 32, but I'm trying to make a generic PCI
wrapper (some other could be aligned to 16)
> See above. There was a reason for keeping these routines in
> c_can_platform.c Simply put, every platform having a Bosch C_CAN
> module can have it's own implementation of the bus (for example you
> use PCI) and register bank layout (16-bit or 32-bit aligned).
I don't understand the reason to keep these functions in
c_can_platform.c . Two generic read/write functions could be written
into c_can.c by using a shift value (0 if aligned to 16, 1 if aligned to
32) as I showed in the previous mail:
> > static u16 c_can_read_reg(struct c_can_priv *priv, enum reg index)
> > {
> >
> > return readw(priv->base + (priv->regs[index] << priv->offset));
> >
> > }
> > static void c_can_write_reg(struct c_can_priv *priv, enum reg index,
> >
> > u16 val)
> >
> > {
> >
> > writew(val, priv->base + (priv->regs[index] << priv->offset));
> >
> > }
Every platform having a Bosch C_CAN/D_CAN can specify its shift value (0
or 1) and it's done.
--
Federico Vaga
next prev parent reply other threads:[~2012-06-05 11:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-17 20:59 [PATCH] STA2X11 CAN: CAN driver for the STA2X11 board Federico Vaga
2012-05-18 6:00 ` Wolfgang Grandegger
2012-05-26 8:36 ` Federico Vaga
2012-05-26 19:57 ` Wolfgang Grandegger
2012-06-04 13:32 ` generic module for c-can on pci Federico Vaga
2012-06-04 13:32 ` [PATCH RFC] c_can_pci: generic module for c_can on PCI Federico Vaga
2012-06-04 14:04 ` Marc Kleine-Budde
2012-06-12 14:25 ` Federico Vaga
2012-06-12 14:46 ` Marc Kleine-Budde
2012-06-12 14:53 ` Federico Vaga
2012-06-04 15:56 ` Alan Cox
2012-06-04 16:45 ` Alessandro Rubini
2012-06-11 13:51 ` Wolfgang Grandegger
2012-06-11 14:23 ` Alessandro Rubini
2012-06-04 16:45 ` Federico Vaga
2012-06-05 3:42 ` Bhupesh SHARMA
2012-06-05 11:19 ` Federico Vaga [this message]
2012-06-05 13:04 ` Bhupesh SHARMA
2012-06-05 13:13 ` Alessandro Rubini
2012-06-05 13:21 ` Marc Kleine-Budde
2012-06-05 13:30 ` Alessandro Rubini
2012-06-05 15:12 ` AnilKumar, Chimata
2012-06-05 16:50 ` Alessandro Rubini
2012-06-06 3:50 ` Bhupesh SHARMA
2012-06-11 13:18 ` Federico Vaga
2012-06-11 14:21 ` Wolfgang Grandegger
2012-06-05 13:22 ` Bhupesh SHARMA
2012-06-11 14:09 ` Wolfgang Grandegger
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=3650428.HarNR9HfNF@harkonnen \
--to=federico.vaga@gmail.com \
--cc=alan@linux.intel.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bhupesh.sharma@st.com \
--cc=giancarlo.asnaghi@st.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=rubini@gnudd.com \
--cc=wg@grandegger.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