* Re: facing some problem with flexcan driver
[not found] <CALUo3F9Zmx-rOCOmBone6b-nu3G_0bfOjL1Npp=ku=2fBHpTJw@mail.gmail.com>
@ 2013-05-15 9:30 ` Marc Kleine-Budde
2013-05-21 6:56 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Marc Kleine-Budde @ 2013-05-15 9:30 UTC (permalink / raw)
To: Ashutosh Singh; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 4251 bytes --]
Hello Ashu,
please use the linux-can mailing list (Cc'ed).
On 05/10/2013 04:31 PM, Ashutosh Singh wrote:
> I trying to use this driver for freescale vybrid processor VF600.
>
> I just modify the below structure
>
> static struct platform_device_id flexcan_devtype[] = {
> {
> .name = "imx25-flexcan",
> .driver_data = FLEXCAN_VER_3_0_0,
> }, {
> .name = "imx28-flexcan",
> .driver_data = FLEXCAN_VER_3_0_4,
> }, {
> .name = "imx35-flexcan",
> .driver_data = FLEXCAN_VER_3_0_0,
> }, {
> .name = "imx53-flexcan",
> .driver_data = FLEXCAN_VER_3_0_0,
> }, {
> .name = "imx6q-flexcan",
> .driver_data = FLEXCAN_VER_10_0_12,
> }, {
> .name = "mvf-flexcan",
> .driver_data = FLEXCAN_VER_10_0_12,
> },
>
> };
Tip: use "git diff" to illustrate your changes.
[...]
> # canconfig can0 bitrate 50000 ctrlmode triple-sampling on
>
> Unhandled fault: external abort on non-linefetch (0x1008) at 0x9087801c
> Internal error: : 1008 [#1]
> Modules linked in:
> CPU: 0 Not tainted (3.0.15-ts-armv7l-gf141ea3-dirty #18)
> PC is at flexcan_get_berr_counter+0xc/0x38
> LR is at can_fill_info+0xf0/0x150
> pc : [<8025c6f4>] lr : [<80258454>] psr: a0000013
> sp : 8f961b80 ip : 00000018 fp : 00000000
> r10: 8f9995b4 r9 : 805f48f0 r8 : 8f99958c
> r7 : 805ca7b0 r6 : 8f961ba0 r5 : 8f86e180 r4 : 8f961ba4
> r3 : 90878000 r2 : 00000000 r1 : 8f961ba4 r0 : 8fe22800
> Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
> Control: 10c53c7d Table: 8f97c059 DAC: 00000015
> Process canconfig (pid: 806, stack limit = 0x8f9602e8)
> Stack: (0x8f961b80 to 0x8f962000)
[...]
> [<8025c6f4>] (flexcan_get_berr_counter+0xc/0x38) from [<80258454>]
> (can_fill_info+0xf0/0x150)
> [<80258454>] (can_fill_info+0xf0/0x150) from [<802e8710>]
> (rtnl_fill_ifinfo+0x5b0/0x76c)
This means the driver is in the flexcan_get_berr_counter() [1] function
when the oops happens. The driver accesses the hardware to read the ecr
register (offset 0x1c) [2].
Please check if the flexcan in the vybrid still has the ecr register at
offset 0x1c. The next thing might be, that in this flexcan design the
clock gating has improved and access to the ecr register is only valid
if the clock(s) is/are switched on. Please check if this patch (totally
untested) helps:
-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
commit 28c17d5a382912ee66ed5476616b3d64d425a3e0
Author: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed May 15 11:28:38 2013 +0200
net: can: flexcan: switch on clocks before accessing ecr register
Reported-by: Ashutosh Singh <ashuleapyear@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 4a40a18..71983c8 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -302,7 +302,13 @@ static int flexcan_get_berr_counter(const struct
net_device *dev,
{
const struct flexcan_priv *priv = netdev_priv(dev);
struct flexcan_regs __iomem *regs = priv->base;
- u32 reg = flexcan_read(®s->ecr);
+ u32 reg;
+
+ clk_prepare_enable(priv->clk_ipg);
+ clk_prepare_enable(priv->clk_per);
+ reg = flexcan_read(®s->ecr);
+ clk_disable_unprepare(priv->clk_per);
+ clk_disable_unprepare(priv->clk_ipg);
bec->txerr = (reg >> 0) & 0xff;
bec->rxerr = (reg >> 8) & 0xff;
-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
[1] http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c#L300
[2] http://lxr.free-electrons.com/source/drivers/net/can/flexcan.c#L305
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: 263 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: facing some problem with flexcan driver
2013-05-15 9:30 ` facing some problem with flexcan driver Marc Kleine-Budde
@ 2013-05-21 6:56 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2013-05-21 6:56 UTC (permalink / raw)
To: Ashutosh Singh; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On 05/15/2013 11:30 AM, Marc Kleine-Budde wrote:
----->8--------
> commit 28c17d5a382912ee66ed5476616b3d64d425a3e0
> Author: Marc Kleine-Budde <mkl@pengutronix.de>
> Date: Wed May 15 11:28:38 2013 +0200
>
> net: can: flexcan: switch on clocks before accessing ecr register
>
> Reported-by: Ashutosh Singh <ashuleapyear@gmail.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Does the patch fix your problem?
regards,
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: 263 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-21 6:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CALUo3F9Zmx-rOCOmBone6b-nu3G_0bfOjL1Npp=ku=2fBHpTJw@mail.gmail.com>
2013-05-15 9:30 ` facing some problem with flexcan driver Marc Kleine-Budde
2013-05-21 6:56 ` Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.