aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwspinlock/omap_hwspinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwspinlock/omap_hwspinlock.c')
-rw-r--r--drivers/hwspinlock/omap_hwspinlock.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c
index 47a275c6ece1..ad2f8cac8487 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP hardware spinlock driver 2 * OMAP hardware spinlock driver
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com 4 * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
5 * 5 *
6 * Contact: Simon Que <sque@ti.com> 6 * Contact: Simon Que <sque@ti.com>
7 * Hari Kanigeri <h-kanigeri2@ti.com> 7 * Hari Kanigeri <h-kanigeri2@ti.com>
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/hwspinlock.h> 29#include <linux/hwspinlock.h>
30#include <linux/of.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
31 32
32#include "hwspinlock_internal.h" 33#include "hwspinlock_internal.h"
@@ -80,14 +81,16 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = {
80 81
81static int omap_hwspinlock_probe(struct platform_device *pdev) 82static int omap_hwspinlock_probe(struct platform_device *pdev)
82{ 83{
83 struct hwspinlock_pdata *pdata = pdev->dev.platform_data; 84 struct device_node *node = pdev->dev.of_node;
84 struct hwspinlock_device *bank; 85 struct hwspinlock_device *bank;
85 struct hwspinlock *hwlock; 86 struct hwspinlock *hwlock;
86 struct resource *res; 87 struct resource *res;
87 void __iomem *io_base; 88 void __iomem *io_base;
88 int num_locks, i, ret; 89 int num_locks, i, ret;
90 /* Only a single hwspinlock block device is supported */
91 int base_id = 0;
89 92
90 if (!pdata) 93 if (!node)
91 return -ENODEV; 94 return -ENODEV;
92 95
93 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 96 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -141,7 +144,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
141 hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; 144 hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
142 145
143 ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, 146 ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
144 pdata->base_id, num_locks); 147 base_id, num_locks);
145 if (ret) 148 if (ret)
146 goto reg_fail; 149 goto reg_fail;
147 150
@@ -174,11 +177,18 @@ static int omap_hwspinlock_remove(struct platform_device *pdev)
174 return 0; 177 return 0;
175} 178}
176 179
180static const struct of_device_id omap_hwspinlock_of_match[] = {
181 { .compatible = "ti,omap4-hwspinlock", },
182 { /* end */ },
183};
184MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
185
177static struct platform_driver omap_hwspinlock_driver = { 186static struct platform_driver omap_hwspinlock_driver = {
178 .probe = omap_hwspinlock_probe, 187 .probe = omap_hwspinlock_probe,
179 .remove = omap_hwspinlock_remove, 188 .remove = omap_hwspinlock_remove,
180 .driver = { 189 .driver = {
181 .name = "omap_hwspinlock", 190 .name = "omap_hwspinlock",
191 .of_match_table = of_match_ptr(omap_hwspinlock_of_match),
182 }, 192 },
183}; 193};
184 194