1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Board setup routines for the Emerson/Artesyn MVME7100
5 * Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.
7 * Author: Alessio Igor Bogani <alessio.bogani@elettra.eu>
9 * Based on earlier code by:
11 * Ajit Prem <ajit.prem@emerson.com>
12 * Copyright 2008 Emerson
14 * USB host fixup is borrowed by:
16 * Martyn Welch <martyn.welch@ge.com>
17 * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
20 #include <linux/pci.h>
22 #include <linux/of_fdt.h>
23 #include <linux/of_platform.h>
24 #include <linux/of_address.h>
27 #include <sysdev/fsl_soc.h>
28 #include <sysdev/fsl_pci.h>
32 #define MVME7100_INTERRUPT_REG_2_OFFSET 0x05
33 #define MVME7100_DS1375_MASK 0x40
34 #define MVME7100_MAX6649_MASK 0x20
35 #define MVME7100_ABORT_MASK 0x10
38 * Setup the architecture
40 static void __init mvme7100_setup_arch(void)
42 struct device_node *bcsr_node;
43 void __iomem *mvme7100_regs = NULL;
47 ppc_md.progress("mvme7100_setup_arch()", 0);
53 fsl_pci_assign_primary();
55 /* Remap BCSR registers */
56 bcsr_node = of_find_compatible_node(NULL, NULL,
57 "artesyn,mvme7100-bcsr");
59 mvme7100_regs = of_iomap(bcsr_node, 0);
60 of_node_put(bcsr_node);
64 /* Disable ds1375, max6649, and abort interrupts */
65 reg = readb(mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);
66 reg |= MVME7100_DS1375_MASK | MVME7100_MAX6649_MASK
67 | MVME7100_ABORT_MASK;
68 writeb(reg, mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);
70 pr_warn("Unable to map board registers\n");
72 pr_info("MVME7100 board from Artesyn\n");
76 * Called very early, device-tree isn't unflattened
78 static int __init mvme7100_probe(void)
80 unsigned long root = of_get_flat_dt_root();
82 return of_flat_dt_is_compatible(root, "artesyn,MVME7100");
85 static void mvme7100_usb_host_fixup(struct pci_dev *pdev)
89 if (!machine_is(mvme7100))
92 /* Ensure only ports 1 & 2 are enabled */
93 pci_read_config_dword(pdev, 0xe0, &val);
94 pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x2);
96 /* System clock is 48-MHz Oscillator and EHCI Enabled. */
97 pci_write_config_dword(pdev, 0xe4, 1 << 5);
99 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
100 mvme7100_usb_host_fixup);
102 machine_arch_initcall(mvme7100, mpc86xx_common_publish_devices);
104 define_machine(mvme7100) {
106 .probe = mvme7100_probe,
107 .setup_arch = mvme7100_setup_arch,
108 .init_IRQ = mpc86xx_init_irq,
109 .get_irq = mpic_get_irq,
110 .time_init = mpc86xx_time_init,
111 .calibrate_decr = generic_calibrate_decr,
112 .progress = udbg_progress,
114 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,