Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwspinlock/omap: add support for dt nodes

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>
[tony@atomide.com: ack for legacy file removal]
Acked-by: Tony Lindgren <tony@atomide.com>
[comment on the imperfect always-zero base_id]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>

authored by

Suman Anna and committed by
Ohad Ben-Cohen
65bd4341 67140ed1

+14 -68
-1
MAINTAINERS
··· 7095 7095 L: linux-omap@vger.kernel.org 7096 7096 S: Maintained 7097 7097 F: drivers/hwspinlock/omap_hwspinlock.c 7098 - F: arch/arm/mach-omap2/hwspinlock.c 7099 7098 7100 7099 OMAP MMC SUPPORT 7101 7100 M: Jarkko Lavinen <jarkko.lavinen@nokia.com>
-3
arch/arm/mach-omap2/Makefile
··· 277 277 278 278 smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o 279 279 obj-y += $(smsc911x-m) $(smsc911x-y) 280 - ifneq ($(CONFIG_HWSPINLOCK_OMAP),) 281 - obj-y += hwspinlock.o 282 - endif 283 280 284 281 obj-y += common-board-devices.o twl-common.o dss-common.o
-60
arch/arm/mach-omap2/hwspinlock.c
··· 1 - /* 2 - * OMAP hardware spinlock device initialization 3 - * 4 - * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com 5 - * 6 - * Contact: Simon Que <sque@ti.com> 7 - * Hari Kanigeri <h-kanigeri2@ti.com> 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU General Public License 11 - * version 2 as published by the Free Software Foundation. 12 - * 13 - * This program is distributed in the hope that it will be useful, but 14 - * WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 - * General Public License for more details. 17 - */ 18 - 19 - #include <linux/kernel.h> 20 - #include <linux/init.h> 21 - #include <linux/err.h> 22 - #include <linux/hwspinlock.h> 23 - 24 - #include "soc.h" 25 - #include "omap_hwmod.h" 26 - #include "omap_device.h" 27 - 28 - static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { 29 - .base_id = 0, 30 - }; 31 - 32 - static int __init hwspinlocks_init(void) 33 - { 34 - int retval = 0; 35 - struct omap_hwmod *oh; 36 - struct platform_device *pdev; 37 - const char *oh_name = "spinlock"; 38 - const char *dev_name = "omap_hwspinlock"; 39 - 40 - /* 41 - * Hwmod lookup will fail in case our platform doesn't support the 42 - * hardware spinlock module, so it is safe to run this initcall 43 - * on all omaps 44 - */ 45 - oh = omap_hwmod_lookup(oh_name); 46 - if (oh == NULL) 47 - return -EINVAL; 48 - 49 - pdev = omap_device_build(dev_name, 0, oh, &omap_hwspinlock_pdata, 50 - sizeof(struct hwspinlock_pdata)); 51 - if (IS_ERR(pdev)) { 52 - pr_err("Can't build omap_device for %s:%s\n", dev_name, 53 - oh_name); 54 - retval = PTR_ERR(pdev); 55 - } 56 - 57 - return retval; 58 - } 59 - /* early board code might need to reserve specific hwspinlock instances */ 60 - omap_postcore_initcall(hwspinlocks_init);
+14 -4
drivers/hwspinlock/omap_hwspinlock.c
··· 1 1 /* 2 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 6 * Contact: Simon Que <sque@ti.com> 7 7 * Hari Kanigeri <h-kanigeri2@ti.com> ··· 27 27 #include <linux/slab.h> 28 28 #include <linux/spinlock.h> 29 29 #include <linux/hwspinlock.h> 30 + #include <linux/of.h> 30 31 #include <linux/platform_device.h> 31 32 32 33 #include "hwspinlock_internal.h" ··· 81 80 82 81 static int omap_hwspinlock_probe(struct platform_device *pdev) 83 82 { 84 - struct hwspinlock_pdata *pdata = pdev->dev.platform_data; 83 + struct device_node *node = pdev->dev.of_node; 85 84 struct hwspinlock_device *bank; 86 85 struct hwspinlock *hwlock; 87 86 struct resource *res; 88 87 void __iomem *io_base; 89 88 int num_locks, i, ret; 89 + /* Only a single hwspinlock block device is supported */ 90 + int base_id = 0; 90 91 91 - if (!pdata) 92 + if (!node) 92 93 return -ENODEV; 93 94 94 95 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 144 141 hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; 145 142 146 143 ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, 147 - pdata->base_id, num_locks); 144 + base_id, num_locks); 148 145 if (ret) 149 146 goto reg_fail; 150 147 ··· 177 174 return 0; 178 175 } 179 176 177 + static const struct of_device_id omap_hwspinlock_of_match[] = { 178 + { .compatible = "ti,omap4-hwspinlock", }, 179 + { /* end */ }, 180 + }; 181 + MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match); 182 + 180 183 static struct platform_driver omap_hwspinlock_driver = { 181 184 .probe = omap_hwspinlock_probe, 182 185 .remove = omap_hwspinlock_remove, 183 186 .driver = { 184 187 .name = "omap_hwspinlock", 188 + .of_match_table = of_match_ptr(omap_hwspinlock_of_match), 185 189 }, 186 190 }; 187 191