[PATCH 10/13] mpc83xx: Power Management support

Guennadi Liakhovetski g.liakhovetski at gmx.de
Wed May 23 07:08:25 EST 2007


On Mon, 7 May 2007, Scott Wood wrote:

> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index 3b99433..1fd9f51 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -138,6 +138,33 @@ u32 get_baudrate(void)
>  EXPORT_SYMBOL(get_baudrate);
>  #endif /* CONFIG_CPM2 */
>  
> +int fsl_sleep_init(struct fsl_sleep_platform_data *sleep,
> +                   struct device_node *node)
> +{
> +	int proplen, ret = -ENODEV;
> +	const u32 *sleepdata = of_get_property(node, "sleep", &proplen);
> +	struct device_node *sleep_controller;
> +
> +	if (!sleepdata || proplen != 8)
> +		return -ENODEV;
> +
> +	sleep_controller = of_find_node_by_phandle(sleepdata[0]);
> +	if (!sleep_controller)
> +		return -ENODEV;
> +
> +	/* There can only be one fsl,mpc83xx-pmc device in the system;
> +	 * it is assumed that it is the one that the pmc driver matches.
> +	 */
> +	if (of_device_is_compatible(sleep_controller, "fsl,mpc83xx-pmc")) {
> +		sleep->sccr_mask = sleepdata[1];
> +		ret = 0;
> +	}

Just wondering - do we really want to special-case 83xx-pmc here? What 
when / if further "sleep controllers" get implemented? Shouldn't this be 
some callback?

BTW, do we have an interface similar to platform-driver/device for of? 
Like of_driver/device. This would be a use case for it. Just register a 
of_driver, which would trigger a dt-scan (just a find_compatible), calling 
driver's probe()... Would it make sense?

Thanks
Guennadi
---
Guennadi Liakhovetski



More information about the Linuxppc-dev mailing list