Path: blob/master/arch/powerpc/platforms/86xx/mvme7100.c
26481 views
// SPDX-License-Identifier: GPL-2.0-or-later1/*2* Board setup routines for the Emerson/Artesyn MVME71003*4* Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.5*6* Author: Alessio Igor Bogani <[email protected]>7*8* Based on earlier code by:9*10* Ajit Prem <[email protected]>11* Copyright 2008 Emerson12*13* USB host fixup is borrowed by:14*15* Martyn Welch <[email protected]>16* Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.17*/1819#include <linux/pci.h>20#include <linux/of.h>21#include <linux/of_fdt.h>22#include <linux/of_address.h>23#include <asm/udbg.h>24#include <asm/mpic.h>25#include <sysdev/fsl_soc.h>26#include <sysdev/fsl_pci.h>2728#include "mpc86xx.h"2930#define MVME7100_INTERRUPT_REG_2_OFFSET 0x0531#define MVME7100_DS1375_MASK 0x4032#define MVME7100_MAX6649_MASK 0x2033#define MVME7100_ABORT_MASK 0x103435/*36* Setup the architecture37*/38static void __init mvme7100_setup_arch(void)39{40struct device_node *bcsr_node;41void __iomem *mvme7100_regs = NULL;42u8 reg;4344if (ppc_md.progress)45ppc_md.progress("mvme7100_setup_arch()", 0);4647#ifdef CONFIG_SMP48mpc86xx_smp_init();49#endif5051fsl_pci_assign_primary();5253/* Remap BCSR registers */54bcsr_node = of_find_compatible_node(NULL, NULL,55"artesyn,mvme7100-bcsr");56if (bcsr_node) {57mvme7100_regs = of_iomap(bcsr_node, 0);58of_node_put(bcsr_node);59}6061if (mvme7100_regs) {62/* Disable ds1375, max6649, and abort interrupts */63reg = readb(mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);64reg |= MVME7100_DS1375_MASK | MVME7100_MAX6649_MASK65| MVME7100_ABORT_MASK;66writeb(reg, mvme7100_regs + MVME7100_INTERRUPT_REG_2_OFFSET);67} else68pr_warn("Unable to map board registers\n");6970pr_info("MVME7100 board from Artesyn\n");71}7273/*74* Called very early, device-tree isn't unflattened75*/76static int __init mvme7100_probe(void)77{78unsigned long root = of_get_flat_dt_root();7980return of_flat_dt_is_compatible(root, "artesyn,MVME7100");81}8283static void mvme7100_usb_host_fixup(struct pci_dev *pdev)84{85unsigned int val;8687if (!machine_is(mvme7100))88return;8990/* Ensure only ports 1 & 2 are enabled */91pci_read_config_dword(pdev, 0xe0, &val);92pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x2);9394/* System clock is 48-MHz Oscillator and EHCI Enabled. */95pci_write_config_dword(pdev, 0xe4, 1 << 5);96}97DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,98mvme7100_usb_host_fixup);99100machine_arch_initcall(mvme7100, mpc86xx_common_publish_devices);101102define_machine(mvme7100) {103.name = "MVME7100",104.probe = mvme7100_probe,105.setup_arch = mvme7100_setup_arch,106.init_IRQ = mpc86xx_init_irq,107.get_irq = mpic_get_irq,108.time_init = mpc86xx_time_init,109.progress = udbg_progress,110#ifdef CONFIG_PCI111.pcibios_fixup_bus = fsl_pcibios_fixup_bus,112#endif113};114115116