spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / arch / powerpc / platforms / 85xx / tqm85xx.c
blobbf7c89fb75bbf92ebd4eb9efcd707f7fe5c315a1
1 /*
2 * Based on MPC8560 ADS and arch/ppc tqm85xx ports
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
6 * Copyright 2008 Freescale Semiconductor Inc.
8 * Copyright (c) 2005-2006 DENX Software Engineering
9 * Stefan Roese <sr@denx.de>
11 * Based on original work by
12 * Kumar Gala <kumar.gala@freescale.com>
13 * Copyright 2004 Freescale Semiconductor Inc.
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
21 #include <linux/stddef.h>
22 #include <linux/kernel.h>
23 #include <linux/pci.h>
24 #include <linux/kdev_t.h>
25 #include <linux/delay.h>
26 #include <linux/seq_file.h>
27 #include <linux/of_platform.h>
29 #include <asm/system.h>
30 #include <asm/time.h>
31 #include <asm/machdep.h>
32 #include <asm/pci-bridge.h>
33 #include <asm/mpic.h>
34 #include <asm/prom.h>
35 #include <mm/mmu_decl.h>
36 #include <asm/udbg.h>
38 #include <sysdev/fsl_soc.h>
39 #include <sysdev/fsl_pci.h>
41 #include "mpc85xx.h"
43 #ifdef CONFIG_CPM2
44 #include <asm/cpm2.h>
45 #endif /* CONFIG_CPM2 */
47 static void __init tqm85xx_pic_init(void)
49 struct mpic *mpic = mpic_alloc(NULL, 0,
50 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
51 0, 256, " OpenPIC ");
52 BUG_ON(mpic == NULL);
53 mpic_init(mpic);
55 mpc85xx_cpm2_pic_init();
59 * Setup the architecture
61 static void __init tqm85xx_setup_arch(void)
63 #ifdef CONFIG_PCI
64 struct device_node *np;
65 #endif
67 if (ppc_md.progress)
68 ppc_md.progress("tqm85xx_setup_arch()", 0);
70 #ifdef CONFIG_CPM2
71 cpm2_reset();
72 #endif
74 #ifdef CONFIG_PCI
75 for_each_node_by_type(np, "pci") {
76 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
77 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
78 struct resource rsrc;
79 if (!of_address_to_resource(np, 0, &rsrc)) {
80 if ((rsrc.start & 0xfffff) == 0x8000)
81 fsl_add_bridge(np, 1);
82 else
83 fsl_add_bridge(np, 0);
87 #endif
90 static void tqm85xx_show_cpuinfo(struct seq_file *m)
92 uint pvid, svid, phid1;
94 pvid = mfspr(SPRN_PVR);
95 svid = mfspr(SPRN_SVR);
97 seq_printf(m, "Vendor\t\t: TQ Components\n");
98 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
99 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
101 /* Display cpu Pll setting */
102 phid1 = mfspr(SPRN_HID1);
103 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
106 static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)
108 unsigned int val;
110 /* Do not do the fixup on other platforms! */
111 if (!machine_is(tqm85xx))
112 return;
114 dev_info(&pdev->dev, "Using TI 1520 fixup on TQM85xx\n");
117 * Enable P2CCLK bit in system control register
118 * to enable CLOCK output to power chip
120 pci_read_config_dword(pdev, 0x80, &val);
121 pci_write_config_dword(pdev, 0x80, val | (1 << 27));
124 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
125 tqm85xx_ti1520_fixup);
127 machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices);
129 static const char *board[] __initdata = {
130 "tqc,tqm8540",
131 "tqc,tqm8541",
132 "tqc,tqm8548",
133 "tqc,tqm8555",
134 "tqc,tqm8560",
135 NULL
139 * Called very early, device-tree isn't unflattened
141 static int __init tqm85xx_probe(void)
143 return of_flat_dt_match(of_get_flat_dt_root(), board);
146 define_machine(tqm85xx) {
147 .name = "TQM85xx",
148 .probe = tqm85xx_probe,
149 .setup_arch = tqm85xx_setup_arch,
150 .init_IRQ = tqm85xx_pic_init,
151 .show_cpuinfo = tqm85xx_show_cpuinfo,
152 .get_irq = mpic_get_irq,
153 .restart = fsl_rstcr_restart,
154 .calibrate_decr = generic_calibrate_decr,
155 .progress = udbg_progress,