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.

Creating MTD SPI Flash Partitions

Other Parts Discussed in Thread: OMAPL138, OMAP-L138, DA8XX

I have a custom board running with kernel version 3.3. I am trying to upgrade to the latest version 3.19, but i cannot get the kernel to create the spi flash partitions i have designated. I also noticed that under the MTD suport of menuconfig the option "Direct char device access to MTD devices" has gone away in version 3.19. Has it moved? Is this why the partitions aren't created?

Old Kernel Output:

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.0 (dan@DWAYER-UBUNTU) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #1 PREEMPT Mon Jan 19 11:42:50 CST 2015
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: AMSC NGCC board
Memory policy: ECC disabled, Data cache writeback
BUG: mapping for 0x80000000 at 0xfffe0000 out of vmalloc space
DaVinci da850/amsc-ngcc/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 12192
Kernel command line: mem=48M@0xC1000000 console=ttyS0,115200n8 root=/dev/ram0 rw initrd=0xC1800000,4MB
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 48MB = 48MB total
Memory: 40420k/40420k available, 8732k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc3800000 - 0xff000000 ( 952 MB)
lowmem : 0xc0000000 - 0xc3000000 ( 48 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc03ad000 (3732 kB)
.init : 0xc03ad000 - 0xc03ce000 ( 132 kB)
.data : 0xc03ce000 - 0xc03f4640 ( 154 kB)
.bss : 0xc03f4664 - 0xc040e24c ( 103 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 227.32 BogoMIPS (lpj=1136640)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc12d5f38 - 0xc12d5f74
gpiochip_add: registered GPIOs 0 to 31 on device: DaVinci
gpiochip_add: registered GPIOs 32 to 63 on device: DaVinci
gpiochip_add: registered GPIOs 64 to 95 on device: DaVinci
gpiochip_add: registered GPIOs 96 to 127 on device: DaVinci
gpiochip_add: registered GPIOs 128 to 143 on device: DaVinci
DaVinci: 144 gpio irqs
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timer0_1
musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 4096K
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 86
io scheduler noop registered (default)
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
console [ttyS0] enabled
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
brd: module loaded
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
m25p80 spi1.0: unrecognized id n25q256
m25p80 spi1.0: found n25q256a, expected m25p80
m25p80 spi1.0: n25q256a (32768 Kbytes)
Creating 15 MTD partitions on "m25p80":
0x000000000000-0x000000040000 : "Stage1"
0x000000040000-0x000000140000 : "Stage2"
0x000000140000-0x000000180000 : "NVRAM"
0x000000180000-0x0000001c0000 : "Mfg Dflts"
0x0000001c0000-0x000000200000 : "Params"
0x000000200000-0x000000300000 : "Stage3"
0x000000300000-0x000000500000 : "FPGA"
0x000000500000-0x000000900000 : "TestAppDSP"
0x000000900000-0x000000d00000 : "AppDSP"
0x000000d00000-0x000000d40000 : "TestAppParams"
0x000000d40000-0x000000d80000 : "UBL"
0x000000d80000-0x000000e80000 : "U-boot"
0x000000e80000-0x000001280000 : "UImage"
0x000001280000-0x000001880000 : "LinuxInitFS"
0x000001880000-0x000001c80000 : "LinuxUserFS"
spi_davinci spi_davinci.1: Controller at 0xfef0e000
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 17
console [netcon0] enabled
netconsole: network logging started
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 132K
INIT: version 2.86 booting
Please wait: booting... (plus more after this but just giving a snippet)

New Kernel Output:

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.19.0-rc5-08930-g2d911e3-dirty (dan@DWAYER-UBUNTU) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #22 PREEMPT Thu Mar 5 13:53:36 CST 2015
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
Machine: AMSC NGCC board
Memory policy: Data cache writethrough
DaVinci da850/amsc-ngcc/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 12192
Kernel command line: mem=48M@0xC1000000 console=ttyS0,115200n8 root=/dev/ram0 rw initrd=0xC1800000,4MB
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 38676K/49152K available (3286K kernel code, 219K rwdata, 1016K rodata, 160K init, 1181K bss, 10476K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc3800000 - 0xff000000 ( 952 MB)
lowmem : 0xc0000000 - 0xc3000000 ( 48 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc043be9c (4304 kB)
.init : 0xc043c000 - 0xc0464000 ( 160 kB)
.data : 0xc0464000 - 0xc049ad40 ( 220 kB)
.bss : 0xc049ad40 - 0xc05c228c (1182 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:245
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
Console: colour dummy device 80x30
Calibrating delay loop... 226.09 BogoMIPS (lpj=1130496)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc133c4d8 - 0xc133c530
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
ABOUT TO CALL FIRST SPI FUNCTION using printk
3ABOUT TO CALL FIRST SPI FUNCTION using macro
register board info
num descriptors = 1
THIS IS A NOTICE
THIS IS INFO
End of register board info, registerd 1 infos
ABOUT TO CALL 2ND SPI FUNCTION
edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
edma-dma-engine edma-dma-engine.1: TI EDMA DMA engine driver
Switched to clocksource timer0_1
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 4096K (c0800000 - c0c00000)
futex hash table entries: 256 (order: -1, 3072 bytes)
io scheduler noop registered (default)
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
console [ttyS0] disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25, base_baud = 14250000) is a 16550A
console [ttyS0] enabled
brd: module loaded
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 0x00000012, TX channel: 0x00000013, event queue: 0
spi_davinci spi_davinci.1: Controller at 0xfef0e000
i2c /dev entries driver
TCP: cubic registered
NET: Registered protocol family 17
console [netcon0] enabled
netconsole: network logging started
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Freeing unused kernel memory: 160K (c043c000 - c0464000)
INIT: version 2.86 booting
Please wait: booting...

Thanks for any help,

Dan

  • HI Daniel,
    I'm looking into it and let me update.
  • Hi Titus,

    Is there any update or suggestions regarding this?

    Do you have any idea how when registering the spi device it can be tied to the spi board info that defines the partitions?

    Thanks,

    Dan

  • Hi Daniel,
    Sorry for the delayed response on this.
    I have checked this and found "SPI flash" driver is missing in current linux driver.

    lxr.free-electrons.com/.../m25p80.c

    Please enable "m25p80" driver in linux kernel 3.19 and you able to see the partitions.


    I have a custom board running with kernel version 3.3. I am trying to upgrade to the latest version 3.19, but i cannot get the kernel to create the spi flash partitions i have designated. I also noticed that under the MTD suport of menuconfig the option "Direct char device access to MTD devices" has gone away in version 3.19. Has it moved? Is this why the partitions aren't created?


    Also, in linux 3.19, they have no options for CHAR MTD instead they have added into common in "MTD" option.

    In Linux 3.19 of Makefile:

    # Core functionality.
    obj-$(CONFIG_MTD) += mtd.o
    mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o

    In Linux 3.3

    # Core functionality.
    obj-$(CONFIG_MTD) += mtd.o
    mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o

    # 'Users' - code which presents functionality to userspace.
    obj-$(CONFIG_MTD_CHAR) += mtdchar.o
  • Now I'm able to get partition for SPI flash on OMAPL138 LogicPD EVM.

    make menuconfig ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-
    Device Drivers --->
    <*> Memory Technology Device (MTD) support --->
    Self-contained MTD device drivers --->
    <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

    And use the following driver and rebuild the kernel.

    drivers/mtd/devices/m25p80.c

    git.kernel.org/.../m25p80.c\

    Please let me know if it not solve your problem.

    Log:

    U-Boot >
    U-Boot > boot
    TFTP from server 10.100.1.94; our IP address is 10.100.1.2
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    ####
    done
    Bytes transferred = 2346336 (23cd60 hex)
    ## Booting kernel from Legacy Image at c0700000 ...
    Image Name: Linux-3.19.1
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 2346272 Bytes = 2.2 MB
    Load Address: c0008000
    Entry Point: c0008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    Booting Linux on physical CPU 0x0
    Linux version 3.19.1 (titus@Titus) (gcc version 4.3.3 (GCC) ) #11 PREEMPT Tue Mar 10 12:56:39 IST 2015
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: Data cache writethrough
    DaVinci da850/omap-l138 variant 0x0
    Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
    Kernel command line: mem=32M console=/dev/ttyS2,115200 ip=dhcp nfsroot=10.100.1.94:/usr/local/filesystem_omapl138 root=/dev/nfs rw ro
    otwait
    PID hash table entries: 128 (order: -3, 512 bytes)
    Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
    Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
    Memory: 27556K/32768K available (3302K kernel code, 210K rwdata, 980K rodata, 180K init, 173K bss, 5212K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
    vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    vmalloc : 0xc2800000 - 0xff000000 ( 968 MB)
    lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
    modules : 0xbf000000 - 0xc0000000 ( 16 MB)
    .text : 0xc0008000 - 0xc0436f7c (4284 kB)
    .init : 0xc0437000 - 0xc0464000 ( 180 kB)
    .data : 0xc0464000 - 0xc0498be0 ( 211 kB)
    .bss : 0xc0498be0 - 0xc04c40f8 ( 174 kB)
    SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptible hierarchical RCU implementation.
    NR_IRQS:245
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
    Console: colour dummy device 80x30
    Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    Setting up static identity map for 0xc033fbc8 - 0xc033fc20
    devtmpfs: initialized
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    cpuidle: using governor menu
    da850_evm_init: OMAPL138 LOGICPD EVM INIT ################
    da850_evm_init: ############# spi info registration pass: 0
    edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
    edma-dma-engine edma-dma-engine.1: TI EDMA DMA engine driver
    i2c_davinci i2c_davinci.1: controller timed out
    i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    tps6507x 1-0048: Read from reg 0xd failed
    VDCDC1: failed to enable
    tps6507x 1-0048: failed to register tps6507x-pmic regulator
    tps6507x-pmic: probe of tps6507x-pmic failed with error -110
    i2c_davinci i2c_davinci.1: controller timed out
    i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    pca953x 1-0020: failed reading register
    pca953x: probe of 1-0020 failed with error -110
    i2c_davinci i2c_davinci.1: controller timed out
    i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    pca953x 1-0021: failed reading register
    pca953x: probe of 1-0021 failed with error -110
    Switched to clocksource timer0_1
    NET: Registered protocol family 2
    TCP established hash table entries: 1024 (order: 0, 4096 bytes)
    TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    TCP: Hash tables configured (established 1024 bind 1024)
    TCP: reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    futex hash table entries: 256 (order: -1, 3072 bytes)
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25, base_baud = 9375000) is a 16550A
    serial8250.1: ttyS1 at MMIO 0x1d0c000 (irq = 53, base_baud = 9375000) is a 16550A
    console [ttyS2] disabled
    serial8250.2: ttyS2 at MMIO 0x1d0d000 (irq = 61, base_baud = 9375000) is a 16550A
    console [ttyS2] enabled
    brd: module loaded
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 0x00000012, TX channel: 0x00000013, event queue: 0
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    Read MAC addr from SPI Flash: 00:08:ee:03:87:65
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    libphy: davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device davinci_mdio-0:00, driver unknown
    i2c /dev entries driver
    TCP: cubic registered
    NET: Registered protocol family 17
  • Hi Titus,

    You are correct about the settings in menuconfig, however there is one more that must be enabled to use the m25p80 driver.
    Device Drivers --->
    <*>Memory Technology Device (MTD) Support --->

    Self-contained MTD Device drivers --->
    <*> Support for most SPI Flash chips

    But also you must enable...
    <*>SPI-Nor device support --->


    Thanks for the help!
    -Dan
  • Sounds good.
    Thanks for your update.