This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: external uart data bus in GPMC

Part Number: AM3352


Tool/software: Linux

Hello,

Our custom board want to use GPMC to hang up two external uart chip(exar16m890),

which means using GPMC to be the uart data bus.

cs0 is nand flash, cs1 & cs2 for uart chip,

but it's seems dead in GPMC.

please give me some suggestion.

kernel ver 4.4.32

here is my GPMC device tree and boot log:

&gpmc {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&nandflash_pins>;
    ranges = <0 0 0x08000000 0x01000000>,   /* CS0: 16MB for NAND */
            <1 0 0x09000000 0x01000000>,    /* CS1: 16MB for exar uart controller 1 */
            <2 0 0x0a000000 0x01000000>;    /* CS2: 16MB for exar uart controller 2 */
    /* nand */
    nand@0,0 {
        compatible = "ti,omap2-nand";
        reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
        interrupt-parent = <&gpmc>;
        interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
                    <1 IRQ_TYPE_NONE>; /* termcount */
        ready-gpio = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */
        ti,nand-ecc-opt = "bch8";
        ti,elm-id = <&elm>;
        nand-bus-width = <8>;
        gpmc,device-nand = "true";
        gpmc,device-width = <1>;
        gpmc,sync-clk-ps = <0>;
        gpmc,cs-on-ns = <0>;
        gpmc,cs-rd-off-ns = <44>;
        gpmc,cs-wr-off-ns = <44>;
        gpmc,adv-on-ns = <6>;
        gpmc,adv-rd-off-ns = <34>;
        gpmc,adv-wr-off-ns = <44>;
        gpmc,we-on-ns = <0>;
        gpmc,we-off-ns = <40>;
        gpmc,oe-on-ns = <0>;
        gpmc,oe-off-ns = <54>;
        gpmc,access-ns = <64>;
        gpmc,rd-cycle-ns = <82>;
        gpmc,wr-cycle-ns = <82>;
        gpmc,bus-turnaround-ns = <0>;
        gpmc,cycle2cycle-delay-ns = <0>;
        gpmc,clk-activation-ns = <0>;
        gpmc,wr-access-ns = <40>;
        gpmc,wr-data-mux-bus-ns = <0>;
        /*
         * MTD partition table
         *
         * All SPL-* partitions are sized to minimal length
         * which can be independently programmable. For
         * NAND flash this is equal to size of erase-block
        */
        #address-cells = <1>;
        #size-cells = <1>;
        partition@0 {
            label = "NAND.SPL";
            reg = <0x00000000 0x000020000>;
        };
        partition@1 {
            label = "NAND.SPL.backup1";
            reg = <0x00020000 0x00020000>;
        };
        partition@2 {
            label = "NAND.SPL.backup2";
            reg = <0x00040000 0x00020000>;
        };
        partition@3 {
            label = "NAND.SPL.backup3";
            reg = <0x00060000 0x00020000>;
        };
        partition@4 {
            label = "NAND.u-boot-spl-os";
            reg = <0x00080000 0x00040000>;
        };
        partition@5 {
            label = "NAND.u-boot";
            reg = <0x000C0000 0x00100000>;
        };
        partition@6 {
            label = "NAND.u-boot-env";
            reg = <0x001C0000 0x00020000>;
        };
        partition@7 {
            label = "NAND.u-boot-env.backup1";
            reg = <0x001E0000 0x00020000>;
        };
        partition@8 {
            label = "NAND.kernel";
            reg = <0x00200000 0x00800000>;
        };
        partition@9 {
            label = "NAND.file-system";
            reg = <0x00A00000 0x07600000>;
        };
    };

    /* Uart */
    exar_uart@1,0 {
        compatible = "exar,16m890", "mtd-ram";
        reg = <1 0 0x01000000>;
        interrupts = <86>;
        clock-frequency = <3686400>;
        bank-width = <1>;
        gpmc,device-width = <1>;    /* 8-bit data width */
    };
    /* Uart */
    exar_uart@2,0 {
        compatible = "exar,16m890", "mtd-ram";
        reg = <2 0 0x01000000>;
        interrupts = <87>;
        clock-frequency = <3686400>;
        bank-width = <1>;
        gpmc,device-width = <1>;    /* 8-bit data width */
    };
};



