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.

AM5749: GPMC setting for connect FPGA is not correct on AM5749 custom board.

Part Number: AM5749

Hi Dears.

I have a problem to setting the GPMC using dts file descriptions.

I'm using SDK-linux-am57xx-evm-08_02_01_00 and SD-card booting.

I modify dra7.dtsi and am574x-idk.dts files as like below.

===== dra7.dtsi =====

/* OCP2SCP1 */
/* IRQ for DWC3_3 and DWC3_4 need IRQ crossbar */
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 = "okay";            // <== here changed
};

====== am574x-idk.dts ======

&gpmc {
status = "okay";
//reg = <0 0x50000000 0 0x37c>; // 64-bits device IO registers
//compatible = "ti,am5532-gpmc";
//ti,hwmod = "gpmc";
ti,no-idle-on-init;
pinctrl-names = "default";
pinctrl-0 = <&adrs_gpmc_default>;
//interrupt-controller;
//gpio-controller;

#address-cell = <2>;
#size-cell = <1>;
ranges = <0 0 0x01000000 0x01000000>; // minimum GPMC partition = 64MB
//3 0 0x20000000 0x10000000>; // minimum GPMC partition = 64MB

fpgacs0@0,0 {
//status = "okay";
reg = <0 0x01000000 0x04000000>;

bank-width = <2>;
//interrupt-parent = <gpmc>;
//interrupts = <0 0>;

gpmc,sync-read;
gpmc,sync-write;
gpmc,device-width = <2>; // 16bits
gpmc,mux-add-data = <1>; // 1:AAD, 2:AD
gpmc,burst-length = <16>; // 16words

.....

};

};

&dra7_pmx_core {
idk_led_rgb0b_default:idk_led_rgb0b_default {
pinctrl-single,pins = <
DRA7XX_CORE_IOPAD(0x3714, PIN_OUTPUT | MUX_MODE14) // gpio1_4
>;
};

adrs_gpmc_default:adrs_gpmc_default {
pinctrl-single,pins = <
DRA7XX_CORE_IOPAD(0x3400, PIN_INPUT | MUX_MODE0) // gpmc_ad0
DRA7XX_CORE_IOPAD(0x3404, PIN_INPUT | MUX_MODE0) // gpmc_ad1
DRA7XX_CORE_IOPAD(0x3408, PIN_INPUT | MUX_MODE0) // gpmc_ad2
DRA7XX_CORE_IOPAD(0x340c, PIN_INPUT | MUX_MODE0) // gpmc_ad3
DRA7XX_CORE_IOPAD(0x3410, PIN_INPUT | MUX_MODE0) // gpmc_ad4

...

};

};

After modify, I compile using "make linux-dtbs" commands and compiled successfully.

I copy the file am574x-idk.dtb to SD-card (/media/someone/rootfs/boot) using sudo permission, and file time changed newly.

But Booting message for gpmc is looks not working

====== booting message ======

[ 5.586914] Registering SWP/SWPB emulation handler
[ 5.592041] omap_voltage_late_init: Voltage driver support not added
[ 5.598419] Power Management for TI OMAP4+ devices.
[ 5.603637] Loading compiled-in X.509 certificates
[ 5.628051] dmm 4e000000.dmm: workaround for errata i878 in use
[ 5.635375] dmm 4e000000.dmm: initialized all PAT entries
[ 5.642059] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
[ 5.649505] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[ 5.654663] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[ 5.661071] omap-gpmc 50000000.gpmc: cannot remap GPMC CS 0 to 0x0000000002000000
[ 5.668579] omap-gpmc 50000000.gpmc: failed to probe DT child 'fpgacs0': -22
[ 5.675964] V3_3D: supplied by smps9
[ 5.680053] vtt_fixed: supplied by V3_3D
[ 5.685089] omap-iommu 40d01000.mmu: 40d01000.mmu registered
[ 5.692474] omap-iommu 40d02000.mmu: 40d02000.mmu registered
[ 5.698669] platform 40800000.dsp: Adding to iommu group 0
[ 5.705169] omap-iommu 58882000.mmu: 58882000.mmu registered

After booting, the command "cat /proc/iomem" printout like below.

====================

root@am57xx-evm:~# cat /proc/iomem
40300000-4037ffff : 40300000.ocmcram ocmcram@40300000
40d01000-40d010ff : 40d01000.mmu mmu@0
40d02000-40d020ff : 40d02000.mmu mmu@0
41501000-415010ff : 41501000.mmu mmu@0
41502000-415020ff : 41502000.mmu mmu@0
43300000-433fffff : 43300000.dma edma3_cc

....

4ae0c154-4ae0c157 : 4ae07de4.regulator-abb-gpu ldo-address
4ae0c158-4ae0c15b : 4ae07ddc.regulator-abb-mpu ldo-address
4ae10000-4ae101ff : 4ae10000.gpio gpio@0
4ae20000-4ae2007f : 4ae20000.timer timer@0
4b300000-4b3000ff : 4b300000.spi qspi_base
50000000-5000037b : 50000000.gpmc gpmc@50000000
55082000-550820ff : 55082000.mmu mmu@0
58000000-5800007f : 58000000.dss dss
58001000-58001fff : 58001000.dispc dispc@0
58004054-58004057 : 58000000.dss pll1_clkctrl
58004300-5800431f : 58000000.dss pll1
58009054-58009057 : 58000000.dss pll2_clkctrl
58009300-5800931f : 58000000.dss pll2
58882000-588820ff : 58882000.mmu mmu@0
80000000-afcfffff : System RAM
80008000-80ffffff : Kernel code
81200000-812fc00f : Kernel data
b0000000-ffffffff : System RAM


