linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/4] hwspinlock core & omap dt support
@ 2015-03-05  2:01 Suman Anna
  2015-03-05  2:01 ` [PATCH v8 1/4] Documentation: dt: add common bindings for hwspinlock Suman Anna
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Suman Anna @ 2015-03-05  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ohad,

This is the latest version of the hwspinlock dt support series,
rebased onto v4.0-rc1 and addressing the long discussion on the
bindings in v7 [1]. I really hope that this series can make it 
into 4.1. 

Mark,
Can you please provide your Acked-by for the binding documents
so that Ohad can pick up the patches for the next merge window?

Following are the main changes in v8 w.r.t v7:
- Revised the generic hwspinlock bindings to remove hwlock-base-id and
  hwlock-num-locks properties, and added the optional hwlock-names
  property.
- Updated the core device tree patch to remove of_hwspin_lock_get_base_id()
  and of_hwspin_lock_get_num_locks() functions. Reworked the
  of_hwspin_lock_get_id() API to not use the list of registered hwspinlock
  banks, but rely on the hwspinlock radix tree itself to perform deferred
  probing and pargs lock specifier validation. The last of the two were
  added in v6, but dropped in v7, and are now restored.
- Updated the OMAP hwspinlock binding and DT support patches for the
  absence of the v7's mandatory hwlock-base-id property.
- Changed the order of patches slightly to lump the core changes together
  and the OMAP hwspinlock changes together.

The validation logs on all the applicable OMAP SoCs are at:
  OMAP4	     : http://pastebin.ubuntu.com/10533448/
  OMAP5      : http://pastebin.ubuntu.com/10533710/
  DRA7 (X15) : http://pastebin.ubuntu.com/10533486/
  AM33xx     : http://pastebin.ubuntu.com/10533623/
  AM43xx     : http://pastebin.ubuntu.com/10533538/

The above logs are generated with some additional test patches staged
here for reference,
https://github.com/sumananna/omap-kernel/commits/hwspinlock/test/4.0-rc1-dt-v8

regards
Suman

[1] https://patchwork.kernel.org/patch/5635201/

---
v7:
http://marc.info/?l=linux-omap&m=142126914027417&w=2
- Dropped the patch "hwspinlock/core: maintain a list of registered
  hwspinlock banks"
- Updated generic hwspinlock bindings to make hwlock-base-id property
  mandatory.
- Updated the OMAP hwspinlock binding and DT support patches to correct
  for the mandatory hwlock-base-id property.
- Updated the common OF helpers patch to move the of_hwspin_lock_get_base_id()
  and of_hwspin_lock_get_num_locks() functions into the internal header,
  these are no longer exported, but available for platform implementations.
  of_hwspin_lock_get_id() is also simplified now.

v6:
http://marc.info/?l=linux-omap&m=141055365213895&w=2
- of_hwspin_lock_request_specific() is replaced
  with of_hwspin_lock_get_id(). of_hwspin_lock_simple_xlate() is
  made internal, and of_hwspin_lock_get_base_id() is added.
- Updated the OMAP hwspinlock DT support patch to assign base-id
  from DT if present
- RFC patches adding the concept of reserved locks and return code
  change convention dropped.

v5:
http://marc.info/?l=linux-omap&m=139890478402807&w=2
- Rebased v4 patches plus additional RFC patches.
- Added back the patch to support DT-based hwlock-base-id property,
  for registration purposes.
- RFC patches introducing the concept of reserved locks.
- Staged patches for converting return convention to better support
  deferred probing of client drivers.

v4:
- The DT bindings are split into separate patches, and updated to
  add comments about #hwlock-cells
- Fixed a registration issue with repeated module installation and
  removal.
- Added a new OF helper to support #hwlock-cells in addition to the
  previous OF functions. The OMAP adaptation patch is updated to use
  the default translate function
- Updated hwspinlock documentation to adjust for the structure
  changes and the new api additions.
- Added build support for AM335x, AM43xx and DRA7xx
http://marc.info/?l=linux-omap&m=138965904015225&w=2

v3:
- Removed the DT property hwlock-base-id and associated OF helper
- Added changes in core to support requesting a specific hwlock using
  phandle + args approach
- Revised both the common and OMAP DT bindings document
http://marc.info/?l=linux-omap&m=138143992932197&w=2

v2:
- Added a new common DT binding documentation and OF helpers.
- Revised OMAP DT parse support to use the new OF helper (Patch2)
- OMAP5 hwspinlock support including the hwmod entry and DT node
- Add AM335x support to OMAP hwspinlock driver, including a fix
  needed in driver given that AM335 spinlock module requires s/w wakeup
- AM335 DT node for spinlock, and a hwmod change to enable smart-idle
  for AM335.
- OMAP4 DT node patch is unchanged
http://marc.info/?l=linux-omap&m=137944644112727&w=2

v1:
- Add DT parse support to OMAP hwspinlock driver
- Add OMAP4 DT node and bindings information
http://marc.info/?l=linux-omap&m=137823082308009&w=2

---

Suman Anna (4):
  Documentation: dt: add common bindings for hwspinlock
  hwspinlock/core: add device tree support
  Documentation: dt: add the omap hwspinlock bindings document
  hwspinlock/omap: add support for dt nodes

 .../devicetree/bindings/hwlock/hwlock.txt          | 59 ++++++++++++++++
 .../devicetree/bindings/hwlock/omap-hwspinlock.txt | 26 +++++++
 Documentation/hwspinlock.txt                       | 10 +++
 MAINTAINERS                                        |  1 -
 arch/arm/mach-omap2/Makefile                       |  3 -
 arch/arm/mach-omap2/hwspinlock.c                   | 60 ----------------
 drivers/hwspinlock/hwspinlock_core.c               | 79 ++++++++++++++++++++++
 drivers/hwspinlock/omap_hwspinlock.c               | 17 +++--
 include/linux/hwspinlock.h                         |  7 ++
 9 files changed, 194 insertions(+), 68 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
 delete mode 100644 arch/arm/mach-omap2/hwspinlock.c

-- 
2.3.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 1/4] Documentation: dt: add common bindings for hwspinlock
  2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
@ 2015-03-05  2:01 ` Suman Anna
  2015-03-05  2:01 ` [PATCH v8 2/4] hwspinlock/core: add device tree support Suman Anna
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Suman Anna @ 2015-03-05  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the generic common bindings used to represent
a hwlock device and use/request locks in a device-tree build.

Each hwspinlock provider should have the '#hwlock-cells' property,
which represents the number of cells to be used for representing
a specific hwspinlock. Client users shall use the property
'hwlocks' for requesting specific lock(s).

Note that the document is named hwlock.txt deliberately to keep
it a bit more generic.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
---
v8: Revised the binding completely, removed hwlock-num-locks and
    hwlock-base-id properties. Added hwlock-names as optional
    property. Revised patch description as well. 

 .../devicetree/bindings/hwlock/hwlock.txt          | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt

diff --git a/Documentation/devicetree/bindings/hwlock/hwlock.txt b/Documentation/devicetree/bindings/hwlock/hwlock.txt
new file mode 100644
index 000000000000..085d1f5c916a
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/hwlock.txt
@@ -0,0 +1,59 @@
+Generic hwlock bindings
+=======================
+
+Generic bindings that are common to all the hwlock platform specific driver
+implementations.
+
+Please also look through the individual platform specific hwlock binding
+documentations for identifying any additional properties specific to that
+platform.
+
+hwlock providers:
+=================
+
+Required properties:
+- #hwlock-cells:        Specifies the number of cells needed to represent a
+                        specific lock.
+
+hwlock users:
+=============
+
+Consumers that require specific hwlock(s) should specify them using the
+property "hwlocks", and an optional "hwlock-names" property.
+
+Required properties:
+- hwlocks:              List of phandle to a hwlock provider node and an
+                        associated hwlock args specifier as indicated by
+                        #hwlock-cells. The list can have just a single hwlock
+                        or multiple hwlocks, with each hwlock represented by
+                        a phandle and a corresponding args specifier.
+
+Optional properties:
+- hwlock-names:         List of hwlock name strings defined in the same order
+                        as the hwlocks, with one name per hwlock. Consumers can
+                        use the hwlock-names to match and get a specific hwlock.
+
+
+1. Example of a node using a single specific hwlock:
+
+The following example has a node requesting a hwlock in the bank defined by
+the node hwlock1. hwlock1 is a hwlock provider with an argument specifier
+of length 1.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>;
+		...
+	};
+
+2. Example of a node using multiple specific hwlocks:
+
+The following example has a node requesting two hwlocks, a hwlock within
+the hwlock device node 'hwlock1' with #hwlock-cells value of 1, and another
+hwlock within the hwlock device node 'hwlock2' with #hwlock-cells value of 2.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>, <&hwlock2 0 3>;
+		...
+	};
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v8 2/4] hwspinlock/core: add device tree support
  2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
  2015-03-05  2:01 ` [PATCH v8 1/4] Documentation: dt: add common bindings for hwspinlock Suman Anna