[    1.456197] pinctrl-single 44e10800.pinmux: pin-0 (50000000.gpmc) status -22
[    1.463452] pinctrl-single 44e10800.pinmux: could not request pin 0 (44e10800.0) from group nandflash_pins  on device pinctrl-single
[    1.475531] omap-gpmc 50000000.gpmc: Error applying setting, reverse things back
[    1.483136] Phil: ==== gpmc_probe ====
[    1.487089] GPMC revision 6.0
[    1.490098] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.498660] Phil: ==== omap_nand_probe ====
[    1.503899] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[    1.510298] nand: Macronix MX30LF1GE8AB
[    1.514231] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.521952] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
[    1.527515] 10 ofpart partitions found on MTD device 8000000.nand
[    1.533701] Creating 10 MTD partitions on "8000000.nand":
[    1.539157] 0x000000000000-0x000000020000 : "NAND.SPL"
[    1.547621] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
[    1.556540] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
[    1.565279] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
[    1.574084] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl-os"
[    1.583192] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
[    1.592332] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
[    1.601139] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
[    1.610644] 0x000000200000-0x000000a00000 : "NAND.kernel"
[    1.625711] 0x000000a00000-0x000008000000 : "NAND.file-system"
[    1.735586] ------------[ cut here ]------------
[    1.740324] WARNING: CPU: 0 PID: 6 at drivers/memory/omap-gpmc.c:1993 gpmc_probe_generic_child+0x484/0x7e0()
[    1.750363] enable GPMC debug to configure .dts timings for CS1
[    1.756365] Modules linked in:
[    1.759484] CPU: 0 PID: 6 Comm: kworker/u2:0 Not tainted 4.4.32-gadde2ca9f8 #1
[    1.766788] Hardware name: Generic AM33XX (Flattened Device Tree)
[    1.772991] Workqueue: deferwq deferred_probe_work_func
[    1.778260] Backtrace: 
[    1.780829] [<c0013324>] (dump_backtrace) from [<c0013520>] (show_stack+0x18/0x1c)
[    1.788446]  r7:c03fade4 r6:000007c9 r5:00000009 r4:00000000
[    1.794257] [<c0013508>] (show_stack) from [<c0263f18>] (dump_stack+0x24/0x28)
[    1.801587] [<c0263ef4>] (dump_stack) from [<c0031168>] (warn_slowpath_common+0x88/0xb4)
[    1.809745] [<c00310e0>] (warn_slowpath_common) from [<c00311cc>] (warn_slowpath_fmt+0x38/0x40)
[    1.818526]  r8:00000000 r7:00000000 r6:c0775028 r5:cf106e00 r4:c06860bc
[    1.825390] [<c0031198>] (warn_slowpath_fmt) from [<c03fade4>] (gpmc_probe_generic_child+0x484/0x7e0)
[    1.834696]  r3:00000001 r2:c06860bc
[    1.838322]  r4:cfd9f7a8
[    1.840941] [<c03fa960>] (gpmc_probe_generic_child) from [<c03fb5d0>] (gpmc_probe+0x444/0x5c0)
[    1.849601]  r10:cf106e00 r9:00000000 r8:cf40d694 r7:c0775028 r6:cf40d610 r5:cfd9f7a8
[    1.857581]  r4:00000000
[    1.860170] [<c03fb18c>] (gpmc_probe) from [<c031f798>] (platform_drv_probe+0x54/0xb8)
[    1.868166]  r10:cf002800 r9:00000000 r8:00000001 r7:fffffdfb r6:c0739170 r5:cf106e10
[    1.876141]  r4:c0773ee8
[    1.878722] [<c031f744>] (platform_drv_probe) from [<c031dee4>] (driver_probe_device+0x20c/0x300)
[    1.887680]  r7:c0739170 r6:00000000 r5:cf106e10 r4:c0773ee8
[    1.893478] [<c031dcd8>] (driver_probe_device) from [<c031e138>] (__device_attach_driver+0x88/0x94)
[    1.902607]  r9:00000000 r8:cf002800 r7:00000001 r6:cf106e10 r5:cf069e78 r4:c0739170
[    1.910528] [<c031e0b0>] (__device_attach_driver) from [<c031c22c>] (bus_for_each_drv+0x68/0x9c)
[    1.919364]  r7:00000001 r6:c031e0b0 r5:cf069e78 r4:00000000
[    1.925165] [<c031c1c4>] (bus_for_each_drv) from [<c031dc30>] (__device_attach+0xac/0x110)
[    1.933520]  r6:cf106e44 r5:cf106e10 r4:cf106e10
[    1.938223] [<c031db84>] (__device_attach) from [<c031e290>] (device_initial_probe+0x14/0x18)
[    1.946830]  r7:00000000 r6:c072c018 r5:cf106e10 r4:cf106e10
[    1.952626] [<c031e27c>] (device_initial_probe) from [<c031d2cc>] (bus_probe_device+0x8c/0x94)
[    1.961338] [<c031d240>] (bus_probe_device) from [<c031d704>] (deferred_probe_work_func+0x5c/0x8c)
[    1.970348]  r7:00000000 r6:c072be80 r5:c072be74 r4:cf106e10
[    1.976147] [<c031d6a8>] (deferred_probe_work_func) from [<c0046d64>] (process_one_work+0x12c/0x378)
[    1.985364]  r7:00000000 r6:cf3c9c00 r5:c072be98 r4:cf02a380
[    1.991159] [<c0046c38>] (process_one_work) from [<c0047028>] (worker_thread+0x78/0x568)
[    1.999297]  r10:cf002800 r9:cf02a380 r8:00000088 r7:cf002810 r6:cf02a398 r5:cf002800
[    2.007293]  r4:cf068000
[    2.009884] [<c0046fb0>] (worker_thread) from [<c004c914>] (kthread+0xdc/0xf4)
[    2.017184]  r10:00000000 r9:00000000 r8:00000000 r7:c0046fb0 r6:cf02a380 r5:cf014d40
[    2.025161]  r4:00000000
[    2.027746] [<c004c838>] (kthread) from [<c000f978>] (ret_from_fork+0x14/0x3c)
[    2.035131]  r7:00000000 r6:00000000 r5:c004c838 r4:cf014d40
[    2.040934] ---[ end trace 55fa9bf4c43290bd ]---
[    2.048713] 9000000.exar_uart: ttyS1 at MMIO 0x9000000 (irq = 0, base_baud = 230400) is a 16550A
[    2.058569] ------------[ cut here ]------------
[    2.063420] WARNING: CPU: 0 PID: 6 at drivers/memory/omap-gpmc.c:1993 gpmc_probe_generic_child+0x484/0x7e0()
[    2.073404] enable GPMC debug to configure .dts timings for CS2
[    2.079364] Modules linked in:
[    2.082519] CPU: 0 PID: 6 Comm: kworker/u2:0 Tainted: G        W       4.4.32-gadde2ca9f8 #1
[    2.091041] Hardware name: Generic AM33XX (Flattened Device Tree)
[    2.097195] Workqueue: deferwq deferred_probe_work_func
[    2.102498] Backtrace: 
[    2.105020] [<c0013324>] (dump_backtrace) from [<c0013520>] (show_stack+0x18/0x1c)
[    2.112673]  r7:c03fade4 r6:000007c9 r5:00000009 r4:00000000
[    2.118442] [<c0013508>] (show_stack) from [<c0263f18>] (dump_stack+0x24/0x28)
[    2.125764] [<c0263ef4>] (dump_stack) from [<c0031168>] (warn_slowpath_common+0x88/0xb4)
[    2.133957] [<c00310e0>] (warn_slowpath_common) from [<c00311cc>] (warn_slowpath_fmt+0x38/0x40)
[    2.142737]  r8:00000000 r7:00000000 r6:c0775028 r5:cf106e00 r4:c06860bc
[    2.149567] [<c0031198>] (warn_slowpath_fmt) from [<c03fade4>] (gpmc_probe_generic_child+0x484/0x7e0)
[    2.158871]  r3:00000002 r2:c06860bc
[    2.162528]  r4:cfd9f99c
[    2.165113] [<c03fa960>] (gpmc_probe_generic_child) from [<c03fb5d0>] (gpmc_probe+0x444/0x5c0)
[    2.173806]  r10:cf106e00 r9:00000000 r8:cf40d694 r7:c0775028 r6:cf40d610 r5:cfd9f99c
[    2.181781]  r4:00000000
[    2.184370] [<c03fb18c>] (gpmc_probe) from [<c031f798>] (platform_drv_probe+0x54/0xb8)
[    2.192366]  r10:cf002800 r9:00000000 r8:00000001 r7:fffffdfb r6:c0739170 r5:cf106e10
[    2.200307]  r4:c0773ee8
[    2.202921] [<c031f744>] (platform_drv_probe) from [<c031dee4>] (driver_probe_device+0x20c/0x300)
[    2.211878]  r7:c0739170 r6:00000000 r5:cf106e10 r4:c0773ee8
[    2.217641] [<c031dcd8>] (driver_probe_device) from [<c031e138>] (__device_attach_driver+0x88/0x94)
[    2.226771]  r9:00000000 r8:cf002800 r7:00000001 r6:cf106e10 r5:cf069e78 r4:c0739170
[    2.234690] [<c031e0b0>] (__device_attach_driver) from [<c031c22c>] (bus_for_each_drv+0x68/0x9c)
[    2.243559]  r7:00000001 r6:c031e0b0 r5:cf069e78 r4:00000000
[    2.249324] [<c031c1c4>] (bus_for_each_drv) from [<c031dc30>] (__device_attach+0xac/0x110)
[    2.257669]  r6:cf106e44 r5:cf106e10 r4:cf106e10
[    2.262405] [<c031db84>] (__device_attach) from [<c031e290>] (device_initial_probe+0x14/0x18)
[    2.271010]  r7:00000000 r6:c072c018 r5:cf106e10 r4:cf106e10
[    2.276772] [<c031e27c>] (device_initial_probe) from [<c031d2cc>] (bus_probe_device+0x8c/0x94)
[    2.285481] [<c031d240>] (bus_probe_device) from [<c031d704>] (deferred_probe_work_func+0x5c/0x8c)
[    2.294523]  r7:00000000 r6:c072be80 r5:c072be74 r4:cf106e10
[    2.300288] [<c031d6a8>] (deferred_probe_work_func) from [<c0046d64>] (process_one_work+0x12c/0x378)
[    2.309503]  r7:00000000 r6:cf3c9c00 r5:c072be98 r4:cf02a380
[    2.315299] [<c0046c38>] (process_one_work) from [<c0047028>] (worker_thread+0x78/0x568)
[    2.323468]  r10:cf002800 r9:cf02a380 r8:00000088 r7:cf002810 r6:cf02a398 r5:cf002800
[    2.331534]  r4:cf068000
[    2.334126] [<c0046fb0>] (worker_thread) from [<c004c914>] (kthread+0xdc/0xf4)
[    2.341435]  r10:00000000 r9:00000000 r8:00000000 r7:c0046fb0 r6:cf02a380 r5:cf014d40
[    2.349379]  r4:00000000
[    2.351999] [<c004c838>] (kthread) from [<c000f978>] (ret_from_fork+0x14/0x3c)
[    2.359265]  r7:00000000 r6:00000000 r5:c004c838 r4:cf014d40
[    2.365048] ---[ end trace 55fa9bf4c43290be ]---
[    2.372665] a000000.exar_uart: ttyS2 at MMIO 0xa000000 (irq = 0, base_baud = 230400) is a 16550A
  • Hi Phil,

    From the log it is obvious that the kernel does not like the exar_uart@1,0 & exar_uart@2,0 child nodes.
    When grepping the linux kernel I couldn't find any driver compatible with "exar,16m890", "mtd-ram". Can you share which driver are you trying to call with this value in the compatible paramter? Maybe this is the root cause of your kernel panic.

    Best Regards,
    Yordan
  • Hi Yordan,

    Thx for reply, yesterday I modify the child-node, the log looks fine, here is my new child-node:

    exar_uart@1,0 { /* Chip-select 1 for uart chip1 */
    
            compatible = "exar,16m890";
    
            reg = <1 0 0x01000000>;
    
            fifo-size = <64>;
    
            interrupts = <86>;
    
            clock-frequency = <3686400>;
    
            bank-width = <1>;
    
            #address-cells = <1>;
    
            #size-cells = <1>;
    
            gpmc,device-width = <1>;    /* 8-bit data width */
    
            gpmc,cs-on-ns = <0>;        /* Assertion time */
    
            gpmc,cs-rd-off-ns = <20> ; /* Read deassertion time */
    
            gpmc,cs-wr-off-ns = <20>;   /* Write deassertion time */
    
            gpmc,sync-clk-ps = <20000>;
    
        };

    here is the booting log:

    [ 1.724226] 9000000.exar_uart: ttyS1 at MMIO 0x9000000 (irq = 0, base_baud = 230400) is a 16550A 
    [ 1.736870] a000000.exar_uart: ttyS2 at MMIO 0xa000000 (irq = 0, base_baud = 230400) is a 16550A 
    

    but when I access chip-select 1 memory, the cpu will hang(dead), 

    did I miss any configuration?

    About the uart chip, the uart chip is compatible with standard 8250, 

    I add my uart define in <KERNEL_DIR>/drivers/tty/serial/of_serial.c,

    so that the kernel can  recognize it

    static const struct of_device_id of_platform_serial_table[] = {
        { .compatible = "ns8250",   .data = (void *)PORT_8250, },
        { .compatible = "ns16450",  .data = (void *)PORT_16450, },
        { .compatible = "ns16550a", .data = (void *)PORT_16550A, },
        { .compatible = "ns16550",  .data = (void *)PORT_16550, },
        { .compatible = "exar,16m890",  .data = (void *)PORT_16550A},
        { .compatible = "ns16750",  .data = (void *)PORT_16750, },
        { .compatible = "ns16850",  .data = (void *)PORT_16850, },
        { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, },
    
        ....
        ....
    };

  • See if ttyS1 & ttyS2 are not used by another uart interface. Start your checks from u-boot dts files, for example uart1 is defined by default in arch/arm/boot/dts/am335x-evm.dts & in the u-boot arch/arm/dts/am335x-evm.dts files (both are 16550). So double check if they don't use the ttyS1 & ttyS2 handles.

    Best Regards,
    Yordan
  • Hi Yordan,
    Thanks for reply, I found the problem, my mux is setting wrong
    Thanks again.