Forum Discussion
Altera_Forum
Honored Contributor
16 years ago --- Quote Start --- You will need to define your mtd parts and flash bus width in config.c. --- Quote End --- You are talking about this section for the bus width, right?
static struct physmap_flash_data nios2_flash_data = {# if defined(CONFIG_ALTERA_NEEK_C3) || defined(CONFIG_ALTERA_CYCLONE_III)
.width = 2, /* 16 bits data bus */# else
.width = 1, /* 8 bits data bus */# endif
.parts = nios2_partitions,
.nr_parts = ARRAY_SIZE(nios2_partitions),
};
And this variable for the MTD parts?
static struct mtd_partition nios2_partitions = {
....
}
I have a 16 bit wide flash. I am sure I am compiling with ".width = 2" because I dumped a "#warning" macro in the correct code, and an "#error" macro in the alternative. Despite this, the CFI detection finds 2 x8 devices, instead of 1 x16 device. It correctly recognizes that it is a 16MB device, but thinks there are two of them. As a result, it thinks there are 32 MB of flash. The flash drivers then generate a lot of errors (I assume resulting from the incorrect detection of flash). I inserted a "printk" into physmap.c:physmap_flash_probe(), to print the value of physmap_data->width. It outputs "Physmap Width: 2". I've included the boot log below. I truncated the flash errors, because they seemed endless.
Linux version 2.6.30-00494-g84a224b-dirty (pinta@drake-linux) (gcc version 4.1.2)# 40 Mon Oct 5 18:05:24 EDT 2009
console enabled
Early printk initialized
Linux/Nios II-MMU
init_bootmem_node(?,0x62bd, 0x6000, 0x8000)
free_bootmem(0x62bd000, 0x1d43000)
reserve_bootmem(0x62bd000, 0x400)
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
Kernel command line: noinitrd rw root=/dev/mtdblock2 rootfstype=jffs2
NR_IRQS:32
PID hash table entries: 128 (order: 7, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
We have 32768 pages of RAM
Memory available: 29672k/2800k RAM, 0k/0k ROM (2119k kernel code, 680k data)
Calibrating delay loop... 41.98 BogoMIPS (lpj=209920)
Mount-cache hash table entries: 512
net_namespace: 492 bytes
NET: Registered protocol family 16
init_BSP(): registering device resources
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
JFFS2: default compression mode: priority
msgmni has been set to 57
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
ttyJ0 at MMIO 0x21208b0 (irq = 1) is a Altera JTAG UART
ttyS0 at MMIO 0x2120840 (irq = 4) is a Altera UART
console handover: boot -> real
ttyS1 at MMIO 0x2120b00 (irq = 8) is a Altera UART
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@cam.org>
eth0: SMC91C11xFD (rev 2) at e2110300 IRQ 6
eth0: Ethernet addr: 00:07:ed:0f:0a:53
physmap platform flash device: 01000000 at 00000000
Physmap Width: 2
physmap-flash.0: Found 2 x8 devices at 0x0 in 16-bit bank in cfi_chip_setup
NOR chip too large to fit in mapping. Attempting to cope...
Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Reducing visibility of 32768KiB chip to 16384KiB
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x000000000000-0x000000060000 : "U-Boot"
0x000000060000-0x000000200000 : "uImage"
0x000000200000-0x000001000000 : "romfs/jffs2"
TCP cubic registered
NET: Registered protocol family 10
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
/home/pinta/projects/micropump/nios_linux/nios2-linux/linux-2.6/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link down
ADDRCONF(NETDEV_UP): eth0: link is not ready
IP-Config: Unable to set interface netmask (-22).
Empty flash at 0x0000fffc ends at 0x00010000
CLEANMARKER node found at 0x00010000, not first node in block (0x00000000)
Empty flash at 0x0002fffc ends at 0x00030000
CLEANMARKER node found at 0x00030000, not first node in block (0x00020000)
Empty flash at 0x0004fffc ends at 0x00050000
CLEANMARKER node found at 0x00050000, not first node in block (0x00040000)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
Empty flash at 0x0006fffc ends at 0x00070000
CLEANMARKER node found at 0x00070000, not first node in block (0x00060000)
Empty flash at 0x0008fffc ends at 0x00090000
CLEANMARKER node found at 0x00090000, not first node in block (0x00080000)
Empty flash at 0x000afffc ends at 0x000b0000
CLEANMARKER node found at 0x000b0000, not first node in block (0x000a0000)
Empty flash at 0x000cffe8 ends at 0x000d0000
CLEANMARKER node found at 0x000d0000, not first node in block (0x000c0000)
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120000: 0x55ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00440000: 0x55ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00760000: 0x55ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00010: 0xd76a instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00014: 0x5000 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00018: 0x6a00 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a0001c: 0x0040 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00020: 0x0068 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00024: 0x40ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00028: 0x6880 instead
Empty flash at 0x00a0002c ends at 0x00a0004c
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a0004c: 0x0400 instead