public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Accessing an MTD device from kernel space
@ 2004-05-26 21:21 Eisenhut, Daniel (MED)
  2004-05-26 21:26 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Eisenhut, Daniel (MED) @ 2004-05-26 21:21 UTC (permalink / raw)
  To: 'linux-mtd@lists.infradead.org'

To list,

I've successfully setup MTD devices for our NOR flash chips and
everything is working great from userspace.  But I have a need to access
the NOR flash from within kernelspace, such as in a /proc entry.

What is the best way to access the flash from within the kernel?  The
only way I've be able to so far is to just dereference a pointer
pointing to the flash address.  But this creates two issues (that I know
about):

1. A race condition between my proc entry that reads the flash and
another process using the MTD device.

2. The MTD device does not always leave the flash chip in read mode.

Is there anything setup in the current MTD code to allow access from
within the kernel?

Thanks...
Dan

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

* Re: Accessing an MTD device from kernel space
  2004-05-26 21:21 Accessing an MTD device from kernel space Eisenhut, Daniel (MED)
@ 2004-05-26 21:26 ` Thomas Gleixner
  2004-05-26 23:38   ` Dan Eisenhut
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2004-05-26 21:26 UTC (permalink / raw)
  To: Eisenhut, Daniel (MED), 'linux-mtd@lists.infradead.org'

On Wednesday 26 May 2004 23:21, Eisenhut, Daniel (MED) wrote:
> To list,
>
> I've successfully setup MTD devices for our NOR flash chips and
> everything is working great from userspace.  But I have a need to access
> the NOR flash from within kernelspace, such as in a /proc entry.
>
> What is the best way to access the flash from within the kernel?  The
> only way I've be able to so far is to just dereference a pointer
> pointing to the flash address.  But this creates two issues (that I know
> about):
>
> 1. A race condition between my proc entry that reads the flash and
> another process using the MTD device.
>
> 2. The MTD device does not always leave the flash chip in read mode.
>
> Is there anything setup in the current MTD code to allow access from
> within the kernel?

Just use the mtd API which is used from fs drivers and anything else which 
accessed the mtd devices from kernel space

mtd->read(....), mtd->erase(...) 

-- 
Thomas
________________________________________________________________________
Steve Ballmer quotes the statistic that IT pros spend 70 percent of their 
time managing existing systems. That couldn’t have anything to do with 
the fact that 99 percent of these systems run Windows, could it?
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

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

* Re: Accessing an MTD device from kernel space
  2004-05-26 21:26 ` Thomas Gleixner
@ 2004-05-26 23:38   ` Dan Eisenhut
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Eisenhut @ 2004-05-26 23:38 UTC (permalink / raw)
  To: tglx; +Cc: 'linux-mtd@lists.infradead.org'

On Wed, 2004-05-26 at 16:26, Thomas Gleixner wrote:
> Just use the mtd API which is used from fs drivers and anything else which 
> accessed the mtd devices from kernel space
> 
> mtd->read(....), mtd->erase(...) 

Thanks...  I dug through the fs/jffs2 directory and figured out how to
use the get_mtd_device() and mtd->read() functions.  Its working great.

Dan

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

end of thread, other threads:[~2004-05-26 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-26 21:21 Accessing an MTD device from kernel space Eisenhut, Daniel (MED)
2004-05-26 21:26 ` Thomas Gleixner
2004-05-26 23:38   ` Dan Eisenhut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox