Removable flash storage
Hello all.
I am working with a device that has 3 nand flash slots, two are internal and not removable, one is external and is removable.
We currently have a single driver that registers partitions on each card at kernel boot time. All three cards work, and we use yaffs as a filesystem on top of MTD.
I am trying to come up with a clean way of allowing the external card to be inserted/removed at runtime.
One solution is to have a seperate nand driver for that card & build it as a module, then simply modprobe/rmmod. However, that solution isn't so great because we then have two driver source files that are essentially the same. We also thought that a /proc based solution might work, where you write "eject 3" or something to /proc/mtd.
What will play nicest with MTD as it stands? If I need to break the driver up, is there any suggestions for minimising code duplication?
Cheers
Brad
A message that is not in the archive (sent off-list or not yet received): [email protected]
Looks like I sent a message that didn't hit the list. It is attached below.
More info - having a single partition on my NAND device causes no oops. But multiple (3) partitions on the nand device does cause it to break.
From a quick look in mtdpart.c, it looks like when you add a partition, slave->master is always set to master. Automatically adding/deleting mtd devices looks like it is killing me somehow. Any suggestions on what I should do to tell mtd and nand_release that only one device should be deleted for all 3 partitions?
Cheers
Brad
Quoted 87 lines · Brad Beveridge
Hi again. Further to my previous post, I am finding that when I rmmod my nand module, I get a kernel oops (see below).
When I insmod my driver, basically I do some setup & callnand_scan, then if that returns OK I calladd_mtd_partitions.
On rmmod, I simply callnand_release, then kfree mymtd_infostructure. I've only started looking into this, but I thought I should post the oops output so wiser heads could take a look. Ang suggestions on how to start tracking down this particular oops?Cheers
BradHere is the oops output
kernel BUG at
include/linux/dcache.h:276!Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c5864000 [00000000] *pgd=a5cd1011, *pte=00000000, *ppte=00000000 Internal error: Oops: 807 [#1] Modules linked in: scallop CPU: 0 PC is at __bug+0x40/0x54 LR is at 0x1 pc : [<c0028bec>] lr : [<00000001>] Not taintedsp :
c5e9ddd8ip : 60000093 fp :c5e9dde8
r10:befffe64r9 :c5e9c000r8 :c02a1400
r7 :c01dabc0r6 :c01dab7cr5 :c587b948r4 : 00000000 r3 : 00000000 r2 : 00000000 r1 : 00001596 r0 : 00000001
Flags: nZCv IRQs on FIQs on ModeSVC_32Segment user
Control: 397F Table: A5864000 DAC: 00000015 Process rmmod (pid: 43, stack limit =0xc5e9c190)Stack: (0xc5e9ddd8 to 0xc5e9e000)ddc0:
c5c5dd60c5e9de00
dde0:c5e9ddecc00a1840c0028bb8c5c5dd60c026a380c5e9de14c5e9de04c00d9028
de00:c00a1820c5c5dd60c5e9de28c5e9de18c00d904cc00d9010c5c5dd10c5e9de3c
de20:c5e9de2cc01127fcc00d9044c5c5dd10c5e9de54c5e9de40c0116bdcc01127e8
de40:c026a380c026a380c5e9de68c5e9de58c0117970c0116bb800000000c5e9de80
de60:c5e9de6cc00a0a0cc0117968c031b920c01daba8c5e9de94c5e9de84c012f37c
de80:c00a09acc031b920c5e9dea8c5e9de98c012e9f4c012f2e4c01dabb0c5e9decc
dea0:c5e9deacc012f3f4c012e9ecc01dabe8c02a1400c01daaecc01daadcc021b468
dec0:c5e9def0c5e9ded0c012b62cc012f3acc01daaf4c02a1400c01daaf4c5880c00
dee0: 00000880c5e9df10c5e9def4c012c818c012b5a4c5880c00c5880d68c01cf184
df00:c5e9df48c5e9df28c5e9df14c0132f38c012c7d800000002bf001580c5e9df40
df20:c5e9df2cbf0007b8c0132f2cbf00148000000000c5e9dfa4c5e9df44c004cf20
df40:bf00077c000000006c61637300706f6cc0060fb0c5ee428cc5c6064060000010
df60:c5e9c0004019cbe0c5ee428cc5e9dfacc5e9df7cc0029e88c00dab58c5e9dfac
df80: 000000006c61637300706f6c000741c800000081c00232a400000000c5e9dfa8
dfa0:c0023120c004cd6800706f6c000741c800900081befffe5c00000880 00000000
dfc0:6c61637300706f6c000741c800000002 00000880 00000000befffe64befffe8c
dfe0:befffe5cbefffe500002cf104019cbf060000010 009000810000b9900000b990Backtrace: [<c0028bac>] (__bug+0x0/0x54) from [<c00a1840>] (sysfs_remove_dir+0x2c/0x168)r4 = C5C5DD60
[<c00a1814>] (sysfs_remove_dir+0x0/0x168) from [<c00d9028>] (kobject_del+0x24/0x34) r5 = C026A380 r4 = C5C5DD60
[<c00d9004>] (kobject_del+0x0/0x34) from [<c00d904c>] (kobject_unregister+0x14/0x20) r4 = C5C5DD60
[<c00d9038>] (kobject_unregister+0x0/0x20) from [<c01127fc>] (elv_unregister_queue+0x20/0x30) r4 = C5C5DD10
[<c01127dc>] (elv_unregister_queue+0x0/0x30) from [<c0116bdc>] (blk_unregister_queue+0x30/0x48) r4 = C5C5DD10
[<c0116bac>] (blk_unregister_queue+0x0/0x48) from [<c0117970>] (unlink_gendisk+0x14/0x28) r5 = C026A380 r4 = C026A380
[<c011795c>] (unlink_gendisk+0x0/0x28) from [<c00a0a0c>] (del_gendisk+0x6c/0xc4)
r4 = 00000000
[<c00a09a0>] (del_gendisk+0x0/0xc4) from [<c012f37c>] (del_mtd_blktrans_dev+0xa4/0xc8) r5 = C01DABA8 r4 = C031B920
[<c012f2d8>] (del_mtd_blktrans_dev+0x0/0xc8) from [<c012e9f4>] (mtdblock_remove_dev+0x14/0x20) r4 = C031B920
[<c012e9e0>] (mtdblock_remove_dev+0x0/0x20) from [<c012f3f4>] (blktrans_notify_remove+0x54/0x84) r4 = C01DABB0
[<c012f3a0>] (blktrans_notify_remove+0x0/0x84) from [<c012b62c>] (del_mtd_device+0x94/0xf0) r8 = C021B468 r7 = C01DAADC r6 = C01DAAEC r5 = C02A1400
r4 = C01DABE8
[<c012b598>] (del_mtd_device+0x0/0xf0) from [<c012c818>] (del_mtd_partitions+0x4c/0x70) r8 = 00000880 r7 = C5880C00 r6 = C01DAAF4 r5 = C02A1400
r4 = C01DAAF4
[<c012c7cc>] (del_mtd_partitions+0x0/0x70) from [<c0132f38>] (nand_release+0x18/0x58) r7 = C5E9DF48 r6 = C01CF184 r5 = C5880D68 r4 = C5880C00
[<c0132f20>] (nand_release+0x0/0x58) from [<bf0007b8>] (scallop_cleanup+0x48/0x94[scallop]) r5 = BF001580 r4 = 00000002
[<bf000770>] (scallop_cleanup+0x0/0x94[scallop]) from [<c004cf20>] (sys_delete_module+0x1c4/0x228) r5 = 00000000 r4 = BF001480
[<c004cd5c>] (sys_delete_module+0x0/0x228) from [<c0023120>] (ret_fast_syscall+0x0/0x2c) r8 = C00232A4 r7 = 00000081 r6 = 000741C8 r5 = 00706F6C
r4 = 6C616373Code: 1b003adb e59f0014 eb003ad9 e3a03000 (e5833000)Segmentation fault
<--- end of oops -->
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre
Brad Beveridge Bluewater Systems Ltd
Phone: +64 3 3779127 (Aus +1 800 148 751) Level 17, 119 Armagh St
Fax: +64 3 3779135 PO Box 13889
Email: [email protected] Christchurch
Web: http://www.bluewatersys.com New Zealand