From: Sean MacLennan <smaclennan@pikatech.com>
To: linuxppc-dev <linuxppc-dev@ozlabs.org>,
Josh Boyer <jwboyer@linux.vnet.ibm.com>
Subject: [RFC] Driver helper functions.....
Date: Thu, 7 Aug 2008 12:22:42 -0400 [thread overview]
Message-ID: <20080807122242.63a9f156@lappy.seanm.ca> (raw)
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
reply other threads:[~2008-08-07 16:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080807122242.63a9f156@lappy.seanm.ca \
--to=smaclennan@pikatech.com \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).