@ 2015-03-05  2:01 ` Suman Anna
  2015-03-12 11:05   ` Bjorn Andersson
  2015-03-05  2:01 ` [PATCH v8 3/4] Documentation: dt: add the omap hwspinlock bindings document Suman Anna
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Suman Anna @ 2015-03-05  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

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 <s-anna@ti.com>
---
v8: Removed the previous OF helpers of_hwspin_lock_get_num_locks()
    & of_hwspin_lock_get_base_id() due to the revised generic
    bindings. Added back the support for deferred probing and
    pargs specifier validation like in v6, but without using an
    added list for storing registered hwspinlock devices.

 Documentation/hwspinlock.txt         | 10 +++++
 drivers/hwspinlock/hwspinlock_core.c | 79 ++++++++++++++++++++++++++++++++++++
 include/linux/hwspinlock.h           |  7 ++++
 3 files changed, 96 insertions(+)

diff --git a/Documentation/hwspinlock.txt b/Documentation/hwspinlock.txt
index 62f7d4ea6e26..61c1ee98e59f 100644
--- a/Documentation/hwspinlock.txt
+++ b/Documentation/hwspinlock.txt
@@ -48,6 +48,16 @@ independent, drivers.
      ids for predefined purposes.
      Should be called from a process context (might sleep).
 
+  int of_hwspin_lock_get_id(struct device_node *np, int index);
+   - retrieve the global lock id for an OF phandle-based specific lock.
+     This function provides a means for DT users of a hwspinlock module
+     to get the global lock id of a specific hwspinlock, so that it can
+     be requested using the normal hwspin_lock_request_specific() API.
+     The function returns a lock id number on success, -EPROBE_DEFER if
+     the hwspinlock device is not yet registered with the core, or other
+     error values.
+     Should be called from a process context (might sleep).
+
   int hwspin_lock_free(struct hwspinlock *hwlock);
    - free a previously-assigned hwspinlock; returns 0 on success, or an
      appropriate error code on failure (e.g. -EINVAL if the hwspinlock
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 461a0d739d75..f8539f624e3d 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -27,6 +27,7 @@
 #include <linux/hwspinlock.h>
 #include <linux/pm_runtime.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 
 #include "hwspinlock_internal.h"
 
@@ -257,6 +258,84 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
 }
 EXPORT_SYMBOL_GPL(__hwspin_unlock);
 
+/**
+ * of_hwspin_lock_simple_xlate - translate hwlock_spec to return a lock id
+ * @bank: the hwspinlock device bank
+ * @hwlock_spec: hwlock specifier as found in the device tree
+ *
+ * This is a simple translation function, suitable for hwspinlock platform
+ * drivers that only has a lock specifier length of 1.
+ *
+ * Returns a relative index of the lock within a specified bank on success,
+ * or -EINVAL on invalid specifier cell count.
+ */
+static inline int
+of_hwspin_lock_simple_xlate(const struct of_phandle_args *hwlock_spec)
+{
+	if (WARN_ON(hwlock_spec->args_count != 1))
+		return -EINVAL;
+
+	return hwlock_spec->args[0];
+}
+
+/**
+ * of_hwspin_lock_get_id() - get lock id for an OF phandle-based specific lock
+ * @np: device node from which to request the specific hwlock
+ * @index: index of the hwlock in the list of values
+ *
+ * This function provides a means for DT users of the hwspinlock module to
+ * get the global lock id of a specific hwspinlock using the phandle of the
+ * hwspinlock device, so that it can be requested using the normal
+ * hwspin_lock_request_specific() API.
+ *
+ * Returns the global lock id number on success, -EPROBE_DEFER if the hwspinlock
+ * device is not yet registered, -EINVAL on invalid args specifier value or an
+ * appropriate error as returned from the OF parsing of the DT client node.
+ */
+int of_hwspin_lock_get_id(struct device_node *np, int index)
+{
+	struct of_phandle_args args;
+	struct hwspinlock *hwlock;
+	struct radix_tree_iter iter;
+	void **slot;
+	int id;
+	int ret;
+
+	ret = of_parse_phandle_with_args(np, "hwlocks", "#hwlock-cells", index,
+					 &args);
+	if (ret)
+		return ret;
+
+	/* perform a sanity check of the hwspinlock device */
+	ret = -EPROBE_DEFER;
+	rcu_read_lock();
+	radix_tree_for_each_slot(slot, &hwspinlock_tree, &iter, 0) {
+		hwlock = radix_tree_deref_slot(slot);
+		if (unlikely(!hwlock))
+			continue;
+
+		if (hwlock->bank->dev->of_node == args.np) {
+			ret = 0;
+			break;
+		}
+	}
+	rcu_read_unlock();
+	if (ret < 0)
+		goto out;
+
+	id = of_hwspin_lock_simple_xlate(&args);
+	if (id < 0 || id >= hwlock->bank->num_locks) {
+		ret = -EINVAL;
+		goto out;
+	}
+	id += hwlock->bank->base_id;
+
+out:
+	of_node_put(args.np);
+	return ret ? ret : id;
+}
+EXPORT_SYMBOL_GPL(of_hwspin_lock_get_id);
+
 static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id)
 {
 	struct hwspinlock *tmp;
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index 3343298e40e8..859d673d98c8 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -26,6 +26,7 @@
 #define HWLOCK_IRQ	0x02	/* Disable interrupts, don't save state */
 
 struct device;
+struct device_node;
 struct hwspinlock;
 struct hwspinlock_device;
 struct hwspinlock_ops;
@@ -66,6 +67,7 @@ int hwspin_lock_unregister(struct hwspinlock_device *bank);
 struct hwspinlock *hwspin_lock_request(void);
 struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
 int hwspin_lock_free(struct hwspinlock *hwlock);
+int of_hwspin_lock_get_id(struct device_node *np, int index);
 int hwspin_lock_get_id(struct hwspinlock *hwlock);
 int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
 							unsigned long *);
@@ -120,6 +122,11 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
 {
 }
 
+static inline int of_hwspin_lock_get_id(struct device_node *np, int index)
+{
+	return 0;
+}
+
 static inline int hwspin_lock_get_id(struct hwspinlock *hwlock)
 {
 	return 0;
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v8 3/4] Documentation: dt: add the omap hwspinlock bindings document
  2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
  2015-03-05  2:01 ` [PATCH v8 1/4] Documentation: dt: add common bindings for hwspinlock Suman Anna
  2015-03-05  2:01 ` [PATCH v8 2/4] hwspinlock/core: add device tree support Suman Anna
@ 2015-03-05  2:01 ` Suman Anna
  2015-03-05  2:01 ` [PATCH v8 4/4] hwspinlock/omap: add support for dt nodes Suman Anna
  2015-03-12  9:24 ` [PATCH v8 0/4] hwspinlock core & omap dt support Ohad Ben-Cohen
  4 siblings, 0 replies; 12+ messages in thread
