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/AM5728: GPMC MRAM problem

Part Number: AM5728

Tool/software: Linux

Hi

I'm using AM572x custom board

and, I use GPMC MRAM (Multiplex mode)

MRAM: MR4A16BCMA35

U-Boot Command(md, mw) is working.

But, Linux Application can not use it.

Test MRAM memory
[main] 99 Dev Open!
[main] 105 Mem Mapping for Phy -> Vir!Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

content:
pgd = ece78680
[00000000] *pgd=ace38003, *pmd=fbbc5003
------------[ cut here ]------------
WARNING: CPU: 1 PID: 28 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x368()
44000000.ocp:L3 Custom Error: MASTER MPU TARGET GPMC (Read): Data Access in User mode during Functional access
Bus error (core dumped)Modules linked in: cbc jitterentropy_rng drbg virtio_rpmsg_bus xfrm_user xfrm4_tunnel prueth ipcomp xfrm_ipcomp esp4 bluetooth ah4 pru_rproc af_key xfrm_algo ecb pruss_intc sha512_generic extcon_usb_gpio sha512_arm sha256_generic hmac md5 sha1_generic sha1_arm_neon pvrsrvkm(O) sha1_arm omap_aes_driver omap_sham pruss omap_wdt extcon gpio_pisosr rtc_ds1307 omap_des omap_rng rng_core debugss_kmodule(O) omap_remoteproc remoteproc virtio virtio_ring sch_fq_codel uio_module_drv(O) uio gdbserverproxy(O) cryptodev(O) cmemk(O)

CPU: 1 PID: 28 Comm: irq/23-l3-app-i Tainted: G O 4.4.19-rt25-gf572d285f0 #95
Hardware name: Generic DRA74X (Flattened Device Tree)
Backtrace:
[<c0013b44>] (dump_backtrace) from [<c0013d40>] (show_stack+0x18/0x1c)
r7:c03009c4 r6:20010113 r5:00000000 r4:c095fcc4
[<c0013d28>] (show_stack) from [<c02d2c84>] (dump_stack+0x8c/0xa0)
[<c02d2bf8>] (dump_stack) from [<c0035fd4>] (warn_slowpath_common+0x88/0xb8)
r7:c03009c4 r6:00000093 r5:00000009 r4:ee651e28
[<c0035f4c>] (warn_slowpath_common) from [<c003603c>] (warn_slowpath_fmt+0x38/0x40)
r8:00000017 r7:c0842cdc r6:00000002 r5:c0842d9c r4:c0842e40
[<c0036008>] (warn_slowpath_fmt) from [<c03009c4>] (l3_interrupt_handler+0x25c/0x368)
r3:ee61f680 r2:c0842e40
r4:80080003
[<c0300768>] (l3_interrupt_handler) from [<c00839ac>] (irq_forced_thread_fn+0x28/0x7c)
r10:c0083984 r9:ee61fbc0 r8:ee60c900 r7:00000001 r6:00000000 r5:ee60c900
r4:ee61fbc0
[<c0083984>] (irq_forced_thread_fn) from [<c0083d14>] (irq_thread+0x124/0x1f8)
r7:00000001 r6:00000000 r5:ee650000 r4:ee61fbe4
[<c0083bf0>] (irq_thread) from [<c0050c64>] (kthread+0xe4/0xfc)
r10:00000000 r9:00000000 r8:00000000 r7:c0083bf0 r6:ee61fbc0 r5:ee61fc00
r4:00000000
[<c0050b80>] (kthread) from [<c0010710>] (ret_from_fork+0x14/0x24)
r7:00000000 r6:00000000 r5:c0050b80 r4:ee61fc00
---[ end trace 0000000000000002 ]---

const unsigned int mem_address = 0x01000000;
const unsigned int mem_size = 0x01000000;

mem_dev = open("/dev/mem", O_RDWR | O_SYNC);

printf("[%s] %d Dev Open!\n", __FUNCTION__, __LINE__);

