• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * SBC8641D board specific routines
3  *
4  * Copyright 2008 Wind River Systems Inc.
5  *
6  * By Paul Gortmaker (see MAINTAINERS for contact information)
7  *
8  * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
9  *
10  * This program is free software; you can redistribute  it and/or modify it
11  * under  the terms of  the GNU General  Public License as published by the
12  * Free Software Foundation;  either version 2 of the  License, or (at your
13  * option) any later version.
14  */
15 
16 #include <linux/stddef.h>
17 #include <linux/kernel.h>
18 #include <linux/pci.h>
19 #include <linux/kdev_t.h>
20 #include <linux/delay.h>
21 #include <linux/seq_file.h>
22 #include <linux/of_platform.h>
23 
24 #include <asm/time.h>
25 #include <asm/machdep.h>
26 #include <asm/pci-bridge.h>
27 #include <asm/prom.h>
28 #include <mm/mmu_decl.h>
29 #include <asm/udbg.h>
30 
31 #include <asm/mpic.h>
32 
33 #include <sysdev/fsl_pci.h>
34 #include <sysdev/fsl_soc.h>
35 
36 #include "mpc86xx.h"
37 
38 static void __init
sbc8641_setup_arch(void)39 sbc8641_setup_arch(void)
40 {
41 #ifdef CONFIG_PCI
42 	struct device_node *np;
43 #endif
44 
45 	if (ppc_md.progress)
46 		ppc_md.progress("sbc8641_setup_arch()", 0);
47 
48 #ifdef CONFIG_PCI
49 	for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
50 		fsl_add_bridge(np, 0);
51 #endif
52 
53 	printk("SBC8641 board from Wind River\n");
54 
55 #ifdef CONFIG_SMP
56 	mpc86xx_smp_init();
57 #endif
58 }
59 
60 
61 static void
sbc8641_show_cpuinfo(struct seq_file * m)62 sbc8641_show_cpuinfo(struct seq_file *m)
63 {
64 	uint svid = mfspr(SPRN_SVR);
65 
66 	seq_printf(m, "Vendor\t\t: Wind River Systems\n");
67 
68 	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
69 }
70 
71 
72 /*
73  * Called very early, device-tree isn't unflattened
74  */
sbc8641_probe(void)75 static int __init sbc8641_probe(void)
76 {
77 	unsigned long root = of_get_flat_dt_root();
78 
79 	if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
80 		return 1;	/* Looks good */
81 
82 	return 0;
83 }
84 
85 static long __init
mpc86xx_time_init(void)86 mpc86xx_time_init(void)
87 {
88 	unsigned int temp;
89 
90 	/* Set the time base to zero */
91 	mtspr(SPRN_TBWL, 0);
92 	mtspr(SPRN_TBWU, 0);
93 
94 	temp = mfspr(SPRN_HID0);
95 	temp |= HID0_TBEN;
96 	mtspr(SPRN_HID0, temp);
97 	asm volatile("isync");
98 
99 	return 0;
100 }
101 
102 static __initdata struct of_device_id of_bus_ids[] = {
103 	{ .compatible = "simple-bus", },
104 	{ .compatible = "gianfar", },
105 	{},
106 };
107 
declare_of_platform_devices(void)108 static int __init declare_of_platform_devices(void)
109 {
110 	of_platform_bus_probe(NULL, of_bus_ids, NULL);
111 
112 	return 0;
113 }
114 machine_device_initcall(sbc8641, declare_of_platform_devices);
115 
define_machine(sbc8641)116 define_machine(sbc8641) {
117 	.name			= "SBC8641D",
118 	.probe			= sbc8641_probe,
119 	.setup_arch		= sbc8641_setup_arch,
120 	.init_IRQ		= mpc86xx_init_irq,
121 	.show_cpuinfo		= sbc8641_show_cpuinfo,
122 	.get_irq		= mpic_get_irq,
123 	.restart		= fsl_rstcr_restart,
124 	.time_init		= mpc86xx_time_init,
125 	.calibrate_decr		= generic_calibrate_decr,
126 	.progress		= udbg_progress,
127 #ifdef CONFIG_PCI
128 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
129 #endif
130 };
131