Path: blob/master/arch/powerpc/platforms/83xx/mpc832x_mds.c
10819 views
/*1* Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.2*3* Description:4* MPC832xE MDS board specific routines.5*6* This program is free software; you can redistribute it and/or modify it7* under the terms of the GNU General Public License as published by the8* Free Software Foundation; either version 2 of the License, or (at your9* option) any later version.10*/1112#include <linux/stddef.h>13#include <linux/kernel.h>14#include <linux/init.h>15#include <linux/errno.h>16#include <linux/reboot.h>17#include <linux/pci.h>18#include <linux/kdev_t.h>19#include <linux/major.h>20#include <linux/console.h>21#include <linux/delay.h>22#include <linux/seq_file.h>23#include <linux/root_dev.h>24#include <linux/initrd.h>25#include <linux/of_platform.h>26#include <linux/of_device.h>2728#include <asm/system.h>29#include <asm/atomic.h>30#include <asm/time.h>31#include <asm/io.h>32#include <asm/machdep.h>33#include <asm/ipic.h>34#include <asm/irq.h>35#include <asm/prom.h>36#include <asm/udbg.h>37#include <sysdev/fsl_soc.h>38#include <sysdev/fsl_pci.h>39#include <asm/qe.h>40#include <asm/qe_ic.h>4142#include "mpc83xx.h"4344#undef DEBUG45#ifdef DEBUG46#define DBG(fmt...) udbg_printf(fmt)47#else48#define DBG(fmt...)49#endif5051/* ************************************************************************52*53* Setup the architecture54*55*/56static void __init mpc832x_sys_setup_arch(void)57{58struct device_node *np;59u8 __iomem *bcsr_regs = NULL;6061if (ppc_md.progress)62ppc_md.progress("mpc832x_sys_setup_arch()", 0);6364/* Map BCSR area */65np = of_find_node_by_name(NULL, "bcsr");66if (np) {67struct resource res;6869of_address_to_resource(np, 0, &res);70bcsr_regs = ioremap(res.start, res.end - res.start +1);71of_node_put(np);72}7374#ifdef CONFIG_PCI75for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")76mpc83xx_add_bridge(np);77#endif7879#ifdef CONFIG_QUICC_ENGINE80qe_reset();8182if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {83par_io_init(np);84of_node_put(np);8586for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)87par_io_of_config(np);88}8990if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))91!= NULL){92/* Reset the Ethernet PHYs */93#define BCSR8_FETH_RST 0x5094clrbits8(&bcsr_regs[8], BCSR8_FETH_RST);95udelay(1000);96setbits8(&bcsr_regs[8], BCSR8_FETH_RST);97iounmap(bcsr_regs);98of_node_put(np);99}100#endif /* CONFIG_QUICC_ENGINE */101}102103static struct of_device_id mpc832x_ids[] = {104{ .type = "soc", },105{ .compatible = "soc", },106{ .compatible = "simple-bus", },107{ .type = "qe", },108{ .compatible = "fsl,qe", },109{},110};111112static int __init mpc832x_declare_of_platform_devices(void)113{114/* Publish the QE devices */115of_platform_bus_probe(NULL, mpc832x_ids, NULL);116117return 0;118}119machine_device_initcall(mpc832x_mds, mpc832x_declare_of_platform_devices);120121static void __init mpc832x_sys_init_IRQ(void)122{123struct device_node *np;124125np = of_find_node_by_type(NULL, "ipic");126if (!np)127return;128129ipic_init(np, 0);130131/* Initialize the default interrupt mapping priorities,132* in case the boot rom changed something on us.133*/134ipic_set_default_priority();135of_node_put(np);136137#ifdef CONFIG_QUICC_ENGINE138np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");139if (!np) {140np = of_find_node_by_type(NULL, "qeic");141if (!np)142return;143}144qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);145of_node_put(np);146#endif /* CONFIG_QUICC_ENGINE */147}148149/*150* Called very early, MMU is off, device-tree isn't unflattened151*/152static int __init mpc832x_sys_probe(void)153{154unsigned long root = of_get_flat_dt_root();155156return of_flat_dt_is_compatible(root, "MPC832xMDS");157}158159define_machine(mpc832x_mds) {160.name = "MPC832x MDS",161.probe = mpc832x_sys_probe,162.setup_arch = mpc832x_sys_setup_arch,163.init_IRQ = mpc832x_sys_init_IRQ,164.get_irq = ipic_get_irq,165.restart = mpc83xx_restart,166.time_init = mpc83xx_time_init,167.calibrate_decr = generic_calibrate_decr,168.progress = udbg_progress,169};170171172