Subject: can: flexcan: Ancient Freescale Reference FlexCAN Driver and bug fixes so it works.

From: [email-masked] (Tom Evans)
Date: Fri, 11 Dec 2015 09:53:27 +1100

On 10/12/2015 11:44 PM, Marc Kleine-Budde wrote:
> On 12/10/2015 12:44 PM, Tom Evans wrote:
>> I've just had to delve back into the deep murky past and try to get
>> Freescale's Kernel 2.6.35 FlexCAN driver working...

On an i.MX53. That's the last supported kernel Freescale ever released 
for that series of parts.

> 2.6.x I feel your pain. Another option would be to port the flexcan
> driver to that old kernel. But I'm getting off topic here :)

Been there. Options are to port 2.6.38 (Freescale's Android release) 
which has the 2.6.38 mainstream driver, but looks to have a full 
collection of all the bugs fixed since then. Some kind soul has already 
done that and released a patch (but I don't like the bugs). Or the 3.4 
version we're running with our 3.4 kernel or something more modern. I 
don't trust later versions to even compile - the headers and interfaces 
change. Then I can't use modern ones anyway as they use NAPI and that 
simply doesn't work with Linux and CAN. So I'd have to apply all my 
de-NAPI patches. The simplest path was to fix the simple and stupidly 
obvious bugs in the existing driver rather than add new complicated bugs.

>> 2 - It can't receive in order, but you'd only need to sort on the
>> 3 - It can't transmit in order either (unless you drop it to one
>
> In order reception is crucial.

So what mind-set at Freescale doesn't see this as a problem? I suspect 
their CAN knowledge stopped at the HCS08 stage, making tiny devices that 
control just one thing, like a door lock. So just receive and transmit 
one or two messages where "priority order" is more important than 
running any debug or diagnostic protocols.

>> Patches to fix all of it on the end of this thread:
>>
>> https://community.freescale.com/thread/303271
>
> If there's interest in working with this prehistoric kernel, why isn't
> there anyone that picks up all the patches and add them to a git repo.

There was. That's what the above post is meant to be for. But the last 
actual activity was in January 2013. It details how to submit patches, 
but it is too onerous for me. It has to use their exact complete 
distribution (of everything, not just the kernel) running on their exact 
development board. It also needs your .gitconfig set up "just so" 
matching your Freescale registration details. I'm using the thread as a 
dumping ground for "useful patches for customers", and hope google or 
Freescale's search can find them.

> fsl doesn't seem to care either, maybe unless you're using
 > their newest product :(

The team seems to disappear almost before the product is released. They 
all moved to i.MX6 years ago.

Tom