All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-10-10 21:15 ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Hi,

This is an updated series addressing the review comments from the
v2 series. The hwmod patches have been dropped from the repost
as per Paul's request, they have already been queued.

The series is tested on top of v3.12-rc4 + Benoit's 3.13 DTS branch and
Tero's clock series, along with the queued hwmod patches.

Changes in 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
- OMAP AM335 support patches are unchanged from v2.
- OMAP DTS patches are unchanged from v2.

v2
- Added a new common DT binding documentation and OF helpers (Patch1),
  addressing the review comments from v1 [2]. The MSM support [1] needs
  to be reworked on top of this common patch.
- Revised OMAP DT parse support to use the new OF helper (Patch2)
- OMAP5 hwspinlock support including the hwmod entry and DT node (Patches 4, 5)
- Add AM335x support to OMAP hwspinlock driver, including a fix
  needed in driver given that AM335 spinlock module requires s/w wakeup
  (Patches 6, 7)
- AM335 DT node for spinlock, and a hwmod change to enable smart-idle
  for AM335 (Patches 8, 9). The sysc patch is not essential for AM335
  spinlock functionality, but is needed for smart-idling the IP when
  the module is enabled.
- OMAP4 DT node patch is unchanged (Patch 3)
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

[1] https://lkml.org/lkml/2013/8/14/528
[2] http://marc.info/?t=137823090300005&r=1&w=2

Suman Anna (8):
  hwspinlock/core: maintain a list of registered hwspinlock banks
  hwspinlock/core: add common dt bindings and OF helpers
  hwspinlock/omap: add support for dt nodes
  hwspinlock/omap: enable module before reading SYSSTATUS register
  hwspinlock/omap: support AM33xx
  ARM: dts: OMAP4: Add hwspinlock node
  ARM: dts: OMAP5: Add hwspinlock node
  ARM: dts: AM33XX: Add hwspinlock node

 .../devicetree/bindings/hwlock/hwlock.txt          |  49 ++++++++
 .../devicetree/bindings/hwlock/omap-hwspinlock.txt |  19 +++
 arch/arm/boot/dts/am33xx.dtsi                      |   6 +
 arch/arm/boot/dts/omap4.dtsi                       |   6 +
 arch/arm/boot/dts/omap5.dtsi                       |   6 +
 arch/arm/mach-omap2/Makefile                       |   3 -
 arch/arm/mach-omap2/hwspinlock.c                   |  60 ----------
 drivers/hwspinlock/Kconfig                         |   2 +-
 drivers/hwspinlock/hwspinlock_core.c               | 133 ++++++++++++++++++++-
 drivers/hwspinlock/hwspinlock_internal.h           |   2 +
 drivers/hwspinlock/omap_hwspinlock.c               |  38 ++++--
 include/linux/hwspinlock.h                         |  19 ++-
 12 files changed, 263 insertions(+), 80 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

-- 
1.8.4


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

* [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-10-10 21:15 ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Suman Anna

Hi,

This is an updated series addressing the review comments from the
v2 series. The hwmod patches have been dropped from the repost
as per Paul's request, they have already been queued.

The series is tested on top of v3.12-rc4 + Benoit's 3.13 DTS branch and
Tero's clock series, along with the queued hwmod patches.

Changes in 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
- OMAP AM335 support patches are unchanged from v2.
- OMAP DTS patches are unchanged from v2.

v2
- Added a new common DT binding documentation and OF helpers (Patch1),
  addressing the review comments from v1 [2]. The MSM support [1] needs
  to be reworked on top of this common patch.
- Revised OMAP DT parse support to use the new OF helper (Patch2)
- OMAP5 hwspinlock support including the hwmod entry and DT node (Patches 4, 5)
- Add AM335x support to OMAP hwspinlock driver, including a fix
  needed in driver given that AM335 spinlock module requires s/w wakeup
  (Patches 6, 7)
- AM335 DT node for spinlock, and a hwmod change to enable smart-idle
  for AM335 (Patches 8, 9). The sysc patch is not essential for AM335
  spinlock functionality, but is needed for smart-idling the IP when
  the module is enabled.
- OMAP4 DT node patch is unchanged (Patch 3)
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

[1] https://lkml.org/lkml/2013/8/14/528
[2] http://marc.info/?t=137823090300005&r=1&w=2

Suman Anna (8):
  hwspinlock/core: maintain a list of registered hwspinlock banks
  hwspinlock/core: add common dt bindings and OF helpers
  hwspinlock/omap: add support for dt nodes
  hwspinlock/omap: enable module before reading SYSSTATUS register
  hwspinlock/omap: support AM33xx
  ARM: dts: OMAP4: Add hwspinlock node
  ARM: dts: OMAP5: Add hwspinlock node
  ARM: dts: AM33XX: Add hwspinlock node

 .../devicetree/bindings/hwlock/hwlock.txt          |  49 ++++++++
 .../devicetree/bindings/hwlock/omap-hwspinlock.txt |  19 +++
 arch/arm/boot/dts/am33xx.dtsi                      |   6 +
 arch/arm/boot/dts/omap4.dtsi                       |   6 +
 arch/arm/boot/dts/omap5.dtsi                       |   6 +
 arch/arm/mach-omap2/Makefile                       |   3 -
 arch/arm/mach-omap2/hwspinlock.c                   |  60 ----------
 drivers/hwspinlock/Kconfig                         |   2 +-
 drivers/hwspinlock/hwspinlock_core.c               | 133 ++++++++++++++++++++-
 drivers/hwspinlock/hwspinlock_internal.h           |   2 +
 drivers/hwspinlock/omap_hwspinlock.c               |  38 ++++--
 include/linux/hwspinlock.h                         |  19 ++-
 12 files changed, 263 insertions(+), 80 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

-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCHv3 1/8] hwspinlock/core: maintain a list of registered hwspinlock banks
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

The hwspinlock_device structure is used for registering a bank of
locks with the driver core. The structure already contains the
necessary members to identify the bank of locks. The core does not
maintain the hwspinlock_devices itself, but maintains only a radix
tree for all the registered locks. A specific lock can be requested
by users using a global lock id, and any device-specific fields
can be retrieved through a reference to the hwspinlock_device in
each lock.

The global lock id, however, is not friendly to be requested for
users using the device-tree model. The device-tree representation
will typically have each of the hwspinlock devices represented as
a DT node, and a specific lock can be requested using the device's
phandle and a lock specifier. Add support to the core therefore to
maintain all the registered hwspinlock_devices, so that a device
can be looked up and a specific lock belonging to the device
requested through a phandle + args approach.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/hwspinlock_core.c     | 48 ++++++++++++++++++++++++++++++++
 drivers/hwspinlock/hwspinlock_internal.h |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 461a0d7..00c49d3 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -59,6 +59,11 @@ static RADIX_TREE(hwspinlock_tree, GFP_KERNEL);
  */
 static DEFINE_MUTEX(hwspinlock_tree_lock);
 
