linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Accessing flash directly from User Space
@ 2009-10-27 19:59 Jonathan Haws
  2009-10-27 20:13 ` Bill Gatliff
  0 siblings, 1 reply; 44+ messages in thread
From: Jonathan Haws @ 2009-10-27 19:59 UTC (permalink / raw)
  To: linuxppc-dev@lists.ozlabs.org

I know this is probably a really dumb question, but a wise man once said th=
at the only stupid question is the one that is not asked.

So, I have written a flash driver in VxWorks that simply addresses the flas=
h directly and handles all the hardware accesses just fine.  I am porting t=
hat to Linux and need it to run in user space (mainly to simplify the inter=
face with the user - I want to keep it the same as in VxWorks).  Here is a =
snippet of what my question is:

static uint8_t bflashEraseSector(int sa, int verbose)
{
	uint16_t * flash =3D (uint16_t *) NOR_FLASH_BASE_ADRS;
	uint32_t offset;

	...

	/* We divide by 2 here to adjust for the 16-bit offset into the address */
	offset =3D sa * NOR_FLASH_SECTOR_SIZE / 2;
	flash[BFLASH_SECTOR_ERASE_ADDR1] =3D BFLASH_SECTOR_ERASE_BYTE1;

	...

}

I am trying to get a pointer to NOR_FLASH_BASE_ADRS which is defined to be =
0xFC000000.  I then dereference that directly to write to the flash.

How can I get that pointer?  Unfortunately I cannot simply use the address =
of the flash.  Is there some magical function call that gives me access to =
that portion of the memory space?

Thanks for the help!

Jonathan

PS - I know that I could simply use the MTD driver provided by the kernel, =
but I need to be able to keep the interface the same so we can use previous=
ly written code.

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

end of thread, other threads:[~2009-11-01 10:03 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27 19:59 Accessing flash directly from User Space Jonathan Haws
2009-10-27 20:13 ` Bill Gatliff
2009-10-27 20:15   ` Jonathan Haws
2009-10-27 20:30     ` Bill Gatliff
2009-10-27 20:31       ` Jonathan Haws
2009-10-27 22:24       ` Jonathan Haws
2009-10-27 22:32         ` Scott Wood
2009-10-27 22:35           ` Jonathan Haws
2009-10-27 22:42             ` Scott Wood
2009-10-27 22:52               ` Jonathan Haws
2009-10-28  9:56                 ` Kenneth Johansson
2009-10-28 14:45                   ` Jonathan Haws
2009-10-29 21:36                     ` Joerg Albert
2009-10-29 21:39                       ` Jonathan Haws
2009-10-29 16:33                 ` Scott Wood
2009-10-29 16:48                   ` Jonathan Haws
     [not found]           ` <BB99A6BA28709744BF22A68E6D7EB51F0330D368AA@midas.usurf.usu.edu >
2009-10-27 22:42             ` Alessandro Rubini
2009-10-28 11:24         ` Josh Boyer
2009-10-28 14:38           ` Jonathan Haws
2009-10-28 17:44             ` Accessing flash directly from User Space [SOLVED] Jonathan Haws
2009-10-29  9:00               ` Joakim Tjernlund
2009-10-29  9:15                 ` Joakim Tjernlund
2009-10-29 17:01                   ` Jonathan Haws
2009-10-29 11:08                 ` Kenneth Johansson
2009-10-29 17:02                   ` Jonathan Haws
2009-10-29 23:30                 ` Scott Wood
2009-10-30 14:50                   ` Jonathan Haws
2009-10-30 14:56                     ` Michael Buesch
2009-10-30 14:57                       ` Jonathan Haws
     [not found]                       ` <BB99A6BA28709744BF22A68E6D7EB51F0330E23124@midas.usurf.usu.edu >
2009-10-30 15:08                         ` Alessandro Rubini
2009-10-30 15:24                           ` Michael Buesch
2009-10-30 15:33                             ` Jonathan Haws
2009-10-31 13:26                               ` Joakim Tjernlund
2009-10-31 16:42                                 ` Michael Buesch
2009-10-31 20:14                                   ` Joakim Tjernlund
2009-10-31 20:35                                     ` Michael Buesch
2009-10-31 22:31                                       ` Joakim Tjernlund
2009-11-01 10:07                                         ` Segher Boessenkool
2009-10-30 15:48                             ` Micha Nelissen
2009-10-30 16:46                               ` Jonathan Haws
2009-10-30 17:49                                 ` Gabriel Paubert
2009-10-30 15:57                           ` Scott Wood
     [not found]       ` <BB99A6BA28709744BF22A68E6D7EB51F0330D3688B@midas.usurf.usu.edu >
2009-10-27 22:32         ` Accessing flash directly from User Space Alessandro Rubini
2009-10-27 22:33           ` Jonathan Haws

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).