Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Jun 2007 04:55 PM by  TomCooksey
Steps to 'mainlining' i.MX31 LITEKIT Linux support
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages
TomCooksey
New Member
New Member
Posts:


--
26 Jun 2007 02:26 PM
    I've been following the arm-linux kernel mailing list for some time. It seems neither the i.MX31 or the MXC platform have been mainlined, let alone the LITEKIT. A chap from Freescale has submitted a patch to the arm-linux maintainer (Russel King) to add basic i.MX31 and ADS board support. From what I understand, this patch was rejected (for various reasons). I believe work is continuing at Freescale to improve the patch in order to get i.MX31 mainlined. I think the problem is that it's not just a new CPU they are adding but a new platform. Things like the serial port, frame buffer, etc. are common across several i.MXxx processors (specifically the i.MX27). To avoid code duplication they are creating a platform device called MXC. The i.MX31 CPU support sits under the MXC platform support, along with many of the common peripherals.

    If you look at the Freescale kernel source hierarchy, you'll see arch/arm/plat-mxc, which contains all the platform code common across both i.MX31 and i.MX27. (Note, this does not contain any device drivers which are located elsewhere in the kernel tree). The Kconfig in arch/arm/plat-mxc provides options for specifying the CPU to use (I.e. i.MX31 or i.MX27). There is then an arch/arm/arch-mx3 directory, which contains common i.MX31 code, as well as the board bringup code for the "various" boards which use an i.MX31. This is where the ADS specific code is located and where Hasan put his LITEKIT specific code.

    So, in summary, the hirearchy is "Platform"->"CPU"->"Board". For us, in Linux Kconfig speak, this is "ARCH_MXC"->"ARCH_MX3"->"MACH_MX31LITE", all of which will be defined when the kernel is compiled.

    So, assuming the "MXC platform and i.MX31ADS core support" patch is eventually accepted and merged upstream, "all" that's needed to get LITEKIT support mainlined is to create a BSP for the LITEKIT which fits into the hierarchy mentioned above (and get it accepted up-stream... not easy). This is exactly what Hasan has done for us (Thanks Hasan!). Now, until Freescale has their patch accepted, we're going to be stuck with lots of work keeping Hasan's LITEKIT BSP up-to-date with the changes Freescale makes to the MXC platform code, not to mention the up-stream kernel changes being made.

    To make this easier, Freescale have made their kernel development git repository public and is available at http://opensource.freescale.com/git?p=linux-2.6-mx.git;a=summary. There are lots of branches, but I propose the ones we're interested are the "devel" branch, the "stack2007xxxx" branch and possibly the "bsp-imx31ads-rel4" branch.

    The devel branch is the main one Freescale develops and contains all the platform code, device drivers, etc. needed for the i.MX31ADS. Freescale also makes a reasonable effort to keep this up-to-date with the mainline kernel. E.g. the devel branch is currently at 2.6.20.

    The stack2007xxxx branches are taken from the mainline tree and only ever have basic i.MX31 support added to them. These branches are used for mainlining code. At the moment, the latest is stack20070604 which is a copy of the mainline 2.6.22-rc3 strait from Linus' tree plus the applied "MXC platform and i.MX31ADS core support" patch.

    The bsp-imx31ads-rel4 branch is what's used to generate kernel releases to include with the complete ADS BSP (the ones released as ISO images).

    What I want to do is put together a patch which applies against one of the Freescale git branches and adds support for the litekit. I then want to submit this patch to Quinn Jensen at Freescale to see if he will add it to the Freescale tree. If he does, then we're one step closer to getting litekit support mainlined. It may also have the added bonus that when Freescale releases the next BSP ISO, it could come with LITEKIT support built in, meaning we will no longer have to keep applying & fixing Hasan's patch.

    I think there are 3 ways forward, depending upon which branch a patch is created for:

    1) We add basic litekit support and patch against the stack2007xxxx branches
    2) We add litekit support and all the associated driver fixes (e.g. the MXC_IDE fix) and patch against the devel branch
    3) We add litekit support and all the associated driver fixes (e.g. the MXC_IDE fix) and patch against the bsp-imx31ads-rel4 branch

    Pros & Cons:

    1) (Basic) Litekit support will be mainlined quicker, possibly. It will be easier to do but generally will still require a second patch to make a useful kernel.

    2) The only problem I see with using the devel branch to patch against is that it is at 2.6.20, which means the binary drivers for the MPEG4 acceleration and OpenGL ES will probably be broken. But hopefully, we'll have new ones when Freescale ships the next release of the ADS BSP ISO image (which I assume will be based on the current devel branch).

    3) This is by far the easiest patch to do as it's basically what we already have. It allows us to use the OpenGL ES & MPEG4 binary drivers included with the ADS BSP. The problem is that we'll have to update the patch when Freescale release the next BSP.

    What do people think is the best way to go? Personally I think patching against devel is going to yield the best results, but I'm more than open to suggestions.

    Assuming we're going to aim at the devel branch, I think the best way forward is to take a patched tree from zonque's "mega" patch and start moving some of the code over to a clone of the current devel branch. Once we have a basic bootable system (by that I mean basic kernel + serial port driver), create a patch and send it to Quinn.

    Please post your thoughts & comments, especially if you want to help out with this effort.


    Cheers,

    Tom

    PS: My thanks go out to everyone who's helped out with getting Linux on the LITEKIT.
    zonque
    New Member
    New Member
    Posts:


    --
    27 Jun 2007 11:48 AM
    Hi,

    Quinn Jensen told me that he's waiting for the basic support patch to be accepted by Russel King. As soon as that happens, we can start merging things to Freescale's git repository. I also have some patches ready which I would like to send upstream asap. The litekit happily runs Linux here for some weeks now, with most peripherals supported.

    Next step after putting everything into Freescale's rep would be to send the patches off to appropriate maintainers and mailing lists.

    Greets,
    Daniel
    TomCooksey
    New Member
    New Member
    Posts:


    --
    27 Jun 2007 04:55 PM
    Excellent! I assume your the same Daniel who posted on the arm-linux mailing list about the i.MX31 a day or so ago?

    From previous posts by Quinn, it sounds like he would like community support to get chunks carved out and mainlined.

    What do your patches apply against and what are they for? I've been thinking that this perhaps should be approached from two sides. First, we need full LITEKIT support for those people who are actually using the board for something useful. Perhaps merging what we currently have for the LITEKIT into freescale's devel branch (by merging I mean patch against that branch and send it off to Quinn).

    On the other end of the spectrum we have patches to go for mainline. If you look at the stack2007xxxx branch, the ADS code is _VERY_ simple compared to the devel branch (It basically defines the serial port and nothing else). I'd quite like to have a go at writing the LITEKIT BSP from scratch (using what we currently have as a guide) in the same manner as the ADS BSP is written in the stack2007xxxx branch. I.e. very, very simple (probably all my skill can manage anyway. ).

    The problem with the LITEKIT BSP as it stands at the moment is that it is rather complicated and contains quite a lot of redundant code from the ADS BSP (E.g. The 8250 serial driver is still in mx31lite.c... the litekit doesn't HAVE an 8250 device!).

    If the LITEKIT is to be mainlined, the BSP will need to be stripped of all currently non-mainlined code and then cleaned up before upstream will even think about considering it. IMO, it is going to be easier to start from scratch, which I fancy having a go at anyway. So, over the next week or so I hope to have 2 patches to apply against the stack2007xxxx branch. One which adds very basic LITEKIT support and another to add the mxc serial device driver and console support.
    You are not authorized to post a reply.