2 * Board setup routines for the Emerson/Artesyn MVME7100
4 * Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.
6 * Author: Alessio Igor Bogani <alessio.bogani@elettra.eu>
8 * Based on earlier code by:
10 * Ajit Prem <ajit.prem@emerson.com>
11 * Copyright 2008 Emerson
13 * USB host fixup is borrowed by:
15 * Martyn Welch <martyn.welch@ge.com>
16 * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version.
25 #include <linux/pci.h>
27 #include <linux/of_platform.h>
28 #include <linux/of_address.h>
31 #include <sysdev/fsl_soc.h>
32 #include <sysdev/fsl_pci.h>
36 #define MVME7100_INTERRUPT_REG_2_OFFSET 0x05
37 #define MVME7100_DS1375_MASK 0x40
38 #define MVME7100_MAX6649_MASK 0x20
39 #define MVME7100_ABORT_MASK 0x10
42 * Setup the architecture
44 static void __init mvme7100_setup_arch(void)
46 struct device_node *bcsr_node;
47 void __iomem *mvme7100_regs = NULL;
51 ppc_md.progress("mvme7100_setup_arch()", 0);
57 fsl_pci_assign_primary();
59 /* Remap BCSR registers */
60 bcsr_node = of_find_compatible_node(NULL, NULL,
61 "artesyn,mvme7100-bcsr");
63 mvme7100_regs = of_iomap(bcsr_node, 0);
64 of_node_put(bcsr_node);
68 /* Disable ds1375, max6649, and abort interrupts */
69 reg = readb(mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);
70 reg |= MVME7100_DS1375_MASK | MVME7100_MAX6649_MASK
71 | MVME7100_ABORT_MASK;
72 writeb(reg, mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);
74 pr_warn("Unable to map board registers\n");
76 pr_info("MVME7100 board from Artesyn\n");
80 * Called very early, device-tree isn't unflattened
82 static int __init mvme7100_probe(void)
84 unsigned long root = of_get_flat_dt_root();
86 return of_flat_dt_is_compatible(root, "artesyn,MVME7100");
89 static void mvme7100_usb_host_fixup(struct pci_dev *pdev)
93 if (!machine_is(mvme7100))
96 /* Ensure only ports 1 & 2 are enabled */
97 pci_read_config_dword(pdev, 0xe0, &val);
98 pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x2);
100 /* System clock is 48-MHz Oscillator and EHCI Enabled. */
101 pci_write_config_dword(pdev, 0xe4, 1 << 5);
103 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
104 mvme7100_usb_host_fixup);
106 machine_arch_initcall(mvme7100, mpc86xx_common_publish_devices);
108 define_machine(mvme7100) {
110 .probe = mvme7100_probe,
111 .setup_arch = mvme7100_setup_arch,
112 .init_IRQ = mpc86xx_init_irq,
113 .get_irq = mpic_get_irq,
114 .time_init = mpc86xx_time_init,
115 .calibrate_decr = generic_calibrate_decr,
116 .progress = udbg_progress,
118 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,