linux/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-or-later
   2/*
   3 * MPC86xx HPCN board specific routines
   4 *
   5 * Recode: ZHANG WEI <wei.zhang@freescale.com>
   6 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
   7 *
   8 * Copyright 2006 Freescale Semiconductor Inc.
   9 */
  10
  11#include <linux/stddef.h>
  12#include <linux/kernel.h>
  13#include <linux/pci.h>
  14#include <linux/kdev_t.h>
  15#include <linux/delay.h>
  16#include <linux/seq_file.h>
  17#include <linux/of_platform.h>
  18
  19#include <asm/time.h>
  20#include <asm/machdep.h>
  21#include <asm/pci-bridge.h>
  22#include <asm/prom.h>
  23#include <mm/mmu_decl.h>
  24#include <asm/udbg.h>
  25#include <asm/swiotlb.h>
  26
  27#include <asm/mpic.h>
  28
  29#include <sysdev/fsl_pci.h>
  30#include <sysdev/fsl_soc.h>
  31
  32#include "mpc86xx.h"
  33
  34#undef DEBUG
  35
  36#ifdef DEBUG
  37#define DBG(fmt...) do { printk(KERN_ERR fmt); } while(0)
  38#else
  39#define DBG(fmt...) do { } while(0)
  40#endif
  41
  42#ifdef CONFIG_PCI
  43extern int uli_exclude_device(struct pci_controller *hose,
  44                                u_char bus, u_char devfn);
  45
  46static int mpc86xx_exclude_device(struct pci_controller *hose,
  47                                   u_char bus, u_char devfn)
  48{
  49        if (hose->dn == fsl_pci_primary)
  50                return uli_exclude_device(hose, bus, devfn);
  51
  52        return PCIBIOS_SUCCESSFUL;
  53}
  54#endif /* CONFIG_PCI */
  55
  56
  57static void __init
  58mpc86xx_hpcn_setup_arch(void)
  59{
  60        if (ppc_md.progress)
  61                ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
  62
  63#ifdef CONFIG_PCI
  64        ppc_md.pci_exclude_device = mpc86xx_exclude_device;
  65#endif
  66
  67        printk("MPC86xx HPCN board from Freescale Semiconductor\n");
  68
  69#ifdef CONFIG_SMP
  70        mpc86xx_smp_init();
  71#endif
  72
  73        fsl_pci_assign_primary();
  74
  75        swiotlb_detect_4g();
  76}
  77
  78
  79static void
  80mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
  81{
  82        uint svid = mfspr(SPRN_SVR);
  83
  84        seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  85
  86        seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  87}
  88
  89
  90/*
  91 * Called very early, device-tree isn't unflattened
  92 */
  93static int __init mpc86xx_hpcn_probe(void)
  94{
  95        if (of_machine_is_compatible("fsl,mpc8641hpcn"))
  96                return 1;       /* Looks good */
  97
  98        /* Be nice and don't give silent boot death.  Delete this in 2.6.27 */
  99        if (of_machine_is_compatible("mpc86xx")) {
 100                pr_warn("WARNING: your dts/dtb is old. You must update before the next kernel release.\n");
 101                return 1;
 102        }
 103
 104        return 0;
 105}
 106
 107static const struct of_device_id of_bus_ids[] __initconst = {
 108        { .compatible = "fsl,srio", },
 109        {},
 110};
 111
 112static int __init declare_of_platform_devices(void)
 113{
 114        mpc86xx_common_publish_devices();
 115        of_platform_bus_probe(NULL, of_bus_ids, NULL);
 116
 117        return 0;
 118}
 119machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
 120
 121define_machine(mpc86xx_hpcn) {
 122        .name                   = "MPC86xx HPCN",
 123        .probe                  = mpc86xx_hpcn_probe,
 124        .setup_arch             = mpc86xx_hpcn_setup_arch,
 125        .init_IRQ               = mpc86xx_init_irq,
 126        .show_cpuinfo           = mpc86xx_hpcn_show_cpuinfo,
 127        .get_irq                = mpic_get_irq,
 128        .time_init              = mpc86xx_time_init,
 129        .calibrate_decr         = generic_calibrate_decr,
 130        .progress               = udbg_progress,
 131#ifdef CONFIG_PCI
 132        .pcibios_fixup_bus      = fsl_pcibios_fixup_bus,
 133#endif
 134};
 135