From: Suman Anna @ 2015-03-05  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

HwSpinlock IP is present only on OMAP4 and other newer SoCs,
which are all device-tree boot only. This patch adds the
DT bindings information for OMAP hwspinlock module.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
---
v8: Removed the previous information about hwlock-base-id, and added
    a reference to the base binding document.

 .../devicetree/bindings/hwlock/omap-hwspinlock.txt | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt

diff --git a/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
new file mode 100644
index 000000000000..2c9804f4f4ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
@@ -0,0 +1,26 @@
+OMAP4+ HwSpinlock Driver
+========================
+
+Required properties:
+- compatible:		Should be "ti,omap4-hwspinlock" for
+			    OMAP44xx, OMAP54xx, AM33xx, AM43xx, DRA7xx SoCs
+- reg:			Contains the hwspinlock module register address space
+			(base address and length)
+- ti,hwmods:		Name of the hwmod associated with the hwspinlock device
+- #hwlock-cells:	Should be 1. The OMAP hwspinlock users will use a
+			0-indexed relative hwlock number as the argument
+			specifier value for requesting a specific hwspinlock
+			within a hwspinlock bank.
+
+Please look at the generic hwlock binding for usage information for consumers,
+"Documentation/devicetree/bindings/hwlock/hwlock.txt"
+
+Example:
+
+/* OMAP4 */
+hwspinlock: spinlock at 4a0f6000 {
+	compatible = "ti,omap4-hwspinlock";
+	reg = <0x4a0f6000 0x1000>;
+	ti,hwmods = "spinlock";
+	#hwlock-cells = <1>;
+};
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v8 4/4] hwspinlock/omap: add support for dt nodes
  2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
                   ` (2 preceding siblings ...)
  2015-03-05  2:01 ` [PATCH v8 3/4] Documentation: dt: add the omap hwspinlock bindings document Suman Anna