virt_addr = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_dev, mem_address);
if(virt_addr == MAP_FAILED)
    printf("[%s] %d Error mmap", __FUNCTION__, __LINE__);
else
    printf("[%s] %d Mem Mapping for Phy -> Vir!\n", __FUNCTION__, __LINE__);

printf("content: \n");
for (i=0; i<100; i++)
{
    printf("[%03d]0x%02x ",i,*(char *)(virt_addr+i));
    *((char *)virt_addr+i) = i;
    if(i%10 == 0)
        printf("\n");
}
printf("\n");

Pinmux

//GPMC MRAM
{GPMC_A1, (M0 | PIN_OUTPUT | MANUAL_MODE)}, /* gpmc_a1.vin4b_d1 */
{GPMC_A2, (M0 | PIN_OUTPUT | MANUAL_MODE)}, /* gpmc_a2.vin4b_d2 */
{GPMC_A3, (M0 | PIN_OUTPUT | MANUAL_MODE)}, /* gpmc_a3.vin4b_d3 */
{GPMC_A4, (M0 | PIN_OUTPUT | MANUAL_MODE)}, /* gpmc_a4.vin4b_d4 */

{GPMC_OEN_REN, (M0 | PIN_INPUT_PULLUP)}, /* gpmc_oen_ren.gpio2_24 */
{GPMC_WEN, (M0 | PIN_INPUT_PULLUP)}, /* gpmc_wen.gpio2_25 */
{GPMC_BEN0, (M0 | PIN_INPUT_PULLDOWN)}, /* gpmc_ben0.gpio2_26 */
{GPMC_BEN1, (M0 | PIN_INPUT_PULLDOWN)}, /* gpmc_ben1.gpio2_27 */
{GPMC_WAIT0, (M0 | PIN_INPUT_PULLUP)}, /* gpmc_wait0.gpio2_28 */
{GPMC_CS3, (M0 | PIN_INPUT_PULLDOWN)}, /* gpmc_cs3.vin3a_clk0 */
{GPMC_ADVN_ALE, (M0 | PIN_INPUT_PULLUP)}, /* gpmc_advn_ale.gpio2_23 */

