OMAP2+: hwmod: upgrade per-hwmod mutex to a spinlock
Change the per-hwmod mutex to a spinlock. (The per-hwmod lock
serializes most post-initialization hwmod operations such as enable,
idle, and shutdown.) Spinlocks are needed, because in some cases,
hwmods must be enabled from timer interrupt disabled-context, such as
an ISR. The current use-case that is driving this is the OMAP GPIO
block ISR: it can trigger interrupts even with its clocks disabled,
but these clocks are needed for register accesses in the ISR to succeed.
This patch also effectively reverts commit
848240223c
- this patch makes
_omap_hwmod_enable() and _omap_hwmod_init() static, renames them back
to _enable() and _idle(), and changes their callers to call the
spinlocking versions. Previously, since omap_hwmod_{enable,init}()
attempted to take mutexes, these functions could not be called while
the timer interrupt was disabled; but now that the functions use
spinlocks and save and restore the IRQ state, it is appropriate to
call them directly.
Kevin Hilman <khilman@deeprootsystems.com> originally proposed this
patch - thanks Kevin.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Benoît Cousson <b-cousson@ti.com>
This commit is contained in:
parent
bd36179eec
commit
dc6d1cda04
3 changed files with 64 additions and 56 deletions
|
@ -32,7 +32,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
struct omap_device;
|
||||
|
@ -472,7 +472,7 @@ struct omap_hwmod_class {
|
|||
* @_postsetup_state: internal-use state to leave the hwmod in after _setup()
|
||||
* @flags: hwmod flags (documented below)
|
||||
* @omap_chip: OMAP chips this hwmod is present on
|
||||
* @_mutex: mutex serializing operations on this hwmod
|
||||
* @_lock: spinlock serializing operations on this hwmod
|
||||
* @node: list node for hwmod list (internal use)
|
||||
*
|
||||
* @main_clk refers to this module's "main clock," which for our
|
||||
|
@ -502,7 +502,7 @@ struct omap_hwmod {
|
|||
void *dev_attr;
|
||||
u32 _sysc_cache;
|
||||
void __iomem *_mpu_rt_va;
|
||||
struct mutex _mutex;
|
||||
spinlock_t _lock;
|
||||
struct list_head node;
|
||||
u16 flags;
|
||||
u8 _mpu_port_index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue