aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2015-05-15 00:06:39 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-05-22 01:14:38 -0400
commit2def86a7200ca3a9828926eef927a89adb82ce32 (patch)
tree0a1d9c2225617fea111b47e6c8639ecc6e0c9f99
parentdce143c3381c355ef73be3dd97cf3ca1b15359b8 (diff)
hvc: Convert to using interrupts instead of opal events
Convert the opal hvc driver to use the new irqchip to register for opal events. As older firmware versions may not have device tree bindings for the interrupt parent we just use a hardcoded hwirq based on the event number. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--drivers/tty/hvc/hvc_opal.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index 543b234e70fc..47b54c6aefd2 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -29,6 +29,7 @@
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <linux/export.h> 31#include <linux/export.h>
32#include <linux/interrupt.h>
32 33
33#include <asm/hvconsole.h> 34#include <asm/hvconsole.h>
34#include <asm/prom.h> 35#include <asm/prom.h>
@@ -61,7 +62,6 @@ static struct hvc_opal_priv *hvc_opal_privs[MAX_NR_HVC_CONSOLES];
61/* For early boot console */ 62/* For early boot console */
62static struct hvc_opal_priv hvc_opal_boot_priv; 63static struct hvc_opal_priv hvc_opal_boot_priv;
63static u32 hvc_opal_boot_termno; 64static u32 hvc_opal_boot_termno;
64static bool hvc_opal_event_registered;
65 65
66static const struct hv_ops hvc_opal_raw_ops = { 66static const struct hv_ops hvc_opal_raw_ops = {
67 .get_chars = opal_get_chars, 67 .get_chars = opal_get_chars,
@@ -162,28 +162,15 @@ static const struct hv_ops hvc_opal_hvsi_ops = {
162 .tiocmset = hvc_opal_hvsi_tiocmset, 162 .tiocmset = hvc_opal_hvsi_tiocmset,
163}; 163};
164 164
165static int hvc_opal_console_event(struct notifier_block *nb,
166 unsigned long events, void *change)
167{
168 if (events & OPAL_EVENT_CONSOLE_INPUT)
169 hvc_kick();
170 return 0;
171}
172
173static struct notifier_block hvc_opal_console_nb = {
174 .notifier_call = hvc_opal_console_event,
175};
176
177static int hvc_opal_probe(struct platform_device *dev) 165static int hvc_opal_probe(struct platform_device *dev)
178{ 166{
179 const struct hv_ops *ops; 167 const struct hv_ops *ops;
180 struct hvc_struct *hp; 168 struct hvc_struct *hp;
181 struct hvc_opal_priv *pv; 169 struct hvc_opal_priv *pv;
182 hv_protocol_t proto; 170 hv_protocol_t proto;
183 unsigned int termno, boot = 0; 171 unsigned int termno, irq, boot = 0;
184 const __be32 *reg; 172 const __be32 *reg;
185 173
186
187 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) { 174 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) {
188 proto = HV_PROTOCOL_RAW; 175 proto = HV_PROTOCOL_RAW;
189 ops = &hvc_opal_raw_ops; 176 ops = &hvc_opal_raw_ops;
@@ -227,18 +214,18 @@ static int hvc_opal_probe(struct platform_device *dev)
227 dev->dev.of_node->full_name, 214 dev->dev.of_node->full_name,
228 boot ? " (boot console)" : ""); 215 boot ? " (boot console)" : "");
229 216
230 /* We don't do IRQ ... */ 217 irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT));
231 hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); 218 if (!irq) {
219 pr_err("hvc_opal: Unable to map interrupt for device %s\n",
220 dev->dev.of_node->full_name);
221 return irq;
222 }
223
224 hp = hvc_alloc(termno, irq, ops, MAX_VIO_PUT_CHARS);
232 if (IS_ERR(hp)) 225 if (IS_ERR(hp))
233 return PTR_ERR(hp); 226 return PTR_ERR(hp);
234 dev_set_drvdata(&dev->dev, hp); 227 dev_set_drvdata(&dev->dev, hp);
235 228
236 /* ... but we use OPAL event to kick the console */
237 if (!hvc_opal_event_registered) {
238 opal_notifier_register(&hvc_opal_console_nb);
239 hvc_opal_event_registered = true;
240 }
241
242 return 0; 229 return 0;
243} 230}
244 231