@ 2015-03-05  2:01 ` Suman Anna
  2015-03-12  9:24 ` [PATCH v8 0/4] hwspinlock core & omap dt support Ohad Ben-Cohen
  4 siblings, 0 replies; 12+ messages in thread
From: Suman Anna @ 2015-03-05  2:01 UTC (permalink / raw)
  To: linux-arm-kernel

HwSpinlock IP is present only on OMAP4 and other newer SoCs,
which are all device-tree boot only. This patch adds the
base support for parsing the DT nodes, and removes the code
dealing with the traditional platform device instantiation.

Signed-off-by: Suman Anna <s-anna@ti.com>
[tony at atomide.com: ack for legacy file removal]
Acked-by: Tony Lindgren <tony@atomide.com>
---
v8: Updated to not rely on the retrieving base-id from DT node.
    Did not use match data for base_id as OMAP will be using 0
    as base id value anyways. This looks almost like the v5 version
    without the added xlate ops.

 MAINTAINERS                          |  1 -
 arch/arm/mach-omap2/Makefile         |  3 --
 arch/arm/mach-omap2/hwspinlock.c     | 60 ------------------------------------
 drivers/hwspinlock/omap_hwspinlock.c | 17 +++++++---
 4 files changed, 13 insertions(+), 68 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/hwspinlock.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8cf9a8a..f735fb3dfdd7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7035,7 +7035,6 @@ M:	Ohad Ben-Cohen <ohad@wizery.com>
 L:	linux-omap at vger.kernel.org
 S:	Maintained
 F:	drivers/hwspinlock/omap_hwspinlock.c
