blob: 9fc20a37835e62b5247bf5d37cf5283e06825f7c [file] [log] [blame]
Kumar Gala0052bc52008-01-24 23:53:03 -06001/*
2 * Based on MPC8560 ADS and arch/ppc tqm85xx ports
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2008 Freescale Semiconductor Inc.
7 *
8 * Copyright (c) 2005-2006 DENX Software Engineering
9 * Stefan Roese <sr@denx.de>
10 *
11 * Based on original work by
12 * Kumar Gala <kumar.gala@freescale.com>
13 * Copyright 2004 Freescale Semiconductor Inc.
14 *
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.
19 */
20
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>
28
Kumar Gala0052bc52008-01-24 23:53:03 -060029#include <asm/time.h>
30#include <asm/machdep.h>
31#include <asm/pci-bridge.h>
32#include <asm/mpic.h>
33#include <asm/prom.h>
34#include <mm/mmu_decl.h>
35#include <asm/udbg.h>
36
37#include <sysdev/fsl_soc.h>
38#include <sysdev/fsl_pci.h>
39
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040040#include "mpc85xx.h"
41
Kumar Gala0052bc52008-01-24 23:53:03 -060042#ifdef CONFIG_CPM2
43#include <asm/cpm2.h>
Kumar Gala0052bc52008-01-24 23:53:03 -060044#endif /* CONFIG_CPM2 */
45
46static void __init tqm85xx_pic_init(void)
47{
Kyle Moffett996983b2011-12-02 06:28:02 +000048 struct mpic *mpic = mpic_alloc(NULL, 0,
Kyle Moffette55d7f72011-12-22 10:19:14 +000049 MPIC_BIG_ENDIAN,
Kumar Gala0052bc52008-01-24 23:53:03 -060050 0, 256, " OpenPIC ");
51 BUG_ON(mpic == NULL);
Kumar Gala0052bc52008-01-24 23:53:03 -060052 mpic_init(mpic);
53
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040054 mpc85xx_cpm2_pic_init();
Kumar Gala0052bc52008-01-24 23:53:03 -060055}
56
57/*
58 * Setup the architecture
59 */
60static void __init tqm85xx_setup_arch(void)
61{
Kumar Gala0052bc52008-01-24 23:53:03 -060062 if (ppc_md.progress)
63 ppc_md.progress("tqm85xx_setup_arch()", 0);
64
65#ifdef CONFIG_CPM2
66 cpm2_reset();
67#endif
68
Jia Hongtao905e75c2012-08-28 15:44:08 +080069 fsl_pci_assign_primary();
Kumar Gala0052bc52008-01-24 23:53:03 -060070}
71
72static void tqm85xx_show_cpuinfo(struct seq_file *m)
73{
74 uint pvid, svid, phid1;
Kumar Gala0052bc52008-01-24 23:53:03 -060075
76 pvid = mfspr(SPRN_PVR);
77 svid = mfspr(SPRN_SVR);
78
79 seq_printf(m, "Vendor\t\t: TQ Components\n");
80 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
81 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
82
83 /* Display cpu Pll setting */
84 phid1 = mfspr(SPRN_HID1);
85 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
Kumar Gala0052bc52008-01-24 23:53:03 -060086}
87
Greg Kroah-Hartmancad5cef2012-12-21 14:04:10 -080088static void tqm85xx_ti1520_fixup(struct pci_dev *pdev)
Dmitry Eremin-Solenikove9502fb2010-07-21 10:33:24 +000089{
90 unsigned int val;
91
92 /* Do not do the fixup on other platforms! */
93 if (!machine_is(tqm85xx))
94 return;
95
96 dev_info(&pdev->dev, "Using TI 1520 fixup on TQM85xx\n");
97
98 /*
99 * Enable P2CCLK bit in system control register
100 * to enable CLOCK output to power chip
101 */
102 pci_read_config_dword(pdev, 0x80, &val);
103 pci_write_config_dword(pdev, 0x80, val | (1 << 27));
104
105}
106DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
107 tqm85xx_ti1520_fixup);
108
Jia Hongtao905e75c2012-08-28 15:44:08 +0800109machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices);
Kumar Gala0052bc52008-01-24 23:53:03 -0600110
Andi Kleen9597abe2012-10-04 17:11:37 -0700111static const char * const board[] __initconst = {
Grant Likelya4f740c2010-10-30 11:49:09 -0400112 "tqc,tqm8540",
113 "tqc,tqm8541",
114 "tqc,tqm8548",
115 "tqc,tqm8555",
116 "tqc,tqm8560",
117 NULL
118};
119
Kumar Gala0052bc52008-01-24 23:53:03 -0600120/*
121 * Called very early, device-tree isn't unflattened
122 */
123static int __init tqm85xx_probe(void)
124{
Benjamin Herrenschmidt56571382016-07-05 15:04:05 +1000125 return of_device_compatible_match(of_root, board);
Kumar Gala0052bc52008-01-24 23:53:03 -0600126}
127
128define_machine(tqm85xx) {
129 .name = "TQM85xx",
130 .probe = tqm85xx_probe,
131 .setup_arch = tqm85xx_setup_arch,
132 .init_IRQ = tqm85xx_pic_init,
133 .show_cpuinfo = tqm85xx_show_cpuinfo,
134 .get_irq = mpic_get_irq,
Kumar Gala0052bc52008-01-24 23:53:03 -0600135 .calibrate_decr = generic_calibrate_decr,
136 .progress = udbg_progress,
137};