* Obtaining start/end address of an MTD partition
@ 2010-04-26 11:05 Matthew Lear
2010-04-26 12:59 ` Artem Bityutskiy
[not found] ` <y2zfb0149a91004260523n8c61e72es6be68d5d7ea162e6@mail.gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Matthew Lear @ 2010-04-26 11:05 UTC (permalink / raw)
To: linux-mtd
Hello all,
Is it possible to obtain an MTD partition's starting address through usage
of the MTD ioctls? I've had a very quick look and from what I can tell,
this doesn't seem to be possible.
To be clear, I'd like to obtain the addresses below (displayed by Linux
when it detects the MTD partitions on boot).
Creating 6 MTD partitions on "physmap-flash.0":
0x00000000-0x00120000 : "RedBoot"
0x00120000-0x01000000 : "foo"
0x01000000-0x01400000 : "bar"
I can obviously use the MEMGETINFO ioctl on a particular MTD device to
return info in struct mtd_info_user, but this doesn't give me all the
information I need for that particular partition (ie start and end offsets
in terms of 'physical' addresses).
Basically, I'm trying to cater for using another flash driver instead of
the MTD sub-system on some custom hw in order to access the flash device.
I'd like to be able to get the MTD partition start and end addresses so I
know where to operate on this other device. A bit clunky, I know (if it
were my decision MTD would be used).
RedBoot creates the FIS entries above and Linux parses this just fine at
boot. If I were using MTD to access the flash device I could open
/dev/mtd<x> or /dev/mtdblock<x> accordingly. However, there is a
requirement to access the flash through another device (/dev/flash). For
example, if I wanted to write to the area covered by /dev/mtd1, I need to
be able to:
i) get the start address of /dev/mtd1
ii) open /dev/flash and seek to the offset provided by (i) above.
iii) perform the operation(s).
...so I need the partition start addresses (and end too if possible). Can
these offsets be obtained through the MTD user space ioctls?
Many thanks,
-- Matt
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Obtaining start/end address of an MTD partition
2010-04-26 11:05 Obtaining start/end address of an MTD partition Matthew Lear
@ 2010-04-26 12:59 ` Artem Bityutskiy
2010-04-26 14:24 ` Matthew Lear
[not found] ` <y2zfb0149a91004260523n8c61e72es6be68d5d7ea162e6@mail.gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2010-04-26 12:59 UTC (permalink / raw)
To: matt; +Cc: linux-mtd
On Mon, 2010-04-26 at 12:05 +0100, Matthew Lear wrote:
> Hello all,
>
> Is it possible to obtain an MTD partition's starting address through usage
> of the MTD ioctls? I've had a very quick look and from what I can tell,
> this doesn't seem to be possible.
>
> To be clear, I'd like to obtain the addresses below (displayed by Linux
> when it detects the MTD partitions on boot).
>
> Creating 6 MTD partitions on "physmap-flash.0":
> 0x00000000-0x00120000 : "RedBoot"
> 0x00120000-0x01000000 : "foo"
> 0x01000000-0x01400000 : "bar"
Did you try 'cat /proc/mtd' ?
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Obtaining start/end address of an MTD partition
2010-04-26 12:59 ` Artem Bityutskiy
@ 2010-04-26 14:24 ` Matthew Lear
2010-04-28 14:42 ` Matthew Lear
0 siblings, 1 reply; 5+ messages in thread
From: Matthew Lear @ 2010-04-26 14:24 UTC (permalink / raw)
To: dedekind1; +Cc: matt, linux-mtd
> On Mon, 2010-04-26 at 12:05 +0100, Matthew Lear wrote:
>> Hello all,
>>
>> Is it possible to obtain an MTD partition's starting address through
>> usage
>> of the MTD ioctls? I've had a very quick look and from what I can tell,
>> this doesn't seem to be possible.
>>
>> To be clear, I'd like to obtain the addresses below (displayed by Linux
>> when it detects the MTD partitions on boot).
>>
>> Creating 6 MTD partitions on "physmap-flash.0":
>> 0x00000000-0x00120000 : "RedBoot"
>> 0x00120000-0x01000000 : "foo"
>> 0x01000000-0x01400000 : "bar"
>
> Did you try 'cat /proc/mtd' ?
Yes, of course but the only way I could easily obtain the start address of
a particular partition using /proc/mtd would be to increment the sizes of
each previous partition. It's doable but just seems clunky...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Obtaining start/end address of an MTD partition
2010-04-26 14:24 ` Matthew Lear
@ 2010-04-28 14:42 ` Matthew Lear
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Lear @ 2010-04-28 14:42 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On 04/26/10 15:24, Matthew Lear wrote:
>> On Mon, 2010-04-26 at 12:05 +0100, Matthew Lear wrote:
>>> Hello all,
>>>
>>> Is it possible to obtain an MTD partition's starting address through
>>> usage
>>> of the MTD ioctls? I've had a very quick look and from what I can tell,
>>> this doesn't seem to be possible.
>>>
>>> To be clear, I'd like to obtain the addresses below (displayed by Linux
>>> when it detects the MTD partitions on boot).
>>>
>>> Creating 6 MTD partitions on "physmap-flash.0":
>>> 0x00000000-0x00120000 : "RedBoot"
>>> 0x00120000-0x01000000 : "foo"
>>> 0x01000000-0x01400000 : "bar"
>>
>> Did you try 'cat /proc/mtd' ?
>
> Yes, of course but the only way I could easily obtain the start address of
> a particular partition using /proc/mtd would be to increment the sizes of
> each previous partition. It's doable but just seems clunky...
Actually, it's worse than that. This will only work if each partition is
adjacent. If there is any gap (ie unpartitioned space on the device)
between partitions, this will not work at all.
Surely, I'm not the first person to try to obtain this info from MTD?
Any help appreciated...
-- Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <y2zfb0149a91004260523n8c61e72es6be68d5d7ea162e6@mail.gmail.com>]
end of thread, other threads:[~2010-04-28 14:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-26 11:05 Obtaining start/end address of an MTD partition Matthew Lear
2010-04-26 12:59 ` Artem Bityutskiy
2010-04-26 14:24 ` Matthew Lear
2010-04-28 14:42 ` Matthew Lear
[not found] ` <y2zfb0149a91004260523n8c61e72es6be68d5d7ea162e6@mail.gmail.com>
2010-04-26 14:20 ` Matthew Lear
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).