cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

mpc834x_mds.c (2287B)


      1// SPDX-License-Identifier: GPL-2.0-or-later
      2/*
      3 * arch/powerpc/platforms/83xx/mpc834x_mds.c
      4 *
      5 * MPC834x MDS board specific routines
      6 *
      7 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
      8 */
      9
     10#include <linux/stddef.h>
     11#include <linux/kernel.h>
     12#include <linux/init.h>
     13#include <linux/errno.h>
     14#include <linux/reboot.h>
     15#include <linux/pci.h>
     16#include <linux/kdev_t.h>
     17#include <linux/major.h>
     18#include <linux/console.h>
     19#include <linux/delay.h>
     20#include <linux/seq_file.h>
     21#include <linux/root_dev.h>
     22#include <linux/of_address.h>
     23#include <linux/of_platform.h>
     24
     25#include <linux/atomic.h>
     26#include <asm/time.h>
     27#include <asm/io.h>
     28#include <asm/machdep.h>
     29#include <asm/ipic.h>
     30#include <asm/irq.h>
     31#include <asm/udbg.h>
     32#include <sysdev/fsl_soc.h>
     33#include <sysdev/fsl_pci.h>
     34
     35#include "mpc83xx.h"
     36
     37#define BCSR5_INT_USB		0x02
     38static int __init mpc834xemds_usb_cfg(void)
     39{
     40	struct device_node *np;
     41	void __iomem *bcsr_regs = NULL;
     42	u8 bcsr5;
     43
     44	mpc834x_usb_cfg();
     45	/* Map BCSR area */
     46	np = of_find_node_by_name(NULL, "bcsr");
     47	if (np) {
     48		struct resource res;
     49
     50		of_address_to_resource(np, 0, &res);
     51		bcsr_regs = ioremap(res.start, resource_size(&res));
     52		of_node_put(np);
     53	}
     54	if (!bcsr_regs)
     55		return -1;
     56
     57	/*
     58	 * if Processor Board is plugged into PIB board,
     59	 * force to use the PHY on Processor Board
     60	 */
     61	bcsr5 = in_8(bcsr_regs + 5);
     62	if (!(bcsr5 & BCSR5_INT_USB))
     63		out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
     64	iounmap(bcsr_regs);
     65	return 0;
     66}
     67
     68/* ************************************************************************
     69 *
     70 * Setup the architecture
     71 *
     72 */
     73static void __init mpc834x_mds_setup_arch(void)
     74{
     75	mpc83xx_setup_arch();
     76
     77	mpc834xemds_usb_cfg();
     78}
     79
     80machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);
     81
     82/*
     83 * Called very early, MMU is off, device-tree isn't unflattened
     84 */
     85static int __init mpc834x_mds_probe(void)
     86{
     87	return of_machine_is_compatible("MPC834xMDS");
     88}
     89
     90define_machine(mpc834x_mds) {
     91	.name			= "MPC834x MDS",
     92	.probe			= mpc834x_mds_probe,
     93	.setup_arch		= mpc834x_mds_setup_arch,
     94	.discover_phbs  	= mpc83xx_setup_pci,
     95	.init_IRQ		= mpc83xx_ipic_init_IRQ,
     96	.get_irq		= ipic_get_irq,
     97	.restart		= mpc83xx_restart,
     98	.time_init		= mpc83xx_time_init,
     99	.calibrate_decr		= generic_calibrate_decr,
    100	.progress		= udbg_progress,
    101};