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 25 Jun 2009 12:35 AM by  andreas.b
Linux 2.6.22 Litekit Patch
 9 Replies
Sort:
You are not authorized to post a reply.
Author Messages

zyzyis@gmail.com



New Member


Posts:
New Member


--
30 Sep 2008 06:19 AM
    Hi all,


    I just posted a MX27 litekit patch for the Linux 2.6.22 kernel. It works very well except the SD card.

    You can get it from my blog.

    http://200dollartablet.blogspot.com/

    gabriel.neagoe@gmail.com



    New Member


    Posts:
    New Member


    --
    02 Oct 2008 02:41 PM
    I've downloaded and tested the patch, and I've got the 2.6.22 kernel working. Thank you for the work !

    On the other hand, I still have some problems with the root file system (kernel reports an error when trying to execute /sbin/init ). Is it possible to create a link to a working rootfs image ? It will help me to debug my system.

    helio-2000



    New Member


    Posts:
    New Member


    --
    09 Jan 2009 08:41 AM
    Hello, this is my first post here.

    I am trying zyzyis' patch for linux-2.6.22. I succesfully compile the kernel and then send zImage to LoLo:

    load raw 0xa0100000 1633648
    exec -t
    ATAG_CORE1, 4096, 255, 4, 1413545986, Uncompressing Linux.......................
    ................................................................... done, booting the kernel.

    And then, it hangs up.

    Please, can you see anything what I can be missing here?

    Thank you.

    johnlongawa



    New Member


    Posts:
    New Member


    --
    23 Jan 2009 01:06 AM
    Could you possibly post your .config file for the 2.6.22 kernel build and identify your toolchain?

    My toolchain was built with cross-tool and uses gcc 4.2.4 and glibc 2.3.3.

    I pulled down the mainline kernel for 2.6.22 and applied your patch but it was complaining about the ethernet driver (missing the IRQ table). I made a guess at what it should be and got it to compile but most likely guessed wrong. I am able to get the kernel to start its initialization but during CSI init it panics:

    ...
    Linux video capture interface: v2.00
    Unhandled fault: external abort on non-linefetch (0x808) at 0xeb000010
    Internal error: : 808 [#1] PREEMPT
    Modules linked in:
    CPU: 0 Not tainted (2.6.22.6 #1)
    PC is at gpio_sensor_active+0xa4/0xac
    LR is at 0xbf600003
    pc : [<c0042674>] lr : [<bf600003>] psr: 60000013
    sp : c7c1df70 ip : 00000001 fp : c7c1df7c
    r10: c001f404 r9 : 00000001 r8 : c001eaac
    r7 : c7c1c000 r6 : 00000000 r5 : 00000000 r4 : 00000000
    r3 : eb000000 r2 : 00000400 r1 : 00000000 r0 : 00000000
    Flags: nZCv IRQs on FIQs on Mode SVC_32 Segment kernel
    Control: 0005317f Table: a0004000 DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7c1c260)
    Stack: (0xc7c1df70 to 0xc7c1e000)
    df60: c7c1df8c c7c1df80 c00181dc c00425e0
    df80: c7c1dff4 c7c1df90 c0008794 c00181dc cef7163a d3ef542f 00000000 00000000
    dfa0: 00000000 c7c1dfb0 c0037f44 c00498a4 00000000 00000000 c00086e4 c0050258
    dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    dfe0: 00000000 00000000 00000000 c7c1dff8 c0050258 c00086f4 d7ad0f26 1f8b0006
    Backtrace:
    [<c00425d0>] (gpio_sensor_active+0x0/0xac) from [<c00181dc>] (ov2640_init+0x10/0x28)
    [<c00181cc>] (ov2640_init+0x0/0x28) from [<c0008794>] (kernel_init+0xb0/0x26c)
    [<c00086e4>] (kernel_init+0x0/0x26c) from [<c0050258>] (do_exit+0x0/0x92c)
    Code: e3a01000 ebfffa64 e3a034eb e3a02b01 (e1c321b0)
    Kernel panic - not syncing: Attempted to kill init!

    johnlongawa



    New Member


    Posts:
    New Member


    --
    23 Jan 2009 05:27 PM
    I got past my configuration error so now the kernel gets pretty far before hanging up trying to mount the root file system via NFS.

    Therefore, I don't need the previously requested configuration or toolchain info.

    Thanks!

    helio-2000



    New Member


    Posts:
    New Member


    --
    26 Jan 2009 12:44 AM
    My problem was I need to specify machine number with "-i 0x34e" option on exec.

    helio-2000



    New Member


    Posts:
    New Member


    --
    26 Jan 2009 08:24 AM
    Another problem that happens here is that when you configure network settings with LoLo and then boot the kernel ethernet is working fine.

    FEC ENET Version 0.2
    fec: PHY @ 0x0, ID 0x7fffffff -- unknown PHY!
    eth0: ethernet 00:11:22:33:44:55

    However, if you don't initialize network settings with LoLo and boot the kernel, ethernet does not work.

    FEC ENET Version 0.2
    FEC: No PHY device found.
    eth0: ethernet 00:11:22:33:44:55

    It may be produced by somo initialization steps that makes LoLo to the external PHY but, of course, as LoLo is not open source I don't know how to reproduce these steps in the fec linux driver.

    This is a "to do" thing, because network initialization should be independent of the Bootloader which came before.

    johnlongawa



    New Member


    Posts:
    New Member


    --
    05 Feb 2009 01:09 AM
    The PHY isn't being found because the FEC_SEL signal is not asserted when the FEC reads the PHY serially to get its ID.

    I've had lots of trouble with the ethernet setup trying to get a patched kernel to run on the ZoomLite with the i.MX27 SOM. I think I have it
    straightened out now. Maybe some of this will be of value to others struggling to port to the ZoomLite.

    First of all, the ethernet LEDs never come on the first time I power the board. When the two LEDs near the ethernet connector are off and I try to load an image via tftp I get the "No empty FEC TX DMA buffers" message. However, if I wait for the board GPIO0 and GPIO1 LEDs to start blinking and then quickly toggle the power off then on, the ethernet LEDs come on and I can communicate via tftp. It works consistently.

    In examining the kernel boot messages I noticed the fec driver was just not happy with the ZoomLite PHY because it was getting the ID wrong, was not setting the ethernet address correctly, was not recognizing the SMSC PHY and was therefore not initializing it. When you use LOLO to configure sm0 before booting it happens to be in a reasonable state - but the same isn't true for booting without configuring via LOLO first.

    When you use 'ifconfig sm0 /dev/config' via LOLO, the MAC address gets loaded into the FEC and the FEC_SEL signal is enabled so the FEC can communicate with the PHY. An unpatched MX27ADS 2.6.22 kernel FEC driver loads the MAC address from flash for some systems but when ARCH_MXC is defined, it tries to load the address from the i.MX 'IMM' area (which seems to be inaccessible on a ZoomLite via LOLO - and appears unprogrammed when read via the FEC driver). When the MAC address is all zeros or all FFs, the fec driver replaces it with a default address.

    The patched 2.6.22 kernel FEC driver just reads the ethernet address from the FEC assuming the bootloader (in our case LOLO) has initialized it. The default MAC address can be specified on the kernel command line:

    fec_mac=00:01:02:03:04:05


    This is fine for development but on a Zoom Lite board, we should be getting the MAC address from the serial EEPROM.

    Here are some things I experimented with to get things to work:

    1. Make sure the FEC_SEL signal is asserted to allow the FEC to communicate with the PHY. You can do this in the 'gpio_fec_active' function in ads27_gpio.c in arch/arm/mach-mx27:

    #define FEC_SEL_PIN MX27_PIN_SSI3_CLK

    /* Configure the FEC PHY select output to enable it */
    gpio_request_mux(FEC_SEL_PIN, GPIO_MUX_GPIO);
    mxc_set_gpio_direction(FEC_SEL_PIN, 0);
    mxc_set_gpio_dataout(FEC_SEL_PIN, 1);

    2. Set the expio_intr_fec to zero in mx27ads.c and change the fec.c driver to not use request_irq, disable_irq, or enable_irq for the PHY whenever the value of expio_intr_fec is zero. You don't need the PHY to interrupt since all the driver ever does is acknowledge it. The FEC gets internal interrupts from the PHY by communicating with it serially. If you need the PHY to interrupt then configure the PCMCIA_READY input as the source.

    3. Tweak the discovery function in the fec.c driver to ignore the first 2 to 4 bits of the first PHY ID word because the SMSC8700 sometimes returns 7fff and 3fff when you query it with an address other than its own. Because of this, the fec driver thinks the phy ID is 7fffffff or 3fffffff at address 0 when it should be discovering ID 0x007C0C3 at address 0x1f (the default for the SMSC8700).

    TO DO THIS I REPLACED:

    if ((phytype = (mii_reg & 0xffff)) != 0xffff && phytype != 0) {


    WITH:

    phytype = mii_reg & 0xffff;

    if (((phytype & 0x0fff) != 0x0fff) && (phytype != 0)) {


    4. Finally, add support for the SMSC8700 to the fec.c driver. You don't need to configure PHYLIB or load the SMSC driver - all ethernet and PHY support is handled internal to the fec driver. To add another PHY just add a PHY info structure for it. This one seems to work for me. Note, we don't even enable PHY interrupts so we don't need to provide anything for the 'ack_int' command sequence. Also, the 'shutdown' member is never used so it can be empty as well. Also note, IDs are shifted right 4 bits:

    static phy_info_t phy_info_smsc8700= {
    0x00007c0c,
    "SMSC8700",

    (const phy_cmd_t []) { /* config */
    { mk_mii_read(MII_REG_CR), mii_parse_cr },
    { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
    { mk_mii_end, }
    },
    (const phy_cmd_t []) { /* startup */
    { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* auto-negotiate */
    { mk_mii_read(MII_REG_SR), mii_parse_sr },
    { mk_mii_end, }
    },
    (const phy_cmd_t []) { /* ack_int - never happens, no interrupt */
    { mk_mii_end, }
    },
    (const phy_cmd_t []) { /* shutdown */
    { mk_mii_end, }
    },
    };

    Don't forget to add a pointer to the SMSC info in the info array:

    static phy_info_t const * const phy_info[] = {
    &phy_info_lxt970,
    &phy_info_lxt971,
    &phy_info_qs6612,
    &phy_info_am79c874,
    &phy_info_ks8721bl,
    &phy_info_dp83848,
    &phy_info_smsc8700, /* <------ added phy_info pointer */
    NULL

    With these mods, the fec driver recognizes and initializes the SMSC PHY properly on the ZoomLite. My output during boot looks like:

    FEC ENET Version 0.2
    fec: PHY @ 0x1f, ID 0x0007c0c3 -- SMSC8700
    eth0: ethernet 00:08:ee:01:f6:c3

    I haven't tried to read the MAC address out of the serial EEPROM so for now I just pass the ethernet address on the kernel command line.

    thomas.gaberan



    New Member


    Posts:
    New Member


    --
    19 Jun 2009 01:20 AM
    Hi,

    first thank you for all your posts...

    i'm currently trying to boot linux on a IMX27 litekit.

    I have read all your posts, but i don't find how you compile the kernel ? did you use the ltib tools or smth else ?

    cause i've tried with it. It's giving me a linux-2.6.22-mx27ads config file but the compile give's error.

    i'm a little in trouble now... is there someone to help me ?

    regards.

    Thomas

    andreas.b



    New Member


    Posts:
    New Member


    --
    25 Jun 2009 12:35 AM
    How did you get the patch to work?
    I patched a vanilla kernel without any error messages and the compilation went well without any complaints, yet the board hangs up after "Uncompressing Linux.....................done, booting the kernel."

    Are there any differences on newer boards that makes the patch unuseful?

    We have patched another kernel that boots and runs well but I don't get the framebuffer to work and also there is no USB or CF-support.
    You are not authorized to post a reply.