+/*
+ * A linked list for maintaining all the registered hwspinlock devices.
+ * The list is maintained in an ordered-list of the supported locks group.
+ */
+static LIST_HEAD(hwspinlock_devices);
 
 /**
  * __hwspin_trylock() - attempt to lock a specific hwspinlock
@@ -307,6 +312,40 @@ out:
 	return hwlock;
 }
 
+/*
+ * Add a new hwspinlock device to the global list, keeping the list of
+ * devices sorted by base order.
+ *
+ * Returns 0 on success, or -EBUSY if the new device overlaps with some
+ * other device's lock space.
+ */
+static int hwspinlock_device_add(struct hwspinlock_device *bank)
+{
+	struct list_head *entry = &hwspinlock_devices;
+	struct hwspinlock_device *_bank;
+	int ret = 0;
+
+	list_for_each(entry, &hwspinlock_devices) {
+		_bank = list_entry(entry, struct hwspinlock_device, list);
+		if (_bank->base_id >= bank->base_id + bank->num_locks)
+			break;
+	}
+
+	if (entry != &hwspinlock_devices &&
+	    entry->prev != &hwspinlock_devices) {
+		_bank = list_entry(entry->prev, struct hwspinlock_device, list);
+		if (_bank->base_id + _bank->num_locks > bank->base_id) {
+			dev_err(bank->dev, "hwlock space overlap, cannot add device\n");
+			ret = -EBUSY;
+		}
+	}
+
+	if (!ret)
+		list_add_tail(&bank->list, entry);
+
+	return ret;
+}
+
 /**
  * hwspin_lock_register() - register a new hw spinlock device
  * @bank: the hwspinlock device, which usually provides numerous hw locks
@@ -339,6 +378,12 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 	bank->base_id = base_id;
 	bank->num_locks = num_locks;
 
+	mutex_lock(&hwspinlock_tree_lock);
+	ret = hwspinlock_device_add(bank);
+	mutex_unlock(&hwspinlock_tree_lock);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < num_locks; i++) {
 		hwlock = &bank->lock[i];
 
@@ -355,6 +400,9 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 reg_failed:
 	while (--i >= 0)
 		hwspin_lock_unregister_single(base_id + i);
+	mutex_lock(&hwspinlock_tree_lock);
+	list_del(&bank->list);
+	mutex_unlock(&hwspinlock_tree_lock);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(hwspin_lock_register);
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h
index d26f78b..aff560c 100644
--- a/drivers/hwspinlock/hwspinlock_internal.h
+++ b/drivers/hwspinlock/hwspinlock_internal.h
@@ -53,6 +53,7 @@ struct hwspinlock {
 
 /**
  * struct hwspinlock_device - a device which usually spans numerous hwspinlocks
+ * @list: list element to link hwspinlock devices together
  * @dev: underlying device, will be used to invoke runtime PM api
  * @ops: platform-specific hwspinlock handlers
  * @base_id: id index of the first lock in this device
@@ -60,6 +61,7 @@ struct hwspinlock {
  * @lock: dynamically allocated array of 'struct hwspinlock'
  */
 struct hwspinlock_device {
+	struct list_head list;
 	struct device *dev;
 	const struct hwspinlock_ops *ops;
 	int base_id;
-- 
1.8.4


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

* [PATCHv3 1/8] hwspinlock/core: maintain a list of registered hwspinlock banks
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

The hwspinlock_device structure is used for registering a bank of
locks with the driver core. The structure already contains the
necessary members to identify the bank of locks. The core does not
maintain the hwspinlock_devices itself, but maintains only a radix
tree for all the registered locks. A specific lock can be requested
by users using a global lock id, and any device-specific fields
can be retrieved through a reference to the hwspinlock_device in
each lock.

The global lock id, however, is not friendly to be requested for
users using the device-tree model. The device-tree representation
will typically have each of the hwspinlock devices represented as
a DT node, and a specific lock can be requested using the device's
phandle and a lock specifier. Add support to the core therefore to
maintain all the registered hwspinlock_devices, so that a device
can be looked up and a specific lock belonging to the device
requested through a phandle + args approach.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/hwspinlock_core.c     | 48 ++++++++++++++++++++++++++++++++
 drivers/hwspinlock/hwspinlock_internal.h |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 461a0d7..00c49d3 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -59,6 +59,11 @@ static RADIX_TREE(hwspinlock_tree, GFP_KERNEL);
  */
 static DEFINE_MUTEX(hwspinlock_tree_lock);
 
+/*
+ * A linked list for maintaining all the registered hwspinlock devices.
+ * The list is maintained in an ordered-list of the supported locks group.
+ */
+static LIST_HEAD(hwspinlock_devices);
 
 /**
  * __hwspin_trylock() - attempt to lock a specific hwspinlock
@@ -307,6 +312,40 @@ out:
 	return hwlock;
 }
 
+/*
+ * Add a new hwspinlock device to the global list, keeping the list of
+ * devices sorted by base order.
+ *
+ * Returns 0 on success, or -EBUSY if the new device overlaps with some
+ * other device's lock space.
+ */
+static int hwspinlock_device_add(struct hwspinlock_device *bank)
+{
+	struct list_head *entry = &hwspinlock_devices;
+	struct hwspinlock_device *_bank;
+	int ret = 0;
+
+	list_for_each(entry, &hwspinlock_devices) {
+		_bank = list_entry(entry, struct hwspinlock_device, list);
+		if (_bank->base_id >= bank->base_id + bank->num_locks)
+			break;
+	}
+
+	if (entry != &hwspinlock_devices &&
+	    entry->prev != &hwspinlock_devices) {
+		_bank = list_entry(entry->prev, struct hwspinlock_device, list);
+		if (_bank->base_id + _bank->num_locks > bank->base_id) {
+			dev_err(bank->dev, "hwlock space overlap, cannot add device\n");
+			ret = -EBUSY;
+		}
+	}
+
+	if (!ret)
+		list_add_tail(&bank->list, entry);
+
+	return ret;
+}
+
 /**
  * hwspin_lock_register() - register a new hw spinlock device
  * @bank: the hwspinlock device, which usually provides numerous hw locks
@@ -339,6 +378,12 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 	bank->base_id = base_id;
 	bank->num_locks = num_locks;
 
+	mutex_lock(&hwspinlock_tree_lock);
+	ret = hwspinlock_device_add(bank);
+	mutex_unlock(&hwspinlock_tree_lock);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < num_locks; i++) {
 		hwlock = &bank->lock[i];
 
@@ -355,6 +400,9 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 reg_failed:
 	while (--i >= 0)
 		hwspin_lock_unregister_single(base_id + i);
+	mutex_lock(&hwspinlock_tree_lock);
+	list_del(&bank->list);
+	mutex_unlock(&hwspinlock_tree_lock);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(hwspin_lock_register);
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h
index d26f78b..aff560c 100644
--- a/drivers/hwspinlock/hwspinlock_internal.h
+++ b/drivers/hwspinlock/hwspinlock_internal.h
@@ -53,6 +53,7 @@ struct hwspinlock {
 
 /**
  * struct hwspinlock_device - a device which usually spans numerous hwspinlocks
+ * @list: list element to link hwspinlock devices together
  * @dev: underlying device, will be used to invoke runtime PM api
  * @ops: platform-specific hwspinlock handlers
  * @base_id: id index of the first lock in this device
@@ -60,6 +61,7 @@ struct hwspinlock {
  * @lock: dynamically allocated array of 'struct hwspinlock'
  */
 struct hwspinlock_device {
+	struct list_head list;
 	struct device *dev;
 	const struct hwspinlock_ops *ops;
 	int base_id;
-- 
1.8.4

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

* [PATCHv3 2/8] hwspinlock/core: add common dt bindings and OF helpers
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

This patch adds the necessary documentation and OF helpers to
represent a hwlock device and use/request locks in a device-tree
build.

All the platform-specific hwlock driver implementations need the
number of locks and associated base id for registering the locks
present within the device with the driver core. The number of locks
is represented by 'hwlock-num-locks' property in DT bindings. A
property for base id is not needed in DT binding, as it can be
satisfied using a phandle + args specifier.

OF helpers have been added to the driver core to read the common
'hwlock-num-locks' property, and to request a specific lock using
the phandle + args specifier. The latter function is different
from the existing non-DT function, in that the specifier is
relative to the hwlock device instead of being a global lock id
registered with the core.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 .../devicetree/bindings/hwlock/hwlock.txt          | 49 +++++++++++++
 drivers/hwspinlock/hwspinlock_core.c               | 85 +++++++++++++++++++++-
 include/linux/hwspinlock.h                         | 19 ++++-
 3 files changed, 148 insertions(+), 5 deletions(-)
 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 0000000..3fef8cc
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/hwlock.txt
@@ -0,0 +1,49 @@
+Generic hwlock bindings
+=======================
+
+Generic bindings that are common to all the hwlock platform specific driver
+implementations, the retrieved values are used for registering the device
+specific parameters with the hwspinlock core.
+
+The validity and need of these common properties may vary from one platform
+implementation to another. The platform specific bindings should explicitly
+state if a property is mandatory or optional. Please look through the
+individual platform specific hwlock binding documentations for identifying
+the applicable properties.
+
+Common properties:
+- hwlock-num-locks:	Number of locks present in a hwlock device. This
+			property is needed on hwlock devices, where the number
+			of supported locks within a hwlock device cannot be
+			read from a register.
+
+Hwlock Users:
+=============
+
+Nodes that require specific hwlock(s) should specify them using one or more
+properties, each containing a phandle to the hwlock node and a 0-indexed
+relative hwlock number within that hwlock node. Multiple hwlocks can be
+requested using an array of the phandle and hwlock number specifier tuple.
+
+1. Example of a node using a single specific hwlock:
+
+The following example has a node requesting third hwlock in the bank
+defined by the node hwlock1.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>;
+		...
+	};
+
+2. Example of a node using multiple specific hwlocks:
+
+The following example has a node requesting two hwlocks, third hwlock within
+the hwlock device node 'hwlock1', and the first hwlock within the hwlock
+device node 'hwlock2'.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>, <&hwlock2 0>;
+		...
+	};
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 00c49d3..3f1089a 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -1,7 +1,7 @@
 /*
  * Hardware spinlock framework
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Ohad Ben-Cohen <ohad@wizery.com>
  *
@@ -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"
 
@@ -262,6 +263,33 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
 }
 EXPORT_SYMBOL_GPL(__hwspin_unlock);
 
+/**
+ * of_hwspin_lock_get_num_locks() - OF helper to retrieve number of locks
+ * @dn: device node pointer
+ *
+ * This is an OF helper function that can be called by the underlying
+ * platform-specific implementations, to retrieve the number of locks
+ * present within a hwspinlock device instance. The hwlock-num-locks
+ * DT property may be optional for some platforms, while mandatory for
+ * some others, so this function is typically called only by needed
+ * platform-specific implementations.
+ *
+ * Returns a positive number of locks on success, -ENODEV on generic
+ * failure or an appropriate error code as returned by the OF layer
+ */
+int of_hwspin_lock_get_num_locks(struct device_node *dn)
+{
+	unsigned int val;
+	int ret = -ENODEV;
+
+	ret = of_property_read_u32(dn, "hwlock-num-locks", &val);
+	if (!ret)
+		ret = val ? val : -ENODEV;
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(of_hwspin_lock_get_num_locks);
+
 static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id)
 {
 	struct hwspinlock *tmp;
@@ -589,6 +617,61 @@ out:
 EXPORT_SYMBOL_GPL(hwspin_lock_request_specific);
 
 /**
+ * of_hwspin_lock_request_specific() - request a OF phandle-based specific lock
+ * @np: device node from which to request the specific hwlock
+ * @propname: property name containing hwlock specifier(s)
+ * @index: index of the hwlock
+ *
+ * This function is the OF equivalent of hwspin_lock_request_specific(). This
+ * function provides a means for users of the hwspinlock module to request a
+ * specific hwspinlock using the phandle of the hwspinlock device. The requested
+ * lock number is indexed relative to the hwspinlock device, unlike the
+ * hwspin_lock_request_specific() which is an absolute lock number.
+ *
+ * Returns the address of the assigned hwspinlock, or NULL on error
+ */
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+					const char *propname, int index)
+{
+	struct hwspinlock_device *bank;
+	struct of_phandle_args args;
+	unsigned int id;
+	int ret;
+
+	ret = of_parse_phandle_with_fixed_args(np, propname, 1, index, &args);
+	if (ret) {
+		pr_warn("%s: can't parse hwlocks property of node '%s[%d]' ret = %d\n",
+			__func__, np->full_name, index, ret);
+		return NULL;
+	}
+
+	/* sanity check (this shouldn't happen) */
+	WARN_ON(args.args_count != 1);
+
+	mutex_lock(&hwspinlock_tree_lock);
+	list_for_each_entry(bank, &hwspinlock_devices, list)
+		if (bank->dev->of_node == args.np)
+			break;
+	mutex_unlock(&hwspinlock_tree_lock);
+	if (&bank->list == &hwspinlock_devices) {
+		pr_warn("%s: requested hwspinlock device %s is not registered\n",
+			__func__, args.np->full_name);
+		return NULL;
+	}
+
+	id = args.args[0];
+	if (id >= bank->num_locks) {
+		pr_warn("%s: requested lock %d is out of range [0, %d]\n",
+			__func__, id, bank->num_locks - 1);
+		return NULL;
+	}
+
+	id += bank->base_id;
+	return hwspin_lock_request_specific(id);
+}
+EXPORT_SYMBOL(of_hwspin_lock_request_specific);
+
+/**
  * hwspin_lock_free() - free a specific hwspinlock
  * @hwlock: the specific hwspinlock to free
  *
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index 3343298..4bd36be 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -1,7 +1,7 @@
 /*
  * Hardware spinlock public header
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Ohad Ben-Cohen <ohad@wizery.com>
  *
@@ -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;
@@ -60,11 +61,14 @@ struct hwspinlock_pdata {
 
 #if defined(CONFIG_HWSPINLOCK) || defined(CONFIG_HWSPINLOCK_MODULE)
 
+int of_hwspin_lock_get_num_locks(struct device_node *dn);
 int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 		const struct hwspinlock_ops *ops, int base_id, int num_locks);
 int hwspin_lock_unregister(struct hwspinlock_device *bank);
 struct hwspinlock *hwspin_lock_request(void);
 struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+		const char *propname, int index);
 int hwspin_lock_free(struct hwspinlock *hwlock);
 int hwspin_lock_get_id(struct hwspinlock *hwlock);
 int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
@@ -80,9 +84,9 @@ void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
  * code path get compiled away. This way, if CONFIG_HWSPINLOCK is not
  * required on a given setup, users will still work.
  *
- * The only exception is hwspin_lock_register/hwspin_lock_unregister, with which
- * we _do_ want users to fail (no point in registering hwspinlock instances if
- * the framework is not available).
+ * The only exception is hwspin_lock_register/hwspin_lock_unregister and
+ * associated OF helpers, with which we _do_ want users to fail (no point
+ * in registering hwspinlock instances if the framework is not available).
  *
  * Note: ERR_PTR(-ENODEV) will still be considered a success for NULL-checking
  * users. Others, which care, can still check this with IS_ERR.
@@ -97,6 +101,13 @@ static inline struct hwspinlock *hwspin_lock_request_specific(unsigned int id)
 	return ERR_PTR(-ENODEV);
 }
 
+static inline
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+						const char *propname, int index)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline int hwspin_lock_free(struct hwspinlock *hwlock)
 {
 	return 0;
-- 
1.8.4


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

* [PATCHv3 2/8] hwspinlock/core: add common dt bindings and OF helpers
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

This patch adds the necessary documentation and OF helpers to
represent a hwlock device and use/request locks in a device-tree
build.

All the platform-specific hwlock driver implementations need the
number of locks and associated base id for registering the locks
present within the device with the driver core. The number of locks
is represented by 'hwlock-num-locks' property in DT bindings. A
property for base id is not needed in DT binding, as it can be
satisfied using a phandle + args specifier.

OF helpers have been added to the driver core to read the common
'hwlock-num-locks' property, and to request a specific lock using
the phandle + args specifier. The latter function is different
from the existing non-DT function, in that the specifier is
relative to the hwlock device instead of being a global lock id
registered with the core.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 .../devicetree/bindings/hwlock/hwlock.txt          | 49 +++++++++++++
 drivers/hwspinlock/hwspinlock_core.c               | 85 +++++++++++++++++++++-
 include/linux/hwspinlock.h                         | 19 ++++-
 3 files changed, 148 insertions(+), 5 deletions(-)
 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 0000000..3fef8cc
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/hwlock.txt
@@ -0,0 +1,49 @@
+Generic hwlock bindings
+=======================
+
+Generic bindings that are common to all the hwlock platform specific driver
+implementations, the retrieved values are used for registering the device
+specific parameters with the hwspinlock core.
+
+The validity and need of these common properties may vary from one platform
+implementation to another. The platform specific bindings should explicitly
+state if a property is mandatory or optional. Please look through the
+individual platform specific hwlock binding documentations for identifying
+the applicable properties.
+
+Common properties:
+- hwlock-num-locks:	Number of locks present in a hwlock device. This
+			property is needed on hwlock devices, where the number
+			of supported locks within a hwlock device cannot be
+			read from a register.
+
+Hwlock Users:
+=============
+
+Nodes that require specific hwlock(s) should specify them using one or more
+properties, each containing a phandle to the hwlock node and a 0-indexed
+relative hwlock number within that hwlock node. Multiple hwlocks can be
+requested using an array of the phandle and hwlock number specifier tuple.
+
+1. Example of a node using a single specific hwlock:
+
+The following example has a node requesting third hwlock in the bank
+defined by the node hwlock1.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>;
+		...
+	};
+
+2. Example of a node using multiple specific hwlocks:
+
+The following example has a node requesting two hwlocks, third hwlock within
+the hwlock device node 'hwlock1', and the first hwlock within the hwlock
+device node 'hwlock2'.
+
+	node {
+		...
+		hwlocks = <&hwlock1 2>, <&hwlock2 0>;
+		...
+	};
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 00c49d3..3f1089a 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -1,7 +1,7 @@
 /*
  * Hardware spinlock framework
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Ohad Ben-Cohen <ohad@wizery.com>
  *
@@ -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"
 
@@ -262,6 +263,33 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
 }
 EXPORT_SYMBOL_GPL(__hwspin_unlock);
 
+/**
+ * of_hwspin_lock_get_num_locks() - OF helper to retrieve number of locks
+ * @dn: device node pointer
+ *
+ * This is an OF helper function that can be called by the underlying
+ * platform-specific implementations, to retrieve the number of locks
+ * present within a hwspinlock device instance. The hwlock-num-locks
+ * DT property may be optional for some platforms, while mandatory for
+ * some others, so this function is typically called only by needed
+ * platform-specific implementations.
+ *
+ * Returns a positive number of locks on success, -ENODEV on generic
+ * failure or an appropriate error code as returned by the OF layer
+ */
+int of_hwspin_lock_get_num_locks(struct device_node *dn)
+{
+	unsigned int val;
+	int ret = -ENODEV;
+
+	ret = of_property_read_u32(dn, "hwlock-num-locks", &val);
+	if (!ret)
+		ret = val ? val : -ENODEV;
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(of_hwspin_lock_get_num_locks);
+
 static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id)
 {
 	struct hwspinlock *tmp;
@@ -589,6 +617,61 @@ out:
 EXPORT_SYMBOL_GPL(hwspin_lock_request_specific);
 
 /**
+ * of_hwspin_lock_request_specific() - request a OF phandle-based specific lock
+ * @np: device node from which to request the specific hwlock
+ * @propname: property name containing hwlock specifier(s)
+ * @index: index of the hwlock
+ *
+ * This function is the OF equivalent of hwspin_lock_request_specific(). This
+ * function provides a means for users of the hwspinlock module to request a
+ * specific hwspinlock using the phandle of the hwspinlock device. The requested
+ * lock number is indexed relative to the hwspinlock device, unlike the
+ * hwspin_lock_request_specific() which is an absolute lock number.
+ *
+ * Returns the address of the assigned hwspinlock, or NULL on error
+ */
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+					const char *propname, int index)
+{
+	struct hwspinlock_device *bank;
+	struct of_phandle_args args;
+	unsigned int id;
+	int ret;
+
+	ret = of_parse_phandle_with_fixed_args(np, propname, 1, index, &args);
+	if (ret) {
+		pr_warn("%s: can't parse hwlocks property of node '%s[%d]' ret = %d\n",
+			__func__, np->full_name, index, ret);
+		return NULL;
+	}
+
+	/* sanity check (this shouldn't happen) */
+	WARN_ON(args.args_count != 1);
+
+	mutex_lock(&hwspinlock_tree_lock);
+	list_for_each_entry(bank, &hwspinlock_devices, list)
+		if (bank->dev->of_node == args.np)
+			break;
+	mutex_unlock(&hwspinlock_tree_lock);
+	if (&bank->list == &hwspinlock_devices) {
+		pr_warn("%s: requested hwspinlock device %s is not registered\n",
+			__func__, args.np->full_name);
+		return NULL;
+	}
+
+	id = args.args[0];
+	if (id >= bank->num_locks) {
+		pr_warn("%s: requested lock %d is out of range [0, %d]\n",
+			__func__, id, bank->num_locks - 1);
+		return NULL;
+	}
+
+	id += bank->base_id;
+	return hwspin_lock_request_specific(id);
+}
+EXPORT_SYMBOL(of_hwspin_lock_request_specific);
+
+/**
  * hwspin_lock_free() - free a specific hwspinlock
  * @hwlock: the specific hwspinlock to free
  *
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index 3343298..4bd36be 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -1,7 +1,7 @@
 /*
  * Hardware spinlock public header
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Ohad Ben-Cohen <ohad@wizery.com>
  *
@@ -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;
@@ -60,11 +61,14 @@ struct hwspinlock_pdata {
 
 #if defined(CONFIG_HWSPINLOCK) || defined(CONFIG_HWSPINLOCK_MODULE)
 
+int of_hwspin_lock_get_num_locks(struct device_node *dn);
 int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
 		const struct hwspinlock_ops *ops, int base_id, int num_locks);
 int hwspin_lock_unregister(struct hwspinlock_device *bank);
 struct hwspinlock *hwspin_lock_request(void);
 struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+		const char *propname, int index);
 int hwspin_lock_free(struct hwspinlock *hwlock);
 int hwspin_lock_get_id(struct hwspinlock *hwlock);
 int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
@@ -80,9 +84,9 @@ void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
  * code path get compiled away. This way, if CONFIG_HWSPINLOCK is not
  * required on a given setup, users will still work.
  *
- * The only exception is hwspin_lock_register/hwspin_lock_unregister, with which
- * we _do_ want users to fail (no point in registering hwspinlock instances if
- * the framework is not available).
+ * The only exception is hwspin_lock_register/hwspin_lock_unregister and
+ * associated OF helpers, with which we _do_ want users to fail (no point
+ * in registering hwspinlock instances if the framework is not available).
  *
  * Note: ERR_PTR(-ENODEV) will still be considered a success for NULL-checking
  * users. Others, which care, can still check this with IS_ERR.
@@ -97,6 +101,13 @@ static inline struct hwspinlock *hwspin_lock_request_specific(unsigned int id)
 	return ERR_PTR(-ENODEV);
 }
 
+static inline
+struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np,
+						const char *propname, int index)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline int hwspin_lock_free(struct hwspinlock *hwlock)
 {
 	return 0;
-- 
1.8.4


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

* [PATCHv3 3/8] hwspinlock/omap: add support for dt nodes
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

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>
---
 .../devicetree/bindings/hwlock/omap-hwspinlock.txt | 19 +++++++
 arch/arm/mach-omap2/Makefile                       |  3 --
 arch/arm/mach-omap2/hwspinlock.c                   | 60 ----------------------
 drivers/hwspinlock/omap_hwspinlock.c               | 17 ++++--
 4 files changed, 32 insertions(+), 67 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
 delete mode 100644 arch/arm/mach-omap2/hwspinlock.c

diff --git a/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
new file mode 100644
index 0000000..8eb6965
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
@@ -0,0 +1,19 @@
+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
+
+
+Example:
+
+/* OMAP4 */
+hwspinlock: spinlock@4a0f6000 {
+	compatible = "ti,omap4-hwspinlock";
+	reg = <0x4a0f6000 0x1000>;
+	ti,hwmods = "spinlock";
+};
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 020079e..a2312f2 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -297,9 +297,6 @@ obj-y					+= $(smc91x-m) $(smc91x-y)
 
 smsc911x-$(CONFIG_SMSC911X)		:= gpmc-smsc911x.o
 obj-y					+= $(smsc911x-m) $(smsc911x-y)
-ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
-obj-y					+= hwspinlock.o
-endif
 
 emac-$(CONFIG_TI_DAVINCI_EMAC)		:= am35xx-emac.o
 obj-y					+= $(emac-m) $(emac-y)
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
deleted file mode 100644
index ef175ac..0000000
--- 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 292869c..349c5aa 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-2013 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_device.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);
@@ -128,7 +130,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
-						pdata->base_id, num_locks);
+						base_id, num_locks);
 	if (ret)
 		goto reg_fail;
 
@@ -161,12 +163,19 @@ 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",
 		.owner	= THIS_MODULE,
+		.of_match_table = omap_hwspinlock_of_match,
 	},
 };
 
-- 
1.8.4


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

* [PATCHv3 3/8] hwspinlock/omap: add support for dt nodes
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

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>
---
 .../devicetree/bindings/hwlock/omap-hwspinlock.txt | 19 +++++++
 arch/arm/mach-omap2/Makefile                       |  3 --
 arch/arm/mach-omap2/hwspinlock.c                   | 60 ----------------------
 drivers/hwspinlock/omap_hwspinlock.c               | 17 ++++--
 4 files changed, 32 insertions(+), 67 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
 delete mode 100644 arch/arm/mach-omap2/hwspinlock.c

diff --git a/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
new file mode 100644
index 0000000..8eb6965
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/omap-hwspinlock.txt
@@ -0,0 +1,19 @@
+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
+
+
+Example:
+
+/* OMAP4 */
+hwspinlock: spinlock@4a0f6000 {
+	compatible = "ti,omap4-hwspinlock";
+	reg = <0x4a0f6000 0x1000>;
+	ti,hwmods = "spinlock";
+};
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 020079e..a2312f2 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -297,9 +297,6 @@ obj-y					+= $(smc91x-m) $(smc91x-y)
 
 smsc911x-$(CONFIG_SMSC911X)		:= gpmc-smsc911x.o
 obj-y					+= $(smsc911x-m) $(smsc911x-y)
-ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
-obj-y					+= hwspinlock.o
-endif
 
 emac-$(CONFIG_TI_DAVINCI_EMAC)		:= am35xx-emac.o
 obj-y					+= $(emac-m) $(emac-y)
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
deleted file mode 100644
index ef175ac..0000000
--- 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 292869c..349c5aa 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-2013 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_device.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);
@@ -128,7 +130,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
-						pdata->base_id, num_locks);
+						base_id, num_locks);
 	if (ret)
 		goto reg_fail;
 
@@ -161,12 +163,19 @@ 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",
 		.owner	= THIS_MODULE,
+		.of_match_table = omap_hwspinlock_of_match,
 	},
 };
 
-- 
1.8.4

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

* [PATCHv3 4/8] hwspinlock/omap: enable module before reading SYSSTATUS register
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

The number of hwspinlocks are determined based on the value read
from the IP block's SYSSTATUS register. However, the module may
not be enabled and clocked, and the read may result in a bus error.

This particular issue is seen rather easily on AM33XX, since the
module wakeup is software controlled, and it is disabled out of
reset. Make sure the module is enabled and clocked before reading
the SYSSTATUS register.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/omap_hwspinlock.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c
index 349c5aa..9495d76 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -100,10 +100,23 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	if (!io_base)
 		return -ENOMEM;
 
