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_platform.h>
23 #include <linux/of_address.h>
26 #include <sysdev/fsl_soc.h>
27 #include <sysdev/fsl_pci.h>
31 #define MVME7100_INTERRUPT_REG_2_OFFSET 0x05
32 #define MVME7100_DS1375_MASK 0x40
33 #define MVME7100_MAX6649_MASK 0x20
34 #define MVME7100_ABORT_MASK 0x10
37 * Setup the architecture
39 static void __init
mvme7100_setup_arch(void)
41 struct device_node
*bcsr_node
;
42 void __iomem
*mvme7100_regs
= NULL
;
46 ppc_md
.progress("mvme7100_setup_arch()", 0);
52 fsl_pci_assign_primary();
54 /* Remap BCSR registers */
55 bcsr_node
= of_find_compatible_node(NULL
, NULL
,
56 "artesyn,mvme7100-bcsr");
58 mvme7100_regs
= of_iomap(bcsr_node
, 0);
59 of_node_put(bcsr_node
);
63 /* Disable ds1375, max6649, and abort interrupts */
64 reg
= readb(mvme7100_regs
+ MVME7100_INTERRUPT_REG_2_OFFSET
);
65 reg
|= MVME7100_DS1375_MASK
| MVME7100_MAX6649_MASK
66 | MVME7100_ABORT_MASK
;
67 writeb(reg
, mvme7100_regs
+ MVME7100_INTERRUPT_REG_2_OFFSET
);
69 pr_warn("Unable to map board registers\n");
71 pr_info("MVME7100 board from Artesyn\n");
75 * Called very early, device-tree isn't unflattened
77 static int __init
mvme7100_probe(void)
79 unsigned long root
= of_get_flat_dt_root();
81 return of_flat_dt_is_compatible(root
, "artesyn,MVME7100");
84 static void mvme7100_usb_host_fixup(struct pci_dev
*pdev
)
88 if (!machine_is(mvme7100
))
91 /* Ensure only ports 1 & 2 are enabled */
92 pci_read_config_dword(pdev
, 0xe0, &val
);
93 pci_write_config_dword(pdev
, 0xe0, (val
& ~7) | 0x2);
95 /* System clock is 48-MHz Oscillator and EHCI Enabled. */
96 pci_write_config_dword(pdev
, 0xe4, 1 << 5);
98 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC
, PCI_DEVICE_ID_NEC_USB
,
99 mvme7100_usb_host_fixup
);
101 machine_arch_initcall(mvme7100
, mpc86xx_common_publish_devices
);
103 define_machine(mvme7100
) {
105 .probe
= mvme7100_probe
,
106 .setup_arch
= mvme7100_setup_arch
,
107 .init_IRQ
= mpc86xx_init_irq
,
108 .get_irq
= mpic_get_irq
,
109 .time_init
= mpc86xx_time_init
,
110 .calibrate_decr
= generic_calibrate_decr
,
111 .progress
= udbg_progress
,
113 .pcibios_fixup_bus
= fsl_pcibios_fixup_bus
,