From: Ben Warren <bwarren@qstreams.com>
To: "Benedict, Michael" <MBenedict@twacs.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: RE: MPC 8349e-mITX and MTD/Flash
Date: Tue, 10 Apr 2007 10:41:23 -0400 [thread overview]
Message-ID: <1176216083.14027.20.camel@saruman.qstreams.net> (raw)
In-Reply-To: <CF7E46FCFF66AD478BB72724345289EC2795D2@twx-exch01.twacs.local>
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
next prev parent reply other threads:[~2007-04-10 14:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1176216083.14027.20.camel@saruman.qstreams.net \
--to=bwarren@qstreams.com \
--cc=MBenedict@twacs.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).