root@am57xx-evm:~# devmem2 0x01000000 h

/dev/mem opened.[ 75.796722] ------------[ cut here ]------------
[ 75.802673] WARNING: CPU: 0 PID: 218 at drivers/bus/omap_l3_noc.c:141 l3_interrupt_handler+0x294/0x38c
[ 75.812042] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET GPMC (Read): Data Access in User mode during Functional access
[ 75.823120] Modules linked in: sch_fq_codel cryptodev(O)
[ 75.828491] CPU: 0 PID: 218 Comm: devmem2 Tainted: G O 5.10.100-g7a7a3af903 #1
[ 75.837066] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 75.843200] [<c020eb18>] (unwind_backtrace) from [<c0209f10>] (show_stack+0x10/0x14)

....

Bus error (core dumped)
root@am57xx-evm:~# devmem2 0x50000000 h
/dev/mem opened.
Memory mapped at address 0xb6f4d000.
Read at address 0x50000000 (0xb6f4d000): 0x0060
root@am57xx-evm:~# devmem2 0x50000000 w
/dev/mem opened.
Memory mapped at address 0xb6f2c000.
Read at address 0x50000000 (0xb6f2c000): 0x00000060
root@am57xx-evm:~# devmem2 0x50000300 w
/dev/mem opened.
Memory mapped at address 0xb6f40000.
Read at address 0x50000300 (0xb6f40300): 0x00000000
root@am57xx-evm:~#

=============================================

I want to access gpmc address range (0x00000000 ~ 0x3fff_ffff) using devmem2 command.

I want to solve this problem using dts settings. Is it possible?

Can you give some advices or to know related threads?

  • I changed DTS and kernel:omap-gpmc.c as like below.

    === dts ===


    &gpmc {
    status = "okay";
    ti,no-idle-on-init;
    pinctrl-names = "default";
    pinctrl-0 = <&adrs_gpmc_default>;

    ranges = <0 0 0x00000000 0x10000000>; // minimum GPMC partition = 64MB

    fpgacs0@0 {
    reg = <0 0x00100000 0x01000000>;
    bank-width = <2>;

    ....

    === omap-gpmc.c ===

    static int gpmc_cs_remap(int cs, u32 base)
    {
    int ret;
    u32 old_base, size;

    if (cs >= gpmc_cs_num) {
    pr_err("%s: requested chip-select is disabled\n", __func__);
    return -ENODEV;
    }

    /*
    * Make sure we ignore any device offsets from the GPMC partition
    * allocated for the chip select and that the new base confirms
    * to the GPMC 16MB minimum granularity.
    */
    base &= ~(SZ_16M - 1);

    // 2022.10.24, ckyu
    gpmc_cs_get_memconf(cs, &old_base, &size);
    if (base == old_base)
    {
    pr_err("%s: old_base=0x%08x, base=0x%08x, size=0x%08x\n", __func__, old_base, base, size);
    return 0;
    }

    ret = gpmc_cs_delete_mem(cs);
    if (ret < 0)
    {
    pr_err("%s: rtn-path 1\n", __func__);
    return ret;
    }

    ret = gpmc_cs_insert_mem(cs, base, size);
    if (ret < 0)
    {
    pr_err("%s: rtn-path 2\n", __func__);
    return ret;
    }

    ret = gpmc_cs_set_memconf(cs, base, size);

    return ret;
    }

    After this, compiled kernel and copied am574x-idk.dtb and zImage to /media/someone/rootfs/boot on SD-card.

    Below is related booting message what I think.

    === booting message (related) ===

    [ 5.643524] dmm 4e000000.dmm: initialized all PAT entries
    [ 5.650207] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
    [ 5.657592] omap-gpmc 50000000.gpmc: num_res=2, res_name=gpmc@50000000, start=0x50000000
    [ 5.665740] omap-gpmc 50000000.gpmc: gpmc_base=750d175a
    [ 5.671081] omap-gpmc 50000000.gpmc: GPMC clk_rate = 266000000
    [ 5.676971] omap-gpmc 50000000.gpmc: GPMC revision 6.0
    [ 5.682128] gpmc_cs_get_memconf: cs=0, base=0x00000000, size=0x01000000
    [ 5.688781] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000, cs_num=8
    [ 5.695983] gpmc_cs_request: cs=0, *base=0x01000000, size=0x01000000, rtn=0
    [ 5.703033] gpmc_cs_get_memconf: cs=0, base=0x01000000, size=0x01000000
    [ 5.709686] gpmc_cs_remap: rtn-path 2
    [ 5.713378] omap-gpmc 50000000.gpmc: cannot remap GPMC CS 0 to 0x0000000000100000
    [ 5.720886] omap-gpmc 50000000.gpmc: GPMC CS 0 start cannot be lesser than 0x1000000
    [ 5.728698] omap-gpmc 50000000.gpmc: failed to probe DT child 'fpgacs0': -16
    [ 5.736053] V3_3D: supplied by smps9
    [ 5.740173] vtt_fixed: supplied by V3_3D
    [ 5.745178] omap-iommu 40d01000.mmu: 40d01000.mmu registered
    [ 5.752563] omap-iommu 40d02000.mmu: 40d02000.mmu registered
    [ 5.758789] platform 40800000.dsp: Adding to iommu group 0
    [ 5.765258] omap-iommu 58882000.mmu: 58882000.mmu registered

    At booting time, related GPMC port status changed to some state (low -> high or low).

    But GPMC looks not set properly.

    In DTS, CS_0 "reg = <0 0x00100000 0x01000000>;"  setting seems not adopted in booting message.

    Am I misunderstood something ?

    Thanks.