Skip to content

Commit

Permalink
hwspinlock/omap: add support for dt nodes
Browse files Browse the repository at this point in the history
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 <[email protected]>
[[email protected]: ack for legacy file removal]
Acked-by: Tony Lindgren <[email protected]>
[comment on the imperfect always-zero base_id]
Signed-off-by: Ohad Ben-Cohen <[email protected]>
  • Loading branch information
sumananna authored and ohadbc committed May 2, 2015
1 parent 67140ed commit 65bd434
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 68 deletions.
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7095,7 +7095,6 @@ M: Ohad Ben-Cohen <[email protected]>
L: [email protected]
S: Maintained
F: drivers/hwspinlock/omap_hwspinlock.c
F: arch/arm/mach-omap2/hwspinlock.c

OMAP MMC SUPPORT
M: Jarkko Lavinen <[email protected]>
Expand Down
3 changes: 0 additions & 3 deletions arch/arm/mach-omap2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,5 @@ obj-y += $(nand-m) $(nand-y)

smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
obj-y += $(smsc911x-m) $(smsc911x-y)
ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
obj-y += hwspinlock.o
endif

obj-y += common-board-devices.o twl-common.o dss-common.o
60 changes: 0 additions & 60 deletions arch/arm/mach-omap2/hwspinlock.c

This file was deleted.

18 changes: 14 additions & 4 deletions drivers/hwspinlock/omap_hwspinlock.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* OMAP hardware spinlock driver
*
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
* Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
*
* Contact: Simon Que <[email protected]>
* Hari Kanigeri <[email protected]>
Expand All @@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/hwspinlock.h>
#include <linux/of.h>
#include <linux/platform_device.h>

#include "hwspinlock_internal.h"
Expand Down Expand Up @@ -80,14 +81,16 @@ 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;
/* Only a single hwspinlock block device is supported */
int base_id = 0;

if (!pdata)
if (!node)
return -ENODEV;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand Down Expand Up @@ -141,7 +144,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;

ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
pdata->base_id, num_locks);
base_id, num_locks);
if (ret)
goto reg_fail;

Expand Down Expand Up @@ -174,11 +177,18 @@ static int omap_hwspinlock_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id omap_hwspinlock_of_match[] = {
{ .compatible = "ti,omap4-hwspinlock", },
{ /* end */ },
};
MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);

static struct platform_driver omap_hwspinlock_driver = {
.probe = omap_hwspinlock_probe,
.remove = omap_hwspinlock_remove,
.driver = {
.name = "omap_hwspinlock",
.of_match_table = of_match_ptr(omap_hwspinlock_of_match),
},
};

Expand Down

0 comments on commit 65bd434

Please sign in to comment.