From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
Wolfram Sang <w.sang@pengutronix.de>,
Christian Pellegrin <chripell@fsfe.org>,
Barry Song <21cnbao@gmail.com>,
Samuel Ortiz <sameo@linux.intel.com>,
socketcan-core@lists.berlios.de, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
andrew.chih.howe.khor@intel.com, qi.wang@intel.com,
margie.foster@intel.com, yong.y.wang@intel.com,
kok.howg.ewe@intel.com, joel.clark@intel.com
Subject: Re: [PATCH net-next-2.6 12/17 v3] can: EG20T PCH: Fix bit timing calculation issue
Date: Wed, 24 Nov 2010 13:58:25 +0100 [thread overview]
Message-ID: <4CED0BF1.1060305@pengutronix.de> (raw)
In-Reply-To: <4CED037F.6060306@dsn.okisemi.com>
[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]
On 11/24/2010 01:22 PM, Tomoya MORINAGA wrote:
> Fix bit timing calculation issue
> Modify like use calculated value directly passed by CAN core module.
>
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> drivers/net/can/pch_can.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
> index 7342030..466f011 100644
> --- a/drivers/net/can/pch_can.c
> +++ b/drivers/net/can/pch_can.c
> @@ -800,17 +800,15 @@ static int pch_set_bittiming(struct net_device *ndev)
> const struct can_bittiming *bt = &priv->can.bittiming;
> u32 canbit;
> u32 bepe;
> - u32 brp;
>
> /* Setting the CCE bit for accessing the Can Timing register. */
> pch_can_bit_set(&priv->regs->cont, PCH_CTRL_CCE);
>
> - brp = (bt->tq) / (1000000000/PCH_CAN_CLK) - 1;
> - canbit = brp & PCH_MSK_BITT_BRP;
> + canbit = (bt->brp - 1) & PCH_MSK_BITT_BRP;
Masking here shouldn't be necessary but won't hurt, better play safe.
> canbit |= (bt->sjw - 1) << PCH_BIT_SJW_SHIFT;
> canbit |= (bt->phase_seg1 + bt->prop_seg - 1) << PCH_BIT_TSEG1_SHIFT;
> canbit |= (bt->phase_seg2 - 1) << PCH_BIT_TSEG2_SHIFT;
> - bepe = (brp & PCH_MSK_BRPE_BRPE) >> PCH_BIT_BRPE_BRPE_SHIFT;
> + bepe = ((bt->brp - 1) & PCH_MSK_BRPE_BRPE) >> PCH_BIT_BRPE_BRPE_SHIFT;
dito
> iowrite32(canbit, &priv->regs->bitt);
> iowrite32(bepe, &priv->regs->brpe);
> pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_CCE);
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2010-11-24 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 12:22 [PATCH net-next-2.6 12/17 v3] can: EG20T PCH: Fix bit timing calculation issue Tomoya MORINAGA
2010-11-24 12:58 ` Marc Kleine-Budde [this message]
2010-11-26 0:06 ` Tomoya MORINAGA
2010-11-26 12:44 ` Marc Kleine-Budde
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=4CED0BF1.1060305@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=21cnbao@gmail.com \
--cc=andrew.chih.howe.khor@intel.com \
--cc=chripell@fsfe.org \
--cc=davem@davemloft.net \
--cc=joel.clark@intel.com \
--cc=kok.howg.ewe@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=margie.foster@intel.com \
--cc=netdev@vger.kernel.org \
--cc=qi.wang@intel.com \
--cc=sameo@linux.intel.com \
--cc=socketcan-core@lists.berlios.de \
--cc=tomoya-linux@dsn.okisemi.com \
--cc=w.sang@pengutronix.de \
--cc=wg@grandegger.com \
--cc=yong.y.wang@intel.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