RE: [PATCH 3/4 v2] omap: hwspinlock: Created driver for OMAP hardware spinlock.
Sanjeev, Please see my comments below: +EXPORT_SYMBOL(hwspinlock_trylock); [sp] The code is almost duplicated in the functions hwspinlock_trylock() and hwspinlock_lock(). The difference being try-once/ try-multiple. I believe one function with additional arg - say limit - should be sufficient. If there is need to abstract additional arg, you can define macros for the same. [SQ] Good point, done. + for (i = 0; i hwspinlock_state.num_locks !found; i++) { + if (!hwspinlock_array[i].is_allocated) { + found = true; + handle = hwspinlock_array[i]; + } [sp] Starting from index 0 every time can be quite time consuming esp. in the situations where we need spinlocks. IRQs being disabled for long can impact the performance. Wouldn't a used and free list be better alternative? [SQ] Done. + if (WARN_ON(hwspinlock_array[id].is_allocated)) + goto exit; + [sp] if (id hwspinlock_state.num_locks) then ?? [SQ] Good catch. Fixed. +EXPORT_SYMBOL(hwspinlock_request_specific); [sp] What if either of the request funcs are called before hwspinlock_probe() gets executed? [SQ] Added a check for that. +/* Probe function */ +static int __devinit hwspinlock_probe(struct platform_device *pdev) { + struct resource *res; + void __iomem *io_base; + int id; + [sp] Extra line? [SQ] Yeah, got rid of it. + void __iomem *sysstatus_reg; [sp] can be combined with op_base declaration. [SQ] Okay done. +static struct platform_driver hwspinlock_driver = { + .probe = hwspinlock_probe, + .driver = { + .name = hwspinlock, [sp] Extra TAB? [SQ] No, it's one level down. Notice the extra { }'s. Thanks, Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/4 v2] omap: hwspinlock: uncomment the hwmod part for hwspinlock
arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) [sp] I did not see this file in any of the master, for-next or pm branches. [SQ] This will go into Santosh's omap4_next branch for upstreaming. That branch contains the file. Thanks, Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/4 v2] omap: hwspinlock: Add HWSPINLOCK base address information in omap44xx.h
+#define OMAP44XX_SPINLOCK_BASE (L4_44XX_BASE + 0xF6000) + [sp] Can this be simply OMAP4_SPINLOCK_BASE equiv to OMAP4_MMUx_BASE defined just above. OR is this address specific to OMAP44xx only? (I haven't checked what is the the convention followed in rest of the file) [SQ] Yes, I'll change it to OMAP4_ Thanks, Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3 v3] omap: hwspinlock: uncomment the hwmod part for hwspinlock
uncomment the hwmod part for hwspinlock Signed-off-by: Simon Que s...@ti.com Signed-off-by: Hari Kanigeri h-kanige...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index bb0c870..81e3f3f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5797,7 +5797,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* omap44xx_smartreflex_iva_hwmod, */ /* omap44xx_smartreflex_mpu_hwmod, */ /* spinlock class */ -/* omap44xx_spinlock_hwmod, */ + omap44xx_spinlock_hwmod, /* timer class */ omap44xx_timer1_hwmod, omap44xx_timer2_hwmod, -- 1.7.0 0001-uncomment-the-hwmod-part-for-hwspinlock.patch Description: 0001-uncomment-the-hwmod-part-for-hwspinlock.patch
[PATCH 2/3 v3] omap: hwspinlock: Created driver for OMAP hardware spinlock
Created driver for OMAP hardware spinlock. - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each IP. It will pass spinlock register offset info to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in register offset info passed in device initialization. It uses hwmod to obtain the base address of the hardware spinlock module. Then it reads info from the registers. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address calculated from the base address and lock offsets. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function. int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com Signed-off-by: Hari Kanigeri h-kanige...@ti.com Signed-off-by: Krishnamoorthy, Balaji T balaj...@ti.com --- arch/arm/mach-omap2/hwspinlocks.c| 65 + arch/arm/plat-omap/hwspinlock.c | 347 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 53 3 files changed, 465 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..154fc40 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,65 @@ +/* + * OMAP hardware spinlock device initialization + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/module.h +#include linux/interrupt.h +#include linux/device.h +#include linux/delay.h +#include linux/io.h +#include linux/slab.h + +#include plat/hwspinlock.h +#include plat/omap_device.h +#include plat/omap_hwmod.h + + +struct omap_device_pm_latency omap_spinlock_latency[] = { + { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + } +}; + +/* Initialization function */ +int __init hwspinlocks_init(void) +{ + int retval = 0; + + struct omap_hwmod *oh; + const char *oh_name, *pdev_name; + + oh_name = spinlock; + oh = omap_hwmod_lookup(oh_name); + if (WARN_ON(oh == NULL)) + return -EINVAL; + + pdev_name = hwspinlock; + + /* Pass data to device initialization */ + omap_device_build(pdev_name, 0, oh, NULL, 0, omap_spinlock_latency, + ARRAY_SIZE(omap_spinlock_latency), false); + + return retval; +} +postcore_initcall(hwspinlocks_init); diff --git a/arch/arm/plat-omap/hwspinlock.c b/arch/arm/plat-omap/hwspinlock.c new
[PATCH 3/3 v3] omap: hwspinlock: Patch to add support to build hwspinlock modules
Patch to add support to build hwspinlock modules Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 ++ arch/arm/plat-omap/Makefile |2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 630f880..fe49340 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -176,3 +176,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index ea8e555..c9f79d5 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile @@ -34,3 +34,5 @@ obj-$(CONFIG_OMAP_REMOTE_PROC) += remoteproc.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o obj-$(CONFIG_OMAP_PM) += omap-pm.o + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o -- 1.7.0 0003-Patch-to-add-support-to-build-hwspinlock-modules.patch Description: 0003-Patch-to-add-support-to-build-hwspinlock-modules.patch
RE: [PATCH 3/5] omap:hwspinlock-added hwspinlock driver
Nishanth, just a curious question: Is there no h/w spinlock implementation for other architectures in linux? I mean the concept does not seem unique for a heterogenous processor environments now a days.. if it does exist, maybe we have two options: * extend standard spinlock architecture to handle h/w spinlocks as well * establish a new framework for h/w spinlocks.. Thank you for bringing that to my attention. I did a quick search and haven't found any hwspinlock module elsewhere. But should there be hwspinlocks over multiple architectures in the future, we can definitely consider something like the two solutions that you suggested, so that they can be used from platform-independent kernel code. However, right now we can develop OMAP hwspinlock independently of that. Thanks, Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4 v2] omap: hwspinlock: uncomment the hwmod part for hwspinlock
uncomment the hwmod part for hwspinlock Signed-off-by: Simon Que s...@ti.com Signed-off-by: Hari Kanigeri h-kanige...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index bb0c870..81e3f3f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5797,7 +5797,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* omap44xx_smartreflex_iva_hwmod, */ /* omap44xx_smartreflex_mpu_hwmod, */ /* spinlock class */ -/* omap44xx_spinlock_hwmod, */ + omap44xx_spinlock_hwmod, /* timer class */ omap44xx_timer1_hwmod, omap44xx_timer2_hwmod, -- 1.7.0 0001-omap-hwspinlock-uncomment-the-hwmod-part-for-hwspinlock.patch Description: 0001-omap-hwspinlock-uncomment-the-hwmod-part-for-hwspinlock.patch
[PATCH 2/4 v2] omap: hwspinlock: Add HWSPINLOCK base address information in omap44xx.h
Add HWSPINLOCK base address information in omap44xx.h Signed-off-by: Simon Que s...@ti.com Signed-off-by: Hari Kanigeri h-kanige...@ti.com --- arch/arm/plat-omap/include/plat/omap44xx.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h index 8b3f12f..8016508 100644 --- a/arch/arm/plat-omap/include/plat/omap44xx.h +++ b/arch/arm/plat-omap/include/plat/omap44xx.h @@ -52,5 +52,7 @@ #define OMAP4_MMU1_BASE0x55082000 #define OMAP4_MMU2_BASE0x4A066000 +#define OMAP44XX_SPINLOCK_BASE (L4_44XX_BASE + 0xF6000) + #endif /* __ASM_ARCH_OMAP44XX_H */ -- 1.7.1 binzC1jWudfvR.bin Description: 0002-omap-hwspinlock-Add-HWSPINLOCK-base-address-information-in-omap44xx..patch
[PATCH 3/4 v2] omap: hwspinlock: Created driver for OMAP hardware spinlock.
Created driver for OMAP hardware spinlock. - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each IP. It will pass spinlock register offset info to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in register offset info passed in device initialization. It uses hwmod to obtain the base address of the hardware spinlock module. Then it reads info from the registers. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address calculated from the base address and lock offsets. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function. int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com Signed-off-by: Hari Kanigeri h-kanige...@ti.com Signed-off-by: Krishnamoorthy, Balaji T balaj...@ti.com --- arch/arm/mach-omap2/hwspinlocks.c| 65 + arch/arm/plat-omap/hwspinlock.c | 353 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 47 3 files changed, 465 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..154fc40 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,65 @@ +/* + * OMAP hardware spinlock device initialization + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/module.h +#include linux/interrupt.h +#include linux/device.h +#include linux/delay.h +#include linux/io.h +#include linux/slab.h + +#include plat/hwspinlock.h +#include plat/omap_device.h +#include plat/omap_hwmod.h + + +struct omap_device_pm_latency omap_spinlock_latency[] = { + { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + } +}; + +/* Initialization function */ +int __init hwspinlocks_init(void) +{ + int retval = 0; + + struct omap_hwmod *oh; + const char *oh_name, *pdev_name; + + oh_name = spinlock; + oh = omap_hwmod_lookup(oh_name); + if (WARN_ON(oh == NULL)) + return -EINVAL; + + pdev_name = hwspinlock; + + /* Pass data to device initialization */ + omap_device_build(pdev_name, 0, oh, NULL, 0, omap_spinlock_latency, + ARRAY_SIZE(omap_spinlock_latency), false); + + return retval; +} +postcore_initcall(hwspinlocks_init); diff --git a/arch/arm/plat-omap/hwspinlock.c b/arch/arm/plat-omap/hwspinlock.c new
[PATCH 4/4 v2] omap: hwspinlock: Patch to add support to build hwspinlock modules
Patch to add support to build hwspinlock modules Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 ++ arch/arm/plat-omap/Makefile |2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 630f880..fe49340 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -176,3 +176,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index ea8e555..c9f79d5 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile @@ -34,3 +34,5 @@ obj-$(CONFIG_OMAP_REMOTE_PROC) += remoteproc.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o obj-$(CONFIG_OMAP_PM) += omap-pm.o + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o -- 1.7.0 binGYDapB62mR.bin Description: 0004-omap-hwspinlock-Patch-to-add-support-to-build-hwspinlock-modules.patch
[PATCH] omap: hwspinlock: Added hwspinlock driver
Hello, This is the patch submission for the hardware spinlock driver. I will not be available for the next 4 weeks. Please contact Hari Kanigeri (h-kanige...@ti.com) instead. Thanks, Simon == From 509bd1a2e7e5c1a6af3248742e0d53ca5f9fd066 Mon Sep 17 00:00:00 2001 From: Simon Que s...@ti.com Date: Wed, 23 Jun 2010 18:40:30 -0500 Subject: [PATCH] omap: hwspinlock: Added hwspinlock driver Created driver for OMAP hardware spinlock. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each IP. It will pass spinlock register offset info to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in register offset info passed in device initialization. It uses hwmod to obtain the base address of the hardware spinlock module. Then it reads info from the registers. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address calculated from the base address and lock offsets. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function. int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 + arch/arm/mach-omap2/hwspinlocks.c| 71 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/plat-omap/Makefile |3 +- arch/arm/plat-omap/hwspinlock.c | 335 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 29 +++ arch/arm/plat-omap/include/plat/omap44xx.h |2 + 7 files changed, 442 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..5f5c87b 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..58a6483 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,71 @@ +/* + * OMAP hardware spinlock device initialization + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/module.h +#include linux/interrupt.h +#include linux/device.h +#include linux/delay.h
RE: [RFC v.3] omap: hwspinlock: Added hwspinlock driver
Thanks Santosh, I have responded to your feedback. +#include plat/hwspinlock.h + No need of new line here. +#include plat/omap_device.h +#include plat/omap_hwmod.h Alright I will fix that. +/* Initialization function */ +int __init hwspinlocks_init(void) Since it's only init, can this go to arch/arm/mach-omap2/omap4-commin.c ? No, since it uses local #defines, we would prefer to put it in its own file. + if (retval == HWSPINLOCK_BUSY) + pm_runtime_put(handle-pdev-dev); What resource is getting release with above ?? That was a mistake actually. It should not be called because the device will be locked by the time that code is reached. Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC v.4] omap: hwspinlock: Added hwspinlock driver
Hello, This is the fourth and final RFC for the hardware spinlock driver. I have incorporated some changes and fixes based on Santosh's comments. Please give your comments. Thanks, Simon = From d4794eff60e5e509581fedaf2660b0d2d92463ab Mon Sep 17 00:00:00 2001 From: Simon Que s...@ti.com Date: Wed, 23 Jun 2010 18:40:30 -0500 Subject: [PATCH] omap: hwspinlock: Added hwspinlock driver Created driver for OMAP hardware spinlock. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each hardware spinlock. It will pass spinlock register addresses to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in data passed in device initialization. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address provided by the device initialization. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 + arch/arm/mach-omap2/hwspinlocks.c| 71 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/plat-omap/Makefile |3 +- arch/arm/plat-omap/hwspinlock.c | 295 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 29 +++ arch/arm/plat-omap/include/plat/omap44xx.h |2 + 7 files changed, 402 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..5f5c87b 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..58a6483 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,71 @@ +/* + * OMAP hardware spinlock device initialization + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/module.h +#include linux/interrupt.h +#include linux/device.h +#include linux/delay.h +#include linux/io.h +#include linux/slab.h + +#include plat/hwspinlock.h +#include plat/omap_device.h +#include plat/omap_hwmod.h + +/* Spinlock
[RFC v.3] omap: hwspinlock: Added hwspinlock driver
Hello, I have updated my draft of the spinlock driver patch based on feedback from the Linux-OMAP community. The changes I have made since RFC v.2: - Only one device initialization per IP (in this case, OMAP4) -- this means the driver's probe func will only be called once. - Spinlock address is obtained by calling platform_get_resource from driver, and ioremapped by driver. This makes better use of hwmod. - Device initialization only provides spinlock register offsets, not mapped or raw addresses. - Determining number of locks and lock register addresses is done in driver, not device init. - Calling pm_runtime_get and pm_runtime_put when acquiring/releasing lock. - Fixed file header comment: hwspinlocks.c should be called device initialization not driver Please see attached patch or inline patch below, and provide feedback. I hope to submit the finalized patch on Tuesday July 6. Thanks, Simon From 86223480bb46177b4c625b01122d0a4f40eb95c0 Mon Sep 17 00:00:00 2001 From: Simon Que s...@ti.com Date: Wed, 23 Jun 2010 18:40:30 -0500 Subject: [PATCH] omap: hwspinlock: Added hwspinlock driver Created driver for OMAP hardware spinlock. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each hardware spinlock. It will pass spinlock register addresses to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in data passed in device initialization. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address provided by the device initialization. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 + arch/arm/mach-omap2/hwspinlocks.c| 72 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/plat-omap/Makefile |3 +- arch/arm/plat-omap/hwspinlock.c | 298 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 29 +++ arch/arm/plat-omap/include/plat/omap44xx.h |2 + 7 files changed, 406 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..5f5c87b 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..f0b212b --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,72 @@ +/* + * OMAP hardware spinlock device initialization + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + *
[RFC v.2] omap: hwspinlock: Added hwspinlock driver
Hello, Thanks for all your comments and feedback. I've updated the patch with changes based on the feedback I've received: - Switched to using hwmod. I enabled the hwmod entry for spinlock in omap_hwmod_44xx_data. - Removed reserved/unreserved distinction. Removed CONFIG option for number of reserved locks as well. The reservation will be done at runtime as Kevin and Benoit have suggested. The new API simply provides for reservation of spinlock w/ specific ID or the next available spinlock. - Simplified #define names -- removed the HWSPINLOCK prefix. - Added OMAP4 conditional to Makefiles for building hwspinlock. - Moved base address definition of spinlock register to omap44xx.h - Base addresses are mapped using ioremap and accessed using readl/writel. - Removed the irqsave/restore functions. Now there are only lock/trylock/unlock, without the irq and preempt disable/enable. This keeps it simple, and we can add the irq/preempt disable/enable as a future enhancement. Regarding reserving locks: how do we use the board code to reserve locks? This is not familiar to us. Please see attached patch, or inline patch contents below. Thanks, Simon From a1aa1f5a85814bdf924d140b664a3305224392b2 Mon Sep 17 00:00:00 2001 From: Simon Que s...@ti.com Date: Wed, 23 Jun 2010 18:40:30 -0500 Subject: [PATCH] omap: hwspinlock: Added hwspinlock driver Created driver for OMAP hardware spinlock. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization uses hwmod to configure the devices. One device will be created for each hardware spinlock. It will pass spinlock register addresses to the driver. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in data passed in device initialization. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address provided by the device initialization. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of a hardware spinlock. It returns the handle to the next available (unallocated) spinlock. If no more locks are available, it returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a specific hardware spinlock. This allows the system to use a specific spinlock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. Otherwise it returns a spinlock handle. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Signed-off-by: Simon Que s...@ti.com --- arch/arm/mach-omap2/Makefile |2 + arch/arm/mach-omap2/hwspinlocks.c| 122 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +- arch/arm/plat-omap/Makefile |3 +- arch/arm/plat-omap/hwspinlock.c | 250 ++ arch/arm/plat-omap/include/plat/hwspinlock.h | 30 +++ arch/arm/plat-omap/include/plat/omap44xx.h |2 + 7 files changed, 409 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/hwspinlocks.c create mode 100644 arch/arm/plat-omap/hwspinlock.c create mode 100644 arch/arm/plat-omap/include/plat/hwspinlock.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..5f5c87b 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..868edea --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,122 @@ +/* + * OMAP hardware spinlock driver + * + * Copyright (C) 2010 Texas
RE: [RFC] omap: hwspinlock: Added hwspinlock driver
Benoit, Thanks for the comments. My responses are below. Why using a Kconfig option in that case? You can reserve the locks at run time based on other driver request. The goal of the hwspinlock is to protect data shared between various processors inside OMAP4 like ipu, iva, dsp and mpu. So in anycase the syslink driver can request the needed locks at init time on behalf of the dsp or the ipu. Since you don't even know the number of locks because it is determined at init time, you cannot know at build time that information. You should add an API to reserve some locks at run time instead of doing that. The reserved locks are not meant for syslink use only. It will also be used by i2c, which does not go through syslink. If we were to follow your suggestion, who should call the function to establish number of reserved locks? We can instead think of the config option as requesting a particular number of reserved locks for system use, independent of how many locks actually exist in the system. How many reserved locks there are, and which driver is using which reserved locks -- that is a system integration issue that should be sorted out at a higher level. It is a details, but why are you renaming the registers with the HW prefix? The module name is spinlock not hwspinlock. The names should be that: #define SPINLOCK_REVISION0x #define SPINLOCK_SYSCONFIG 0x0010 #define SPINLOCK_SYSSTATUS 0x0014 #define SPINLOCK_LOCK_BASE 0x0800 or even that since you are not sharing these defines: #define REVISION0x #define SYSCONFIG 0x0010 #define SYSSTATUS 0x0014 #define LOCK_BASE 0x0800 Every IPs are by definition an HW module, so that information is useless. You have a good point, I will make this change. Since it is a new driver for a new IP, why don't you use directly the omap_device / omap_hwmod abstraction? hwmod for spinlock is not currently ready. We want to integrate with the platform/driver/device system for now, as a first step. hwmod can be implemented later. Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFC] omap: hwspinlock: Added hwspinlock driver
Santosh, This reservation KCONFIG isn't necessary. HWSPINLOCK IP is not really for very generic use but specific usages where you need to protect the data between independent softwares running on different masters. For other Linux only side software even with dual core, kernel spinlock library is sufficient. We will consider this. Are you building this for all OMAP's ?? Move this base address to plat/omap44xx.h and use it from there OMAP2_L4_IO_ADDRESS this should not be used anymore. Rather, use ioremap and readl/writel Good points, we'll implement these. Why do you have two files ? This IP is not part of OMAP1 and all the code can go in mach-omap and can be exported from there. Are you suggesting we use a library approach instead of a driver approach? We want to make this expandable in the future. If something in the underlying hardware changes with OMAP5, OMAP6, etc, we only need to update the device initialization file. The driver can remain unchanged. Thank you, Simon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] omap:
Hi, We are introducing a kernel driver for hardware spinlock, called hwspinlock. It is designed to interface with the OMAP4 hardware spinlock module. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization will set aside some spinlocks as reserved for special-purpose use. All other locks can be used by anyone. This is configurable using a Kconfig option. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in data passed in device initialization. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address provided by the device initialization. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. int hwspinlock_lock_irqsave(struct hwspinlock *, unsigned long *); Same as hwspinlock_lock, but disables interrupts and preemption int hwspinlock_trylock_irqsave(struct hwspinlock *, unsigned long *); Same as hwspinlock_trylock, but disables interrupts and preemption int hwspinlock_unlock_irqrestore(struct hwspinlock *, unsigned long); Same as hwspinlock_unlock, but restores interrupts and preemption struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of an unreserved hardware spinlock. If no more locks are available, returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a reserved hardware spinlock. This allows the system to use a specific reserved lock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Please see the below patch contents, or the attached patch, and provide feedback. Signed-off-by: Simon Que s...@ti.com Cc: Hari Kanigeri h-kanige...@ti.com = diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 9f73d79..a13c188 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -182,3 +182,13 @@ config OMAP3_SDRC_AC_TIMING wish to say no. Selecting yes without understanding what is going on could result in system crashes; +config OMAP_HWSPINLOCK_NUM_RESERVED + int Number of hardware spinlocks reserved for system use + depends on ARCH_OMAP + default 8 + range 0 32 + help + Choose a number of hardware spinlocks to reserve for internal use. + The rest will be unreserved and availble for general use. Make + that the number of reserved locks does not exceed the total number + available locks. diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..14af19a 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-y += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..de813a0 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,126 @@ +/* + * OMAP hardware spinlock driver + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor,
[RFC] omap: hwspinlock: Added hwspinlock driver
Hi, We are introducing a kernel driver for hardware spinlock, called hwspinlock. It is designed to interface with the OMAP4 hardware spinlock module. This driver supports: - Reserved spinlocks for internal use - Dynamic allocation of unreserved locks - Lock, unlock, and trylock functions, with or without disabling irqs/preempt - Registered as a platform device driver The device initialization will set aside some spinlocks as reserved for special-purpose use. All other locks can be used by anyone. This is configurable using a Kconfig option. The device initialization file is: arch/arm/mach-omap2/hwspinlocks.c The driver takes in data passed in device initialization. The function hwspinlock_probe() initializes the array of spinlock structures, each containing a spinlock register address provided by the device initialization. The device driver file is: arch/arm/plat-omap/hwspinlock.c Here's an API summary: int hwspinlock_lock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will keep trying until it succeeds. This is a blocking function. int hwspinlock_trylock(struct hwspinlock *); Attempt to lock a hardware spinlock. If it is busy, the function will return BUSY. If it succeeds in locking, the function will return ACQUIRED. This is a non-blocking function int hwspinlock_unlock(struct hwspinlock *); Unlock a hardware spinlock. int hwspinlock_lock_irqsave(struct hwspinlock *, unsigned long *); Same as hwspinlock_lock, but disables interrupts and preemption int hwspinlock_trylock_irqsave(struct hwspinlock *, unsigned long *); Same as hwspinlock_trylock, but disables interrupts and preemption int hwspinlock_unlock_irqrestore(struct hwspinlock *, unsigned long); Same as hwspinlock_unlock, but restores interrupts and preemption struct hwspinlock *hwspinlock_request(void); Provides for dynamic allocation of an unreserved hardware spinlock. If no more locks are available, returns NULL. struct hwspinlock *hwspinlock_request_specific(unsigned int); Provides for static allocation of a reserved hardware spinlock. This allows the system to use a specific reserved lock, identified by an ID. If the ID is invalid or if the desired lock is already allocated, this will return NULL. int hwspinlock_free(struct hwspinlock *); Frees an allocated hardware spinlock (either reserved or unreserved). Please see the below patch contents, or the attached patch, and provide feedback. Signed-off-by: Simon Que s...@ti.com Cc: Hari Kanigeri h-kanige...@ti.com = diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 9f73d79..a13c188 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -182,3 +182,13 @@ config OMAP3_SDRC_AC_TIMING wish to say no. Selecting yes without understanding what is going on could result in system crashes; +config OMAP_HWSPINLOCK_NUM_RESERVED + int Number of hardware spinlocks reserved for system use + depends on ARCH_OMAP + default 8 + range 0 32 + help + Choose a number of hardware spinlocks to reserve for internal use. + The rest will be unreserved and availble for general use. Make + that the number of reserved locks does not exceed the total number + available locks. diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 6725b3a..14af19a 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -170,3 +170,5 @@ obj-y += $(nand-m) $(nand-y) smc91x-$(CONFIG_SMC91X):= gpmc-smc91x.o obj-y += $(smc91x-m) $(smc91x-y) + +obj-y += hwspinlocks.o \ No newline at end of file diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c new file mode 100644 index 000..de813a0 --- /dev/null +++ b/arch/arm/mach-omap2/hwspinlocks.c @@ -0,0 +1,126 @@ +/* + * OMAP hardware spinlock driver + * + * Copyright (C) 2010 Texas Instruments. All rights reserved. + * + * Contact: Simon Que s...@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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor,
Recall: [RFC] omap:
Que, Simon would like to recall the message, [RFC] omap: .-- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html