I've been having some trouble recently when trying to mount a SPI flash chip with the command:
mount -t ext2 -r /dev/mtdblock4 /mnt/spi
Resulting in the error:
mount: mounting /dev/mtdblock4 on /mnt/spi failed: Invalid argument
Running embedded Linux on an OMAP L138.
We've recently upgraded our SPI NOR flash chips for a few prototype boards. Until recently we were using Winbond W25Q128 chips and moved to Micron N25Q256 chips due to space requirements, obsolescence, etc. I've already gone through UBoot and the Linux kernel, adding an array entry for the N25Q256 chip with size, ID, etc. filled out. Below is the startup printout which leads me to believe the chip is seen and setup correctly in /dev, leading me to believe I'm missing something more subtle.
NAND: 256 MiB Searching table entry 0: shift=0 idcode=ef Searching table entry 1: shift=0 idcode=20 Found a match, creating flash WINBOND: Searching flash table[0] Table ID: 3013 ?= Setup ID: ba19 WINBOND: Searching flash table[1] Table ID: 3015 ?= Setup ID: ba19 WINBOND: Searching flash table[2] Table ID: 3016 ?= Setup ID: ba19 WINBOND: Searching flash table[3] Table ID: 3017 ?= Setup ID: ba19 WINBOND: Searching flash table[4] Table ID: 4015 ?= Setup ID: ba19 WINBOND: Searching flash table[5] Table ID: 4016 ?= Setup ID: ba19 WINBOND: Searching flash table[6] Table ID: 4017 ?= Setup ID: ba19 WINBOND: Searching flash table[7] Table ID: 4018 ?= Setup ID: ba19 WINBOND: Searching flash table[8] Table ID: ba19 ?= Setup ID: ba19 SF: Detected N25Q256 with page size 4 KiB, total 32 MiB In: serial Out: serial Err: serial Net: DaVinci-EMAC Entering print_cpuinfo()... PLL0_SYSCLK1: 900 MHz (DSP, fixed /1 clock ratio) PLL0_SYSCLK2: 450 MHz (SPI, fixed /2 clock ratio) PLL0_SYSCLK3: 180 MHz (EMIFA) PLL0_SYSCLK4: 225 MHz (EMAC/MDIO, fixed /4 clock ratio) PLL0_SYSCLK5: 300 MHz (Not used) PLL0_SYSCLK6: 900 MHz (ARM, fixed /1 clock ratio) PLL0_SYSCLK7: 100 MHz (EMAC RMII clock) PLL1_SYSCLK1: 600 MHz (DDR) PLL1_SYSCLK2: 300 MHz (Not used) PLL1_SYSCLK3: 200 MHz (Not used) SDCR : 0x00174622 SDRCR : 0x00000492 SDTIMR1 : 0x1E922A09 SDTIMR2 : 0x4411C722 DRPYC1R : 0x00000083 VTPIO_CTL: 0x0018E1B7 DDR_SLEW : 0x00000000 PSC0 Enabled Modules: 03 06 07 08 10 11 12 14 15 PSC1 Enabled Modules: 01 02 03 05 06 10 13 16 24 25 26 27 28 29 30 31 PINMUX00: 0x88288888 PINMUX01: 0x88888888 PINMUX02: 0x88888888 PINMUX03: 0x88888888 PINMUX04: 0x22228888 PINMUX05: 0x81118111 PINMUX06: 0x81888888 PINMUX07: 0x18111118 PINMUX08: 0x11111111 PINMUX09: 0x11111111 PINMUX10: 0x88888888 PINMUX11: 0x11111188 PINMUX12: 0x11111111 PINMUX13: 0x44448888 PINMUX14: 0x44444488 PINMUX15: 0x44444444 PINMUX16: 0x44444444 PINMUX17: 0x44444444 PINMUX18: 0x88444444 PINMUX19: 0x18888888 CFGCHIP0: 0x00000110 CFGCHIP1: 0x00000000 CFGCHIP2: 0x0000EF00 CFGCHIP3: 0x0000FE20 Exiting print_cpuinfo()... Hit any key to stop autoboot: 0 Searching table entry 0: shift=0 idcode=ef Searching table entry 1: shift=0 idcode=20 Found a match, creating flash WINBOND: Searching flash table[0] Table ID: 3013 ?= Setup ID: ba19 WINBOND: Searching flash table[1] Table ID: 3015 ?= Setup ID: ba19 WINBOND: Searching flash table[2] Table ID: 3016 ?= Setup ID: ba19 WINBOND: Searching flash table[3] Table ID: 3017 ?= Setup ID: ba19 WINBOND: Searching flash table[4] Table ID: 4015 ?= Setup ID: ba19 WINBOND: Searching flash table[5] Table ID: 4016 ?= Setup ID: ba19 WINBOND: Searching flash table[6] Table ID: 4017 ?= Setup ID: ba19 WINBOND: Searching flash table[7] Table ID: 4018 ?= Setup ID: ba19 WINBOND: Searching flash table[8] Table ID: ba19 ?= Setup ID: ba19 SF: Detected N25Q256 with page size 4 KiB, total 32 MiB ## Booting kernel from Legacy Image at c3000000 ... Image Name: Linux-3.3.0 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4132848 Bytes = 3.9 MiB Load Address: c0008000 Entry Point: c0008000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 CPU: VIVT data cache, VIVT instruction cache Machine: DaVinci DA850/OMAP-L138/AM18x EVM Memory policy: ECC disabled, Data cache writeback BUG: mapping for 0x80000000 at 0xfffe0000 out of vmalloc space Built 1 zonelists in Zone order, mobility grouping on. Total pages: 12192 Detecting Board Type Board: QD Controller (0) Registering SPI Flash soc-audio soc-audio.0: ASoC: Failed to create card debugfs directory drivers/rtc/hctosys.c: unable to open rtc device (rtc0) Executing /etc/init.d/rcS... mount: mounting /dev/mtdblock4 on /mnt/spi failed: Invalid argument cp: can't stat '/mnt/spi/startup.ash': No such file or directory /etc/init.d/rcS: line 28: /etc/startup.ash: not found
And next is the dmesg output:
~ # dmesg Booting Linux on physical CPU 0 Linux version 3.3.0 (kelliott@BuilderBox) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #2 PREEMPT Wed Jun 11 13:40:11 EDT 2014 CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 CPU: VIVT data cache, VIVT instruction cache Machine: DaVinci DA850/OMAP-L138/AM18x EVM Memory policy: ECC disabled, Data cache writeback BUG: mapping for 0x80000000 at 0xfffe0000 out of vmalloc space DaVinci da850/omap-l138/am18x variant 0x1 On node 0 totalpages: 12288 free_area_init_node: node 0, pgdat c086d67c, node_mem_map c088a000 DMA zone: 96 pages used for memmap DMA zone: 0 pages reserved DMA zone: 12192 pages, LIFO batch:1 pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 pcpu-alloc: [0] 0 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 12192 Kernel command line: mem=48M@0xc0000000 console=ttyS2,115200n8 rw noinitrd loglevel=5 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: 39928k/39928k available, 9224k 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 - 0xc04a2000 (4712 kB) .init : 0xc04a2000 - 0xc0833000 (3652 kB) .data : 0xc0834000 - 0xc086e100 ( 233 kB) .bss : 0xc086e124 - 0xc0889c2c ( 111 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... 449.74 BogoMIPS (lpj=2248704) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok Setting up static identity map for 0xc03847d8 - 0xc0384814 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 print_constraints: dummy: NET: Registered protocol family 16 Detecting Board Type Board: QD Controller (0) Registering SPI Flash bio: create slab <bio-0> at 0 SCSI subsystem initialized libata version 3.00 loaded. usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb Advanced Linux Sound Architecture Driver Version 1.0.24. 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. EMAC: MII PHY configured, RMII PHY will not be functional JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. msgmni has been set to 77 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 serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7 serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7 console [ttyS2] enabled 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: n25q256 (32768 Kbytes) Creating 7 MTD partitions on "m25p80": 0x000000000000-0x000000080000 : "UBL" 0x000000080000-0x0000000ff000 : "U-Boot" 0x0000000ff000-0x000000100000 : "U-Boot Environment" 0x000000100000-0x000000500000 : "Kernel" 0x000000500000-0x000001fff000 : "Filesystem" 0x000000000000-0x000001fff000 : "Entire SPI Flash" 0x000001fff000-0x000002000000 : "Flash Variables" Using default MAC address: 00:11:89:00:00:00 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 fffffffc davinci_mdio.0: probed davinci_mdio davinci_mdio.0: phy[0]: device davinci_mdio-0:00, driver Micrel KS8041 davinci_mdio davinci_mdio.0: phy[1]: device davinci_mdio-0:01, driver Micrel KS8041 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 lirc_dev: IR Remote Control driver registered, major 253 IR NEC protocol handler initialized IR RC5(x) protocol handler initialized IR RC6 protocol handler initialized IR JVC protocol handler initialized IR Sony protocol handler initialized IR RC5 (streamzap) protocol handler initialized IR SANYO protocol handler initialized IR MCE Keyboard/mouse protocol handler initialized IR LIRC bridge handler initialized Linux video capture interface: v2.00 usbcore: registered new interface driver uvcvideo USB Video Class driver (1.1.1) watchdog watchdog: heartbeat 60 sec usbcore: registered new interface driver usbhid usbhid: USB HID core driver usbcore: registered new interface driver snd-usb-audio soc-audio soc-audio.0: ASoC: Failed to create card debugfs directory ALSA device list: No soundcards found. 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) Freeing init memory: 3652K
I was wondering if anyone else has had any luck using these newer Micron SPI chips and what they did to get them to work, or if there are any recommended tips on to how to debug this problem.
If there's any additional information that I can provide that would give a clearer understanding of the problem I'm having, just let me know.
Thanks in advance!