02 May, 2015

1 commit

  • This patch adds a new OF-friendly API of_hwspin_lock_get_id()
    for hwspinlock clients to use/request locks from a hwspinlock
    device instantiated through a device-tree blob. This new API
    can be used by hwspinlock clients to get the id for a specific
    lock using the phandle + args specifier, so that it can be
    requested using the available hwspin_lock_request_specific()
    API.

    Signed-off-by: Suman Anna
    Reviewed-by: Bjorn Andersson
    [small comment clarification]
    Signed-off-by: Ohad Ben-Cohen

    Suman Anna
     

27 Aug, 2013

1 commit


22 Sep, 2011

3 commits

  • Hardware Spinlock devices usually contain numerous locks (known
    devices today support between 32 to 256 locks).

    Originally hwspinlock core required drivers to register (and later,
    when needed, unregister) each lock separately.

    That worked, but required hwspinlocks drivers to do a bit extra work
    when they were probed/removed.

    This patch changes hwspin_lock_{un}register() to allow a bank of
    hwspinlocks to be {un}registered in a single invocation.

    A new 'struct hwspinlock_device', which contains an array of 'struct
    hwspinlock's is now being passed to the core upon registration (so
    instead of wrapping each struct hwspinlock, a priv member has been added
    to allow drivers to piggyback their private data with each hwspinlock).

    While at it, several per-lock members were moved to be per-device:
    1. struct device *dev
    2. struct hwspinlock_ops *ops

    In addition, now that the array of locks is handled by the core,
    there's no reason to maintain a per-lock 'int id' member: the id of the
    lock anyway equals to its index in the bank's array plus the bank's
    base_id.
    Remove this per-lock id member too, and instead use a simple pointers
    arithmetic to derive it.

    As a result of this change, hwspinlocks drivers are now simpler and smaller
    (about %20 code reduction) and the memory footprint of the hwspinlock
    framework is reduced.

    Signed-off-by: Ohad Ben-Cohen

    Ohad Ben-Cohen
     
  • Since we're using non-atomic radix tree allocations, we
    should be protecting the tree using a mutex and not a
    spinlock.

    Non-atomic allocations and process context locking is good enough,
    as the tree is manipulated only when locks are registered/
    unregistered/requested/freed.

    The locks themselves are still protected by spinlocks of course,
    and mutexes are not involved in the locking/unlocking paths.

    Cc:
    Signed-off-by: Juan Gutierrez
    [ohad@wizery.com: rewrite the commit log, #include mutex.h, add minor
    commentary]
    [ohad@wizery.com: update register/unregister parts in hwspinlock.txt]
    Signed-off-by: Ohad Ben-Cohen

    Juan Gutierrez
     
  • Use struct device_driver's owner member instead of asking drivers to
    explicitly pass the owner again.

    This simplifies drivers and also save some memory, since there's no
    point now in maintaining a separate owner pointer per hwspinlock.

    Signed-off-by: Ohad Ben-Cohen

    Ohad Ben-Cohen
     

18 Feb, 2011

1 commit

  • Add a platform-independent hwspinlock framework.

    Hardware spinlock devices are needed, e.g., in order to access data
    that is shared between remote processors, that otherwise have no
    alternative mechanism to accomplish synchronization and mutual exclusion
    operations.

    Signed-off-by: Ohad Ben-Cohen
    Cc: Hari Kanigeri
    Cc: Benoit Cousson
    Cc: Kevin Hilman
    Cc: Grant Likely
    Cc: Paul Walmsley
    Cc: Russell King
    Acked-by: Arnd Bergmann
    Signed-off-by: Tony Lindgren

    Ohad Ben-Cohen