aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 20:12:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 20:12:03 -0500
commit1197ab2942f920f261952de0c392ac749a35796b (patch)
tree4922ccc8a6061e5ece6ac7420001f3bf4524ea92 /drivers
parentec773e99ab4abce07b1ae23117179c2861831964 (diff)
parent96cc017c5b7ec095ef047d3c1952b6b6bbf98943 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (106 commits) powerpc/p3060qds: Add support for P3060QDS board powerpc/83xx: Add shutdown request support to MCU handling on MPC8349 MITX powerpc/85xx: Make kexec to interate over online cpus powerpc/fsl_booke: Fix comment in head_fsl_booke.S powerpc/85xx: issue 15 EOI after core reset for FSL CoreNet devices powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver powerpc/85xx: Add 'fsl,pq3-gpio' compatiable for GPIO driver powerpc/86xx: Correct Gianfar support for GE boards powerpc/cpm: Clear muram before it is in use. drivers/virt: add ioctl for 32-bit compat on 64-bit to fsl-hv-manager powerpc/fsl_msi: add support for "msi-address-64" property powerpc/85xx: Setup secondary cores PIR with hard SMP id powerpc/fsl-booke: Fix settlbcam for 64-bit powerpc/85xx: Adding DCSR node to dtsi device trees powerpc/85xx: clean up FPGA device tree nodes for Freecsale QorIQ boards powerpc/85xx: fix PHYS_64BIT selection for P1022DS powerpc/fsl-booke: Fix setup_initial_memory_limit to not blindly map powerpc: respect mem= setting for early memory limit setup powerpc: Update corenet64_smp_defconfig powerpc: Update mpc85xx/corenet 32-bit defconfigs ... Fix up trivial conflicts in: - arch/powerpc/configs/40x/hcu4_defconfig removed stale file, edited elsewhere - arch/powerpc/include/asm/udbg.h, arch/powerpc/kernel/udbg.c: added opal and gelic drivers vs added ePAPR driver - drivers/tty/serial/8250.c moved UPIO_TSI to powerpc vs removed UPIO_DWAPB support
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/cpc925_edac.c67
-rw-r--r--drivers/edac/ppc4xx_edac.c2
-rw-r--r--drivers/gpio/Kconfig8
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/gpio-mpc8xxx.c398
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.c3
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.h6
-rw-r--r--drivers/of/fdt.c7
-rw-r--r--drivers/tty/hvc/Kconfig9
-rw-r--r--drivers/tty/hvc/Makefile1
-rw-r--r--drivers/tty/hvc/hvc_opal.c424
-rw-r--r--drivers/tty/hvc/hvcs.c6
-rw-r--r--drivers/tty/hvc/hvsi_lib.c4
-rw-r--r--drivers/tty/serial/8250.c23
-rw-r--r--drivers/virt/fsl_hypervisor.c1
15 files changed, 927 insertions, 33 deletions
diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index a687a0d16962..a774c0ddaf5b 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -90,6 +90,7 @@ enum apimask_bits {
90 ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H | 90 ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
91 APIMASK_ECC_UE_L | APIMASK_ECC_CE_L), 91 APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
92}; 92};
93#define APIMASK_ADI(n) CPC925_BIT(((n)+1))
93 94
94/************************************************************ 95/************************************************************
95 * Processor Interface Exception Register (APIEXCP) 96 * Processor Interface Exception Register (APIEXCP)
@@ -581,16 +582,73 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
581} 582}
582 583
583/******************** CPU err device********************************/ 584/******************** CPU err device********************************/
585static u32 cpc925_cpu_mask_disabled(void)
586{
587 struct device_node *cpus;
588 struct device_node *cpunode = NULL;
589 static u32 mask = 0;
590
591 /* use cached value if available */
592 if (mask != 0)
593 return mask;
594
595 mask = APIMASK_ADI0 | APIMASK_ADI1;
596
597 cpus = of_find_node_by_path("/cpus");
598 if (cpus == NULL) {
599 cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
600 return 0;
601 }
602
603 while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
604 const u32 *reg = of_get_property(cpunode, "reg", NULL);
605
606 if (strcmp(cpunode->type, "cpu")) {
607 cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
608 continue;
609 }
610
611 if (reg == NULL || *reg > 2) {
612 cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
613 continue;
614 }
615
616 mask &= ~APIMASK_ADI(*reg);
617 }
618
619 if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
620 /* We assume that each CPU sits on it's own PI and that
621 * for present CPUs the reg property equals to the PI
622 * interface id */
623 cpc925_printk(KERN_WARNING,
624 "Assuming PI id is equal to CPU MPIC id!\n");
625 }
626
627 of_node_put(cpunode);
628 of_node_put(cpus);
629
630 return mask;
631}
632
584/* Enable CPU Errors detection */ 633/* Enable CPU Errors detection */
585static void cpc925_cpu_init(struct cpc925_dev_info *dev_info) 634static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
586{ 635{
587 u32 apimask; 636 u32 apimask;
637 u32 cpumask;
588 638
589 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET); 639 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
590 if ((apimask & CPU_MASK_ENABLE) == 0) { 640
591 apimask |= CPU_MASK_ENABLE; 641 cpumask = cpc925_cpu_mask_disabled();
592 __raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET); 642 if (apimask & cpumask) {
643 cpc925_printk(KERN_WARNING, "CPU(s) not present, "
644 "but enabled in APIMASK, disabling\n");
645 apimask &= ~cpumask;
593 } 646 }
647
648 if ((apimask & CPU_MASK_ENABLE) == 0)
649 apimask |= CPU_MASK_ENABLE;
650
651 __raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
594} 652}
595 653
596/* Disable CPU Errors detection */ 654/* Disable CPU Errors detection */
@@ -622,6 +680,9 @@ static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)
622 if ((apiexcp & CPU_EXCP_DETECTED) == 0) 680 if ((apiexcp & CPU_EXCP_DETECTED) == 0)
623 return; 681 return;
624 682
683 if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
684 return;
685
625 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET); 686 apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
626 cpc925_printk(KERN_INFO, "Processor Interface Fault\n" 687 cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
627 "Processor Interface register dump:\n"); 688 "Processor Interface register dump:\n");
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index 0de7d8770891..38400963e245 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -205,7 +205,7 @@ static struct platform_driver ppc4xx_edac_driver = {
205 .remove = ppc4xx_edac_remove, 205 .remove = ppc4xx_edac_remove,
206 .driver = { 206 .driver = {
207 .owner = THIS_MODULE, 207 .owner = THIS_MODULE,
208 .name = PPC4XX_EDAC_MODULE_NAME 208 .name = PPC4XX_EDAC_MODULE_NAME,
209 .of_match_table = ppc4xx_edac_match, 209 .of_match_table = ppc4xx_edac_match,
210 }, 210 },
211}; 211};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 74603ca06e34..8482a23887dc 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -99,6 +99,14 @@ config GPIO_MPC5200
99 def_bool y 99 def_bool y
100 depends on PPC_MPC52xx 100 depends on PPC_MPC52xx
101 101
102config GPIO_MPC8XXX
103 bool "MPC512x/MPC8xxx GPIO support"
104 depends on PPC_MPC512x || PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || \
105 FSL_SOC_BOOKE || PPC_86xx
106 help
107 Say Y here if you're going to use hardware that connects to the
108 MPC512x/831x/834x/837x/8572/8610 GPIOs.
109
102config GPIO_MSM_V1 110config GPIO_MSM_V1
103 tristate "Qualcomm MSM GPIO v1" 111 tristate "Qualcomm MSM GPIO v1"
104 depends on GPIOLIB && ARCH_MSM 112 depends on GPIOLIB && ARCH_MSM
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4a9ad2f99ada..dbcb0bcfd8da 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o
29obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o 29obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o
30obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o 30obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o
31obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o 31obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o
32obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o
32obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o 33obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o
33obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o 34obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o
34obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o 35obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
new file mode 100644
index 000000000000..ec3fcf0a7e12
--- /dev/null
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -0,0 +1,398 @@
1/*
2 * GPIOs on MPC512x/8349/8572/8610 and compatible
3 *
4 * Copyright (C) 2008 Peter Korsgaard <jacmet@sunsite.dk>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/spinlock.h>
14#include <linux/io.h>
15#include <linux/of.h>
16#include <linux/of_gpio.h>
17#include <linux/gpio.h>
18#include <linux/slab.h>
19#include <linux/irq.h>
20
21#define MPC8XXX_GPIO_PINS 32
22
23#define GPIO_DIR 0x00
24#define GPIO_ODR 0x04
25#define GPIO_DAT 0x08
26#define GPIO_IER 0x0c
27#define GPIO_IMR 0x10
28#define GPIO_ICR 0x14
29#define GPIO_ICR2 0x18
30
31struct mpc8xxx_gpio_chip {
32 struct of_mm_gpio_chip mm_gc;
33 spinlock_t lock;
34
35 /*
36 * shadowed data register to be able to clear/set output pins in
37 * open drain mode safely
38 */
39 u32 data;
40 struct irq_host *irq;
41 void *of_dev_id_data;
42};
43
44static inline u32 mpc8xxx_gpio2mask(unsigned int gpio)
45{
46 return 1u << (MPC8XXX_GPIO_PINS - 1 - gpio);
47}
48
49static inline struct mpc8xxx_gpio_chip *
50to_mpc8xxx_gpio_chip(struct of_mm_gpio_chip *mm)
51{
52 return container_of(mm, struct mpc8xxx_gpio_chip, mm_gc);
53}
54
55static void mpc8xxx_gpio_save_regs(struct of_mm_gpio_chip *mm)
56{
57 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
58
59 mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT);
60}
61
62/* Workaround GPIO 1 errata on MPC8572/MPC8536. The status of GPIOs
63 * defined as output cannot be determined by reading GPDAT register,
64 * so we use shadow data register instead. The status of input pins
65 * is determined by reading GPDAT register.
66 */
67static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio)
68{
69 u32 val;
70 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
71 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
72
73 val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR);
74
75 return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio);
76}
77
78static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio)
79{
80 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
81
82 return in_be32(mm->regs + GPIO_DAT) & mpc8xxx_gpio2mask(gpio);
83}
84
85static void mpc8xxx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
86{
87 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
88 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
89 unsigned long flags;
90
91 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
92
93 if (val)
94 mpc8xxx_gc->data |= mpc8xxx_gpio2mask(gpio);
95 else
96 mpc8xxx_gc->data &= ~mpc8xxx_gpio2mask(gpio);
97
98 out_be32(mm->regs + GPIO_DAT, mpc8xxx_gc->data);
99
100 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
101}
102
103static int mpc8xxx_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
104{
105 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
106 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
107 unsigned long flags;
108
109 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
110
111 clrbits32(mm->regs + GPIO_DIR, mpc8xxx_gpio2mask(gpio));
112
113 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
114
115 return 0;
116}
117
118static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
119{
120 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
121 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
122 unsigned long flags;
123
124 mpc8xxx_gpio_set(gc, gpio, val);
125
126 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
127
128 setbits32(mm->regs + GPIO_DIR, mpc8xxx_gpio2mask(gpio));
129
130 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
131
132 return 0;
133}
134
135static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
136{
137 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
138 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
139
140 if (mpc8xxx_gc->irq && offset < MPC8XXX_GPIO_PINS)
141 return irq_create_mapping(mpc8xxx_gc->irq, offset);
142 else
143 return -ENXIO;
144}
145
146static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
147{
148 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_desc_get_handler_data(desc);
149 struct irq_chip *chip = irq_desc_get_chip(desc);
150 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
151 unsigned int mask;
152
153 mask = in_be32(mm->regs + GPIO_IER) & in_be32(mm->regs + GPIO_IMR);
154 if (mask)
155 generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
156 32 - ffs(mask)));
157 chip->irq_eoi(&desc->irq_data);
158}
159
160static void mpc8xxx_irq_unmask(struct irq_data *d)
161{
162 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_data_get_irq_chip_data(d);
163 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
164 unsigned long flags;
165
166 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
167
168 setbits32(mm->regs + GPIO_IMR, mpc8xxx_gpio2mask(irqd_to_hwirq(d)));
169
170 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
171}
172
173static void mpc8xxx_irq_mask(struct irq_data *d)
174{
175 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_data_get_irq_chip_data(d);
176 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
177 unsigned long flags;
178
179 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
180
181 clrbits32(mm->regs + GPIO_IMR, mpc8xxx_gpio2mask(irqd_to_hwirq(d)));
182
183 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
184}
185
186static void mpc8xxx_irq_ack(struct irq_data *d)
187{
188 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_data_get_irq_chip_data(d);
189 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
190
191 out_be32(mm->regs + GPIO_IER, mpc8xxx_gpio2mask(irqd_to_hwirq(d)));
192}
193
194static int mpc8xxx_irq_set_type(struct irq_data *d, unsigned int flow_type)
195{
196 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_data_get_irq_chip_data(d);
197 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
198 unsigned long flags;
199
200 switch (flow_type) {
201 case IRQ_TYPE_EDGE_FALLING:
202 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
203 setbits32(mm->regs + GPIO_ICR,
204 mpc8xxx_gpio2mask(irqd_to_hwirq(d)));
205 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
206 break;
207
208 case IRQ_TYPE_EDGE_BOTH:
209 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
210 clrbits32(mm->regs + GPIO_ICR,
211 mpc8xxx_gpio2mask(irqd_to_hwirq(d)));
212 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
213 break;
214
215 default:
216 return -EINVAL;
217 }
218
219 return 0;
220}
221
222static int mpc512x_irq_set_type(struct irq_data *d, unsigned int flow_type)
223{
224 struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_data_get_irq_chip_data(d);
225 struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
226 unsigned long gpio = irqd_to_hwirq(d);
227 void __iomem *reg;
228 unsigned int shift;
229 unsigned long flags;
230
231 if (gpio < 16) {
232 reg = mm->regs + GPIO_ICR;
233 shift = (15 - gpio) * 2;
234 } else {
235 reg = mm->regs + GPIO_ICR2;
236 shift = (15 - (gpio % 16)) * 2;
237 }
238
239 switch (flow_type) {
240 case IRQ_TYPE_EDGE_FALLING:
241 case IRQ_TYPE_LEVEL_LOW:
242 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
243 clrsetbits_be32(reg, 3 << shift, 2 << shift);
244 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
245 break;
246
247 case IRQ_TYPE_EDGE_RISING:
248 case IRQ_TYPE_LEVEL_HIGH:
249 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
250 clrsetbits_be32(reg, 3 << shift, 1 << shift);
251 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
252 break;
253
254 case IRQ_TYPE_EDGE_BOTH:
255 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
256 clrbits32(reg, 3 << shift);
257 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
258 break;
259
260 default:
261 return -EINVAL;
262 }
263
264 return 0;
265}
266
267static struct irq_chip mpc8xxx_irq_chip = {
268 .name = "mpc8xxx-gpio",
269 .irq_unmask = mpc8xxx_irq_unmask,
270 .irq_mask = mpc8xxx_irq_mask,
271 .irq_ack = mpc8xxx_irq_ack,
272 .irq_set_type = mpc8xxx_irq_set_type,
273};
274
275static int mpc8xxx_gpio_irq_map(struct irq_host *h, unsigned int virq,
276 irq_hw_number_t hw)
277{
278 struct mpc8xxx_gpio_chip *mpc8xxx_gc = h->host_data;
279
280 if (mpc8xxx_gc->of_dev_id_data)
281 mpc8xxx_irq_chip.irq_set_type = mpc8xxx_gc->of_dev_id_data;
282
283 irq_set_chip_data(virq, h->host_data);
284 irq_set_chip_and_handler(virq, &mpc8xxx_irq_chip, handle_level_irq);
285 irq_set_irq_type(virq, IRQ_TYPE_NONE);
286
287 return 0;
288}
289
290static int mpc8xxx_gpio_irq_xlate(struct irq_host *h, struct device_node *ct,
291 const u32 *intspec, unsigned int intsize,
292 irq_hw_number_t *out_hwirq,
293 unsigned int *out_flags)
294
295{
296 /* interrupt sense values coming from the device tree equal either
297 * EDGE_FALLING or EDGE_BOTH
298 */
299 *out_hwirq = intspec[0];
300 *out_flags = intspec[1];
301
302 return 0;
303}
304
305static struct irq_host_ops mpc8xxx_gpio_irq_ops = {
306 .map = mpc8xxx_gpio_irq_map,
307 .xlate = mpc8xxx_gpio_irq_xlate,
308};
309
310static struct of_device_id mpc8xxx_gpio_ids[] __initdata = {
311 { .compatible = "fsl,mpc8349-gpio", },
312 { .compatible = "fsl,mpc8572-gpio", },
313 { .compatible = "fsl,mpc8610-gpio", },
314 { .compatible = "fsl,mpc5121-gpio", .data = mpc512x_irq_set_type, },
315 { .compatible = "fsl,pq3-gpio", },
316 { .compatible = "fsl,qoriq-gpio", },
317 {}
318};
319
320static void __init mpc8xxx_add_controller(struct device_node *np)
321{
322 struct mpc8xxx_gpio_chip *mpc8xxx_gc;
323 struct of_mm_gpio_chip *mm_gc;
324 struct gpio_chip *gc;
325 const struct of_device_id *id;
326 unsigned hwirq;
327 int ret;
328
329 mpc8xxx_gc = kzalloc(sizeof(*mpc8xxx_gc), GFP_KERNEL);
330 if (!mpc8xxx_gc) {
331 ret = -ENOMEM;
332 goto err;
333 }
334
335 spin_lock_init(&mpc8xxx_gc->lock);
336
337 mm_gc = &mpc8xxx_gc->mm_gc;
338 gc = &mm_gc->gc;
339
340 mm_gc->save_regs = mpc8xxx_gpio_save_regs;
341 gc->ngpio = MPC8XXX_GPIO_PINS;
342 gc->direction_input = mpc8xxx_gpio_dir_in;
343 gc->direction_output = mpc8xxx_gpio_dir_out;
344 if (of_device_is_compatible(np, "fsl,mpc8572-gpio"))
345 gc->get = mpc8572_gpio_get;
346 else
347 gc->get = mpc8xxx_gpio_get;
348 gc->set = mpc8xxx_gpio_set;
349 gc->to_irq = mpc8xxx_gpio_to_irq;
350
351 ret = of_mm_gpiochip_add(np, mm_gc);
352 if (ret)
353 goto err;
354
355 hwirq = irq_of_parse_and_map(np, 0);
356 if (hwirq == NO_IRQ)
357 goto skip_irq;
358
359 mpc8xxx_gc->irq =
360 irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, MPC8XXX_GPIO_PINS,
361 &mpc8xxx_gpio_irq_ops, MPC8XXX_GPIO_PINS);
362 if (!mpc8xxx_gc->irq)
363 goto skip_irq;
364
365 id = of_match_node(mpc8xxx_gpio_ids, np);
366 if (id)
367 mpc8xxx_gc->of_dev_id_data = id->data;
368
369 mpc8xxx_gc->irq->host_data = mpc8xxx_gc;
370
371 /* ack and mask all irqs */
372 out_be32(mm_gc->regs + GPIO_IER, 0xffffffff);
373 out_be32(mm_gc->regs + GPIO_IMR, 0);
374
375 irq_set_handler_data(hwirq, mpc8xxx_gc);
376 irq_set_chained_handler(hwirq, mpc8xxx_gpio_irq_cascade);
377
378skip_irq:
379 return;
380
381err:
382 pr_err("%s: registration failed with status %d\n",
383 np->full_name, ret);
384 kfree(mpc8xxx_gc);
385
386 return;
387}
388
389static int __init mpc8xxx_add_gpiochips(void)
390{
391 struct device_node *np;
392
393 for_each_matching_node(np, mpc8xxx_gpio_ids)
394 mpc8xxx_add_controller(np);
395
396 return 0;
397}
398arch_initcall(mpc8xxx_add_gpiochips);
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index ddb33cfd3543..7bf1e2015784 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -1674,6 +1674,9 @@ static int __devinit ps3_gelic_driver_probe(struct ps3_system_bus_device *dev)
1674 int result; 1674 int result;
1675 1675
1676 pr_debug("%s: called\n", __func__); 1676 pr_debug("%s: called\n", __func__);
1677
1678 udbg_shutdown_ps3gelic();
1679
1677 result = ps3_open_hv_device(dev); 1680 result = ps3_open_hv_device(dev);
1678 1681
1679 if (result) { 1682 if (result) {
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
index d3fadfbc3bcc..a93df6ac1909 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
@@ -359,6 +359,12 @@ static inline void *port_priv(struct gelic_port *port)
359 return port->priv; 359 return port->priv;
360} 360}
361 361
362#ifdef CONFIG_PPC_EARLY_DEBUG_PS3GELIC
363extern void udbg_shutdown_ps3gelic(void);
364#else
365static inline void udbg_shutdown_ps3gelic(void) {}
366#endif
367
362extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask); 368extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask);
363/* shared netdev ops */ 369/* shared netdev ops */
364extern void gelic_card_up(struct gelic_card *card); 370extern void gelic_card_up(struct gelic_card *card);
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index aeec35bc3789..fd85fa298e0f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -681,9 +681,14 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
681 if (p != NULL && l > 0) 681 if (p != NULL && l > 0)
682 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); 682 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
683 683
684 /*
685 * CONFIG_CMDLINE is meant to be a default in case nothing else
686 * managed to set the command line, unless CONFIG_CMDLINE_FORCE
687 * is set in which case we override whatever was found earlier.
688 */
684#ifdef CONFIG_CMDLINE 689#ifdef CONFIG_CMDLINE
685#ifndef CONFIG_CMDLINE_FORCE 690#ifndef CONFIG_CMDLINE_FORCE
686 if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) 691 if (!((char *)data)[0])
687#endif 692#endif
688 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 693 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
689#endif /* CONFIG_CMDLINE */ 694#endif /* CONFIG_CMDLINE */
diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
index e371753ba921..4222035acfb7 100644
--- a/drivers/tty/hvc/Kconfig
+++ b/drivers/tty/hvc/Kconfig
@@ -34,6 +34,15 @@ config HVC_ISERIES
34 help 34 help
35 iSeries machines support a hypervisor virtual console. 35 iSeries machines support a hypervisor virtual console.
36 36
37config HVC_OPAL
38 bool "OPAL Console support"
39 depends on PPC_POWERNV
40 select HVC_DRIVER
41 select HVC_IRQ
42 default y
43 help
44 PowerNV machines running under OPAL need that driver to get a console
45
37config HVC_RTAS 46config HVC_RTAS
38 bool "IBM RTAS Console support" 47 bool "IBM RTAS Console support"
39 depends on PPC_RTAS 48 depends on PPC_RTAS
diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile
index e29205316376..89abf40bc73d 100644
--- a/drivers/tty/hvc/Makefile
+++ b/drivers/tty/hvc/Makefile
@@ -1,4 +1,5 @@
1obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi_lib.o 1obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi_lib.o
2obj-$(CONFIG_HVC_OPAL) += hvc_opal.o hvsi_lib.o
2obj-$(CONFIG_HVC_OLD_HVSI) += hvsi.o 3obj-$(CONFIG_HVC_OLD_HVSI) += hvsi.o
3obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o 4obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
4obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 5obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
new file mode 100644
index 000000000000..7b38512d6c41
--- /dev/null
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -0,0 +1,424 @@
1/*
2 * opal driver interface to hvc_console.c
3 *
4 * Copyright 2011 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#undef DEBUG
23
24#include <linux/types.h>
25#include <linux/init.h>
26#include <linux/delay.h>
27#include <linux/slab.h>
28#include <linux/console.h>
29#include <linux/of.h>
30#include <linux/of_platform.h>
31
32#include <asm/hvconsole.h>
33#include <asm/prom.h>
34#include <asm/firmware.h>
35#include <asm/hvsi.h>
36#include <asm/udbg.h>
37#include <asm/opal.h>
38
39#include "hvc_console.h"
40
41static const char hvc_opal_name[] = "hvc_opal";
42
43static struct of_device_id hvc_opal_match[] __devinitdata = {
44 { .name = "serial", .compatible = "ibm,opal-console-raw" },
45 { .name = "serial", .compatible = "ibm,opal-console-hvsi" },
46 { },
47};
48
49typedef enum hv_protocol {
50 HV_PROTOCOL_RAW,
51 HV_PROTOCOL_HVSI
52} hv_protocol_t;
53
54struct hvc_opal_priv {
55 hv_protocol_t proto; /* Raw data or HVSI packets */
56 struct hvsi_priv hvsi; /* HVSI specific data */
57};
58static struct hvc_opal_priv *hvc_opal_privs[MAX_NR_HVC_CONSOLES];
59
60/* For early boot console */
61static struct hvc_opal_priv hvc_opal_boot_priv;
62static u32 hvc_opal_boot_termno;
63
64static const struct hv_ops hvc_opal_raw_ops = {
65 .get_chars = opal_get_chars,
66 .put_chars = opal_put_chars,
67 .notifier_add = notifier_add_irq,
68 .notifier_del = notifier_del_irq,
69 .notifier_hangup = notifier_hangup_irq,
70};
71
72static int hvc_opal_hvsi_get_chars(uint32_t vtermno, char *buf, int count)
73{
74 struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
75
76 if (WARN_ON(!pv))
77 return -ENODEV;
78
79 return hvsilib_get_chars(&pv->hvsi, buf, count);
80}
81
82static int hvc_opal_hvsi_put_chars(uint32_t vtermno, const char *buf, int count)
83{
84 struct hvc_opal_priv *pv = hvc_opal_privs[vtermno];
85
86 if (WARN_ON(!pv))
87 return -ENODEV;
88
89 return hvsilib_put_chars(&pv->hvsi, buf, count);
90}
91
92static int hvc_opal_hvsi_open(struct hvc_struct *hp, int data)
93{
94 struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno];
95 int rc;
96
97 pr_devel("HVSI@%x: do open !\n", hp->vtermno);
98
99 rc = notifier_add_irq(hp, data);
100 if (rc)
101 return rc;
102
103 return hvsilib_open(&pv->hvsi, hp);
104}
105
106static void hvc_opal_hvsi_close(struct hvc_struct *hp, int data)
107{
108 struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno];
109
110 pr_devel("HVSI@%x: do close !\n", hp->vtermno);
111
112 hvsilib_close(&pv->hvsi, hp);
113
114 notifier_del_irq(hp, data);
115}
116
117void hvc_opal_hvsi_hangup(struct hvc_struct *hp, int data)
118{
119 struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno];
120
121 pr_devel("HVSI@%x: do hangup !\n", hp->vtermno);
122
123 hvsilib_close(&pv->hvsi, hp);
124
125 notifier_hangup_irq(hp, data);
126}
127
128static int hvc_opal_hvsi_tiocmget(struct hvc_struct *hp)
129{
130 struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno];
131
132 if (!pv)
133 return -EINVAL;
134 return pv->hvsi.mctrl;
135}
136
137static int hvc_opal_hvsi_tiocmset(struct hvc_struct *hp, unsigned int set,
138 unsigned int clear)
139{
140 struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno];
141
142 pr_devel("HVSI@%x: Set modem control, set=%x,clr=%x\n",
143 hp->vtermno, set, clear);
144
145 if (set & TIOCM_DTR)
146 hvsilib_write_mctrl(&pv->hvsi, 1);
147 else if (clear & TIOCM_DTR)
148 hvsilib_write_mctrl(&pv->hvsi, 0);
149
150 return 0;
151}
152
153static const struct hv_ops hvc_opal_hvsi_ops = {
154 .get_chars = hvc_opal_hvsi_get_chars,
155 .put_chars = hvc_opal_hvsi_put_chars,
156 .notifier_add = hvc_opal_hvsi_open,
157 .notifier_del = hvc_opal_hvsi_close,
158 .notifier_hangup = hvc_opal_hvsi_hangup,
159 .tiocmget = hvc_opal_hvsi_tiocmget,
160 .tiocmset = hvc_opal_hvsi_tiocmset,
161};
162
163static int __devinit hvc_opal_probe(struct platform_device *dev)
164{
165 const struct hv_ops *ops;
166 struct hvc_struct *hp;
167 struct hvc_opal_priv *pv;
168 hv_protocol_t proto;
169 unsigned int termno, boot = 0;
170 const __be32 *reg;
171
172 if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) {
173 proto = HV_PROTOCOL_RAW;
174 ops = &hvc_opal_raw_ops;
175 } else if (of_device_is_compatible(dev->dev.of_node,
176 "ibm,opal-console-hvsi")) {
177 proto = HV_PROTOCOL_HVSI;
178 ops = &hvc_opal_hvsi_ops;
179 } else {
180 pr_err("hvc_opal: Unkown protocol for %s\n",
181 dev->dev.of_node->full_name);
182 return -ENXIO;
183 }
184
185 reg = of_get_property(dev->dev.of_node, "reg", NULL);
186 termno = reg ? be32_to_cpup(reg) : 0;
187
188 /* Is it our boot one ? */
189 if (hvc_opal_privs[termno] == &hvc_opal_boot_priv) {
190 pv = hvc_opal_privs[termno];
191 boot = 1;
192 } else if (hvc_opal_privs[termno] == NULL) {
193 pv = kzalloc(sizeof(struct hvc_opal_priv), GFP_KERNEL);
194 if (!pv)
195 return -ENOMEM;
196 pv->proto = proto;
197 hvc_opal_privs[termno] = pv;
198 if (proto == HV_PROTOCOL_HVSI)
199 hvsilib_init(&pv->hvsi, opal_get_chars, opal_put_chars,
200 termno, 0);
201
202 /* Instanciate now to establish a mapping index==vtermno */
203 hvc_instantiate(termno, termno, ops);
204 } else {
205 pr_err("hvc_opal: Device %s has duplicate terminal number #%d\n",
206 dev->dev.of_node->full_name, termno);
207 return -ENXIO;
208 }
209
210 pr_info("hvc%d: %s protocol on %s%s\n", termno,
211 proto == HV_PROTOCOL_RAW ? "raw" : "hvsi",
212 dev->dev.of_node->full_name,
213 boot ? " (boot console)" : "");
214
215 /* We don't do IRQ yet */
216 hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS);
217 if (IS_ERR(hp))
218 return PTR_ERR(hp);
219 dev_set_drvdata(&dev->dev, hp);
220
221 return 0;
222}
223
224static int __devexit hvc_opal_remove(struct platform_device *dev)
225{
226 struct hvc_struct *hp = dev_get_drvdata(&dev->dev);
227 int rc, termno;
228
229 termno = hp->vtermno;
230 rc = hvc_remove(hp);
231 if (rc == 0) {
232 if (hvc_opal_privs[termno] != &hvc_opal_boot_priv)
233 kfree(hvc_opal_privs[termno]);
234 hvc_opal_privs[termno] = NULL;
235 }
236 return rc;
237}
238
239static struct platform_driver hvc_opal_driver = {
240 .probe = hvc_opal_probe,
241 .remove = __devexit_p(hvc_opal_remove),
242 .driver = {
243 .name = hvc_opal_name,
244 .owner = THIS_MODULE,
245 .of_match_table = hvc_opal_match,
246 }
247};
248
249static int __init hvc_opal_init(void)
250{
251 if (!firmware_has_feature(FW_FEATURE_OPAL))
252 return -ENODEV;
253
254 /* Register as a vio device to receive callbacks */
255 return platform_driver_register(&hvc_opal_driver);
256}
257module_init(hvc_opal_init);
258
259static void __exit hvc_opal_exit(void)
260{
261 platform_driver_unregister(&hvc_opal_driver);
262}
263module_exit(hvc_opal_exit);
264
265static void udbg_opal_putc(char c)
266{
267 unsigned int termno = hvc_opal_boot_termno;
268 int count = -1;
269
270 if (c == '\n')
271 udbg_opal_putc('\r');
272
273 do {
274 switch(hvc_opal_boot_priv.proto) {
275 case HV_PROTOCOL_RAW:
276 count = opal_put_chars(termno, &c, 1);
277 break;
278 case HV_PROTOCOL_HVSI:
279 count = hvc_opal_hvsi_put_chars(termno, &c, 1);
280 break;
281 }
282 } while(count == 0 || count == -EAGAIN);
283}
284
285static int udbg_opal_getc_poll(void)
286{
287 unsigned int termno = hvc_opal_boot_termno;
288 int rc = 0;
289 char c;
290
291 switch(hvc_opal_boot_priv.proto) {
292 case HV_PROTOCOL_RAW:
293 rc = opal_get_chars(termno, &c, 1);
294 break;
295 case HV_PROTOCOL_HVSI:
296 rc = hvc_opal_hvsi_get_chars(termno, &c, 1);
297 break;
298 }
299 if (!rc)
300 return -1;
301 return c;
302}
303
304static int udbg_opal_getc(void)
305{
306 int ch;
307 for (;;) {
308 ch = udbg_opal_getc_poll();
309 if (ch == -1) {
310 /* This shouldn't be needed...but... */
311 volatile unsigned long delay;
312 for (delay=0; delay < 2000000; delay++)
313 ;
314 } else {
315 return ch;
316 }
317 }
318}
319
320static void udbg_init_opal_common(void)
321{
322 udbg_putc = udbg_opal_putc;
323 udbg_getc = udbg_opal_getc;
324 udbg_getc_poll = udbg_opal_getc_poll;
325 tb_ticks_per_usec = 0x200; /* Make udelay not suck */
326}
327
328void __init hvc_opal_init_early(void)
329{
330 struct device_node *stdout_node = NULL;
331 const u32 *termno;
332 const char *name = NULL;
333 const struct hv_ops *ops;
334 u32 index;
335
336 /* find the boot console from /chosen/stdout */
337 if (of_chosen)
338 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
339 if (name) {
340 stdout_node = of_find_node_by_path(name);
341 if (!stdout_node) {
342 pr_err("hvc_opal: Failed to locate default console!\n");
343 return;
344 }
345 } else {
346 struct device_node *opal, *np;
347
348 /* Current OPAL takeover doesn't provide the stdout
349 * path, so we hard wire it
350 */
351 opal = of_find_node_by_path("/ibm,opal/consoles");
352 if (opal)
353 pr_devel("hvc_opal: Found consoles in new location\n");
354 if (!opal) {
355 opal = of_find_node_by_path("/ibm,opal");
356 if (opal)
357 pr_devel("hvc_opal: "
358 "Found consoles in old location\n");
359 }
360 if (!opal)
361 return;
362 for_each_child_of_node(opal, np) {
363 if (!strcmp(np->name, "serial")) {
364 stdout_node = np;
365 break;
366 }
367 }
368 of_node_put(opal);
369 }
370 if (!stdout_node)
371 return;
372 termno = of_get_property(stdout_node, "reg", NULL);
373 index = termno ? *termno : 0;
374 if (index >= MAX_NR_HVC_CONSOLES)
375 return;
376 hvc_opal_privs[index] = &hvc_opal_boot_priv;
377
378 /* Check the protocol */
379 if (of_device_is_compatible(stdout_node, "ibm,opal-console-raw")) {
380 hvc_opal_boot_priv.proto = HV_PROTOCOL_RAW;
381 ops = &hvc_opal_raw_ops;
382 pr_devel("hvc_opal: Found RAW console\n");
383 }
384 else if (of_device_is_compatible(stdout_node,"ibm,opal-console-hvsi")) {
385 hvc_opal_boot_priv.proto = HV_PROTOCOL_HVSI;
386 ops = &hvc_opal_hvsi_ops;
387 hvsilib_init(&hvc_opal_boot_priv.hvsi, opal_get_chars,
388 opal_put_chars, index, 1);
389 /* HVSI, perform the handshake now */
390 hvsilib_establish(&hvc_opal_boot_priv.hvsi);
391 pr_devel("hvc_opal: Found HVSI console\n");
392 } else
393 goto out;
394 hvc_opal_boot_termno = index;
395 udbg_init_opal_common();
396 add_preferred_console("hvc", index, NULL);
397 hvc_instantiate(index, index, ops);
398out:
399 of_node_put(stdout_node);
400}
401
402#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW
403void __init udbg_init_debug_opal(void)
404{
405 u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO;
406 hvc_opal_privs[index] = &hvc_opal_boot_priv;
407 hvc_opal_boot_priv.proto = HV_PROTOCOL_RAW;
408 hvc_opal_boot_termno = index;
409 udbg_init_opal_common();
410}
411#endif /* CONFIG_PPC_EARLY_DEBUG_OPAL_RAW */
412
413#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI
414void __init udbg_init_debug_opal_hvsi(void)
415{
416 u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO;
417 hvc_opal_privs[index] = &hvc_opal_boot_priv;
418 hvc_opal_boot_termno = index;
419 udbg_init_opal_common();
420 hvsilib_init(&hvc_opal_boot_priv.hvsi, opal_get_chars, opal_put_chars,
421 index, 1);
422 hvsilib_establish(&hvc_opal_boot_priv.hvsi);
423}
424#endif /* CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI */
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 55882b5930a6..b9040bec36bd 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1532,7 +1532,7 @@ static int __devinit hvcs_initialize(void)
1532 goto register_fail; 1532 goto register_fail;
1533 } 1533 }
1534 1534
1535 hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); 1535 hvcs_pi_buff = (unsigned long *) __get_free_page(GFP_KERNEL);
1536 if (!hvcs_pi_buff) { 1536 if (!hvcs_pi_buff) {
1537 rc = -ENOMEM; 1537 rc = -ENOMEM;
1538 goto buff_alloc_fail; 1538 goto buff_alloc_fail;
@@ -1548,7 +1548,7 @@ static int __devinit hvcs_initialize(void)
1548 return 0; 1548 return 0;
1549 1549
1550kthread_fail: 1550kthread_fail:
1551 kfree(hvcs_pi_buff); 1551 free_page((unsigned long)hvcs_pi_buff);
1552buff_alloc_fail: 1552buff_alloc_fail:
1553 tty_unregister_driver(hvcs_tty_driver); 1553 tty_unregister_driver(hvcs_tty_driver);
1554register_fail: 1554register_fail:
@@ -1597,7 +1597,7 @@ static void __exit hvcs_module_exit(void)
1597 kthread_stop(hvcs_task); 1597 kthread_stop(hvcs_task);
1598 1598
1599 spin_lock(&hvcs_pi_lock); 1599 spin_lock(&hvcs_pi_lock);
1600 kfree(hvcs_pi_buff); 1600 free_page((unsigned long)hvcs_pi_buff);
1601 hvcs_pi_buff = NULL; 1601 hvcs_pi_buff = NULL;
1602 spin_unlock(&hvcs_pi_lock); 1602 spin_unlock(&hvcs_pi_lock);
1603 1603
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c
index bd9b09827b24..6f4dd83d8695 100644
--- a/drivers/tty/hvc/hvsi_lib.c
+++ b/drivers/tty/hvc/hvsi_lib.c
@@ -183,7 +183,7 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count)
183 unsigned int tries, read = 0; 183 unsigned int tries, read = 0;
184 184
185 if (WARN_ON(!pv)) 185 if (WARN_ON(!pv))
186 return 0; 186 return -ENXIO;
187 187
188 /* If we aren't open, don't do anything in order to avoid races 188 /* If we aren't open, don't do anything in order to avoid races
189 * with connection establishment. The hvc core will call this 189 * with connection establishment. The hvc core will call this
@@ -234,7 +234,7 @@ int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count)
234 int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA); 234 int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA);
235 235
236 if (WARN_ON(!pv)) 236 if (WARN_ON(!pv))
237 return 0; 237 return -ENODEV;
238 238
239 dp.hdr.type = VS_DATA_PACKET_HEADER; 239 dp.hdr.type = VS_DATA_PACKET_HEADER;
240 dp.hdr.len = adjcount + sizeof(struct hvsi_header); 240 dp.hdr.len = adjcount + sizeof(struct hvsi_header);
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index a87a56cb5417..eeadf1b8e093 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -450,24 +450,6 @@ static void au_serial_out(struct uart_port *p, int offset, int value)
450 __raw_writel(value, p->membase + offset); 450 __raw_writel(value, p->membase + offset);
451} 451}
452 452
453static unsigned int tsi_serial_in(struct uart_port *p, int offset)
454{
455 unsigned int tmp;
456 offset = map_8250_in_reg(p, offset) << p->regshift;
457 if (offset == UART_IIR) {
458 tmp = readl(p->membase + (UART_IIR & ~3));
459 return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */
460 } else
461 return readb(p->membase + offset);
462}
463
464static void tsi_serial_out(struct uart_port *p, int offset, int value)
465{
466 offset = map_8250_out_reg(p, offset) << p->regshift;
467 if (!((offset == UART_IER) && (value & UART_IER_UUE)))
468 writeb(value, p->membase + offset);
469}
470
471static unsigned int io_serial_in(struct uart_port *p, int offset) 453static unsigned int io_serial_in(struct uart_port *p, int offset)
472{ 454{
473 offset = map_8250_in_reg(p, offset) << p->regshift; 455 offset = map_8250_in_reg(p, offset) << p->regshift;
@@ -508,11 +490,6 @@ static void set_io_from_upio(struct uart_port *p)
508 p->serial_out = au_serial_out; 490 p->serial_out = au_serial_out;
509 break; 491 break;
510 492
511 case UPIO_TSI:
512 p->serial_in = tsi_serial_in;
513 p->serial_out = tsi_serial_out;
514 break;
515
516 default: 493 default:
517 p->serial_in = io_serial_in; 494 p->serial_in = io_serial_in;
518 p->serial_out = io_serial_out; 495 p->serial_out = io_serial_out;
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 3d9162151fd2..4939e0ccc4e5 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -706,6 +706,7 @@ static const struct file_operations fsl_hv_fops = {
706 .poll = fsl_hv_poll, 706 .poll = fsl_hv_poll,
707 .read = fsl_hv_read, 707 .read = fsl_hv_read,
708 .unlocked_ioctl = fsl_hv_ioctl, 708 .unlocked_ioctl = fsl_hv_ioctl,
709 .compat_ioctl = fsl_hv_ioctl,
709}; 710};
710 711
711static struct miscdevice fsl_hv_misc_dev = { 712static struct miscdevice fsl_hv_misc_dev = {