Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Linux/AM5716: parallel NOR flash: GPMC memory mapping does not work in Linux (works in U-Boot)

$
0
0

Part Number:AM5716

Tool/software: Linux

I have a custom AM5716-based board with 2 parallel NOR flash chips and trying to make them work in Linux as physical memory mapped MTD devices. It works in U-Boot, and does not work in Linux.

.config: enabled CONFIG_MTD_PHYSMAP, CONFIG_MTD_PHYSMAP_OF

device tree (partial):

#include "dra7.dtsi"

&gpmc {
        status = "okay";
        u-boot,dm-spl;

        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0 0 0x08000000 0x02000000>,   /* CS0: NOR 32M */
                 <1 0 0x0a000000 0x02000000>;   /* CS1: NOR 32M */

        nor@0,0 {
                compatible = "issi,is29gl256", "cfi-flash";
                reg = <0 0x00000000 0x02000000>;

                // Generic bindings
                linux,mtd-name = "issi,is29gl256";
                bank-width = <2>;
.....


 Kernel boot log (with added extra printk):

[    0.426220] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    0.426230] gpmc_mem_init: cs=0
[    0.426239] gpmc_mem_init: cs=0, base=00000000, size=01000000
[    0.426253] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    0.426261] gpmc_mem_init: cs=1
[    0.426268] gpmc_mem_init: cs=2
[    0.426275] gpmc_mem_init: cs=3
[    0.426281] gpmc_mem_init: cs=4
[    0.426288] gpmc_mem_init: cs=5
[    0.426294] gpmc_mem_init: cs=6
[    0.426301] gpmc_mem_init: cs=7
[    0.426307] gpmc_probe: gpmc_mem_init called
[    0.426647] gpmc_probe: gpmc_gpio_init ok
[    0.426910] gpmc_probe: gpmc_setup_irq ok
[    0.426921] gpmc_probe_generic_child
[    0.426950] gpmc_probe_generic_child name=(null) cs=0 res=[mem 0x08000000-0x09ffffff]
[    0.426966] gpmc_cs_set_memconf: cs=0 base=02000000 size=02000000
[    0.426975] gpmc_probe_generic_child gpmc_cs_request ret=0
[    0.427036] gpmc_probe_generic_child gpmc_cs_disable_mem(cs=0) called
[    0.427054] gpmc_cs_set_memconf: cs=0 base=08000000 size=02000000
[    0.427062] gpmc_probe_generic_child gpmc_cs_remap ret=0
[    0.427072] gpmc_probe_generic_child bank-width = 2
[    0.427080] gpmc_probe_generic_child gpmc_cs_program_settings cs=0 ret=0
[    0.427102] gpmc_probe_generic_child gpmc_cs_set_timings cs=0 ret=0
[    0.427109] gpmc_probe_generic_child gpmc_cs_enable_mem called
[    0.427320] gpmc_probe_generic_child
[    0.427346] gpmc_probe_generic_child name=(null) cs=1 res=[mem 0x0a000000-0x0bffffff]
[    0.427361] gpmc_cs_set_memconf: cs=1 base=02000000 size=02000000
[    0.427370] gpmc_probe_generic_child gpmc_cs_request ret=0
[    0.427428] gpmc_probe_generic_child gpmc_cs_disable_mem(cs=1) called
[    0.427445] gpmc_cs_set_memconf: cs=1 base=0a000000 size=02000000
[    0.427452] gpmc_probe_generic_child gpmc_cs_remap ret=0
[    0.427461] gpmc_probe_generic_child bank-width = 2
[    0.427469] gpmc_probe_generic_child gpmc_cs_program_settings cs=1 ret=0
[    0.427491] gpmc_probe_generic_child gpmc_cs_set_timings cs=1 ret=0
[    0.427498] gpmc_probe_generic_child gpmc_cs_enable_mem called
[    0.427696] gpmc_probe: gpmc_probe_dt_children called
[

It looks like CS0 and CS1 are mapped to proper memory ranges, but in reality neither CFI probe works, nor busybox devmem 08000000 returns real data. Seems like memory is not mapped in Linux.

The line 'gpmc_cs_set_memconf: cs=0 base=02000000 size=02000000' seems to be wrong, but there is a comment in the omap-gpmc.c which explains this as normal, since the start address later is remapped to the proper value:

        /*
         * FIXME: gpmc_cs_request() will map the CS to an arbitary
         * location in the gpmc address space. When booting with
         * device-tree we want the NOR flash to be mapped to the
         * location specified in the device-tree blob. So remap the
         * CS to this location. Once DT migration is complete should
         * just make gpmc_cs_request() map a specific address.
         */
 

The problem is that AM57xx IDK kits do not have parallel NOR flash, so no known good config is available. From the other side, this mapping works in U-boot. I verified this with both md, cp commands and also stopping U-Boot in Code Composer Studio and checking flash from memory browser. Even CFI flash probe works from CCS (by writing 0x0098 to address 080000AA and reading CFI tables from corresponding addresses). So I definitely sure that the hardware works.

What else could be wrong with this Linux setup? The device tree is custom-made, it includes dra7.dtsi, and then enables gpmc as shown above.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>