-F:	arch/arm/mach-omap2/hwspinlock.c
 
 OMAP MMC SUPPORT
 M:	Jarkko Lavinen <jarkko.lavinen@nokia.com>
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b83f18fcec9b..209a54007657 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -281,8 +281,5 @@ obj-y					+= $(nand-m) $(nand-y)
 
 smsc911x-$(CONFIG_SMSC911X)		:= gpmc-smsc911x.o
 obj-y					+= $(smsc911x-m) $(smsc911x-y)
-ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
-obj-y					+= hwspinlock.o
-endif
 
 obj-y					+= common-board-devices.o twl-common.o dss-common.o
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
deleted file mode 100644
index ef175acaeaa2..000000000000
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * OMAP hardware spinlock device initialization
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
- *
- * Contact: Simon Que <sque@ti.com>
- *          Hari Kanigeri <h-kanigeri2@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/hwspinlock.h>
-
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-
-static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
-	.base_id = 0,
-};
-
-static int __init hwspinlocks_init(void)
-{
-	int retval = 0;
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	const char *oh_name = "spinlock";
-	const char *dev_name = "omap_hwspinlock";
-
-	/*
-	 * Hwmod lookup will fail in case our platform doesn't support the
-	 * hardware spinlock module, so it is safe to run this initcall
-	 * on all omaps
-	 */
-	oh = omap_hwmod_lookup(oh_name);
-	if (oh == NULL)
-		return -EINVAL;
-
-	pdev = omap_device_build(dev_name, 0, oh, &omap_hwspinlock_pdata,
-				sizeof(struct hwspinlock_pdata));
-	if (IS_ERR(pdev)) {
-		pr_err("Can't build omap_device for %s:%s\n", dev_name,
-								oh_name);
-		retval = PTR_ERR(pdev);
-	}
-
-	return retval;
-}
-/* early board code might need to reserve specific hwspinlock instances */
-omap_postcore_initcall(hwspinlocks_init);
diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c
index 47a275c6ece1..e49e5eb784a6 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -1,7 +1,7 @@
 /*
  * OMAP hardware spinlock driver
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Simon Que <sque@ti.com>
  *          Hari Kanigeri <h-kanigeri2@ti.com>
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/hwspinlock.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #include "hwspinlock_internal.h"
@@ -80,14 +81,15 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = {
 
 static int omap_hwspinlock_probe(struct platform_device *pdev)
 {
-	struct hwspinlock_pdata *pdata = pdev->dev.platform_data;
+	struct device_node *node = pdev->dev.of_node;
 	struct hwspinlock_device *bank;
 	struct hwspinlock *hwlock;
 	struct resource *res;
 	void __iomem *io_base;
 	int num_locks, i, ret;
+	int base_id = 0;
 
-	if (!pdata)
+	if (!node)
 		return -ENODEV;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -141,7 +143,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 		hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
 
 	ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
-						pdata->base_id, num_locks);
+						base_id, num_locks);
 	if (ret)
 		goto reg_fail;
 
@@ -174,11 +176,18 @@ static int omap_hwspinlock_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id omap_hwspinlock_of_match[] = {
+	{ .compatible = "ti,omap4-hwspinlock", },
+	{ /* end */ },
+};
+MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
+
 static struct platform_driver omap_hwspinlock_driver = {
 	.probe		= omap_hwspinlock_probe,
 	.remove		= omap_hwspinlock_remove,
 	.driver		= {
 		.name	= "omap_hwspinlock",
+		.of_match_table = of_match_ptr(omap_hwspinlock_of_match),
 	},
 };
 
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
                   ` (3 preceding siblings ...)
  2015-03-05  2:01 ` [PATCH v8 4/4] hwspinlock/omap: add support for dt nodes Suman Anna
