Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
0004  *
0005  * Description:
0006  * MPC832xE MDS board specific routines.
0007  */
0008 
0009 #include <linux/stddef.h>
0010 #include <linux/kernel.h>
0011 #include <linux/init.h>
0012 #include <linux/errno.h>
0013 #include <linux/reboot.h>
0014 #include <linux/pci.h>
0015 #include <linux/kdev_t.h>
0016 #include <linux/major.h>
0017 #include <linux/console.h>
0018 #include <linux/delay.h>
0019 #include <linux/seq_file.h>
0020 #include <linux/root_dev.h>
0021 #include <linux/initrd.h>
0022 #include <linux/of_platform.h>
0023 #include <linux/of_device.h>
0024 
0025 #include <linux/atomic.h>
0026 #include <asm/time.h>
0027 #include <asm/io.h>
0028 #include <asm/machdep.h>
0029 #include <asm/ipic.h>
0030 #include <asm/irq.h>
0031 #include <asm/udbg.h>
0032 #include <sysdev/fsl_soc.h>
0033 #include <sysdev/fsl_pci.h>
0034 #include <soc/fsl/qe/qe.h>
0035 
0036 #include "mpc83xx.h"
0037 
0038 #undef DEBUG
0039 #ifdef DEBUG
0040 #define DBG(fmt...) udbg_printf(fmt)
0041 #else
0042 #define DBG(fmt...)
0043 #endif
0044 
0045 /* ************************************************************************
0046  *
0047  * Setup the architecture
0048  *
0049  */
0050 static void __init mpc832x_sys_setup_arch(void)
0051 {
0052     struct device_node *np;
0053     u8 __iomem *bcsr_regs = NULL;
0054 
0055     mpc83xx_setup_arch();
0056 
0057     /* Map BCSR area */
0058     np = of_find_node_by_name(NULL, "bcsr");
0059     if (np) {
0060         struct resource res;
0061 
0062         of_address_to_resource(np, 0, &res);
0063         bcsr_regs = ioremap(res.start, resource_size(&res));
0064         of_node_put(np);
0065     }
0066 
0067 #ifdef CONFIG_QUICC_ENGINE
0068     if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
0069         par_io_init(np);
0070         of_node_put(np);
0071 
0072         for_each_node_by_name(np, "ucc")
0073             par_io_of_config(np);
0074     }
0075 
0076     if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
0077             != NULL){
0078         /* Reset the Ethernet PHYs */
0079 #define BCSR8_FETH_RST 0x50
0080         clrbits8(&bcsr_regs[8], BCSR8_FETH_RST);
0081         udelay(1000);
0082         setbits8(&bcsr_regs[8], BCSR8_FETH_RST);
0083         iounmap(bcsr_regs);
0084         of_node_put(np);
0085     }
0086 #endif              /* CONFIG_QUICC_ENGINE */
0087 }
0088 
0089 machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);
0090 
0091 /*
0092  * Called very early, MMU is off, device-tree isn't unflattened
0093  */
0094 static int __init mpc832x_sys_probe(void)
0095 {
0096     return of_machine_is_compatible("MPC832xMDS");
0097 }
0098 
0099 define_machine(mpc832x_mds) {
0100     .name       = "MPC832x MDS",
0101     .probe      = mpc832x_sys_probe,
0102     .setup_arch     = mpc832x_sys_setup_arch,
0103     .discover_phbs  = mpc83xx_setup_pci,
0104     .init_IRQ   = mpc83xx_ipic_init_IRQ,
0105     .get_irq    = ipic_get_irq,
0106     .restart    = mpc83xx_restart,
0107     .time_init  = mpc83xx_time_init,
0108     .calibrate_decr = generic_calibrate_decr,
0109     .progress   = udbg_progress,
0110 };