linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Driver helper functions.....
@ 2008-08-07 16:22 Sean MacLennan
  0 siblings, 0 replies; only message in thread
From: Sean MacLennan @ 2008-08-07 16:22 UTC (permalink / raw)
  To: linuxppc-dev, Josh Boyer

The design of the warp is basically a processor, an FPGA, some RAM,
some flash, and some glue logic. As the number of drivers rapidly
expands... we are starting to hit inter-driver conflicts with a select
few FPGA registers.

So we need a few "helper" functions to handle locking. Basically
something like this:

static DEFINE_SPINLOCK(fpga_lock);

void warp_fpga_set_imr(imr)
{ /* imr = interrupt mask register */
	lock
	read/modify/write imr
	unlock
}

void warp_fpga_clear_imr(imr);
int warp_fpga_indirect_read();
int warp_fpga_indirect_write();

Maybe a couple more, but I think it would basically be four functions.

So I see a few solutions:

1) Write an fpga driver. That seems overkill for basically exporting
four functions.

2) Add a non-static spinlock to the platform code and export that. This
adds minimal code to the platform code but gives eveybody a lock that
is always there.

3) Add the above functions to the platform code.

So my questions are, what would be best practice? Would adding the
functions and/or spinlock to the platform code be kosher?

And if I did add the spinlock and/or functions to the platform code,
where would I put the include file to export them from? In the arch
code itself? i.e. arch/powerpc/platforms/44x/warp.h?

Cheers,
   Sean

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-07 16:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 16:22 [RFC] Driver helper functions Sean MacLennan

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