diff options
Diffstat (limited to 'arch/powerpc/platforms/85xx/mpc85xx_rdb.c')
| -rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 222 | 
1 files changed, 216 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c index ccf520e890b..db214cd4c82 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c @@ -1,7 +1,7 @@  /*   * MPC85xx RDB Board Setup   * - * Copyright 2009 Freescale Semiconductor Inc. + * Copyright 2009,2012 Freescale Semiconductor Inc.   *   * This program is free software; you can redistribute  it and/or modify it   * under  the terms of  the GNU General  Public License as published by the @@ -26,6 +26,9 @@  #include <asm/prom.h>  #include <asm/udbg.h>  #include <asm/mpic.h> +#include <asm/qe.h> +#include <asm/qe_ic.h> +#include <asm/fsl_guts.h>  #include <sysdev/fsl_soc.h>  #include <sysdev/fsl_pci.h> @@ -47,21 +50,36 @@ void __init mpc85xx_rdb_pic_init(void)  	struct mpic *mpic;  	unsigned long root = of_get_flat_dt_root(); +#ifdef CONFIG_QUICC_ENGINE +	struct device_node *np; +#endif +  	if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) { -		mpic = mpic_alloc(NULL, 0, -			MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | +		mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | +			MPIC_BIG_ENDIAN |  			MPIC_SINGLE_DEST_CPU,  			0, 256, " OpenPIC  ");  	} else {  		mpic = mpic_alloc(NULL, 0, -		  MPIC_WANTS_RESET | -		  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | +		  MPIC_BIG_ENDIAN |  		  MPIC_SINGLE_DEST_CPU,  		  0, 256, " OpenPIC  ");  	}  	BUG_ON(mpic == NULL);  	mpic_init(mpic); + +#ifdef CONFIG_QUICC_ENGINE +	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); +	if (np) { +		qe_ic_init(np, 0, qe_ic_cascade_low_mpic, +				qe_ic_cascade_high_mpic); +		of_node_put(np); + +	} else +		pr_err("%s: Could not find qe-ic node\n", __func__); +#endif +  }  /* @@ -69,7 +87,7 @@ void __init mpc85xx_rdb_pic_init(void)   */  static void __init mpc85xx_rdb_setup_arch(void)  { -#ifdef CONFIG_PCI +#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)  	struct device_node *np;  #endif @@ -85,11 +103,73 @@ static void __init mpc85xx_rdb_setup_arch(void)  #endif  	mpc85xx_smp_init(); + +#ifdef CONFIG_QUICC_ENGINE +	np = of_find_compatible_node(NULL, NULL, "fsl,qe"); +	if (!np) { +		pr_err("%s: Could not find Quicc Engine node\n", __func__); +		goto qe_fail; +	} + +	qe_reset(); +	of_node_put(np); + +	np = of_find_node_by_name(NULL, "par_io"); +	if (np) { +		struct device_node *ucc; + +		par_io_init(np); +		of_node_put(np); + +		for_each_node_by_name(ucc, "ucc") +			par_io_of_config(ucc); + +	} +#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) +	if (machine_is(p1025_rdb)) { + +		struct ccsr_guts_85xx __iomem *guts; + +		np = of_find_node_by_name(NULL, "global-utilities"); +		if (np) { +			guts = of_iomap(np, 0); +			if (!guts) { + +				pr_err("mpc85xx-rdb: could not map global utilities register\n"); + +			} else { +			/* P1025 has pins muxed for QE and other functions. To +			* enable QE UEC mode, we need to set bit QE0 for UCC1 +			* in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9 +			* and QE12 for QE MII management singals in PMUXCR +			* register. +			*/ +				setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) | +						MPC85xx_PMUXCR_QE(3) | +						MPC85xx_PMUXCR_QE(9) | +						MPC85xx_PMUXCR_QE(12)); +				iounmap(guts); +			} +			of_node_put(np); +		} + +	} +#endif + +qe_fail: +#endif	/* CONFIG_QUICC_ENGINE */ +  	printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");  }  machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); +machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); +machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);  machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); +machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); +machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); +machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); +machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices);  /*   * Called very early, device-tree isn't unflattened @@ -112,6 +192,52 @@ static int __init p1020_rdb_probe(void)  	return 0;  } +static int __init p1020_rdb_pc_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PC"); +} + +static int __init p1021_rdb_pc_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC")) +		return 1; +	return 0; +} + +static int __init p2020_rdb_pc_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC")) +		return 1; +	return 0; +} + +static int __init p1025_rdb_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	return of_flat_dt_is_compatible(root, "fsl,P1025RDB"); +} + +static int __init p1020_mbg_pc_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC"); +} + +static int __init p1020_utm_pc_probe(void) +{ +	unsigned long root = of_get_flat_dt_root(); + +	return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC"); +} +  define_machine(p2020_rdb) {  	.name			= "P2020 RDB",  	.probe			= p2020_rdb_probe, @@ -139,3 +265,87 @@ define_machine(p1020_rdb) {  	.calibrate_decr		= generic_calibrate_decr,  	.progress		= udbg_progress,  }; + +define_machine(p1021_rdb_pc) { +	.name			= "P1021 RDB-PC", +	.probe			= p1021_rdb_pc_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +}; + +define_machine(p2020_rdb_pc) { +	.name			= "P2020RDB-PC", +	.probe			= p2020_rdb_pc_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +}; + +define_machine(p1025_rdb) { +	.name			= "P1025 RDB", +	.probe			= p1025_rdb_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +}; + +define_machine(p1020_mbg_pc) { +	.name			= "P1020 MBG-PC", +	.probe			= p1020_mbg_pc_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +}; + +define_machine(p1020_utm_pc) { +	.name			= "P1020 UTM-PC", +	.probe			= p1020_utm_pc_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +}; + +define_machine(p1020_rdb_pc) { +	.name			= "P1020RDB-PC", +	.probe			= p1020_rdb_pc_probe, +	.setup_arch		= mpc85xx_rdb_setup_arch, +	.init_IRQ		= mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI +	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus, +#endif +	.get_irq		= mpic_get_irq, +	.restart		= fsl_rstcr_restart, +	.calibrate_decr		= generic_calibrate_decr, +	.progress		= udbg_progress, +};  |