Path: blob/master/arch/powerpc/platforms/83xx/mpc834x_mds.c
10818 views
/*1* arch/powerpc/platforms/83xx/mpc834x_mds.c2*3* MPC834x MDS board specific routines4*5* Maintainer: Kumar Gala <[email protected]>6*7* This program is free software; you can redistribute it and/or modify it8* under the terms of the GNU General Public License as published by the9* Free Software Foundation; either version 2 of the License, or (at your10* option) any later version.11*/1213#include <linux/stddef.h>14#include <linux/kernel.h>15#include <linux/init.h>16#include <linux/errno.h>17#include <linux/reboot.h>18#include <linux/pci.h>19#include <linux/kdev_t.h>20#include <linux/major.h>21#include <linux/console.h>22#include <linux/delay.h>23#include <linux/seq_file.h>24#include <linux/root_dev.h>25#include <linux/of_platform.h>2627#include <asm/system.h>28#include <asm/atomic.h>29#include <asm/time.h>30#include <asm/io.h>31#include <asm/machdep.h>32#include <asm/ipic.h>33#include <asm/irq.h>34#include <asm/prom.h>35#include <asm/udbg.h>36#include <sysdev/fsl_soc.h>37#include <sysdev/fsl_pci.h>3839#include "mpc83xx.h"4041#define BCSR5_INT_USB 0x0242static int mpc834xemds_usb_cfg(void)43{44struct device_node *np;45void __iomem *bcsr_regs = NULL;46u8 bcsr5;4748mpc834x_usb_cfg();49/* Map BCSR area */50np = of_find_node_by_name(NULL, "bcsr");51if (np) {52struct resource res;5354of_address_to_resource(np, 0, &res);55bcsr_regs = ioremap(res.start, res.end - res.start + 1);56of_node_put(np);57}58if (!bcsr_regs)59return -1;6061/*62* if Processor Board is plugged into PIB board,63* force to use the PHY on Processor Board64*/65bcsr5 = in_8(bcsr_regs + 5);66if (!(bcsr5 & BCSR5_INT_USB))67out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));68iounmap(bcsr_regs);69return 0;70}7172/* ************************************************************************73*74* Setup the architecture75*76*/77static void __init mpc834x_mds_setup_arch(void)78{79#ifdef CONFIG_PCI80struct device_node *np;81#endif8283if (ppc_md.progress)84ppc_md.progress("mpc834x_mds_setup_arch()", 0);8586#ifdef CONFIG_PCI87for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")88mpc83xx_add_bridge(np);89#endif9091mpc834xemds_usb_cfg();92}9394static void __init mpc834x_mds_init_IRQ(void)95{96struct device_node *np;9798np = of_find_node_by_type(NULL, "ipic");99if (!np)100return;101102ipic_init(np, 0);103104/* Initialize the default interrupt mapping priorities,105* in case the boot rom changed something on us.106*/107ipic_set_default_priority();108}109110static struct of_device_id mpc834x_ids[] = {111{ .type = "soc", },112{ .compatible = "soc", },113{ .compatible = "simple-bus", },114{ .compatible = "gianfar", },115{},116};117118static int __init mpc834x_declare_of_platform_devices(void)119{120of_platform_bus_probe(NULL, mpc834x_ids, NULL);121return 0;122}123machine_device_initcall(mpc834x_mds, mpc834x_declare_of_platform_devices);124125/*126* Called very early, MMU is off, device-tree isn't unflattened127*/128static int __init mpc834x_mds_probe(void)129{130unsigned long root = of_get_flat_dt_root();131132return of_flat_dt_is_compatible(root, "MPC834xMDS");133}134135define_machine(mpc834x_mds) {136.name = "MPC834x MDS",137.probe = mpc834x_mds_probe,138.setup_arch = mpc834x_mds_setup_arch,139.init_IRQ = mpc834x_mds_init_IRQ,140.get_irq = ipic_get_irq,141.restart = mpc83xx_restart,142.time_init = mpc83xx_time_init,143.calibrate_decr = generic_calibrate_decr,144.progress = udbg_progress,145};146147148