powerpc/eeh: Check handle_eeh_events() return value
[deliverable/linux.git] / arch / powerpc / platforms / 83xx / km83xx.c
1 /*
2 * Copyright 2008-2011 DENX Software Engineering GmbH
3 * Author: Heiko Schocher <hs@denx.de>
4 *
5 * Description:
6 * Keymile KMETER1 board specific routines.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14 #include <linux/stddef.h>
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/errno.h>
18 #include <linux/reboot.h>
19 #include <linux/pci.h>
20 #include <linux/kdev_t.h>
21 #include <linux/major.h>
22 #include <linux/console.h>
23 #include <linux/delay.h>
24 #include <linux/seq_file.h>
25 #include <linux/root_dev.h>
26 #include <linux/initrd.h>
27 #include <linux/of_platform.h>
28 #include <linux/of_device.h>
29
30 #include <linux/atomic.h>
31 #include <asm/time.h>
32 #include <asm/io.h>
33 #include <asm/machdep.h>
34 #include <asm/ipic.h>
35 #include <asm/irq.h>
36 #include <asm/prom.h>
37 #include <asm/udbg.h>
38 #include <sysdev/fsl_soc.h>
39 #include <sysdev/fsl_pci.h>
40 #include <asm/qe.h>
41 #include <asm/qe_ic.h>
42
43 #include "mpc83xx.h"
44
45 #define SVR_REV(svr) (((svr) >> 0) & 0xFFFF) /* Revision field */
46 /* ************************************************************************
47 *
48 * Setup the architecture
49 *
50 */
51 static void __init mpc83xx_km_setup_arch(void)
52 {
53 #ifdef CONFIG_QUICC_ENGINE
54 struct device_node *np;
55 #endif
56
57 if (ppc_md.progress)
58 ppc_md.progress("kmpbec83xx_setup_arch()", 0);
59
60 mpc83xx_setup_pci();
61
62 #ifdef CONFIG_QUICC_ENGINE
63 qe_reset();
64
65 np = of_find_node_by_name(NULL, "par_io");
66 if (np != NULL) {
67 par_io_init(np);
68 of_node_put(np);
69
70 for_each_node_by_name(np, "spi")
71 par_io_of_config(np);
72
73 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
74 par_io_of_config(np);
75 }
76
77 np = of_find_compatible_node(NULL, "network", "ucc_geth");
78 if (np != NULL) {
79 uint svid;
80
81 /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */
82 svid = mfspr(SPRN_SVR);
83 if (SVR_REV(svid) == 0x0021) {
84 struct device_node *np_par;
85 struct resource res;
86 void __iomem *base;
87 int ret;
88
89 np_par = of_find_node_by_name(NULL, "par_io");
90 if (np_par == NULL) {
91 printk(KERN_WARNING "%s couldn;t find par_io node\n",
92 __func__);
93 return;
94 }
95 /* Map Parallel I/O ports registers */
96 ret = of_address_to_resource(np_par, 0, &res);
97 if (ret) {
98 printk(KERN_WARNING "%s couldn;t map par_io registers\n",
99 __func__);
100 return;
101 }
102 base = ioremap(res.start, resource_size(&res));
103
104 /*
105 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2)
106 * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1)
107 */
108 setbits32((base + 0xa8), 0x0c003000);
109
110 /*
111 * IMMR + 0x14AC[20:27] = 10101010
112 * (data delay for both UCC's)
113 */
114 clrsetbits_be32((base + 0xac), 0xff0, 0xaa0);
115 iounmap(base);
116 of_node_put(np_par);
117 }
118 of_node_put(np);
119 }
120 #endif /* CONFIG_QUICC_ENGINE */
121 }
122
123 machine_device_initcall(mpc83xx_km, mpc83xx_declare_of_platform_devices);
124
125 /* list of the supported boards */
126 static char *board[] __initdata = {
127 "Keymile,KMETER1",
128 "Keymile,kmpbec8321",
129 NULL
130 };
131
132 /*
133 * Called very early, MMU is off, device-tree isn't unflattened
134 */
135 static int __init mpc83xx_km_probe(void)
136 {
137 unsigned long node = of_get_flat_dt_root();
138 int i = 0;
139
140 while (board[i]) {
141 if (of_flat_dt_is_compatible(node, board[i]))
142 break;
143 i++;
144 }
145 return (board[i] != NULL);
146 }
147
148 define_machine(mpc83xx_km) {
149 .name = "mpc83xx-km-platform",
150 .probe = mpc83xx_km_probe,
151 .setup_arch = mpc83xx_km_setup_arch,
152 .init_IRQ = mpc83xx_ipic_and_qe_init_IRQ,
153 .get_irq = ipic_get_irq,
154 .restart = mpc83xx_restart,
155 .time_init = mpc83xx_time_init,
156 .calibrate_decr = generic_calibrate_decr,
157 .progress = udbg_progress,
158 };
This page took 0.047415 seconds and 5 git commands to generate.