{GPMC_AD0, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad0.vin3a_d0 */
{GPMC_AD1, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad1.vin3a_d1 */
{GPMC_AD2, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad2.vin3a_d2 */
{GPMC_AD3, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad3.vin3a_d3 */
{GPMC_AD4, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad4.vin3a_d4 */
{GPMC_AD5, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad5.vin3a_d5 */
{GPMC_AD6, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad6.vin3a_d6 */
{GPMC_AD7, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad7.vin3a_d7 */
{GPMC_AD8, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad8.vin3a_d8 */
{GPMC_AD9, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad9.vin3a_d9 */
{GPMC_AD10, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad10.vin3a_d10 */
{GPMC_AD11, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad11.vin3a_d11 */
{GPMC_AD12, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad12.vin3a_d12 */
{GPMC_AD13, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad13.vin3a_d13 */
{GPMC_AD14, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad14.vin3a_d14 */
{GPMC_AD15, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)}, /* gpmc_ad15.vin3a_d15 */

U-Boot GPMC Reg Define mem.h

#define STNOR_GPMC_CONFIG1 0x01801203
#define STNOR_GPMC_CONFIG2 0x001f1f00
#define STNOR_GPMC_CONFIG3 0x001f1f01
#define STNOR_GPMC_CONFIG4 0x1f011f01
#define STNOR_GPMC_CONFIG5 0x001d1f1f
#define STNOR_GPMC_CONFIG6 0x08070280
#define STNOR_GPMC_CONFIG7 0x00000F41

 

My Development Environment

Host PC OS: Ubuntu 16.04 linux 64bit

AM5728 SDK: u-boot-2016.05 / linux-rt-4.4.19

AM5728 SDK Ver: ti-processor-sdk-linux-rt-am57xx-evm-03.01.00.06

IPC: ipc_3_43_02_04

XDC: xdctools_3_32_00_06_core

Thanks and best regards.

John.

  • GPMC devices are memory mapped. Have you tried to read/write directly to the GPMC address?
  • GPMC devices are memory mapped. Have you tried to read/write directly to the GPMC address?
    -> GPMC CONFIG 7 Register Setting 0x00000F41 in U-Boot

    base addr mapping: 0x1000000

    Best Regards

    John

  • Yes, this is correct.
  • My Register Setting is correct..

    u-boot command is working
    but Linux application can not use it.

    Why doesn't it work?
    Does the setting change from Linux?

    Best Regards
    John
  • I want advice this issue more.

    Does the setting change from Linux?

    plz, check for this issue one more time.


    Best Regards
    John
  • Hi,

    In my experience these kind of L3 errors:
    L3 Custom Error: MASTER MPU TARGET GPMC (Read): Data Access in User mode during Functional access

    Occur, when you access an illegal memory address. Can you show the dts node of the GPMC? Which CS are you using, what is its base address (make sure that no other peripheral uses this address at the same time as GPMC)?

    Best Regards,
    Yordan
  • Thank you for your reply.


    base addr: 0x1000000
    gpmc cs: 3 (The GPMC Device on my board is connected only to MRAM...)

    Dts file.
    gpmc: gpmc@50000000 {
    compatible = "ti,am3352-gpmc";
    ti,hwmods = "gpmc";
    reg = <0x50000000 0x37c>; /* device IO registers */
    interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
    dmas = <&edma_xbar 4 0>;
    dma-names = "rxtx";
    gpmc,num-cs = <8>;
    gpmc,num-waitpins = <2>;
    #address-cells = <2>;
    #size-cells = <1>;
    interrupt-controller;
    #interrupt-cells = <2>;
    gpio-controller;
    #gpio-cells = <2>;
    status = "disabled";
    };

    &gpmc {
    #address-cells = <2>;
    #size-cells = <1>;

    /* chip select ranges */
    /* GPMC MRAM = 2MB -> Minimum Size 16MB */
    ranges = <3 0 0x1000000 0x1000000>;

    mram@0,0{
    reg = <3 0 0x1000000>;
    compatible = "cfi-flash"; /* fake nor flash.... */
    #address-cells = <1>;
    #size-cells = <1>;

    bank-width = <2>;

    gpmc,mux-add-data = <2>; /* MultiPlex Mode Setting 1:AAD 2:AD */
    gpmc,device-width = <2>; /* Total width of device(s) connected to a GPMC
    chip-select in bytes. The GPMC supports 8-bit
    and 16-bit devices and so this property must be
    1 or 2. */
    };
    };

    Best Regards, 

    John

  • Is there anyone there?
    I want advice.


    Best Regards,
    John
  • Hi,

    Sorry for the delayed reply.

    Do you see the GPMC address space in /proc/iomem?

    Also, I just noticed this. You say your MRAM is located at CS3, however you define it as mram@0,0 (this means MRAM located at CS0) and everywhere else you define cs3:
    ranges = <3 0 0x1000000 0x1000000>;
    reg = <3 0 0x1000000>;
    Can you change mram@0,0 to mram@3,0 and see if the error will persist?

    Best Regards,
    Yordan
  • Thank you for your reply.

    I tried it by change to mram@3,0

    But, Linux Application can not use it.

    When running the app, the same problem are arising..

     

    running the linux app log..

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

    Test MRAM memory
    [GPMC_Init] 34 Dev Open!
    [GPMC_Init] 65 Reg Setting!
    [main] 101 Dev Open!
    [main] 107 Mem Mapping for Phy -> Vir!
    content:
    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
    pgd = ed7673c0
    [00000000] *pgd=ad64e003, *pmd=fc969003
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 28 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x368()
    44000000.ocp:L3 Custom Error: MASTER MPU TARGET GPMC (Read): Data Access in User mode during Functional access
    Bus error (core dumped)Modules linked in:
    rpmsg_pru cbc drbg xfrm_user xfrm4_tunnel virtio_rpmsg_bus ipcomp xfrm_ipcomp esp4 bluetooth ah4 af_key xfrm_algo prueth pru_rproc ecb pruss_intc extcon_usb_gpio sha512_generic sha512_arm pvrsrvkm(O) sha256_generic hmac md5 sha1_generic sha1_arm_neon sha1_arm omap_aes_driver omap_sham pruss omap_wdt extcon gpio_pisosr rtc_ds1307 omap_des omap_rng rng_core debugss_kmodule(O) omap_remoteproc remoteproc virtio virtio_ring sch_fq_codel uio_module_drv(O) uio gdbserverproxy(O) cryptodev(O) cmemk(O)
    root@am57xx-evm:/test/URIED-TEST# CPU: 1 PID: 28 Comm: irq/23-l3-app-i Tainted: G O 4.4.19-rt25-gf572d285f0 #134
    Hardware name: Generic DRA74X (Flattened Device Tree)
    Backtrace:
    [<c0013b44>] (dump_backtrace) from [<c0013d40>] (show_stack+0x18/0x1c)
    r7:c03009c4 r6:200f0113 r5:00000000 r4:c09c3dc4
    [<c0013d28>] (show_stack) from [<c02d2c84>] (dump_stack+0x8c/0xa0)
    [<c02d2bf8>] (dump_stack) from [<c0035fd4>] (warn_slowpath_common+0x88/0xb8)
    r7:c03009c4 r6:00000093 r5:00000009 r4:ee651e28
    [<c0035f4c>] (warn_slowpath_common) from [<c003603c>] (warn_slowpath_fmt+0x38/0x40)
    r8:00000017 r7:c089c7ac r6:00000002 r5:c089c86c r4:c089c910
    [<c0036008>] (warn_slowpath_fmt) from [<c03009c4>] (l3_interrupt_handler+0x25c/0x368)
    r3:ee621180 r2:c089c910
    r4:80080003
    [<c0300768>] (l3_interrupt_handler) from [<c00839ac>] (irq_forced_thread_fn+0x28/0x7c)
    r10:c0083984 r9:ee6216c0 r8:ee60a900 r7:00000001 r6:00000000 r5:ee60a900
    r4:ee6216c0
    [<c0083984>] (irq_forced_thread_fn) from [<c0083d14>] (irq_thread+0x124/0x1f8)
    r7:00000001 r6:00000000 r5:ee650000 r4:ee6216e4
    [<c0083bf0>] (irq_thread) from [<c0050c64>] (kthread+0xe4/0xfc)
    r10:00000000 r9:00000000 r8:00000000 r7:c0083bf0 r6:ee6216c0 r5:ee621700
    r4:00000000
    [<c0050b80>] (kthread) from [<c0010710>] (ret_from_fork+0x14/0x24)
    r7:00000000 r6:00000000 r5:c0050b80 r4:ee621700
    ---[ end trace 0000000000000002 ]---

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

    cat /proc/iomem

    50000000-5000037b : /ocp/gpmc@50000000

    Best Regards,

    John

  • Hi John,

    Which physical address are you trying to access with your app?

    Can you try the following from linux console:
    devmem2 0x01000000

    Best Regards,
    Yordan
  • Hi Yordan,

    I try to access phy addr 0x01000000.
    Using This Code

    code. ----------------------------------------------------------------------------------------------------------------------------------------
    const unsigned int mem_address = 0x01000000;
    mem_dev = open("/dev/mem", O_RDWR | O_SYNC);
    virt_addr = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_dev, mem_address);
    .......
    printf("[%03d]0x%02x ",i,*(char *)(virt_addr+i));

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

    But I can see Error Message about Kernel and I can't access that Address 0x01000000.

    Best Regards,
    John