All of lore.kernel.org
 help / color / mirror / Atom feed
* How can I prevent MTD to access the end of a flash device ?
@ 2005-11-07 10:48 Franck
  2005-11-22 14:58 ` Franck
  0 siblings, 1 reply; 11+ messages in thread
From: Franck @ 2005-11-07 10:48 UTC (permalink / raw)
  To: linux-mtd

Hi,

I have two questions that I can't answer by my own. I tried to look at
FAQ and documentation on MTD website but found no answer.

First question is about size of flash. I have a Intel strataflash
whose size is 32MB but because of a buggy platform hardware I can't
access to the last 64KB of the flash. How can I make MTD module aware
of this new size. The restricted map size is initialized by my driver
but it doesn't seem to be used by MTD.

The second question is about the "cacheable" mapping field in map_info
structure. I looked at others drivers and this field seems to be
optional. Does this field, if set, improve flash access a lot ? Should
I set up a cacheable mapping ?

Thanks
--
               Franck

PS: could you CC me in your answer since I'm not subscribed to the list

^ permalink raw reply	[flat|nested] 11+ messages in thread

* How can I prevent MTD to access the end of a flash device ?
  2005-11-07 10:48 How can I prevent MTD to access the end of a flash device ? Franck
@ 2005-11-22 14:58 ` Franck
  2005-11-22 15:21   ` Josh Boyer
  2005-11-22 15:53   ` Nicolas Pitre
  0 siblings, 2 replies; 11+ messages in thread
From: Franck @ 2005-11-22 14:58 UTC (permalink / raw)
  To: lkml

Hi,

I have two questions that I can't answer by my own. I tried to look at
FAQ and documentation on MTD website but found no answer.

First question is about size of flash. I have a Intel strataflash
whose size is 32MB but because of a buggy platform hardware I can't
access to the last 64KB of the flash. How can I make MTD module aware
of this new size. The restricted map size is initialized by my driver
but it doesn't seem to be used by MTD.

The second question is about the "cacheable" mapping field in map_info
structure. I looked at others drivers and this field seems to be
optional. Does this field, if set, improve flash access a lot ? Should
I set up a cacheable mapping ?

Thanks
--
               Franck

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2005-11-22 14:58 ` Franck
@ 2005-11-22 15:21   ` Josh Boyer
  2005-11-22 15:53   ` Nicolas Pitre
  1 sibling, 0 replies; 11+ messages in thread
From: Josh Boyer @ 2005-11-22 15:21 UTC (permalink / raw)
  To: Franck; +Cc: lkml

On 11/22/05, Franck <vagabon.xyz@gmail.com> wrote:
> Hi,
>
> I have two questions that I can't answer by my own. I tried to look at
> FAQ and documentation on MTD website but found no answer.
>
> First question is about size of flash. I have a Intel strataflash
> whose size is 32MB but because of a buggy platform hardware I can't
> access to the last 64KB of the flash. How can I make MTD module aware
> of this new size. The restricted map size is initialized by my driver
> but it doesn't seem to be used by MTD.

The chip driver will detect a 32MiB chip from the CFI probe.  The map
size isn't really used by the chip driver, it's just needed to ensure
that the area is accessible.  What you could try doing is adding a
cfi_fixup function that changes the CFI data read in to remove the
last 64KiB of the chip...  not sure if that will work though.

> The second question is about the "cacheable" mapping field in map_info
> structure. I looked at others drivers and this field seems to be
> optional. Does this field, if set, improve flash access a lot ? Should
> I set up a cacheable mapping ?

Usually this isn't something you want to do especially with flash.  If
a cache line is flushed back to the chip it's probably not going to
work.  The cacheable mappings work for RAM based devices though.

josh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2005-11-22 14:58 ` Franck
  2005-11-22 15:21   ` Josh Boyer
@ 2005-11-22 15:53   ` Nicolas Pitre
  2005-11-24  8:32     ` Franck
  2006-04-23 17:06     ` Franck Bui-Huu
  1 sibling, 2 replies; 11+ messages in thread
From: Nicolas Pitre @ 2005-11-22 15:53 UTC (permalink / raw)
  To: Franck; +Cc: lkml

On Tue, 22 Nov 2005, Franck wrote:

> Hi,
> 
> I have two questions that I can't answer by my own. I tried to look at
> FAQ and documentation on MTD website but found no answer.

Please consider using the MTD mailing list next time (you certainly read 
about it on the MTD web site).

> First question is about size of flash. I have a Intel strataflash
> whose size is 32MB but because of a buggy platform hardware I can't
> access to the last 64KB of the flash. How can I make MTD module aware
> of this new size. The restricted map size is initialized by my driver
> but it doesn't seem to be used by MTD.