+	/*
+	 * make sure the module is enabled and clocked before reading
+	 * the module SYSSTATUS register
+	 */
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+
 	/* Determine number of locks */
 	i = readl(io_base + SYSSTATUS_OFFSET);
 	i >>= SPINLOCK_NUMLOCKS_BIT_OFFSET;
 
+	/*
+	 * runtime PM will make sure the clock of this module is
+	 * enabled again iff at least one lock is requested
+	 */
+	pm_runtime_put(&pdev->dev);
+
 	/* one of the four lsb's must be set, and nothing else */
 	if (hweight_long(i & 0xf) != 1 || i > 8) {
 		ret = -EINVAL;
@@ -123,12 +136,6 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)
 		hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
 
-	/*
-	 * runtime PM will make sure the clock of this module is
-	 * enabled iff at least one lock is requested
-	 */
-	pm_runtime_enable(&pdev->dev);
-
 	ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
 						base_id, num_locks);
 	if (ret)
@@ -137,9 +144,9 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	return 0;
 
 reg_fail:
-	pm_runtime_disable(&pdev->dev);
 	kfree(bank);
 iounmap_base:
+	pm_runtime_disable(&pdev->dev);
 	iounmap(io_base);
 	return ret;
 }
-- 
1.8.4


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

* [PATCHv3 4/8] hwspinlock/omap: enable module before reading SYSSTATUS register
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

