dm: core: device: enable power domain in probe
Enable power domain associated with the device when probe. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
		
							parent
							
								
									e13278c943
								
							
						
					
					
						commit
						3ad3077848
					
				|  | @ -26,6 +26,7 @@ | ||||||
| #include <dm/util.h> | #include <dm/util.h> | ||||||
| #include <linux/err.h> | #include <linux/err.h> | ||||||
| #include <linux/list.h> | #include <linux/list.h> | ||||||
|  | #include <power-domain.h> | ||||||
| 
 | 
 | ||||||
| DECLARE_GLOBAL_DATA_PTR; | DECLARE_GLOBAL_DATA_PTR; | ||||||
| 
 | 
 | ||||||
|  | @ -304,6 +305,7 @@ static void *alloc_priv(int size, uint flags) | ||||||
| 
 | 
 | ||||||
| int device_probe(struct udevice *dev) | int device_probe(struct udevice *dev) | ||||||
| { | { | ||||||
|  | 	struct power_domain pd; | ||||||
| 	const struct driver *drv; | 	const struct driver *drv; | ||||||
| 	int size = 0; | 	int size = 0; | ||||||
| 	int ret; | 	int ret; | ||||||
|  | @ -383,6 +385,11 @@ int device_probe(struct udevice *dev) | ||||||
| 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) | 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) | ||||||
| 		pinctrl_select_state(dev, "default"); | 		pinctrl_select_state(dev, "default"); | ||||||
| 
 | 
 | ||||||
|  | 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) { | ||||||
|  | 		if (!power_domain_get(dev, &pd)) | ||||||
|  | 			power_domain_on(&pd); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	ret = uclass_pre_probe_device(dev); | 	ret = uclass_pre_probe_device(dev); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		goto fail; | 		goto fail; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue