All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Flexcan on imx536 Infotainment
       [not found] <1338849280.43608.YahooMailNeo@web140802.mail.bf1.yahoo.com>
@ 2012-06-04 22:39 ` Keith Jones
  2012-06-04 23:24   ` flexcan_poll_error_state(struct net_device *dev, u32 reg_esr) Keith Jones
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Jones @ 2012-06-04 22:39 UTC (permalink / raw)
  To: linux-can





Hello,

I must be missing a few patches...


I booted up my new Infotainment 
demo board after ported 2.6.39 flexcan (flexcan.h flexcan.c) support 
into my 2.6.35 linux distro. 

After seeing the flexcan driver register and performing the following commands, I get constant interrupts and error packets visualized using my Canoe 
CANbus sniffer. I am using 250K baud. Did not check termination. No 
oscilloscope was used as yet. Can not receive any packets. Can state 
goes from ERROR-ACTIVE to ERROR-PASSIVE.


Any clues?


--------------------------------------------------

.
.

vcan: Virtual CAN interface driver
CAN device driver interface
flexcan netdevice driver
flexcan flexcan.0: device registered (reg_base=e09f0000, irq=82)
flexcan flexcan.1: device registered (reg_base=e09f8000, irq=83)
.
.
.
----------------------------------------------------------------
root@freescale ~$ cat /proc/net/can/version
rev 20090105 abi 8

root@freescale ~$  ip link set can0 up type can bitrate 250000
root@freescale /usr/bin$ ip -d -s link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN qlen 10
    link/can
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
    bitrate 250000 sample-point 0.875
    tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
    flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
    clock 24000000
    re-started bus-errors arbit-lost error-warn error-pass bus-off
    0         
0          0          4         
4          0
    RX: bytes  packets  errors  dropped overrun mcast
    64         8        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    4          0        0

root@freescale ~$ cansend can0 123#1122334455
root@freescale /usr/bin$ ip -d -s link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state
UNKNOWN qlen 10
    link/can
    can state ERROR-PASSIVE (berr-counter tx 128 rx 0) restart-ms 0
    bitrate 250000 sample-point
0.875
    tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
    flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
    clock 24000000
    re-started bus-errors arbit-lost error-warn error-pass bus-off
    0          0          0          5          5          0
    RX: bytes  packets  errors  dropped overrun mcast
    80         10       0       0       0       0
    TX: bytes  packets  errors 
dropped carrier collsns
    5          0        0       0       0       0
root@freescale /usr/bin$ cat /proc/interrupts
           CPU0
  1:       1491    MXC_TZIC  mxsdhci
  2:          0    MXC_TZIC  mxsdhci
  6:          1    MXC_TZIC  mxc_sdma
  8:          2    MXC_TZIC  mxc_nd
  9:          0    MXC_TZIC 
VPU_CODEC_IRQ
 10:          0    MXC_TZIC  mxc_ipu
 11:          2    MXC_TZIC  mxc_ipu
 12:          0    MXC_TZIC  ydx
 14:          0    MXC_TZIC  usb_wakeup, ehci_hcd:usb2
 16:          0    MXC_TZIC  usb_wakeup, ehci_hcd:usb3
 18:          0    MXC_TZIC  usb_wakeup, fsl-usb2-otg, ehci_hcd:usb1, fsl-usb2-udc
 24:          0    MXC_TZIC  mxc_rtc
 28:          0    MXC_TZIC 
ahci
 31:       4093    MXC_TZIC  mxcintuart
 36:          1    MXC_TZIC  CSPI_IRQ
 39:      69290    MXC_TZIC  i.MX Timer Tick
 63:        198    MXC_TZIC  imx-i2c
 64:         60    MXC_TZIC  imx-i2c
 66:          0    MXC_TZIC  asrc
 69:          0    MXC_TZIC  mxc_iim
 73:          0    MXC_TZIC  dvfs
 82:    1283596    MXC_TZIC 
can0
 84:          0    MXC_TZIC  g12
129:          0           -  mxsdhci
132:          0           -  mxsdhci
191:          0           -  eth0
Err:          0
root@freescale /usr/bin$

^ permalink raw reply	[flat|nested] 7+ messages in thread

* flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-04 22:39 ` Flexcan on imx536 Infotainment Keith Jones
@ 2012-06-04 23:24   ` Keith Jones
  2012-06-05  7:46     ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Jones @ 2012-06-04 23:24 UTC (permalink / raw)
  To: linux-can