The number of hwspinlocks are determined based on the value read
from the IP block's SYSSTATUS register. However, the module may
not be enabled and clocked, and the read may result in a bus error.

This particular issue is seen rather easily on AM33XX, since the
module wakeup is software controlled, and it is disabled out of
reset. Make sure the module is enabled and clocked before reading
the SYSSTATUS register.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/omap_hwspinlock.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c
index 349c5aa..9495d76 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -100,10 +100,23 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	if (!io_base)
 		return -ENOMEM;
 
+	/*
+	 * make sure the module is enabled and clocked before reading
+	 * the module SYSSTATUS register
+	 */
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+
 	/* Determine number of locks */
 	i = readl(io_base + SYSSTATUS_OFFSET);
 	i >>= SPINLOCK_NUMLOCKS_BIT_OFFSET;
 
+	/*
+	 * runtime PM will make sure the clock of this module is
+	 * enabled again iff at least one lock is requested
+	 */
+	pm_runtime_put(&pdev->dev);
+
 	/* one of the four lsb's must be set, and nothing else */
 	if (hweight_long(i & 0xf) != 1 || i > 8) {
 		ret = -EINVAL;
@@ -123,12 +136,6 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)
 		hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
 
-	/*
-	 * runtime PM will make sure the clock of this module is
-	 * enabled iff at least one lock is requested
-	 */
-	pm_runtime_enable(&pdev->dev);
-
 	ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
 						base_id, num_locks);
 	if (ret)
@@ -137,9 +144,9 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
 	return 0;
 
 reg_fail:
-	pm_runtime_disable(&pdev->dev);
 	kfree(bank);
 iounmap_base:
+	pm_runtime_disable(&pdev->dev);
 	iounmap(io_base);
 	return ret;
 }
-- 
1.8.4

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

* [PATCHv3 5/8] hwspinlock/omap: support AM33xx
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

AM33XX device family also supports hwspinlocks. The IP
is identical to that of OMAP4/OMAP5, except for the
number of locks.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
index 70637d2..34ff9cd 100644
--- a/drivers/hwspinlock/Kconfig
+++ b/drivers/hwspinlock/Kconfig
@@ -10,7 +10,7 @@ menu "Hardware Spinlock drivers"
 
 config HWSPINLOCK_OMAP
 	tristate "OMAP Hardware Spinlock device"
-	depends on ARCH_OMAP4 || SOC_OMAP5
+	depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_AM33XX
 	select HWSPINLOCK
 	help
 	  Say y here to support the OMAP Hardware Spinlock device (firstly
-- 
1.8.4


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

* [PATCHv3 5/8] hwspinlock/omap: support AM33xx
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

AM33XX device family also supports hwspinlocks. The IP
is identical to that of OMAP4/OMAP5, except for the
number of locks.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/hwspinlock/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
index 70637d2..34ff9cd 100644
--- a/drivers/hwspinlock/Kconfig
+++ b/drivers/hwspinlock/Kconfig
@@ -10,7 +10,7 @@ menu "Hardware Spinlock drivers"
 
 config HWSPINLOCK_OMAP
 	tristate "OMAP Hardware Spinlock device"
-	depends on ARCH_OMAP4 || SOC_OMAP5
+	depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_AM33XX
 	select HWSPINLOCK
 	help
 	  Say y here to support the OMAP Hardware Spinlock device (firstly
-- 
1.8.4


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

* [PATCHv3 6/8] ARM: dts: OMAP4: Add hwspinlock node
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Add the hwspinlock device tree node for OMAP4 family
of SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 45708e1..74db751 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -248,6 +248,12 @@
 			clock-frequency = <48000000>;
 		};
 
+		hwspinlock: spinlock@4a0f6000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x4a0f6000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		i2c1: i2c@48070000 {
 			compatible = "ti,omap4-i2c";
 			reg = <0x48070000 0x100>;
-- 
1.8.4


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

* [PATCHv3 6/8] ARM: dts: OMAP4: Add hwspinlock node
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Suman Anna

Add the hwspinlock device tree node for OMAP4 family
of SoCs.

Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/omap4.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 45708e1..74db751 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -248,6 +248,12 @@
 			clock-frequency = <48000000>;
 		};
 
+		hwspinlock: spinlock@4a0f6000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x4a0f6000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		i2c1: i2c@48070000 {
 			compatible = "ti,omap4-i2c";
 			reg = <0x48070000 0x100>;
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCHv3 7/8] ARM: dts: OMAP5: Add hwspinlock node
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Add the hwspinlock device tree node for OMAP5 SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 86295d2..2a98a59 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -275,6 +275,12 @@
 			ti,hwmods = "i2c5";
 		};
 
+		hwspinlock: spinlock@4a0f6000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x4a0f6000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		mcspi1: spi@48098000 {
 			compatible = "ti,omap4-mcspi";
 			reg = <0x48098000 0x200>;
-- 
1.8.4


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

* [PATCHv3 7/8] ARM: dts: OMAP5: Add hwspinlock node
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Add the hwspinlock device tree node for OMAP5 SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 86295d2..2a98a59 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -275,6 +275,12 @@
 			ti,hwmods = "i2c5";
 		};
 
+		hwspinlock: spinlock@4a0f6000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x4a0f6000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		mcspi1: spi@48098000 {
 			compatible = "ti,omap4-mcspi";
 			reg = <0x48098000 0x200>;
-- 
1.8.4

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

* [PATCHv3 8/8] ARM: dts: AM33XX: Add hwspinlock node
  2013-10-10 21:15 ` Suman Anna
@ 2013-10-10 21:15   ` Suman Anna
  -1 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Add the hwspinlock device tree node for AM33xx family
of SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/boot/dts/am33xx.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 8692490..49dfb86 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -285,6 +285,12 @@
 			status = "disabled";
 		};
 
