[RFC] Driver helper functions.....
Sean MacLennan
smaclennan at pikatech.com
Fri Aug 8 02:22:42 EST 2008
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
More information about the Linuxppc-dev
mailing list