powerpc: Correct USB support for GE Fanuc SBC610
[deliverable/linux.git] / arch / powerpc / platforms / 86xx / gef_sbc610.c
CommitLineData
54508214
MW
1/*
2 * GE Fanuc SBC610 board support
3 *
4 * Author: Martyn Welch <martyn.welch@gefanuc.com>
5 *
6 * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc.
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 * Based on: mpc86xx_hpcn.c (MPC86xx HPCN board specific routines)
14 * Copyright 2006 Freescale Semiconductor Inc.
a969e76a
MW
15 *
16 * NEC fixup adapted from arch/mips/pci/fixup-lm2e.c
54508214
MW
17 */
18
19#include <linux/stddef.h>
20#include <linux/kernel.h>
21#include <linux/pci.h>
22#include <linux/kdev_t.h>
23#include <linux/delay.h>
24#include <linux/seq_file.h>
25#include <linux/of_platform.h>
26
27#include <asm/system.h>
28#include <asm/time.h>
29#include <asm/machdep.h>
30#include <asm/pci-bridge.h>
31#include <asm/mpc86xx.h>
32#include <asm/prom.h>
33#include <mm/mmu_decl.h>
34#include <asm/udbg.h>
35
36#include <asm/mpic.h>
37
38#include <sysdev/fsl_pci.h>
39#include <sysdev/fsl_soc.h>
40
41#include "mpc86xx.h"
42
43#undef DEBUG
44
45#ifdef DEBUG
46#define DBG (fmt...) do { printk(KERN_ERR "SBC610: " fmt); } while (0)
47#else
48#define DBG (fmt...) do { } while (0)
49#endif
50
51static void __init gef_sbc610_setup_arch(void)
52{
53#ifdef CONFIG_PCI
54 struct device_node *np;
55
56 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
57 fsl_add_bridge(np, 1);
58 }
59#endif
60
61 printk(KERN_INFO "GE Fanuc Intelligent Platforms SBC610 6U VPX SBC\n");
62
63#ifdef CONFIG_SMP
64 mpc86xx_smp_init();
65#endif
66}
67
68
69static void gef_sbc610_show_cpuinfo(struct seq_file *m)
70{
54508214 71 uint memsize = total_memory;
54508214
MW
72 uint svid = mfspr(SPRN_SVR);
73
74 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n");
75
54508214
MW
76 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
77 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
78}
79
a969e76a
MW
80static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev)
81{
82 unsigned int val;
83
84 printk(KERN_INFO "Running NEC uPD720101 Fixup\n");
85
86 /* Ensure ports 1, 2, 3, 4 & 5 are enabled */
87 pci_read_config_dword(pdev, 0xe0, &val);
88 pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x5);
89
90 /* System clock is 48-MHz Oscillator and EHCI Enabled. */
91 pci_write_config_dword(pdev, 0xe4, 1 << 5);
92}
93DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
94 gef_sbc610_nec_fixup);
54508214
MW
95
96/*
97 * Called very early, device-tree isn't unflattened
98 *
99 * This function is called to determine whether the BSP is compatible with the
100 * supplied device-tree, which is assumed to be the correct one for the actual
101 * board. It is expected thati, in the future, a kernel may support multiple
102 * boards.
103 */
104static int __init gef_sbc610_probe(void)
105{
106 unsigned long root = of_get_flat_dt_root();
107
108 if (of_flat_dt_is_compatible(root, "gef,sbc610"))
109 return 1;
110
111 return 0;
112}
113
114static long __init mpc86xx_time_init(void)
115{
116 unsigned int temp;
117
118 /* Set the time base to zero */
119 mtspr(SPRN_TBWL, 0);
120 mtspr(SPRN_TBWU, 0);
121
122 temp = mfspr(SPRN_HID0);
123 temp |= HID0_TBEN;
124 mtspr(SPRN_HID0, temp);
125 asm volatile("isync");
126
127 return 0;
128}
129
130static __initdata struct of_device_id of_bus_ids[] = {
131 { .compatible = "simple-bus", },
132 {},
133};
134
135static int __init declare_of_platform_devices(void)
136{
137 printk(KERN_DEBUG "Probe platform devices\n");
138 of_platform_bus_probe(NULL, of_bus_ids, NULL);
139
140 return 0;
141}
142machine_device_initcall(gef_sbc610, declare_of_platform_devices);
143
144define_machine(gef_sbc610) {
145 .name = "GE Fanuc SBC610",
146 .probe = gef_sbc610_probe,
147 .setup_arch = gef_sbc610_setup_arch,
148 .init_IRQ = mpc86xx_init_irq,
149 .show_cpuinfo = gef_sbc610_show_cpuinfo,
150 .get_irq = mpic_get_irq,
151 .restart = fsl_rstcr_restart,
152 .time_init = mpc86xx_time_init,
153 .calibrate_decr = generic_calibrate_decr,
154 .progress = udbg_progress,
155#ifdef CONFIG_PCI
156 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
157#endif
158};
This page took 0.055899 seconds and 5 git commands to generate.