The easiest thing to do is to define MTD partitions, the last one being 
the excluded flash area.

> The second question is about the "cacheable" mapping field in map_info
> structure. I looked at others drivers and this field seems to be
> optional.

It is.

> Does this field, if set, improve flash access a lot ?

Yes.  It was tested on ARM only though.  Some architectures like i386 
for example might need special tricks to implement this.

> Should I set up a cacheable mapping ?

Consider the comment for the inval_cache method in 
include/linux/mtd/map.h and look at lubbock-flash.c for example.


Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2005-11-22 15:53   ` Nicolas Pitre
@ 2005-11-24  8:32     ` Franck
  2005-11-28 16:55       ` Nicolas Pitre
  2006-04-23 17:06     ` Franck Bui-Huu
  1 sibling, 1 reply; 11+ messages in thread
From: Franck @ 2005-11-24  8:32 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: lkml

Hi.

2005/11/22, Nicolas Pitre <nico@cam.org>:
> Please consider using the MTD mailing list next time (you certainly read
> about it on the MTD web site).
>

I did....

> Yes.  It was tested on ARM only though.  Some architectures like i386
> for example might need special tricks to implement this.
>

do you know why ? What was the gain on ARM ?

Thanks
--
               Franck

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2005-11-24  8:32     ` Franck
@ 2005-11-28 16:55       ` Nicolas Pitre
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Pitre @ 2005-11-28 16:55 UTC (permalink / raw)
  To: Franck; +Cc: lkml

On Thu, 24 Nov 2005, Franck wrote:

> > Yes.  It was tested on ARM only though.  Some architectures like i386
> > for example might need special tricks to implement this.
> >
> 
> do you know why ?

Apparently i386 might have issues having two virtual mappings for the 
same physical address range.  This can be worked around in the map 
driver by relying on the knowledge of flash aliases on the bus.

> What was the gain on ARM ?

The ability to use burst transfers which are only activated with cached 
memory, hence twice the read speed or more.


Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2005-11-22 15:53   ` Nicolas Pitre
  2005-11-24  8:32     ` Franck
@ 2006-04-23 17:06     ` Franck Bui-Huu
  2006-04-23 17:24       ` Nicolas Pitre
  1 sibling, 1 reply; 11+ messages in thread
From: Franck Bui-Huu @ 2006-04-23 17:06 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: lkml

Nicolas,

2005/11/22, Nicolas Pitre <nico@cam.org>:
> On Tue, 22 Nov 2005, Franck wrote:
>
> > Hi,
> >
> > I have two questions that I can't answer by my own. I tried to look at
> > FAQ and documentation on MTD website but found no answer.
>
> Please consider using the MTD mailing list next time (you certainly read
> about it on the MTD web site).
>
> > First question is about size of flash. I have a Intel strataflash
> > whose size is 32MB but because of a buggy platform hardware I can't
> > access to the last 64KB of the flash. How can I make MTD module aware
> > of this new size. The restricted map size is initialized by my driver
> > but it doesn't seem to be used by MTD.
>
> The easiest thing to do is to define MTD partitions, the last one being
> the excluded flash area.
>

I hope you don't mind if I continue this thread 5 months later...I put
this issue in my TODO list and now I really need to fix it.

Your advice seems fine, but it brings some restrictions on flash
concatenations: for example, if I have 2 flashes of 32Mbytes, I need
to create 2 partitions whose sizes are 32M - 64K bytes but then I
can't concatenate these two partitions anymore since concatenation
works with mtd devices, not partitions, does it ?

It seems easier to simply probe the flash, then check for its size and
eventually restrict the end of it if needed:

        *mtd = do_map_probe("xxx_probe", map);
        while (mtd->size > 32Mb - 64Kb)
                (*mtd)->size -= (*mtd)->erasesize;

But I don't know if the MTD layer allows this kind of operation, do you ?

