Skip to contentSkip to conversation

ux500: Adding support for u8500 Hsem functionality.

PATCH In review mathieu.poirier at linaro.org 3 participants 3 messages Apr 8, 2011 – Apr 9, 2011 Hardware spinlock core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ux500: Adding support for u8500 Hsem functionality.

From: Mathieu J. Poirier <[email protected]>

The driver is folded in the hwspinlock framework and implements protocol 1 without interrupts.

---
 drivers/hwspinlock/Kconfig      |   23 +++-
 drivers/hwspinlock/Makefile     |    1 +
 drivers/hwspinlock/u8500_hsem.c |  241 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 261 insertions(+), 4 deletions(-)
 create mode 100644 drivers/hwspinlock/u8500_hsem.c
drivers/hwspinlock/Kconfig +19 -4
index 1f29bab..aa62055 100644
@@ -2,10 +2,11 @@
 # Generic HWSPINLOCK framework
 #
 
-config HWSPINLOCK
-	tristate "Generic Hardware Spinlock framework"
-	depends on ARCH_OMAP4
-	help
+menuconfig HWSPINLOCK
+	bool "Generic Hardware Spinlock framework"
+	depends on ARCH_OMAP4 || ARCH_U8500
+	default n
+	---help---
 	  Say y here to support the generic hardware spinlock framework.
 	  You only need to enable this if you have hardware spinlock module
 	  on your system (usually only relevant if your system has remote slave
@@ -13,6 +14,8 @@ config HWSPINLOCK
 
 	  If unsure, say N.
 
+if HWSPINLOCK 
+
 config HWSPINLOCK_OMAP
 	tristate "OMAP Hardware Spinlock device"
 	depends on HWSPINLOCK && ARCH_OMAP4
@@ -21,3 +24,15 @@ config HWSPINLOCK_OMAP
 	  introduced in OMAP4).
 
 	  If unsure, say N.
+
+config HSEM_U8500
+	tristate "STE Hardware Semaphore functionality"
+	depends on HWSPINLOCK && ARCH_U8500
+	help
+	  Say y here to support the STE Hardware Semaphore functionality.  They
+	  provide a synchronisation mechanism for the various processor on the 
+	  SoC.
+
+	  If unsure, say N.
+
+endif # HWSPINLOCK 
drivers/hwspinlock/Makefile +1 -0
index 5729a3f..93eb64b 100644
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
 obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
+obj-$(CONFIG_HSEM_U8500)		+= u8500_hsem.o
drivers/hwspinlock/u8500_hsem.c new file +241 -0

241 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 ux500: Adding support for u8500 Hsem functionality.

drivers/hwspinlock/u8500_hsem.c line 35

Quoted 12 lines · mathieu.poirier at linaro.org
drivers/hwspinlock/u8500_hsem.c new file +12 -0
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/bitops.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/hwspinlock.h>
+#include <linux/platform_device.h>
+#include <asm/mach-types.h>

Do you need all the above? I don't think at least mach-types.h is required.

#2 lore raw
In reply to mathieu.poirier at linaro.org

Hi Mathieu,

On Fri, Apr 8, 2011 at 11:28 PM, <[email protected]> wrote:
...

Quoted 4 lines

+ * Author: Mathieu Poirier <[email protected]>
+ * Heavily borrowed from the work of :
+ * ? Simon Que <[email protected]>
+ * ? Hddari Kanigeri <[email protected]>

s/Hddari/Hari/

Quoted 6 lines

+ ? ? ? platform_set_drvdata(pdev, state);
+
+ ? ? ? /* no pm needed for HSem but required to comply
+ ? ? ? ?* with hwspilock core.
+ ? ? ? ?*/
+ ? ? ? pm_runtime_enable(&pdev->dev);

You seem to have removed the calls to pm_runtime_disable() throughout the driver, is that on purpose ?

You should see an "Unbalanced pm_runtime_enable!" warning about this if you tried rmmod'ing and insmod'ing the driver again.

And just a minor comment if you're submitting a v2: you have a bunch of trailing whitespaces; try checkpatch to spot them easily.

Thanks,
Ohad.