Re: [PATCH] Do not oops when configured flash size is less then chip size

Leon Woestenberg
2006-05-13T13:23:18Z

Hello David W, David V et al,

On 5/13/06, David Woodhouse <dwmw2@infradead.org> wrote:
> On Thu, 2006-05-11 at 16:52 +0100, David Vrabel wrote:
> > It might be better to pretend such configuration is a single chip
> > that's smaller than it physically is.
> Yes, I agree.
> You also need to reduce mtd->size after you've done the probe.
> Please could you test this for me?
>
I cannot perform tests from userspace yet on the flash devices, but I
have tested two kernel boots (one with the size set too small, one
with the correct size).

The right code paths seem to be taken, and it solves the issue. See
the 'too small' boot (that oopsed earlier) below.

I had to change the last formatter in printk from %d to %lu to prevent
a compiler warning:

drivers/mtd/chips/gen_probe.c:43: warning: format '%d' expects type
'int', but argument 3 has type 'long unsigned int'

Thanks and with the best regards,

Leon.

p.s. I hope this kernel log comes through with proper newlines.

Linux version 2.6.17-rc3 (leon@dhcppc7) (gcc version 4.0.1) #63 Sat
May 13 15:09:10 CEST 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: Glomation GESBC-9312-sx
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: console=ttyAM0,57600,8n1 initrd=10M@0x300000 root=/dev/ram0
PID hash table entries: 512 (order: 9, 2048 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 32MB 32MB = 64MB total
Memory: 62408KB available (1932K code, 429K data, 92K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
physmap_configure()
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
io scheduler noop registered
io scheduler cfq registered (default)
ep93xx_wdt: EP93XX watchdog, driver version 0.3 (nCS1 disable detected)
Serial: AMBA driver $Revision: 1.41 $
apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52) is a AMBA
apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54) is a AMBA
uart-pl010: probe of apb:uart3 failed with error -16
RAMDISK driver initialized: 16 RAM disks of 10240K size 1024 blocksize
ep93xx_eth: version 2.8 2005-11-08 Cirrus Logic
ep93xx_eth: #0 at 0xfef10000 IRQ:39
ep93xx_eth: using random number 00:d0:69:40:2b:13 as MAC, don't forget
to assign a valid MAC later!
physmap flash device: physmap_map.size 0x800000 at physmap_map.phys 0x60000000
physmap flash device: CONFIG_MTD_PHYSMAP_LEN:0x800000 at
CONFIG_MTD_PHYSMAP_START:0x60000000
cfi_probe_chip
Number of erase regions: 1
Primary Vendor Command Set: 0001 (Intel/Sharp Extended)
Primary Algorithm Table at 0031
Alternative Vendor Command Set: 0000 (None)
No Alternate Algorithm Table
Vcc Minimum: 2.7 V
Vcc Maximum: 3.6 V
No Vpp line
Typical byte/word write timeout: 256 �s
Maximum byte/word write timeout: 1024 �s
Typical full buffer write timeout: 256 �s
Maximum full buffer write timeout: 1024 �s
Typical block erase timeout: 2048 ms
Maximum block erase timeout: 16384 ms
Chip erase not supported
Device size: 0x1000000 bytes (16 MiB)
Flash Device Interface description: 0x0002
- supports x8 and x16 via BYTE# with asynchronous interface
Max. bytes in buffer write: 0x20
Number of Erase Block Regions: 1
Erase Region #0: BlockSize 0x20000 bytes, 128 blocks
phys_mapped_flash: Found 2 x16 devices at 0x0 in 32-bit bank!!

NOR chip too large to fit in mapping. Attempting to cope... <<<<

Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled

Reducing visibility of 32768KiB chip to 8192KiB <<<<

cmdlinepart partition parsing not available
Searching for RedBoot partition table in phys_mapped_flash at offset 0x7c0000
No RedBoot partition table detected in phys_mapped_flash
mtd: Giving out device 0 to phys_mapped_flash
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2 (2004/08/27)
usbcore: registered new driver rtl8150
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
usbcore: registered new driver pl2303
drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
ep93xx-rtc ep93xx-rtc: rtc intf: sysfs
ep93xx-rtc ep93xx-rtc: rtc intf: proc
ep93xx-rtc ep93xx-rtc: rtc intf: dev (254:0)
ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx as rtc0
i2c /dev entries driver
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 3, 32768 bytes)
TCP bind hash table entries: 1024 (order: 2, 20480 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
ep93xx-rtc ep93xx-rtc: setting the system clock to 1970-01-01 00:00:38 (38)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

--
Leon