@ 2015-03-12  9:24 ` Ohad Ben-Cohen
  2015-03-18 21:57   ` Suman Anna
  4 siblings, 1 reply; 12+ messages in thread
From: Ohad Ben-Cohen @ 2015-03-12  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Suman,

On Thu, Mar 5, 2015 at 4:01 AM, Suman Anna <s-anna@ti.com> wrote:
> This is the latest version of the hwspinlock dt support series,
> rebased onto v4.0-rc1 and addressing the long discussion on the
> bindings in v7 [1]. I really hope that this series can make it
> into 4.1.

>From a quick glance this looks great, thanks!

> Mark,
> Can you please provide your Acked-by for the binding documents
> so that Ohad can pick up the patches for the next merge window?

That would be perfect. Once we'll have it I could move forward with
this towards 4.1.

Thanks,
Ohad.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 2/4] hwspinlock/core: add device tree support
  2015-03-05  2:01 ` [PATCH v8 2/4] hwspinlock/core: add device tree support Suman Anna
@ 2015-03-12 11:05   ` Bjorn Andersson
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Andersson @ 2015-03-12 11:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed 04 Mar 18:01 PST 2015, Suman Anna wrote:

> 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 <s-anna@ti.com>

Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-03-12  9:24 ` [PATCH v8 0/4] hwspinlock core & omap dt support Ohad Ben-Cohen
@ 2015-03-18 21:57   ` Suman Anna
  2015-04-02 16:40     ` Suman Anna
  0 siblings, 1 reply; 12+ messages in thread
From: Suman Anna @ 2015-03-18 21:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mark,

On 03/12/2015 04:24 AM, Ohad Ben-Cohen wrote:
> Hi Suman,
> 
> On Thu, Mar 5, 2015 at 4:01 AM, Suman Anna <s-anna@ti.com> wrote:
>> This is the latest version of the hwspinlock dt support series,
>> rebased onto v4.0-rc1 and addressing the long discussion on the
>> bindings in v7 [1]. I really hope that this series can make it
>> into 4.1.
> 
> From a quick glance this looks great, thanks!
> 
>> Mark,
>> Can you please provide your Acked-by for the binding documents
>> so that Ohad can pick up the patches for the next merge window?
> 
> That would be perfect. Once we'll have it I could move forward with
> this towards 4.1.

Gentle reminder. Can you please provide your ack on the bindings in this
series (Patches 1 & 3) for Ohad to queue up the series for 4.1.

Thanks
Suman

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-03-18 21:57   ` Suman Anna
@ 2015-04-02 16:40     ` Suman Anna
  2015-04-16  9:31       ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Suman Anna @ 2015-04-02 16:40 UTC (permalink / raw)
  To: linux-arm-kernel

Mark,

On 03/18/2015 04:57 PM, Suman Anna wrote:
> Hi Mark,
> 
> On 03/12/2015 04:24 AM, Ohad Ben-Cohen wrote:
>> Hi Suman,
>>
>> On Thu, Mar 5, 2015 at 4:01 AM, Suman Anna <s-anna@ti.com> wrote:
>>> This is the latest version of the hwspinlock dt support series,
>>> rebased onto v4.0-rc1 and addressing the long discussion on the
>>> bindings in v7 [1]. I really hope that this series can make it
>>> into 4.1.
>>
>> From a quick glance this looks great, thanks!
>>
>>> Mark,
>>> Can you please provide your Acked-by for the binding documents
>>> so that Ohad can pick up the patches for the next merge window?
>>
>> That would be perfect. Once we'll have it I could move forward with
>> this towards 4.1.
> 
> Gentle reminder. Can you please provide your ack on the bindings in this
> series (Patches 1 & 3) for Ohad to queue up the series for 4.1.
> 

Ping again, if you can provide your ack on these bindings and the qcom
hwmutex bindings, then Ohad can pick up both the series for 4.1. Both
series are blocked on getting the binding acks.

regards
Suman

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-04-02 16:40     ` Suman Anna
@ 2015-04-16  9:31       ` Mark Rutland
  2015-04-16 10:28         ` Ohad Ben-Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2015-04-16  9:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Apologies for the delay on this.

