diff options
-rw-r--r-- | drivers/hwspinlock/Kconfig | 2 | ||||
-rw-r--r-- | drivers/hwspinlock/omap_hwspinlock.c | 27 |
2 files changed, 21 insertions, 8 deletions
diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig index 70637d23b1f9..3612cb5b30b2 100644 --- a/drivers/hwspinlock/Kconfig +++ b/drivers/hwspinlock/Kconfig | |||
@@ -10,7 +10,7 @@ menu "Hardware Spinlock drivers" | |||
10 | 10 | ||
11 | config HWSPINLOCK_OMAP | 11 | config HWSPINLOCK_OMAP |
12 | tristate "OMAP Hardware Spinlock device" | 12 | tristate "OMAP Hardware Spinlock device" |
13 | depends on ARCH_OMAP4 || SOC_OMAP5 | 13 | depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_DRA7XX || SOC_AM33XX || SOC_AM43XX |
14 | select HWSPINLOCK | 14 | select HWSPINLOCK |
15 | help | 15 | help |
16 | Say y here to support the OMAP Hardware Spinlock device (firstly | 16 | Say y here to support the OMAP Hardware Spinlock device (firstly |
diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 292869cc9034..c1e2cd4d85fe 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c | |||
@@ -98,10 +98,29 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) | |||
98 | if (!io_base) | 98 | if (!io_base) |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
100 | 100 | ||
101 | /* | ||
102 | * make sure the module is enabled and clocked before reading | ||
103 | * the module SYSSTATUS register | ||
104 | */ | ||
105 | pm_runtime_enable(&pdev->dev); | ||
106 | ret = pm_runtime_get_sync(&pdev->dev); | ||
107 | if (ret < 0) { | ||
108 | pm_runtime_put_noidle(&pdev->dev); | ||
109 | goto iounmap_base; | ||
110 | } | ||
111 | |||
101 | /* Determine number of locks */ | 112 | /* Determine number of locks */ |
102 | i = readl(io_base + SYSSTATUS_OFFSET); | 113 | i = readl(io_base + SYSSTATUS_OFFSET); |
103 | i >>= SPINLOCK_NUMLOCKS_BIT_OFFSET; | 114 | i >>= SPINLOCK_NUMLOCKS_BIT_OFFSET; |
104 | 115 | ||
116 | /* | ||
117 | * runtime PM will make sure the clock of this module is | ||
118 | * enabled again iff at least one lock is requested | ||
119 | */ | ||
120 | ret = pm_runtime_put(&pdev->dev); | ||
121 | if (ret < 0) | ||
122 | goto iounmap_base; | ||
123 | |||
105 | /* one of the four lsb's must be set, and nothing else */ | 124 | /* one of the four lsb's must be set, and nothing else */ |
106 | if (hweight_long(i & 0xf) != 1 || i > 8) { | 125 | if (hweight_long(i & 0xf) != 1 || i > 8) { |
107 | ret = -EINVAL; | 126 | ret = -EINVAL; |
@@ -121,12 +140,6 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) | |||
121 | for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) | 140 | for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) |
122 | hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; | 141 | hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; |
123 | 142 | ||
124 | /* | ||
125 | * runtime PM will make sure the clock of this module is | ||
126 | * enabled iff at least one lock is requested | ||
127 | */ | ||
128 | pm_runtime_enable(&pdev->dev); | ||
129 | |||
130 | ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, | 143 | ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, |
131 | pdata->base_id, num_locks); | 144 | pdata->base_id, num_locks); |
132 | if (ret) | 145 | if (ret) |
@@ -135,9 +148,9 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) | |||
135 | return 0; | 148 | return 0; |
136 | 149 | ||
137 | reg_fail: | 150 | reg_fail: |
138 | pm_runtime_disable(&pdev->dev); | ||
139 | kfree(bank); | 151 | kfree(bank); |
140 | iounmap_base: | 152 | iounmap_base: |
153 | pm_runtime_disable(&pdev->dev); | ||
141 | iounmap(io_base); | 154 | iounmap(io_base); |
142 | return ret; | 155 | return ret; |
143 | } | 156 | } |