Thanks
--
               Franck

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2006-04-23 17:06     ` Franck Bui-Huu
@ 2006-04-23 17:24       ` Nicolas Pitre
  2006-04-23 18:57         ` Franck Bui-Huu
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Pitre @ 2006-04-23 17:24 UTC (permalink / raw)
  To: Franck Bui-Huu; +Cc: lkml

On Sun, 23 Apr 2006, Franck Bui-Huu wrote:

> Nicolas,
> 
> 2005/11/22, Nicolas Pitre <nico@cam.org>:
> > On Tue, 22 Nov 2005, Franck wrote:
> >
> > > Hi,
> > >
> > > I have two questions that I can't answer by my own. I tried to look at
> > > FAQ and documentation on MTD website but found no answer.
> >
> > Please consider using the MTD mailing list next time (you certainly read
> > about it on the MTD web site).
> >
> > > First question is about size of flash. I have a Intel strataflash
> > > whose size is 32MB but because of a buggy platform hardware I can't
> > > access to the last 64KB of the flash. How can I make MTD module aware
> > > of this new size. The restricted map size is initialized by my driver
> > > but it doesn't seem to be used by MTD.
> >
> > The easiest thing to do is to define MTD partitions, the last one being
> > the excluded flash area.
> >
> 
> I hope you don't mind if I continue this thread 5 months later...I put
> this issue in my TODO list and now I really need to fix it.
> 
> Your advice seems fine, but it brings some restrictions on flash
> concatenations: for example, if I have 2 flashes of 32Mbytes, I need
> to create 2 partitions whose sizes are 32M - 64K bytes but then I
> can't concatenate these two partitions anymore since concatenation
> works with mtd devices, not partitions, does it ?

MTD partitions are MTD "devices" as well.


Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2006-04-23 17:24       ` Nicolas Pitre
@ 2006-04-23 18:57         ` Franck Bui-Huu
  2006-04-24 15:40           ` David Woodhouse
  0 siblings, 1 reply; 11+ messages in thread
From: Franck Bui-Huu @ 2006-04-23 18:57 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: lkml

2006/4/23, Nicolas Pitre <nico@cam.org>:
> On Sun, 23 Apr 2006, Franck Bui-Huu wrote:
> >
> > Your advice seems fine, but it brings some restrictions on flash
> > concatenations: for example, if I have 2 flashes of 32Mbytes, I need
> > to create 2 partitions whose sizes are 32M - 64K bytes but then I
> > can't concatenate these two partitions anymore since concatenation
> > works with mtd devices, not partitions, does it ?
>
> MTD partitions are MTD "devices" as well.
>

well, mtd_concat_create() functions doesn't use MTD partitions...and
what's happening if the user needs to use its own partitions based on
a device resulting of several concatenated flashes? It migth be
possible to still use your solution and just fix user partitions but
it really seems easier to fix the MTD size after it the flash has been
probed.

Do you think it's possible to change the size of a mtd device rigth
after probing it ?

Thanks
--
               Franck

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2006-04-23 18:57         ` Franck Bui-Huu
@ 2006-04-24 15:40           ` David Woodhouse
  2006-04-24 16:12             ` Franck Bui-Huu
  0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2006-04-24 15:40 UTC (permalink / raw)
  To: Franck Bui-Huu; +Cc: Nicolas Pitre, lkml

On Sun, 2006-04-23 at 20:57 +0200, Franck Bui-Huu wrote:
> well, mtd_concat_create() functions doesn't use MTD partitions...and
> what's happening if the user needs to use its own partitions based on
> a device resulting of several concatenated flashes? It migth be
> possible to still use your solution and just fix user partitions but
> it really seems easier to fix the MTD size after it the flash has been
> probed.

MTD partitions aren't like block device partitions. You just get a set
of MTD devices which are like a wrapper around the original.

MTD concat is the same. You should be able to partition and concat and
partition and concat on top of each other to your heart's content. If
you so desire.

> Do you think it's possible to change the size of a mtd device rigth
> after probing it ?

Yes, that works too.

-- 
dwmw2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How can I prevent MTD to access the end of a flash device ?
  2006-04-24 15:40           ` David Woodhouse
@ 2006-04-24 16:12             ` Franck Bui-Huu
  0 siblings, 0 replies; 11+ messages in thread
From: Franck Bui-Huu @ 2006-04-24 16:12 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Nicolas Pitre, lkml

2006/4/24, David Woodhouse <dwmw2@infradead.org>:
> MTD partitions aren't like block device partitions. You just get a set
> of MTD devices which are like a wrapper around the original.
>
> MTD concat is the same. You should be able to partition and concat and
> partition and concat on top of each other to your heart's content. If
> you so desire.
>

oh ok...should I simply use add_mtd_partitions(...) function to create
a new MTD device based on a given partition ?

> > Do you think it's possible to change the size of a mtd device rigth
> > after probing it ?
>
> Yes, that works too.
>

In your opinion, what is the right thing to do ?

thanks
--
               Franck

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-04-24 16:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-07 10:48 How can I prevent MTD to access the end of a flash device ? Franck
2005-11-22 14:58 ` Franck
2005-11-22 15:21   ` Josh Boyer
2005-11-22 15:53   ` Nicolas Pitre
2005-11-24  8:32     ` Franck
2005-11-28 16:55       ` Nicolas Pitre
2006-04-23 17:06     ` Franck Bui-Huu
2006-04-23 17:24       ` Nicolas Pitre
2006-04-23 18:57         ` Franck Bui-Huu
2006-04-24 15:40           ` David Woodhouse
2006-04-24 16:12             ` Franck Bui-Huu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.