* MPC 8349e-mITX and MTD/Flash
@ 2007-04-09 20:58 Benedict, Michael
[not found] ` <572211.38645.qm@web306.biz.mail.mud.yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Benedict, Michael @ 2007-04-09 20:58 UTC (permalink / raw)
To: linuxppc-embedded
Hello,
Quite simply, I am trying to access the attached flash devices
for this platform from linux. I tried to select all the appropriate MTD
settings that I thought could apply. However, nothing shows up in
/proc/mtd. Can someone point me in the right direction for accessing
these? =09
>From the documentation: "The two Flash memory banks are MX29LV640MTTC-90
top boot Flash memory devices"
Thank you!
Michael
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <572211.38645.qm@web306.biz.mail.mud.yahoo.com>]
* RE: MPC 8349e-mITX and MTD/Flash [not found] ` <572211.38645.qm@web306.biz.mail.mud.yahoo.com> @ 2007-04-10 14:06 ` Benedict, Michael 2007-04-10 14:13 ` Sergei Shtylyov ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Benedict, Michael @ 2007-04-10 14:06 UTC (permalink / raw) To: Ben Warren; +Cc: linuxppc-embedded Ben, I assume that you intended to CC the list but accidently hit "reply" instead. If not, I apologize. Thank you for all your help so far. >-----Original Message----- >From: Ben Warren [mailto:bwarren@qstreams.com]=20 >Sent: Monday, April 09, 2007 4:30 PM >To: Benedict, Michael >Subject: Re: MPC 8349e-mITX and MTD/Flash > >I suspect that MTD doesn't know anything about how >your flash chip is organized. Probably the easiest >thing to use is CONFIG_MTD_PHYSMAP. Using this, you >can either pass the MTD partitioning info via kernel >command line, via static physmap structures in your >board code or, I believe, via device tree (I haven't >tried the last one). The following is from my .config <snip> # # Mapping drivers for chip access # # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_PHYSMAP=3Dy CONFIG_MTD_PHYSMAP_START=3D0x8000000 CONFIG_MTD_PHYSMAP_LEN=3D0x0 CONFIG_MTD_PHYSMAP_BANKWIDTH=3D2 # CONFIG_MTD_PHYSMAP_OF is not set CONFIG_MTD_PLATRAM=3Dy <snip> Is this what you are referring to? Does something look obviously wrong with it? I have taken that configuration from Freescale's reference .config that came with the platform. I am using the latest kernel.org flat device tree for my platform, but the flash is not configured there. After reading a little more, I suppose I am not expecting any partitions, but I would still think I should be able to `mtd_debug info` the block and char devices. When I try, I get "No such device or address" errors. Also, I would still expect something in my /proc/mtd, correct? Any ideas are greatly appreciated. Thank you again, Michael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: MPC 8349e-mITX and MTD/Flash 2007-04-10 14:06 ` Benedict, Michael @ 2007-04-10 14:13 ` Sergei Shtylyov 2007-04-10 14:41 ` Ben Warren 2007-04-10 15:48 ` Timur Tabi 2 siblings, 0 replies; 9+ messages in thread From: Sergei Shtylyov @ 2007-04-10 14:13 UTC (permalink / raw) To: Benedict, Michael; +Cc: linuxppc-embedded Hello. Benedict, Michael wrote: > Ben, > I assume that you intended to CC the list but accidently hit > "reply" instead. If not, I apologize. Thank you for all your help so > far. >>-----Original Message----- >>From: Ben Warren [mailto:bwarren@qstreams.com] >>Sent: Monday, April 09, 2007 4:30 PM >>To: Benedict, Michael >>Subject: Re: MPC 8349e-mITX and MTD/Flash >>I suspect that MTD doesn't know anything about how >>your flash chip is organized. Probably the easiest >>thing to use is CONFIG_MTD_PHYSMAP. Using this, you >>can either pass the MTD partitioning info via kernel >>command line, via static physmap structures in your >>board code or, I believe, via device tree (I haven't >>tried the last one). > The following is from my .config > <snip> > # > # Mapping drivers for chip access > # > # CONFIG_MTD_COMPLEX_MAPPINGS is not set > CONFIG_MTD_PHYSMAP=y > CONFIG_MTD_PHYSMAP_START=0x8000000 > CONFIG_MTD_PHYSMAP_LEN=0x0 > CONFIG_MTD_PHYSMAP_BANKWIDTH=2 > # CONFIG_MTD_PHYSMAP_OF is not set > CONFIG_MTD_PLATRAM=y > <snip> > > Is this what you are referring to? Does something look obviously wrong > with it? Yeah, CONFIG_MTD_PHYSMAP_LEN shoudn't be 0 unless you're registering your MTD via the platform device mechanism (and in that case specifying CONFIG_MTD_PHYSMAP_START and CONFIG_MTD_PHYSMAP_BANKWIDTH doesn't make sense). WBR, Sergei ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: MPC 8349e-mITX and MTD/Flash 2007-04-10 14:06 ` Benedict, Michael 2007-04-10 14:13 ` Sergei Shtylyov @ 2007-04-10 14:41 ` Ben Warren 2007-04-10 15:48 ` Timur Tabi 2 siblings, 0 replies; 9+ messages in thread From: Ben Warren @ 2007-04-10 14:41 UTC (permalink / raw) To: Benedict, Michael; +Cc: linuxppc-embedded On Tue, 2007-04-10 at 09:06 -0500, Benedict, Michael wrote: > Ben, > I assume that you intended to CC the list but accidently hit > "reply" instead. If not, I apologize. Thank you for all your help so > far. > You guessed right. Sorry about that. Thanks for bringing it back in! > >-----Original Message----- > >From: Ben Warren [mailto:bwarren@qstreams.com] > >Sent: Monday, April 09, 2007 4:30 PM > >To: Benedict, Michael > >Subject: Re: MPC 8349e-mITX and MTD/Flash > > > >I suspect that MTD doesn't know anything about how > >your flash chip is organized. Probably the easiest > >thing to use is CONFIG_MTD_PHYSMAP. Using this, you > >can either pass the MTD partitioning info via kernel > >command line, via static physmap structures in your > >board code or, I believe, via device tree (I haven't > >tried the last one). > > The following is from my .config > <snip> > # > # Mapping drivers for chip access > # > # CONFIG_MTD_COMPLEX_MAPPINGS is not set > CONFIG_MTD_PHYSMAP=y > CONFIG_MTD_PHYSMAP_START=0x8000000 > CONFIG_MTD_PHYSMAP_LEN=0x0 > CONFIG_MTD_PHYSMAP_BANKWIDTH=2 > # CONFIG_MTD_PHYSMAP_OF is not set > CONFIG_MTD_PLATRAM=y > <snip> > > Is this what you are referring to? Does something look obviously wrong > with it? I have taken that configuration from Freescale's reference > .config that came with the platform. I am using the latest kernel.org > flat device tree for my platform, but the flash is not configured there. > This is mostly right, but it only defines the physical mapping of the NOR device, not how it is partitioned. The PHYSMAP_LEN shouldn't be zero, though. In my case, I have: CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_START=0xfe000000 CONFIG_MTD_PHYSMAP_LEN=0x800000 CONFIG_MTD_PHYSMAP_BANKWIDTH=2 This indicates that the flash chip is mapped to address 0xfe000000, is 0x800000 bytes (8MB) and is two bytes wide (16 bits). > After reading a little more, I suppose I am not expecting any > partitions, but I would still think I should be able to `mtd_debug info` > the block and char devices. When I try, I get "No such device or > address" errors. Also, I would still expect something in my /proc/mtd, > correct? Any ideas are greatly appreciated. I don't know for sure, but setting the LEN field properly might make it show up in /proc/mtd. Here's some simple code you might find useful as a starting point for statically defining the partitions in your board code. It will allow you to access /dev/mtdx and /dev/mtdblockx. I don't know if this is the 'right' way, but it works: #ifdef CONFIG_MTD_PHYSMAP static int __init board_setup_mtd(void) { int ptbl_entries; static struct mtd_partition *ptbl; ptbl_entries = 2; if ((ptbl = kcalloc(ptbl_entries, sizeof(struct mtd_partition), GFP_KERNEL)) == NULL) { printk(KERN_WARNING "Can't alloc MTD partition table\n"); return -ENOMEM; } ptbl[0].name = "part-1"; ptbl[0].size = 0x40000; /* 256 k */ ptbl[1].name = "part-2"; ptbl[1].offset = 0x40000; ptbl[1].size = 0x7c0000; /* rest of 8MB */ physmap_set_partitions(ptbl, ptbl_entries); return 0; } arch_initcall(board_setup_mtd); #endif ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: MPC 8349e-mITX and MTD/Flash 2007-04-10 14:06 ` Benedict, Michael 2007-04-10 14:13 ` Sergei Shtylyov 2007-04-10 14:41 ` Ben Warren @ 2007-04-10 15:48 ` Timur Tabi 2007-04-10 16:22 ` Benedict, Michael 2007-04-10 16:31 ` Vitaly Bordug 2 siblings, 2 replies; 9+ messages in thread From: Timur Tabi @ 2007-04-10 15:48 UTC (permalink / raw) To: Benedict, Michael; +Cc: linuxppc-embedded Benedict, Michael wrote: > # CONFIG_MTD_COMPLEX_MAPPINGS is not set > CONFIG_MTD_PHYSMAP=y > CONFIG_MTD_PHYSMAP_START=0x8000000 > CONFIG_MTD_PHYSMAP_LEN=0x0 > CONFIG_MTD_PHYSMAP_BANKWIDTH=2 > # CONFIG_MTD_PHYSMAP_OF is not set > CONFIG_MTD_PLATRAM=y This what the latest defconfig for the 8349ITX has: CONFIG_MTD=y CONFIG_MTD_CHAR=y CONFIG_MTD_CFI=y CONFIG_MTD_GEN_PROBE=y CONFIG_MTD_MAP_BANK_WIDTH_1=y CONFIG_MTD_MAP_BANK_WIDTH_2=y CONFIG_MTD_MAP_BANK_WIDTH_4=y CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I2=y CONFIG_MTD_CFI_AMDSTD=y CONFIG_MTD_CFI_UTIL=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_START=0xfe000000 CONFIG_MTD_PHYSMAP_LEN=0x1000000 CONFIG_MTD_PHYSMAP_BANKWIDTH=2 Your settings for CONFIG_MTD_PHYSMAP_START and CONFIG_MTD_PHYSMAP_LEN are wrong. And frankly, I can't understand where you got those values from, unless you created your .config from scratch. The defconfig that's in the kernel is specifically intended for the Freescale MPC8349E-mITX. I should know, because I wrote the code and the defconfig. Having said that, it seems that the kernel now supports defining the physmap via the OF tree. Is that true? -- Timur Tabi Linux Kernel Developer @ Freescale ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: MPC 8349e-mITX and MTD/Flash 2007-04-10 15:48 ` Timur Tabi @ 2007-04-10 16:22 ` Benedict, Michael 2007-04-10 16:48 ` Sergei Shtylyov 2007-04-10 16:31 ` Vitaly Bordug 1 sibling, 1 reply; 9+ messages in thread From: Benedict, Michael @ 2007-04-10 16:22 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-embedded >Your settings for CONFIG_MTD_PHYSMAP_START and=20 >CONFIG_MTD_PHYSMAP_LEN are wrong. And=20 >frankly, I can't understand where you got those values from,=20 >unless you created your=20 >.config from scratch. The defconfig that's in the kernel is=20 >specifically intended for the=20 >Freescale MPC8349E-mITX. I should know, because I wrote the=20 >code and the defconfig. I didn't even know about the defconfig until I started looking into this issue. I tried to "upgrade" the .config that came with the CD but I can't tell you how I introduced these values. That said, I was able to change my configuration to the values in the defconfig and... # mtd_debug info /dev/mtd0 mtd.type =3D MTD_NORFLASH mtd.flags =3D mtd.size =3D 16777216 (16M) mtd.erasesize =3D 65536 (64K) mtd.oobblock =3D 1 mtd.oobsize =3D 0 mtd.ecctype =3D MTD_ECC_NONE regions =3D 4 region[0].offset =3D 0x00000000 region[0].erasesize =3D 65536 (64K) region[0].numblocks =3D 127 region[0].regionindex =3D 0 region[1].offset =3D 0x007f0000 region[1].erasesize =3D 8192 (8K) region[1].numblocks =3D 8 region[1].regionindex =3D 1 region[2].offset =3D 0x00800000 region[2].erasesize =3D 65536 (64K) region[2].numblocks =3D 127 region[2].regionindex =3D 2 region[3].offset =3D 0x00ff0000 region[3].erasesize =3D 8192 (8K) region[3].numblocks =3D 8 region[3].regionindex =3D 3 Its working! Thank you everyone for helping me figure this out. > >Having said that, it seems that the kernel now supports=20 >defining the physmap via the OF=20 >tree. Is that true? Initially I was going to try and define this via the OF tree. However, the documentation indicated that the only supported device_type was "rom" so I did not persue that route. -Michael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: MPC 8349e-mITX and MTD/Flash 2007-04-10 16:22 ` Benedict, Michael @ 2007-04-10 16:48 ` Sergei Shtylyov 2007-04-10 16:48 ` Timur Tabi 0 siblings, 1 reply; 9+ messages in thread From: Sergei Shtylyov @ 2007-04-10 16:48 UTC (permalink / raw) To: Benedict, Michael; +Cc: Timur Tabi, linuxppc-embedded Hello. Benedict, Michael wrote: >>Having said that, it seems that the kernel now supports >>defining the physmap via the OF >>tree. Is that true? > Initially I was going to try and define this via the OF tree. However, > the documentation indicated that the only supported device_type was > "rom" so I did not persue that route. There was long discussion about using "mtd" and other types -- people were complaining that "mtd" was too Linux-centric term, so finally we ended up with "rom". It doesn't imply that ROMs are the only supported devices. :-) WBR, Sergei ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: MPC 8349e-mITX and MTD/Flash 2007-04-10 16:48 ` Sergei Shtylyov @ 2007-04-10 16:48 ` Timur Tabi 0 siblings, 0 replies; 9+ messages in thread From: Timur Tabi @ 2007-04-10 16:48 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Benedict, Michael, linuxppc-embedded Sergei Shtylyov wrote: > Hello. > > Benedict, Michael wrote: > >>> Having said that, it seems that the kernel now supports defining the >>> physmap via the OF tree. Is that true? > >> Initially I was going to try and define this via the OF tree. However, >> the documentation indicated that the only supported device_type was >> "rom" so I did not persue that route. > > There was long discussion about using "mtd" and other types -- people > were complaining that "mtd" was too Linux-centric term, so finally we > ended up with "rom". It doesn't imply that ROMs are the only supported > devices. :-) Okee dokee. I'll add it to my to-do list. -- Timur Tabi Linux Kernel Developer @ Freescale ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: MPC 8349e-mITX and MTD/Flash 2007-04-10 15:48 ` Timur Tabi 2007-04-10 16:22 ` Benedict, Michael @ 2007-04-10 16:31 ` Vitaly Bordug 1 sibling, 0 replies; 9+ messages in thread From: Vitaly Bordug @ 2007-04-10 16:31 UTC (permalink / raw) To: Timur Tabi; +Cc: Benedict, Michael, linuxppc-embedded On Tue, 10 Apr 2007 10:48:43 -0500 Timur Tabi <timur@freescale.com> wrote: > Having said that, it seems that the kernel now supports defining the physmap via the OF > tree. Is that true? Yes, we drafted some stuff while working on mpc8540ads - see drivers/mtd/maps/physmap_of.c -- Sincerely, Vitaly ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-04-10 16:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-09 20:58 MPC 8349e-mITX and MTD/Flash Benedict, Michael
[not found] ` <572211.38645.qm@web306.biz.mail.mud.yahoo.com>
2007-04-10 14:06 ` Benedict, Michael
2007-04-10 14:13 ` Sergei Shtylyov
2007-04-10 14:41 ` Ben Warren
2007-04-10 15:48 ` Timur Tabi
2007-04-10 16:22 ` Benedict, Michael
2007-04-10 16:48 ` Sergei Shtylyov
2007-04-10 16:48 ` Timur Tabi
2007-04-10 16:31 ` Vitaly Bordug
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).