diff options
Diffstat (limited to 'arch/powerpc/platforms/83xx')
22 files changed, 469 insertions, 764 deletions
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig index 73f4135f3a1..2bdc8c862c4 100644 --- a/arch/powerpc/platforms/83xx/Kconfig +++ b/arch/powerpc/platforms/83xx/Kconfig @@ -99,7 +99,6 @@ config SBC834x  config ASP834x  	bool "Analogue & Micro ASP 834x"  	select PPC_MPC834x -	select REDBOOT  	help  	  This enables support for the Analogue & Micro ASP 83xx  	  board. @@ -114,18 +113,21 @@ config KMETER1  endif -# used for usb +# used for usb & gpio  config PPC_MPC831x  	bool +	select ARCH_WANT_OPTIONAL_GPIOLIB  # used for math-emu  config PPC_MPC832x  	bool -# used for usb +# used for usb & gpio  config PPC_MPC834x  	bool +	select ARCH_WANT_OPTIONAL_GPIOLIB -# used for usb +# used for usb & gpio  config PPC_MPC837x  	bool +	select ARCH_WANT_OPTIONAL_GPIOLIB diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile index 6e8bbbbcfdf..ed95bfcbcbf 100644 --- a/arch/powerpc/platforms/83xx/Makefile +++ b/arch/powerpc/platforms/83xx/Makefile @@ -16,4 +16,4 @@ obj-$(CONFIG_MPC837x_MDS)	+= mpc837x_mds.o  obj-$(CONFIG_SBC834x)		+= sbc834x.o  obj-$(CONFIG_MPC837x_RDB)	+= mpc837x_rdb.o  obj-$(CONFIG_ASP834x)		+= asp834x.o -obj-$(CONFIG_KMETER1)		+= kmeter1.o +obj-$(CONFIG_KMETER1)		+= km83xx.o diff --git a/arch/powerpc/platforms/83xx/asp834x.c b/arch/powerpc/platforms/83xx/asp834x.c index aa0d84d2258..464ea8e0292 100644 --- a/arch/powerpc/platforms/83xx/asp834x.c +++ b/arch/powerpc/platforms/83xx/asp834x.c @@ -36,38 +36,7 @@ static void __init asp834x_setup_arch(void)  	mpc834x_usb_cfg();  } -static void __init asp834x_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	of_node_put(np); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} - -static struct __initdata of_device_id asp8347_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", }, -	{}, -}; - -static int __init asp8347_declare_of_platform_devices(void) -{ -	of_platform_bus_probe(NULL, asp8347_ids, NULL); -	return 0; -} -machine_device_initcall(asp834x, asp8347_declare_of_platform_devices); +machine_device_initcall(asp834x, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -82,7 +51,7 @@ define_machine(asp834x) {  	.name			= "ASP8347E",  	.probe			= asp834x_probe,  	.setup_arch		= asp834x_setup_arch, -	.init_IRQ		= asp834x_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c new file mode 100644 index 00000000000..bf4c4473abb --- /dev/null +++ b/arch/powerpc/platforms/83xx/km83xx.c @@ -0,0 +1,197 @@ +/* + * Copyright 2008-2011 DENX Software Engineering GmbH + * Author: Heiko Schocher <hs@denx.de> + * + * Description: + * Keymile 83xx platform specific routines. + * + * 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 + * Free Software Foundation;  either version 2 of the  License, or (at your + * option) any later version. + */ + +#include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/errno.h> +#include <linux/reboot.h> +#include <linux/pci.h> +#include <linux/kdev_t.h> +#include <linux/major.h> +#include <linux/console.h> +#include <linux/delay.h> +#include <linux/seq_file.h> +#include <linux/root_dev.h> +#include <linux/initrd.h> +#include <linux/of_platform.h> +#include <linux/of_device.h> + +#include <linux/atomic.h> +#include <linux/time.h> +#include <linux/io.h> +#include <asm/machdep.h> +#include <asm/ipic.h> +#include <asm/irq.h> +#include <asm/prom.h> +#include <asm/udbg.h> +#include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> +#include <asm/qe.h> +#include <asm/qe_ic.h> + +#include "mpc83xx.h" + +#define SVR_REV(svr)    (((svr) >>  0) & 0xFFFF) /* Revision field */ + +static void quirk_mpc8360e_qe_enet10(void) +{ +	/* +	 * handle mpc8360E Erratum QE_ENET10: +	 * RGMII AC values do not meet the specification +	 */ +	uint svid = mfspr(SPRN_SVR); +	struct	device_node *np_par; +	struct	resource res; +	void	__iomem *base; +	int	ret; + +	np_par = of_find_node_by_name(NULL, "par_io"); +	if (np_par == NULL) { +		pr_warn("%s couldn;t find par_io node\n", __func__); +		return; +	} +	/* Map Parallel I/O ports registers */ +	ret = of_address_to_resource(np_par, 0, &res); +	if (ret) { +		pr_warn("%s couldn;t map par_io registers\n", __func__); +		return; +	} + +	base = ioremap(res.start, res.end - res.start + 1); + +	/* +	 * set output delay adjustments to default values according +	 * table 5 in Errata Rev. 5, 9/2011: +	 * +	 * write 0b01 to UCC1 bits 18:19 +	 * write 0b01 to UCC2 option 1 bits 4:5 +	 * write 0b01 to UCC2 option 2 bits 16:17 +	 */ +	clrsetbits_be32((base + 0xa8), 0x0c00f000, 0x04005000); + +	/* +	 * set output delay adjustments to default values according +	 * table 3-13 in Reference Manual Rev.3 05/2010: +	 * +	 * write 0b01 to UCC2 option 2 bits 16:17 +	 * write 0b0101 to UCC1 bits 20:23 +	 * write 0b0101 to UCC2 option 1 bits 24:27 +	 */ +	clrsetbits_be32((base + 0xac), 0x0000cff0, 0x00004550); + +	if (SVR_REV(svid) == 0x0021) { +		/* +		 * UCC2 option 1: write 0b1010 to bits 24:27 +		 * at address IMMRBAR+0x14AC +		 */ +		clrsetbits_be32((base + 0xac), 0x000000f0, 0x000000a0); +	} else if (SVR_REV(svid) == 0x0020) { +		/* +		 * UCC1: write 0b11 to bits 18:19 +		 * at address IMMRBAR+0x14A8 +		 */ +		setbits32((base + 0xa8), 0x00003000); + +		/* +		 * UCC2 option 1: write 0b11 to bits 4:5 +		 * at address IMMRBAR+0x14A8 +		 */ +		setbits32((base + 0xa8), 0x0c000000); + +		/* +		 * UCC2 option 2: write 0b11 to bits 16:17 +		 * at address IMMRBAR+0x14AC +		 */ +		setbits32((base + 0xac), 0x0000c000); +	} +	iounmap(base); +	of_node_put(np_par); +} + +/* ************************************************************************ + * + * Setup the architecture + * + */ +static void __init mpc83xx_km_setup_arch(void) +{ +#ifdef CONFIG_QUICC_ENGINE +	struct device_node *np; +#endif + +	if (ppc_md.progress) +		ppc_md.progress("kmpbec83xx_setup_arch()", 0); + +	mpc83xx_setup_pci(); + +#ifdef CONFIG_QUICC_ENGINE +	qe_reset(); + +	np = of_find_node_by_name(NULL, "par_io"); +	if (np != NULL) { +		par_io_init(np); +		of_node_put(np); + +		for_each_node_by_name(np, "spi") +			par_io_of_config(np); + +		for_each_node_by_name(np, "ucc") +			par_io_of_config(np); + +		/* Only apply this quirk when par_io is available */ +		np = of_find_compatible_node(NULL, "network", "ucc_geth"); +		if (np != NULL) { +			quirk_mpc8360e_qe_enet10(); +			of_node_put(np); +		} +	} +#endif	/* CONFIG_QUICC_ENGINE */ +} + +machine_device_initcall(mpc83xx_km, mpc83xx_declare_of_platform_devices); + +/* list of the supported boards */ +static char *board[] __initdata = { +	"Keymile,KMETER1", +	"Keymile,kmpbec8321", +	NULL +}; + +/* + * Called very early, MMU is off, device-tree isn't unflattened + */ +static int __init mpc83xx_km_probe(void) +{ +	unsigned long node = of_get_flat_dt_root(); +	int i = 0; + +	while (board[i]) { +		if (of_flat_dt_is_compatible(node, board[i])) +			break; +		i++; +	} +	return (board[i] != NULL); +} + +define_machine(mpc83xx_km) { +	.name		= "mpc83xx-km-platform", +	.probe		= mpc83xx_km_probe, +	.setup_arch	= mpc83xx_km_setup_arch, +	.init_IRQ	= mpc83xx_ipic_and_qe_init_IRQ, +	.get_irq	= ipic_get_irq, +	.restart	= mpc83xx_restart, +	.time_init	= mpc83xx_time_init, +	.calibrate_decr	= generic_calibrate_decr, +	.progress	= udbg_progress, +}; diff --git a/arch/powerpc/platforms/83xx/kmeter1.c b/arch/powerpc/platforms/83xx/kmeter1.c deleted file mode 100644 index 903acfd851a..00000000000 --- a/arch/powerpc/platforms/83xx/kmeter1.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2008 DENX Software Engineering GmbH - * Author: Heiko Schocher <hs@denx.de> - * - * Description: - * Keymile KMETER1 board specific routines. - * - * 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 - * Free Software Foundation;  either version 2 of the  License, or (at your - * option) any later version. - */ - -#include <linux/stddef.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/errno.h> -#include <linux/reboot.h> -#include <linux/pci.h> -#include <linux/kdev_t.h> -#include <linux/major.h> -#include <linux/console.h> -#include <linux/delay.h> -#include <linux/seq_file.h> -#include <linux/root_dev.h> -#include <linux/initrd.h> -#include <linux/of_platform.h> -#include <linux/of_device.h> - -#include <asm/system.h> -#include <asm/atomic.h> -#include <asm/time.h> -#include <asm/io.h> -#include <asm/machdep.h> -#include <asm/ipic.h> -#include <asm/irq.h> -#include <asm/prom.h> -#include <asm/udbg.h> -#include <sysdev/fsl_soc.h> -#include <sysdev/fsl_pci.h> -#include <asm/qe.h> -#include <asm/qe_ic.h> - -#include "mpc83xx.h" - -#define SVR_REV(svr)    (((svr) >>  0) & 0xFFFF) /* Revision field */ -/* ************************************************************************ - * - * Setup the architecture - * - */ -static void __init kmeter1_setup_arch(void) -{ -	struct device_node *np; - -	if (ppc_md.progress) -		ppc_md.progress("kmeter1_setup_arch()", 0); - -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif - -#ifdef CONFIG_QUICC_ENGINE -	qe_reset(); - -	np = of_find_node_by_name(NULL, "par_io"); -	if (np != NULL) { -		par_io_init(np); -		of_node_put(np); - -		for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) -			par_io_of_config(np); -	} - -	np = of_find_compatible_node(NULL, "network", "ucc_geth"); -	if (np != NULL) { -		uint svid; - -		/* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */ -		svid = mfspr(SPRN_SVR); -		if (SVR_REV(svid) == 0x0021) { -			struct	device_node *np_par; -			struct	resource res; -			void	__iomem *base; -			int	ret; - -			np_par = of_find_node_by_name(NULL, "par_io"); -			if (np_par == NULL) { -				printk(KERN_WARNING "%s couldn;t find par_io node\n", -					__func__); -				return; -			} -			/* Map Parallel I/O ports registers */ -			ret = of_address_to_resource(np_par, 0, &res); -			if (ret) { -				printk(KERN_WARNING "%s couldn;t map par_io registers\n", -					__func__); -				return; -			} -			base = ioremap(res.start, res.end - res.start + 1); - -			/* -			 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) -			 * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1) -			 */ -			setbits32((base + 0xa8), 0x0c003000); - -			/* -			 * IMMR + 0x14AC[20:27] = 10101010 -			 * (data delay for both UCC's) -			 */ -			clrsetbits_be32((base + 0xac), 0xff0, 0xaa0); -			iounmap(base); -			of_node_put(np_par); -		} -		of_node_put(np); -	} -#endif				/* CONFIG_QUICC_ENGINE */ -} - -static struct of_device_id kmeter_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .type = "qe", }, -	{ .compatible = "fsl,qe", }, -	{}, -}; - -static int __init kmeter_declare_of_platform_devices(void) -{ -	/* Publish the QE devices */ -	of_platform_bus_probe(NULL, kmeter_ids, NULL); - -	return 0; -} -machine_device_initcall(kmeter1, kmeter_declare_of_platform_devices); - -static void __init kmeter1_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_compatible_node(NULL, NULL, "fsl,pq2pro-pic"); -	if (!np) { -		np = of_find_node_by_type(NULL, "ipic"); -		if (!np) -			return; -	} - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -	of_node_put(np); - -#ifdef CONFIG_QUICC_ENGINE -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); -	if (!np) { -		np = of_find_node_by_type(NULL, "qeic"); -		if (!np) -			return; -	} -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); -	of_node_put(np); -#endif				/* CONFIG_QUICC_ENGINE */ -} - -/* - * Called very early, MMU is off, device-tree isn't unflattened - */ -static int __init kmeter1_probe(void) -{ -	unsigned long root = of_get_flat_dt_root(); - -	return of_flat_dt_is_compatible(root, "keymile,KMETER1"); -} - -define_machine(kmeter1) { -	.name		= "KMETER1", -	.probe		= kmeter1_probe, -	.setup_arch	= kmeter1_setup_arch, -	.init_IRQ	= kmeter1_init_IRQ, -	.get_irq	= ipic_get_irq, -	.restart	= mpc83xx_restart, -	.time_init	= mpc83xx_time_init, -	.calibrate_decr	= generic_calibrate_decr, -	.progress	= udbg_progress, -}; diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c index 70798ac911e..e238b6a55b1 100644 --- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c +++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c @@ -11,7 +11,6 @@   * (at your option) any later version.   */ -#include <linux/init.h>  #include <linux/kernel.h>  #include <linux/module.h>  #include <linux/device.h> @@ -21,6 +20,8 @@  #include <linux/of.h>  #include <linux/of_gpio.h>  #include <linux/slab.h> +#include <linux/kthread.h> +#include <linux/reboot.h>  #include <asm/prom.h>  #include <asm/machdep.h> @@ -30,6 +31,7 @@   */  #define MCU_REG_CTRL	0x20  #define MCU_CTRL_POFF	0x40 +#define MCU_CTRL_BTN	0x80  #define MCU_NUM_GPIO	2 @@ -42,13 +44,55 @@ struct mcu {  static struct mcu *glob_mcu; +struct task_struct *shutdown_thread; +static int shutdown_thread_fn(void *data) +{ +	int ret; +	struct mcu *mcu = glob_mcu; + +	while (!kthread_should_stop()) { +		ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); +		if (ret < 0) +			pr_err("MCU status reg read failed.\n"); +		mcu->reg_ctrl = ret; + + +		if (mcu->reg_ctrl & MCU_CTRL_BTN) { +			i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL, +						  mcu->reg_ctrl & ~MCU_CTRL_BTN); + +			ctrl_alt_del(); +		} + +		set_current_state(TASK_INTERRUPTIBLE); +		schedule_timeout(HZ); +	} + +	return 0; +} + +static ssize_t show_status(struct device *d, +			   struct device_attribute *attr, char *buf) +{ +	int ret; +	struct mcu *mcu = glob_mcu; + +	ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); +	if (ret < 0) +		return -ENODEV; +	mcu->reg_ctrl = ret; + +	return sprintf(buf, "%02x\n", ret); +} +static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); +  static void mcu_power_off(void)  {  	struct mcu *mcu = glob_mcu;  	pr_info("Sending power-off request to the MCU...\n");  	mutex_lock(&mcu->lock); -	i2c_smbus_write_byte_data(glob_mcu->client, MCU_REG_CTRL, +	i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL,  				  mcu->reg_ctrl | MCU_CTRL_POFF);  	mutex_unlock(&mcu->lock);  } @@ -100,8 +144,7 @@ static int mcu_gpiochip_remove(struct mcu *mcu)  	return gpiochip_remove(&mcu->gc);  } -static int __devinit mcu_probe(struct i2c_client *client, -			       const struct i2c_device_id *id) +static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)  {  	struct mcu *mcu;  	int ret; @@ -130,17 +173,28 @@ static int __devinit mcu_probe(struct i2c_client *client,  		dev_info(&client->dev, "will provide power-off service\n");  	} +	if (device_create_file(&client->dev, &dev_attr_status)) +		dev_err(&client->dev, +			"couldn't create device file for status\n"); + +	shutdown_thread = kthread_run(shutdown_thread_fn, NULL, +				      "mcu-i2c-shdn"); +  	return 0;  err:  	kfree(mcu);  	return ret;  } -static int __devexit mcu_remove(struct i2c_client *client) +static int mcu_remove(struct i2c_client *client)  {  	struct mcu *mcu = i2c_get_clientdata(client);  	int ret; +	kthread_stop(shutdown_thread); + +	device_remove_file(&client->dev, &dev_attr_status); +  	if (glob_mcu == mcu) {  		ppc_md.power_off = NULL;  		glob_mcu = NULL; @@ -149,7 +203,6 @@ static int __devexit mcu_remove(struct i2c_client *client)  	ret = mcu_gpiochip_remove(mcu);  	if (ret)  		return ret; -	i2c_set_clientdata(client, NULL);  	kfree(mcu);  	return 0;  } @@ -160,7 +213,7 @@ static const struct i2c_device_id mcu_ids[] = {  };  MODULE_DEVICE_TABLE(i2c, mcu_ids); -static struct of_device_id mcu_of_match_table[] __devinitdata = { +static struct of_device_id mcu_of_match_table[] = {  	{ .compatible = "fsl,mcu-mpc8349emitx", },  	{ },  }; @@ -172,21 +225,11 @@ static struct i2c_driver mcu_driver = {  		.of_match_table = mcu_of_match_table,  	},  	.probe = mcu_probe, -	.remove	= __devexit_p(mcu_remove), +	.remove	= mcu_remove,  	.id_table = mcu_ids,  }; -static int __init mcu_init(void) -{ -	return i2c_add_driver(&mcu_driver); -} -module_init(mcu_init); - -static void __exit mcu_exit(void) -{ -	i2c_del_driver(&mcu_driver); -} -module_exit(mcu_exit); +module_i2c_driver(mcu_driver);  MODULE_DESCRIPTION("Power Management and GPIO expander driver for "  		   "MPC8349E-mITX-compatible MCU"); diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c index f01806c940e..125336f750c 100644 --- a/arch/powerpc/platforms/83xx/misc.c +++ b/arch/powerpc/platforms/83xx/misc.c @@ -11,10 +11,15 @@  #include <linux/stddef.h>  #include <linux/kernel.h> +#include <linux/of_platform.h> +#include <linux/pci.h>  #include <asm/io.h>  #include <asm/hw_irq.h> +#include <asm/ipic.h> +#include <asm/qe_ic.h>  #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h>  #include "mpc83xx.h" @@ -65,3 +70,75 @@ long __init mpc83xx_time_init(void)  	return 0;  } + +void __init mpc83xx_ipic_init_IRQ(void) +{ +	struct device_node *np; + +	/* looking for fsl,pq2pro-pic which is asl compatible with fsl,ipic */ +	np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); +	if (!np) +		np = of_find_node_by_type(NULL, "ipic"); +	if (!np) +		return; + +	ipic_init(np, 0); + +	of_node_put(np); + +	/* Initialize the default interrupt mapping priorities, +	 * in case the boot rom changed something on us. +	 */ +	ipic_set_default_priority(); +} + +#ifdef CONFIG_QUICC_ENGINE +void __init mpc83xx_qe_init_IRQ(void) +{ +	struct device_node *np; + +	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); +	if (!np) { +		np = of_find_node_by_type(NULL, "qeic"); +		if (!np) +			return; +	} +	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); +	of_node_put(np); +} + +void __init mpc83xx_ipic_and_qe_init_IRQ(void) +{ +	mpc83xx_ipic_init_IRQ(); +	mpc83xx_qe_init_IRQ(); +} +#endif /* CONFIG_QUICC_ENGINE */ + +static struct of_device_id __initdata of_bus_ids[] = { +	{ .type = "soc", }, +	{ .compatible = "soc", }, +	{ .compatible = "simple-bus" }, +	{ .compatible = "gianfar" }, +	{ .compatible = "gpio-leds", }, +	{ .type = "qe", }, +	{ .compatible = "fsl,qe", }, +	{}, +}; + +int __init mpc83xx_declare_of_platform_devices(void) +{ +	of_platform_bus_probe(NULL, of_bus_ids, NULL); +	return 0; +} + +#ifdef CONFIG_PCI +void __init mpc83xx_setup_pci(void) +{ +	struct device_node *np; + +	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") +		mpc83xx_add_bridge(np); +	for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") +		mpc83xx_add_bridge(np); +} +#endif diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c index 846831d495b..4f2d9fea77b 100644 --- a/arch/powerpc/platforms/83xx/mpc830x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c @@ -27,66 +27,35 @@   */  static void __init mpc830x_rdb_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc830x_rdb_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8308-pcie") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc831x_usb_cfg();  } -static void __init mpc830x_rdb_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} +static const char *board[] __initdata = { +	"MPC8308RDB", +	"fsl,mpc8308rdb", +	"denx,mpc8308_p1m", +	NULL +};  /*   * Called very early, MMU is off, device-tree isn't unflattened   */  static int __init mpc830x_rdb_probe(void)  { -	unsigned long root = of_get_flat_dt_root(); - -	return of_flat_dt_is_compatible(root, "MPC8308RDB") || -	       of_flat_dt_is_compatible(root, "fsl,mpc8308rdb") || -	       of_flat_dt_is_compatible(root, "denx,mpc8308_p1m"); +	return of_flat_dt_match(of_get_flat_dt_root(), board);  } -static struct of_device_id __initdata of_bus_ids[] = { -	{ .compatible = "simple-bus" }, -	{ .compatible = "gianfar" }, -	{}, -}; - -static int __init declare_of_platform_devices(void) -{ -	of_platform_bus_probe(NULL, of_bus_ids, NULL); -	return 0; -} -machine_device_initcall(mpc830x_rdb, declare_of_platform_devices); +machine_device_initcall(mpc830x_rdb, mpc83xx_declare_of_platform_devices);  define_machine(mpc830x_rdb) {  	.name			= "MPC830x RDB",  	.probe			= mpc830x_rdb_probe,  	.setup_arch		= mpc830x_rdb_setup_arch, -	.init_IRQ		= mpc830x_rdb_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c index ae525e4745d..fa25977c52d 100644 --- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c @@ -28,68 +28,34 @@   */  static void __init mpc831x_rdb_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc831x_rdb_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -	for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc831x_usb_cfg();  } -static void __init mpc831x_rdb_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} +static const char *board[] __initdata = { +	"MPC8313ERDB", +	"fsl,mpc8315erdb", +	NULL +};  /*   * Called very early, MMU is off, device-tree isn't unflattened   */  static int __init mpc831x_rdb_probe(void)  { -	unsigned long root = of_get_flat_dt_root(); - -	return of_flat_dt_is_compatible(root, "MPC8313ERDB") || -	       of_flat_dt_is_compatible(root, "fsl,mpc8315erdb"); +	return of_flat_dt_match(of_get_flat_dt_root(), board);  } -static struct of_device_id __initdata of_bus_ids[] = { -	{ .compatible = "simple-bus" }, -	{ .compatible = "gianfar" }, -	{ .compatible = "gpio-leds", }, -	{}, -}; - -static int __init declare_of_platform_devices(void) -{ -	of_platform_bus_probe(NULL, of_bus_ids, NULL); -	return 0; -} -machine_device_initcall(mpc831x_rdb, declare_of_platform_devices); +machine_device_initcall(mpc831x_rdb, mpc83xx_declare_of_platform_devices);  define_machine(mpc831x_rdb) {  	.name			= "MPC831x RDB",  	.probe			= mpc831x_rdb_probe,  	.setup_arch		= mpc831x_rdb_setup_arch, -	.init_IRQ		= mpc831x_rdb_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c index ec0b401bc9c..8d762203eef 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c @@ -1,5 +1,5 @@  /* - * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. + * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.   *   * Description:   * MPC832xE MDS board specific routines. @@ -26,8 +26,7 @@  #include <linux/of_platform.h>  #include <linux/of_device.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/time.h>  #include <asm/io.h>  #include <asm/machdep.h> @@ -68,14 +67,11 @@ static void __init mpc832x_sys_setup_arch(void)  		struct resource res;  		of_address_to_resource(np, 0, &res); -		bcsr_regs = ioremap(res.start, res.end - res.start +1); +		bcsr_regs = ioremap(res.start, resource_size(&res));  		of_node_put(np);  	} -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  #ifdef CONFIG_QUICC_ENGINE  	qe_reset(); @@ -101,51 +97,7 @@ static void __init mpc832x_sys_setup_arch(void)  #endif				/* CONFIG_QUICC_ENGINE */  } -static struct of_device_id mpc832x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .type = "qe", }, -	{ .compatible = "fsl,qe", }, -	{}, -}; - -static int __init mpc832x_declare_of_platform_devices(void) -{ -	/* Publish the QE devices */ -	of_platform_bus_probe(NULL, mpc832x_ids, NULL); - -	return 0; -} -machine_device_initcall(mpc832x_mds, mpc832x_declare_of_platform_devices); - -static void __init mpc832x_sys_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -	of_node_put(np); - -#ifdef CONFIG_QUICC_ENGINE -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); -	if (!np) { -		np = of_find_node_by_type(NULL, "qeic"); -		if (!np) -			return; -	} -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); -	of_node_put(np); -#endif				/* CONFIG_QUICC_ENGINE */ -} +machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -161,7 +113,7 @@ define_machine(mpc832x_mds) {  	.name 		= "MPC832x MDS",  	.probe 		= mpc832x_sys_probe,  	.setup_arch 	= mpc832x_sys_setup_arch, -	.init_IRQ 	= mpc832x_sys_init_IRQ, +	.init_IRQ	= mpc83xx_ipic_and_qe_init_IRQ,  	.get_irq 	= ipic_get_irq,  	.restart 	= mpc83xx_restart,  	.time_init 	= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c index 17f99745f0e..eff5baabc3f 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c @@ -193,17 +193,14 @@ machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);   */  static void __init mpc832x_rdb_setup_arch(void)  { -#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE) +#if defined(CONFIG_QUICC_ENGINE)  	struct device_node *np;  #endif  	if (ppc_md.progress)  		ppc_md.progress("mpc832x_rdb_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  #ifdef CONFIG_QUICC_ENGINE  	qe_reset(); @@ -218,52 +215,7 @@ static void __init mpc832x_rdb_setup_arch(void)  #endif				/* CONFIG_QUICC_ENGINE */  } -static struct of_device_id mpc832x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .type = "qe", }, -	{ .compatible = "fsl,qe", }, -	{}, -}; - -static int __init mpc832x_declare_of_platform_devices(void) -{ -	/* Publish the QE devices */ -	of_platform_bus_probe(NULL, mpc832x_ids, NULL); - -	return 0; -} -machine_device_initcall(mpc832x_rdb, mpc832x_declare_of_platform_devices); - -static void __init mpc832x_rdb_init_IRQ(void) -{ - -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -	of_node_put(np); - -#ifdef CONFIG_QUICC_ENGINE -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); -	if (!np) { -		np = of_find_node_by_type(NULL, "qeic"); -		if (!np) -			return; -	} -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); -	of_node_put(np); -#endif				/* CONFIG_QUICC_ENGINE */ -} +machine_device_initcall(mpc832x_rdb, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -279,7 +231,7 @@ define_machine(mpc832x_rdb) {  	.name		= "MPC832x RDB",  	.probe		= mpc832x_rdb_probe,  	.setup_arch	= mpc832x_rdb_setup_arch, -	.init_IRQ	= mpc832x_rdb_init_IRQ, +	.init_IRQ	= mpc83xx_ipic_and_qe_init_IRQ,  	.get_irq	= ipic_get_irq,  	.restart	= mpc83xx_restart,  	.time_init	= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 81e44fa1c64..a494fa57bdf 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c @@ -25,8 +25,7 @@  #include <linux/root_dev.h>  #include <linux/of_platform.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/time.h>  #include <asm/io.h>  #include <asm/machdep.h> @@ -41,13 +40,12 @@  static struct of_device_id __initdata mpc834x_itx_ids[] = {  	{ .compatible = "fsl,pq2pro-localbus", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", },  	{},  };  static int __init mpc834x_itx_declare_of_platform_devices(void)  { +	mpc83xx_declare_of_platform_devices();  	return of_platform_bus_probe(NULL, mpc834x_itx_ids, NULL);  }  machine_device_initcall(mpc834x_itx, mpc834x_itx_declare_of_platform_devices); @@ -59,37 +57,14 @@ machine_device_initcall(mpc834x_itx, mpc834x_itx_declare_of_platform_devices);   */  static void __init mpc834x_itx_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc834x_itx_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc834x_usb_cfg();  } -static void __init mpc834x_itx_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} -  /*   * Called very early, MMU is off, device-tree isn't unflattened   */ @@ -104,7 +79,7 @@ define_machine(mpc834x_itx) {  	.name			= "MPC834x ITX",  	.probe			= mpc834x_itx_probe,  	.setup_arch		= mpc834x_itx_setup_arch, -	.init_IRQ		= mpc834x_itx_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c index d0a634b056c..553e793a4a9 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c @@ -25,8 +25,7 @@  #include <linux/root_dev.h>  #include <linux/of_platform.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/time.h>  #include <asm/io.h>  #include <asm/machdep.h> @@ -53,7 +52,7 @@ static int mpc834xemds_usb_cfg(void)  		struct resource res;  		of_address_to_resource(np, 0, &res); -		bcsr_regs = ioremap(res.start, res.end - res.start + 1); +		bcsr_regs = ioremap(res.start, resource_size(&res));  		of_node_put(np);  	}  	if (!bcsr_regs) @@ -77,51 +76,15 @@ static int mpc834xemds_usb_cfg(void)   */  static void __init mpc834x_mds_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc834x_mds_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc834xemds_usb_cfg();  } -static void __init mpc834x_mds_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} - -static struct of_device_id mpc834x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", }, -	{}, -}; - -static int __init mpc834x_declare_of_platform_devices(void) -{ -	of_platform_bus_probe(NULL, mpc834x_ids, NULL); -	return 0; -} -machine_device_initcall(mpc834x_mds, mpc834x_declare_of_platform_devices); +machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -137,7 +100,7 @@ define_machine(mpc834x_mds) {  	.name			= "MPC834x MDS",  	.probe			= mpc834x_mds_probe,  	.setup_arch		= mpc834x_mds_setup_arch, -	.init_IRQ		= mpc834x_mds_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c index 09e9d6fb741..1a26d2f8340 100644 --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c @@ -1,5 +1,5 @@  /* - * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. + * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.   *   * Author: Li Yang <LeoLi@freescale.com>   *	   Yin Olivia <Hong-hua.Yin@freescale.com> @@ -33,8 +33,7 @@  #include <linux/of_platform.h>  #include <linux/of_device.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/time.h>  #include <asm/io.h>  #include <asm/machdep.h> @@ -76,14 +75,11 @@ static void __init mpc836x_mds_setup_arch(void)  		struct resource res;  		of_address_to_resource(np, 0, &res); -		bcsr_regs = ioremap(res.start, res.end - res.start +1); +		bcsr_regs = ioremap(res.start, resource_size(&res));  		of_node_put(np);  	} -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  #ifdef CONFIG_QUICC_ENGINE  	qe_reset(); @@ -144,23 +140,7 @@ static void __init mpc836x_mds_setup_arch(void)  #endif				/* CONFIG_QUICC_ENGINE */  } -static struct of_device_id mpc836x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .type = "qe", }, -	{ .compatible = "fsl,qe", }, -	{}, -}; - -static int __init mpc836x_declare_of_platform_devices(void) -{ -	/* Publish the QE devices */ -	of_platform_bus_probe(NULL, mpc836x_ids, NULL); - -	return 0; -} -machine_device_initcall(mpc836x_mds, mpc836x_declare_of_platform_devices); +machine_device_initcall(mpc836x_mds, mpc83xx_declare_of_platform_devices);  #ifdef CONFIG_QE_USB  static int __init mpc836x_usb_cfg(void) @@ -226,34 +206,6 @@ err:  machine_arch_initcall(mpc836x_mds, mpc836x_usb_cfg);  #endif /* CONFIG_QE_USB */ -static void __init mpc836x_mds_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -	of_node_put(np); - -#ifdef CONFIG_QUICC_ENGINE -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); -	if (!np) { -		np = of_find_node_by_type(NULL, "qeic"); -		if (!np) -			return; -	} -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); -	of_node_put(np); -#endif				/* CONFIG_QUICC_ENGINE */ -} -  /*   * Called very early, MMU is off, device-tree isn't unflattened   */ @@ -268,7 +220,7 @@ define_machine(mpc836x_mds) {  	.name		= "MPC836x MDS",  	.probe		= mpc836x_mds_probe,  	.setup_arch	= mpc836x_mds_setup_arch, -	.init_IRQ	= mpc836x_mds_init_IRQ, +	.init_IRQ	= mpc83xx_ipic_and_qe_init_IRQ,  	.get_irq	= ipic_get_irq,  	.restart	= mpc83xx_restart,  	.time_init	= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c index b0090aac964..b63b42d11d6 100644 --- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c +++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c @@ -1,7 +1,7 @@  /*   * MPC8360E-RDK board file.   * - * Copyright (c) 2006  Freescale Semicondutor, Inc. + * Copyright (c) 2006  Freescale Semiconductor, Inc.   * Copyright (c) 2007-2008  MontaVista Software, Inc.   *   * Author: Anton Vorontsov <avorontsov@ru.mvista.com> @@ -27,61 +27,19 @@  #include "mpc83xx.h" -static struct of_device_id __initdata mpc836x_rdk_ids[] = { -	{ .compatible = "simple-bus", }, -	{}, -}; - -static int __init mpc836x_rdk_declare_of_platform_devices(void) -{ -	return of_platform_bus_probe(NULL, mpc836x_rdk_ids, NULL); -} -machine_device_initcall(mpc836x_rdk, mpc836x_rdk_declare_of_platform_devices); +machine_device_initcall(mpc836x_rdk, mpc83xx_declare_of_platform_devices);  static void __init mpc836x_rdk_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc836x_rdk_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  #ifdef CONFIG_QUICC_ENGINE  	qe_reset();  #endif  } -static void __init mpc836x_rdk_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* -	 * Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -	of_node_put(np); -#ifdef CONFIG_QUICC_ENGINE -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); -	if (!np) -		return; - -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); -	of_node_put(np); -#endif -} -  /*   * Called very early, MMU is off, device-tree isn't unflattened.   */ @@ -96,7 +54,7 @@ define_machine(mpc836x_rdk) {  	.name		= "MPC836x RDK",  	.probe		= mpc836x_rdk_probe,  	.setup_arch	= mpc836x_rdk_setup_arch, -	.init_IRQ	= mpc836x_rdk_init_IRQ, +	.init_IRQ	= mpc83xx_ipic_and_qe_init_IRQ,  	.get_irq	= ipic_get_irq,  	.restart	= mpc83xx_restart,  	.time_init	= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c index 83068322abd..e53a60b6c86 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c @@ -79,54 +79,14 @@ out:   */  static void __init mpc837x_mds_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc837x_mds_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -	for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc837xmds_usb_cfg();  } -static struct of_device_id mpc837x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", }, -	{}, -}; - -static int __init mpc837x_declare_of_platform_devices(void) -{ -	/* Publish platform_device */ -	of_platform_bus_probe(NULL, mpc837x_ids, NULL); - -	return 0; -} -machine_device_initcall(mpc837x_mds, mpc837x_declare_of_platform_devices); - -static void __init mpc837x_mds_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} +machine_device_initcall(mpc837x_mds, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -142,7 +102,7 @@ define_machine(mpc837x_mds) {  	.name			= "MPC837x MDS",  	.probe			= mpc837x_mds_probe,  	.setup_arch		= mpc837x_mds_setup_arch, -	.init_IRQ		= mpc837x_mds_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c index 910caa6b581..9813c81e8e5 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c @@ -1,7 +1,7 @@  /*   * arch/powerpc/platforms/83xx/mpc837x_rdb.c   * - * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved. + * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.   *   * MPC837x RDB board specific routines   * @@ -50,75 +50,37 @@ static void mpc837x_rdb_sd_cfg(void)   */  static void __init mpc837x_rdb_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("mpc837x_rdb_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -	for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") -		mpc83xx_add_bridge(np); -#endif +	mpc83xx_setup_pci();  	mpc837x_usb_cfg();  	mpc837x_rdb_sd_cfg();  } -static struct of_device_id mpc837x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", }, -	{ .compatible = "gpio-leds", }, -	{}, -}; - -static int __init mpc837x_declare_of_platform_devices(void) -{ -	/* Publish platform_device */ -	of_platform_bus_probe(NULL, mpc837x_ids, NULL); - -	return 0; -} -machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices); - -static void __init mpc837x_rdb_init_IRQ(void) -{ -	struct device_node *np; +machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices); -	np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); -} +static const char * const board[] __initconst = { +	"fsl,mpc8377rdb", +	"fsl,mpc8378rdb", +	"fsl,mpc8379rdb", +	"fsl,mpc8377wlan", +	NULL +};  /*   * Called very early, MMU is off, device-tree isn't unflattened   */  static int __init mpc837x_rdb_probe(void)  { -	unsigned long root = of_get_flat_dt_root(); - -	return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") || -	       of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") || -	       of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") || -	       of_flat_dt_is_compatible(root, "fsl,mpc8377wlan"); +	return of_flat_dt_match(of_get_flat_dt_root(), board);  }  define_machine(mpc837x_rdb) {  	.name			= "MPC837x RDB/WLAN",  	.probe			= mpc837x_rdb_probe,  	.setup_arch		= mpc837x_rdb_setup_arch, -	.init_IRQ		= mpc837x_rdb_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h index 0fea8811d45..0cf74d7ea1c 100644 --- a/arch/powerpc/platforms/83xx/mpc83xx.h +++ b/arch/powerpc/platforms/83xx/mpc83xx.h @@ -35,6 +35,8 @@  /* system i/o configuration register high */  #define MPC83XX_SICRH_OFFS         0x118 +#define MPC8308_SICRH_USB_MASK     0x000c0000 +#define MPC8308_SICRH_USB_ULPI     0x00040000  #define MPC834X_SICRH_USB_UTMI     0x00020000  #define MPC831X_SICRH_USB_MASK     0x000000e0  #define MPC831X_SICRH_USB_ULPI     0x000000a0 @@ -68,5 +70,21 @@ extern long mpc83xx_time_init(void);  extern int mpc837x_usb_cfg(void);  extern int mpc834x_usb_cfg(void);  extern int mpc831x_usb_cfg(void); +extern void mpc83xx_ipic_init_IRQ(void); +#ifdef CONFIG_QUICC_ENGINE +extern void mpc83xx_qe_init_IRQ(void); +extern void mpc83xx_ipic_and_qe_init_IRQ(void); +#else +static inline void __init mpc83xx_qe_init_IRQ(void) {} +#define mpc83xx_ipic_and_qe_init_IRQ mpc83xx_ipic_init_IRQ +#endif /* CONFIG_QUICC_ENGINE */ + +#ifdef CONFIG_PCI +extern void mpc83xx_setup_pci(void); +#else +#define mpc83xx_setup_pci()	do {} while (0) +#endif + +extern int mpc83xx_declare_of_platform_devices(void);  #endif				/* __MPC83XX_H__ */ diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c index 49023dbe157..26cb3e93472 100644 --- a/arch/powerpc/platforms/83xx/sbc834x.c +++ b/arch/powerpc/platforms/83xx/sbc834x.c @@ -27,8 +27,7 @@  #include <linux/root_dev.h>  #include <linux/of_platform.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/time.h>  #include <asm/io.h>  #include <asm/machdep.h> @@ -48,52 +47,13 @@   */  static void __init sbc834x_setup_arch(void)  { -#ifdef CONFIG_PCI -	struct device_node *np; -#endif -  	if (ppc_md.progress)  		ppc_md.progress("sbc834x_setup_arch()", 0); -#ifdef CONFIG_PCI -	for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") -		mpc83xx_add_bridge(np); -#endif - +	mpc83xx_setup_pci();  } -static void __init sbc834x_init_IRQ(void) -{ -	struct device_node *np; - -	np = of_find_node_by_type(NULL, "ipic"); -	if (!np) -		return; - -	ipic_init(np, 0); - -	/* Initialize the default interrupt mapping priorities, -	 * in case the boot rom changed something on us. -	 */ -	ipic_set_default_priority(); - -	of_node_put(np); -} - -static struct __initdata of_device_id sbc834x_ids[] = { -	{ .type = "soc", }, -	{ .compatible = "soc", }, -	{ .compatible = "simple-bus", }, -	{ .compatible = "gianfar", }, -	{}, -}; - -static int __init sbc834x_declare_of_platform_devices(void) -{ -	of_platform_bus_probe(NULL, sbc834x_ids, NULL); -	return 0; -} -machine_device_initcall(sbc834x, sbc834x_declare_of_platform_devices); +machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices);  /*   * Called very early, MMU is off, device-tree isn't unflattened @@ -102,14 +62,14 @@ static int __init sbc834x_probe(void)  {  	unsigned long root = of_get_flat_dt_root(); -	return of_flat_dt_is_compatible(root, "SBC834x"); +	return of_flat_dt_is_compatible(root, "SBC834xE");  }  define_machine(sbc834x) { -	.name			= "SBC834x", +	.name			= "SBC834xE",  	.probe			= sbc834x_probe,  	.setup_arch		= sbc834x_setup_arch, -	.init_IRQ		= sbc834x_init_IRQ, +	.init_IRQ		= mpc83xx_ipic_init_IRQ,  	.get_irq		= ipic_get_irq,  	.restart		= mpc83xx_restart,  	.time_init		= mpc83xx_time_init, diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S b/arch/powerpc/platforms/83xx/suspend-asm.S index 1930543c98d..3d1ecd21177 100644 --- a/arch/powerpc/platforms/83xx/suspend-asm.S +++ b/arch/powerpc/platforms/83xx/suspend-asm.S @@ -231,7 +231,7 @@ _GLOBAL(mpc83xx_enter_deep_sleep)  	ori	r4, r4, 0x002a  	mtspr	SPRN_DBAT0L, r4  	lis	r8, TMP_VIRT_IMMR@h -	ori	r4, r8, 0x001e	/* 1 MByte accessable from Kernel Space only */ +	ori	r4, r8, 0x001e	/* 1 MByte accessible from Kernel Space only */  	mtspr	SPRN_DBAT0U, r4  	isync @@ -241,7 +241,7 @@ _GLOBAL(mpc83xx_enter_deep_sleep)  	ori	r4, r4, 0x002a  	mtspr	SPRN_DBAT1L, r4  	lis	r9, (TMP_VIRT_IMMR + 0x01000000)@h -	ori	r4, r9, 0x001e	/* 1 MByte accessable from Kernel Space only */ +	ori	r4, r9, 0x001e	/* 1 MByte accessible from Kernel Space only */  	mtspr	SPRN_DBAT1U, r4  	isync @@ -253,7 +253,7 @@ _GLOBAL(mpc83xx_enter_deep_sleep)  	li	r4, 0x0002  	mtspr	SPRN_DBAT2L, r4  	lis	r4, KERNELBASE@h -	ori	r4, r4, 0x001e	/* 1 MByte accessable from Kernel Space only */ +	ori	r4, r4, 0x001e	/* 1 MByte accessible from Kernel Space only */  	mtspr	SPRN_DBAT2U, r4  	isync diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c index 75ae77f1af6..4b4c081df94 100644 --- a/arch/powerpc/platforms/83xx/suspend.c +++ b/arch/powerpc/platforms/83xx/suspend.c @@ -10,7 +10,6 @@   * by the Free Software Foundation.   */ -#include <linux/init.h>  #include <linux/pm.h>  #include <linux/types.h>  #include <linux/ioport.h> @@ -20,12 +19,16 @@  #include <linux/freezer.h>  #include <linux/suspend.h>  #include <linux/fsl_devices.h> +#include <linux/of_address.h> +#include <linux/of_irq.h>  #include <linux/of_platform.h> +#include <linux/export.h>  #include <asm/reg.h>  #include <asm/io.h>  #include <asm/time.h>  #include <asm/mpc6xx.h> +#include <asm/switch_to.h>  #include <sysdev/fsl_soc.h> @@ -311,21 +314,28 @@ static int mpc83xx_is_pci_agent(void)  	return ret;  } -static struct platform_suspend_ops mpc83xx_suspend_ops = { +static const struct platform_suspend_ops mpc83xx_suspend_ops = {  	.valid = mpc83xx_suspend_valid,  	.begin = mpc83xx_suspend_begin,  	.enter = mpc83xx_suspend_enter,  	.end = mpc83xx_suspend_end,  }; -static int pmc_probe(struct platform_device *ofdev, -                     const struct of_device_id *match) +static struct of_device_id pmc_match[]; +static int pmc_probe(struct platform_device *ofdev)  { +	const struct of_device_id *match;  	struct device_node *np = ofdev->dev.of_node;  	struct resource res; -	struct pmc_type *type = match->data; +	const struct pmc_type *type;  	int ret = 0; +	match = of_match_device(pmc_match, &ofdev->dev); +	if (!match) +		return -EINVAL; + +	type = match->data; +  	if (!of_device_is_available(np))  		return -ENODEV; @@ -422,7 +432,7 @@ static struct of_device_id pmc_match[] = {  	{}  }; -static struct of_platform_driver pmc_driver = { +static struct platform_driver pmc_driver = {  	.driver = {  		.name = "mpc83xx-pmc",  		.owner = THIS_MODULE, @@ -434,7 +444,7 @@ static struct of_platform_driver pmc_driver = {  static int pmc_init(void)  { -	return of_register_platform_driver(&pmc_driver); +	return platform_driver_register(&pmc_driver);  }  module_init(pmc_init); diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c index 3ba4bb7d41b..1ad748bb39b 100644 --- a/arch/powerpc/platforms/83xx/usb.c +++ b/arch/powerpc/platforms/83xx/usb.c @@ -127,7 +127,8 @@ int mpc831x_usb_cfg(void)  	/* Configure clock */  	immr_node = of_get_parent(np); -	if (immr_node && of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) +	if (immr_node && (of_device_is_compatible(immr_node, "fsl,mpc8315-immr") || +			of_device_is_compatible(immr_node, "fsl,mpc8308-immr")))  		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,  		                MPC8315_SCCR_USB_MASK,  		                MPC8315_SCCR_USB_DRCM_01); @@ -138,7 +139,11 @@ int mpc831x_usb_cfg(void)  	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */  	if (prop && !strcmp(prop, "ulpi")) { -		if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) { +		if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) { +			clrsetbits_be32(immap + MPC83XX_SICRH_OFFS, +					MPC8308_SICRH_USB_MASK, +					MPC8308_SICRH_USB_ULPI); +		} else if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) {  			clrsetbits_be32(immap + MPC83XX_SICRL_OFFS,  					MPC8315_SICRL_USB_MASK,  					MPC8315_SICRL_USB_ULPI); @@ -166,13 +171,16 @@ int mpc831x_usb_cfg(void)  		of_node_put(np);  		return ret;  	} -	usb_regs = ioremap(res.start, res.end - res.start + 1); +	usb_regs = ioremap(res.start, resource_size(&res));  	/* Using on-chip PHY */  	if (prop && (!strcmp(prop, "utmi_wide") ||  		     !strcmp(prop, "utmi"))) {  		u32 refsel; +		if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) +			goto out; +  		if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr"))  			refsel = CONTROL_REFSEL_24MHZ;  		else @@ -186,9 +194,11 @@ int mpc831x_usb_cfg(void)  		temp = CONTROL_PHY_CLK_SEL_ULPI;  #ifdef CONFIG_USB_OTG  		/* Set OTG_PORT */ -		dr_mode = of_get_property(np, "dr_mode", NULL); -		if (dr_mode && !strcmp(dr_mode, "otg")) -			temp |= CONTROL_OTG_PORT; +		if (!of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) { +			dr_mode = of_get_property(np, "dr_mode", NULL); +			if (dr_mode && !strcmp(dr_mode, "otg")) +				temp |= CONTROL_OTG_PORT; +		}  #endif /* CONFIG_USB_OTG */  		out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, temp);  	} else { @@ -196,6 +206,7 @@ int mpc831x_usb_cfg(void)  		ret = -EINVAL;  	} +out:  	iounmap(usb_regs);  	of_node_put(np);  	return ret;  | 