Hello,

My kernel does not have "flexcan_poll_error_state" function in its flexcan.c file.  Is the following patch still valid?

[RFC PATCH 07/14] can: flexcan: consolidate error state handling. 


What would a good linux version to obtain a functioning flexcan driver for imx536?  My demo board is shipped with 2.6.35. I am able migrate to any version with appropriate patches.

thanks
keith


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-04 23:24   ` flexcan_poll_error_state(struct net_device *dev, u32 reg_esr) Keith Jones
@ 2012-06-05  7:46     ` Marc Kleine-Budde
  2012-06-07 16:29       ` Keith Jones
  2012-06-11 14:45       ` Wolfgang Grandegger
  0 siblings, 2 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-06-05  7:46 UTC (permalink / raw)
  To: Keith Jones; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

On 06/05/2012 01:24 AM, Keith Jones wrote:
> My kernel does not have "flexcan_poll_error_state" function in its
> flexcan.c file.  Is the following patch still valid?
> 
> [RFC PATCH 07/14] can: flexcan: consolidate error state handling. 

This patch series hasn't been applied yet.

> What would a good linux version to obtain a functioning flexcan
> driver for imx536?  My demo board is shipped with 2.6.35. I am able
> migrate to any version with appropriate patches.

Use v3.4. Your v2.6.35 is probably a freescale kernel, with a freescale
flexcan driver. The mainline driver should work with mx53.

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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-05  7:46     ` Marc Kleine-Budde
@ 2012-06-07 16:29       ` Keith Jones
  2012-06-10 17:46         ` Marc Kleine-Budde
  2012-06-11 14:45       ` Wolfgang Grandegger
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Jones @ 2012-06-07 16:29 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can





On Tuesday, June 5, 2012 12:46 AM, Marc Kleine-Budde wrote:


> Use v3.4. Your v2.6.35 is probably a freescale kernel, with a freescale
> flexcan driver. The mainline driver should work with mx53.

Dropping "drivers/net/can"  and supporting headers from 3.4 into 2.6.35 distro causes rippling compilation inconsistencies. The infrastructure has changed in the 3+ tree.  We would like to continue using 2.6.35 with upgraded flexcan, but the linux source tree dependencies for 3.4 support are significant.  On the other hand, building a complete 3.4 image for imx_ard would be an effort we wish not to undertake at this moment.


How best to get 3.4 flexcan functionality into 2.6.35?

 Your thoughts...

-- 
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   |

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-07 16:29       ` Keith Jones
@ 2012-06-10 17:46         ` Marc Kleine-Budde
  2012-06-13 19:35           ` Keith Jones
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-06-10 17:46 UTC (permalink / raw)
  To: Keith Jones; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

On 06/07/2012 06:29 PM, Keith Jones wrote:
>> Use v3.4. Your v2.6.35 is probably a freescale kernel, with a freescale
>> flexcan driver. The mainline driver should work with mx53.
> 
> Dropping "drivers/net/can"  and supporting headers from 3.4 into
> 2.6.35 distro causes rippling compilation inconsistencies. The

I see.

> infrastructure has changed in the 3+ tree.  We would like to continue
> using 2.6.35 with upgraded flexcan, but the linux source tree
> dependencies for 3.4 support are significant.  On the other hand,
> building a complete 3.4 image for imx_ard would be an effort we wish
> not to undertake at this moment.

> How best to get 3.4 flexcan functionality into 2.6.35?

Port the 3.4 flexcan driver to you 2.6.35 Kernel.

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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-05  7:46     ` Marc Kleine-Budde
  2012-06-07 16:29       ` Keith Jones
@ 2012-06-11 14:45       ` Wolfgang Grandegger
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Grandegger @ 2012-06-11 14:45 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: Keith Jones, linux-can

On 06/05/2012 09:46 AM, Marc Kleine-Budde wrote:
> On 06/05/2012 01:24 AM, Keith Jones wrote:
>> My kernel does not have "flexcan_poll_error_state" function in its
>> flexcan.c file.  Is the following patch still valid?
>>
>> [RFC PATCH 07/14] can: flexcan: consolidate error state handling. 
> 
> This patch series hasn't been applied yet.