+		hwspinlock: spinlock@480ca000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x480ca000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		wdt2: wdt@44e35000 {
 			compatible = "ti,omap3-wdt";
 			ti,hwmods = "wd_timer2";
-- 
1.8.4


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

* [PATCHv3 8/8] ARM: dts: AM33XX: Add hwspinlock node
@ 2013-10-10 21:15   ` Suman Anna
  0 siblings, 0 replies; 24+ messages in thread
From: Suman Anna @ 2013-10-10 21:15 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna

Add the hwspinlock device tree node for AM33xx family
of SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/boot/dts/am33xx.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 8692490..49dfb86 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -285,6 +285,12 @@
 			status = "disabled";
 		};
 
+		hwspinlock: spinlock@480ca000 {
+			compatible = "ti,omap4-hwspinlock";
+			reg = <0x480ca000 0x1000>;
+			ti,hwmods = "spinlock";
+		};
+
 		wdt2: wdt@44e35000 {
 			compatible = "ti,omap3-wdt";
 			ti,hwmods = "wd_timer2";
-- 
1.8.4

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

* Re: [PATCHv3 6/8] ARM: dts: OMAP4: Add hwspinlock node
  2013-10-10 21:15   ` Suman Anna
  (?)
@ 2013-10-11 23:41   ` Tony Lindgren
  2013-10-29 20:59     ` Tony Lindgren
  -1 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2013-10-11 23:41 UTC (permalink / raw)
  To: Suman Anna
  Cc: Ohad Ben-Cohen, Mark Rutland, Benoit Cousson, Kumar Gala,
	Paul Walmsley, linux-kernel, linux-omap, devicetree

* Suman Anna <s-anna@ti.com> [131010 14:24]:
> Add the hwspinlock device tree node for OMAP4 family
> of SoCs.

Suman, can you please post the .dts changes separately from
the driver changes next time so driver maintainers don't
accidentally pick them up. That leads to unnecessary merge
conflicts with the .dts files.

Thanks,

Tony

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

* Re: [PATCHv3 6/8] ARM: dts: OMAP4: Add hwspinlock node
  2013-10-11 23:41   ` Tony Lindgren
@ 2013-10-29 20:59     ` Tony Lindgren
  0 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2013-10-29 20:59 UTC (permalink / raw)
  To: Suman Anna
  Cc: Ohad Ben-Cohen, Mark Rutland, Benoit Cousson, Kumar Gala,
	Paul Walmsley, linux-kernel, linux-omap, devicetree

* Tony Lindgren <tony@atomide.com> [131011 16:49]:
> * Suman Anna <s-anna@ti.com> [131010 14:24]:
> > Add the hwspinlock device tree node for OMAP4 family
> > of SoCs.
> 
> Suman, can you please post the .dts changes separately from
> the driver changes next time so driver maintainers don't
> accidentally pick them up. That leads to unnecessary merge
> conflicts with the .dts files.

Actually I'll pick patches 6 - 8 of this series into
omap-for-v3.13/dt branch as that fixes some boot time warnings
we're seeing without them.

Regards,

Tony

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

* Re: [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-11-12 18:16   ` Anna, Suman
  0 siblings, 0 replies; 24+ messages in thread
From: Anna, Suman @ 2013-11-12 18:16 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel, linux-omap, devicetree, Suman Anna


> Hi,
>
> This is an updated series addressing the review comments from the
> v2 series. The hwmod patches have been dropped from the repost
> as per Paul's request, they have already been queued.

Mark,

Any comments on this series? Tony has picked up the OMAP DTS patches for 
3.13, and so
the "ti,omap4-hwspinlock" compatible string is showing up as 
undocumented in linux-next.
How do you want me to proceed here? I will be separating out the 
bindings into separate patches
in the future.

regards
Suman

>
> The series is tested on top of v3.12-rc4 + Benoit's 3.13 DTS branch and
> Tero's clock series, along with the queued hwmod patches.
>
> Changes in 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
> - OMAP AM335 support patches are unchanged from v2.
> - OMAP DTS patches are unchanged from v2.
>
> v2
> - Added a new common DT binding documentation and OF helpers (Patch1),
>    addressing the review comments from v1 [2]. The MSM support [1] needs
>    to be reworked on top of this common patch.
> - Revised OMAP DT parse support to use the new OF helper (Patch2)
> - OMAP5 hwspinlock support including the hwmod entry and DT node (Patches 4, 5)
> - Add AM335x support to OMAP hwspinlock driver, including a fix
>    needed in driver given that AM335 spinlock module requires s/w wakeup
>    (Patches 6, 7)
> - AM335 DT node for spinlock, and a hwmod change to enable smart-idle
>    for AM335 (Patches 8, 9). The sysc patch is not essential for AM335
>    spinlock functionality, but is needed for smart-idling the IP when
>    the module is enabled.
> - OMAP4 DT node patch is unchanged (Patch 3)
> 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
>
> [1] https://lkml.org/lkml/2013/8/14/528
> [2] http://marc.info/?t=137823090300005&r=1&w=2
>
> Suman Anna (8):
>    hwspinlock/core: maintain a list of registered hwspinlock banks
>    hwspinlock/core: add common dt bindings and OF helpers
>    hwspinlock/omap: add support for dt nodes
>    hwspinlock/omap: enable module before reading SYSSTATUS register
>    hwspinlock/omap: support AM33xx
>    ARM: dts: OMAP4: Add hwspinlock node
>    ARM: dts: OMAP5: Add hwspinlock node
>    ARM: dts: AM33XX: Add hwspinlock node
>
>   .../devicetree/bindings/hwlock/hwlock.txt          |  49 ++++++++
>   .../devicetree/bindings/hwlock/omap-hwspinlock.txt |  19 +++
>   arch/arm/boot/dts/am33xx.dtsi                      |   6 +
>   arch/arm/boot/dts/omap4.dtsi                       |   6 +
>   arch/arm/boot/dts/omap5.dtsi                       |   6 +
>   arch/arm/mach-omap2/Makefile                       |   3 -
>   arch/arm/mach-omap2/hwspinlock.c                   |  60 ----------
>   drivers/hwspinlock/Kconfig                         |   2 +-
>   drivers/hwspinlock/hwspinlock_core.c               | 133 ++++++++++++++++++++-
>   drivers/hwspinlock/hwspinlock_internal.h           |   2 +
>   drivers/hwspinlock/omap_hwspinlock.c               |  38 ++++--
>   include/linux/hwspinlock.h                         |  19 ++-
>   12 files changed, 263 insertions(+), 80 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
>


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

* Re: [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-11-12 18:16   ` Anna, Suman
  0 siblings, 0 replies; 24+ messages in thread
From: Anna, Suman @ 2013-11-12 18:16 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Mark Rutland
  Cc: Tony Lindgren, Benoit Cousson, Kumar Gala, Paul Walmsley,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Suman Anna


> Hi,
>
> This is an updated series addressing the review comments from the
> v2 series. The hwmod patches have been dropped from the repost
> as per Paul's request, they have already been queued.

Mark,

Any comments on this series? Tony has picked up the OMAP DTS patches for 
3.13, and so
the "ti,omap4-hwspinlock" compatible string is showing up as 
undocumented in linux-next.
How do you want me to proceed here? I will be separating out the 
bindings into separate patches
in the future.

regards
Suman

>
> The series is tested on top of v3.12-rc4 + Benoit's 3.13 DTS branch and
> Tero's clock series, along with the queued hwmod patches.
>
> Changes in 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
> - OMAP AM335 support patches are unchanged from v2.
> - OMAP DTS patches are unchanged from v2.
>
> v2
> - Added a new common DT binding documentation and OF helpers (Patch1),
>    addressing the review comments from v1 [2]. The MSM support [1] needs
>    to be reworked on top of this common patch.
> - Revised OMAP DT parse support to use the new OF helper (Patch2)
> - OMAP5 hwspinlock support including the hwmod entry and DT node (Patches 4, 5)
> - Add AM335x support to OMAP hwspinlock driver, including a fix
>    needed in driver given that AM335 spinlock module requires s/w wakeup
>    (Patches 6, 7)
> - AM335 DT node for spinlock, and a hwmod change to enable smart-idle
>    for AM335 (Patches 8, 9). The sysc patch is not essential for AM335
>    spinlock functionality, but is needed for smart-idling the IP when
>    the module is enabled.
> - OMAP4 DT node patch is unchanged (Patch 3)
> 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
>
> [1] https://lkml.org/lkml/2013/8/14/528
> [2] http://marc.info/?t=137823090300005&r=1&w=2
>
> Suman Anna (8):
>    hwspinlock/core: maintain a list of registered hwspinlock banks
>    hwspinlock/core: add common dt bindings and OF helpers
>    hwspinlock/omap: add support for dt nodes
>    hwspinlock/omap: enable module before reading SYSSTATUS register
>    hwspinlock/omap: support AM33xx
>    ARM: dts: OMAP4: Add hwspinlock node
>    ARM: dts: OMAP5: Add hwspinlock node
>    ARM: dts: AM33XX: Add hwspinlock node
>
>   .../devicetree/bindings/hwlock/hwlock.txt          |  49 ++++++++
>   .../devicetree/bindings/hwlock/omap-hwspinlock.txt |  19 +++
>   arch/arm/boot/dts/am33xx.dtsi                      |   6 +
>   arch/arm/boot/dts/omap4.dtsi                       |   6 +
>   arch/arm/boot/dts/omap5.dtsi                       |   6 +
>   arch/arm/mach-omap2/Makefile                       |   3 -
>   arch/arm/mach-omap2/hwspinlock.c                   |  60 ----------
>   drivers/hwspinlock/Kconfig                         |   2 +-
>   drivers/hwspinlock/hwspinlock_core.c               | 133 ++++++++++++++++++++-
>   drivers/hwspinlock/hwspinlock_internal.h           |   2 +
>   drivers/hwspinlock/omap_hwspinlock.c               |  38 ++++--
>   include/linux/hwspinlock.h                         |  19 ++-
>   12 files changed, 263 insertions(+), 80 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
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-11-13  9:36     ` Mark Rutland
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Rutland @ 2013-11-13  9:36 UTC (permalink / raw)
  To: Anna, Suman
  Cc: Ohad Ben-Cohen, Tony Lindgren, Benoit Cousson, Kumar Gala,
	Paul Walmsley, linux-kernel, linux-omap, devicetree

On Tue, Nov 12, 2013 at 06:16:42PM +0000, Anna, Suman wrote:
> 
> > Hi,
> >
> > This is an updated series addressing the review comments from the
> > v2 series. The hwmod patches have been dropped from the repost
> > as per Paul's request, they have already been queued.
> 
> Mark,

Hi Suman,

> 
> Any comments on this series? Tony has picked up the OMAP DTS patches for 
> 3.13, and so
> the "ti,omap4-hwspinlock" compatible string is showing up as 
> undocumented in linux-next.
> How do you want me to proceed here? I will be separating out the 
> bindings into separate patches
> in the future.

The only thing I note that I'm not so keen on is that the
hwlock-specifier is always one cell, rather than using a #hwlock-cells
property on the provider (even if we required it to be <1> for the
moment and just failed if it wasn't).

If possible, I would like an amendment to always use #hwlock-cells, but
otherwise this looks fine to me. Feel free to add my Ack:

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

Thanks,
Mark.

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

* Re: [PATCHv3 0/8]  omap hwspinlock dt support
@ 2013-11-13  9:36     ` Mark Rutland
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Rutland @ 2013-11-13  9:36 UTC (permalink / raw)
  To: Anna, Suman
  Cc: Ohad Ben-Cohen, Tony Lindgren, Benoit Cousson, Kumar Gala,
	Paul Walmsley, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Nov 12, 2013 at 06:16:42PM +0000, Anna, Suman wrote:
> 
> > Hi,
> >
> > This is an updated series addressing the review comments from the
> > v2 series. The hwmod patches have been dropped from the repost
> > as per Paul's request, they have already been queued.
> 
> Mark,

Hi Suman,

> 
> Any comments on this series? Tony has picked up the OMAP DTS patches for 
> 3.13, and so
> the "ti,omap4-hwspinlock" compatible string is showing up as 
> undocumented in linux-next.
> How do you want me to proceed here? I will be separating out the 
> bindings into separate patches
> in the future.

The only thing I note that I'm not so keen on is that the
hwlock-specifier is always one cell, rather than using a #hwlock-cells
property on the provider (even if we required it to be <1> for the
moment and just failed if it wasn't).

If possible, I would like an amendment to always use #hwlock-cells, but
otherwise this looks fine to me. Feel free to add my Ack:

Acked-by: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-11-13  9:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10 21:15 [PATCHv3 0/8] omap hwspinlock dt support Suman Anna
2013-10-10 21:15 ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 1/8] hwspinlock/core: maintain a list of registered hwspinlock banks Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 2/8] hwspinlock/core: add common dt bindings and OF helpers Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 3/8] hwspinlock/omap: add support for dt nodes Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 4/8] hwspinlock/omap: enable module before reading SYSSTATUS register Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 5/8] hwspinlock/omap: support AM33xx Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 6/8] ARM: dts: OMAP4: Add hwspinlock node Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-11 23:41   ` Tony Lindgren
2013-10-29 20:59     ` Tony Lindgren
2013-10-10 21:15 ` [PATCHv3 7/8] ARM: dts: OMAP5: " Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-10-10 21:15 ` [PATCHv3 8/8] ARM: dts: AM33XX: " Suman Anna
2013-10-10 21:15   ` Suman Anna
2013-11-12 18:16 ` [PATCHv3 0/8] omap hwspinlock dt support Anna, Suman
2013-11-12 18:16   ` Anna, Suman
2013-11-13  9:36   ` Mark Rutland
2013-11-13  9:36     ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.