Re: [PATCH 10/13] mpc83xx: Power Management support
From: Scott Wood <hidden>
Date: 2007-05-22 21:19:50
Guennadi Liakhovetski wrote:
quoted
+ /* 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?
The quick and ugly thing would be more if checks. The ideal solution would be a mechanism to look up a device by phandle, returning an ops struct corresponding to the requested class (if the device supports it).
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?
See asm-powerpc/of_platform.h. However, that won't help find the driver you need to talk to if all you have is a phandle. -Scott