> > Gentle reminder. Can you please provide your ack on the bindings in this
> > series (Patches 1 & 3) for Ohad to queue up the series for 4.1.
> > 
> 
> Ping again, if you can provide your ack on these bindings and the qcom
> hwmutex bindings, then Ohad can pick up both the series for 4.1. Both
> series are blocked on getting the binding acks.

Both the bindings look sane to me, so for patches 1 and 3:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-04-16  9:31       ` Mark Rutland
@ 2015-04-16 10:28         ` Ohad Ben-Cohen
  2015-05-02  7:55           ` Ohad Ben-Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: Ohad Ben-Cohen @ 2015-04-16 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 16, 2015 at 12:31 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> Hi,
>
> Apologies for the delay on this.
>
>> > Gentle reminder. Can you please provide your ack on the bindings in this
>> > series (Patches 1 & 3) for Ohad to queue up the series for 4.1.
>> >
>>
>> Ping again, if you can provide your ack on these bindings and the qcom
>> hwmutex bindings, then Ohad can pick up both the series for 4.1. Both
>> series are blocked on getting the binding acks.
>
> Both the bindings look sane to me, so for patches 1 and 3:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>

Great, thanks a lot Mark!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v8 0/4] hwspinlock core & omap dt support
  2015-04-16 10:28         ` Ohad Ben-Cohen
@ 2015-05-02  7:55           ` Ohad Ben-Cohen
  0 siblings, 0 replies; 12+ messages in thread
From: Ohad Ben-Cohen @ 2015-05-02  7:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 16, 2015 at 1:28 PM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
> On Thu, Apr 16, 2015 at 12:31 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> > Hi,
> >
> > Apologies for the delay on this.
> >
> >> > Gentle reminder. Can you please provide your ack on the bindings in this
> >> > series (Patches 1 & 3) for Ohad to queue up the series for 4.1.
> >> >
> >>
> >> Ping again, if you can provide your ack on these bindings and the qcom
> >> hwmutex bindings, then Ohad can pick up both the series for 4.1. Both
> >> series are blocked on getting the binding acks.
> >
> > Both the bindings look sane to me, so for patches 1 and 3:
> >
> > Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> Great, thanks a lot Mark!

All 4 patches in this series have been applied, thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-05-02  7:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05  2:01 [PATCH v8 0/4] hwspinlock core & omap dt support Suman Anna
2015-03-05  2:01 ` [PATCH v8 1/4] Documentation: dt: add common bindings for hwspinlock Suman Anna
2015-03-05  2:01 ` [PATCH v8 2/4] hwspinlock/core: add device tree support Suman Anna
2015-03-12 11:05   ` Bjorn Andersson
2015-03-05  2:01 ` [PATCH v8 3/4] Documentation: dt: add the omap hwspinlock bindings document Suman Anna
2015-03-05  2:01 ` [PATCH v8 4/4] hwspinlock/omap: add support for dt nodes Suman Anna
2015-03-12  9:24 ` [PATCH v8 0/4] hwspinlock core & omap dt support Ohad Ben-Cohen
2015-03-18 21:57   ` Suman Anna
2015-04-02 16:40     ` Suman Anna
2015-04-16  9:31       ` Mark Rutland
2015-04-16 10:28         ` Ohad Ben-Cohen
2015-05-02  7:55           ` Ohad Ben-Cohen

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