Right, it's probably from my private gitorious can-next tree... which is
not up-to-date any more. I'm going to delete it... The important patch
fixing the IRQ flooding is:

commit 6e9d554fa6e481a848358c215f129432262123c0
Author: Wolfgang Grandegger <wg@grandegger.com>
Date:   Mon Dec 12 16:09:28 2011 +0100

    can: flexcan: fix irq flooding by clearing all interrupt sources

    As pointed out by Reuben Dowle and Lothar Waßmann, the TWRN_INT,
    RWRN_INT, BOFF_INT interrupt sources need to be cleared as well
    to avoid interrupt flooding, at least for the Flexcan on i.MX28
    SOCs. Furthermore, the interrupts are only cleared, if really one
    of those interrupt sources are pending (which is not the case for
    rx and tx done).

    Cc: Reuben Dowle <Reuben.Dowle@navico.com>
    Cc: Lothar Waßmann <LW@KARO-electronics.de>
    Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Anyway, on a slow system, bus errors can still result in high system
load. But I do not consider the mx53 a slow system.

>> What would a good linux version to obtain a functioning flexcan
>> driver for imx536?  My demo board is shipped with 2.6.35. I am able
>> migrate to any version with appropriate patches.
> 
> Use v3.4. Your v2.6.35 is probably a freescale kernel, with a freescale
> flexcan driver. The mainline driver should work with mx53.

I agree.

Wolfgang.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: flexcan_poll_error_state(struct net_device *dev, u32 reg_esr)
  2012-06-10 17:46         ` Marc Kleine-Budde
@ 2012-06-13 19:35           ` Keith Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Keith Jones @ 2012-06-13 19:35 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can



On Sunday, June 10, 2012 10:46 AM, Marc Kleine-Budde wrote:

> Port the 3.4 flexcan driver to you 2.6.35 Kernel.

Okay I copied into my 2.6.34 kernel the following with minimal mods described below: 

drivers/net/can/flexcan.c - used module_init(flexcan_init) and module_exit(flexcan_exit) from 2.6.35
drivers/net/can/dev.c
drivers/net/can/Kconfig 
drivers/net/can/Makefile - commented out c_can, cc770, and softing for now
include/linux/can/platform/flexcan.h
drivers/net/can
include/linux/clk.h


I compiled, booted, and up'd  can0 using:

ip link set can0 type can bitrate 250000

Attached a terminated DB9 (120ohm resister across pins 2 and 7) to imx_ard board. On a remote terminated device I sent J1939/Nmea2000 messages at 5 hertz.

When sniffing the bus  I again observed "ErrorFrame" messages with Code : Stuff Error.
On the ard board, all I observe is interrupts on can0 and one or two Rx packets.
can state: ERROR-WARNING
When I down the ard board can0 interface no error packets are sniffed on bus and J1939 signals start
When I up the ard board can0 interface error packets are sniffed  and J1939 signals stop

I am running at 250000 bitrate.

Using flexcan driver from 2.6.35 kernel. The bitrate cannot be set dynamically using iproute tools. In addition, the BSP requires a ENGR00169603-MX53-ARD-FlexCAN-Set-lp-apm patch for proper clock source.  Attempting to set the bitrate produces a "RTNETLINK answers: Operation not supported" message. I am able to send and receive packets by adding patch and hard coding the bitrate.

Using flexcan driver from 2.6.35. I am able to set any bitrate, but I get lots of interrupts with no packets received or sent. Note: I did not use patch for this test.

What is the major difference between 2.3.35 (which sort-of works) and 3.4 which produces error frames? I would like to use the latest kernel driver if I could better understand the issues I am seeing on my demo ard board. Are you aware of flexcan success with 3.4 kernel on imx536?  Why is the driver sending error frames and not passing packets up-stream?

thanks

-keith
Hemisphere GPS

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-13 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1338849280.43608.YahooMailNeo@web140802.mail.bf1.yahoo.com>
2012-06-04 22:39 ` Flexcan on imx536 Infotainment Keith Jones
2012-06-04 23:24   ` flexcan_poll_error_state(struct net_device *dev, u32 reg_esr) Keith Jones
2012-06-05  7:46     ` Marc Kleine-Budde
2012-06-07 16:29       ` Keith Jones
2012-06-10 17:46         ` Marc Kleine-Budde
2012-06-13 19:35           ` Keith Jones
2012-06-11 14:45       ` Wolfgang Grandegger

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.