Commit 363214f9f6292537abe7ab4d923b62053d225efa

Authored by Ye Li
1 parent 5b45c754fd

MLK-20945-2 dm: device: Check the power up result in probe

If a device has relevant power domain, we will check the power up
result in probing the device. If the power up is failed, the device_probe
will return failure immediately.

The only exception is the new FLAG (DM_FLAG_IGNORE_POWER_ON) is set by driver
to indicate ignore the power up result.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8524ca764d8fbd05da1593abfed62bb075c50cd4)

Showing 2 changed files with 10 additions and 1 deletions Side-by-side Diff

drivers/core/device.c
... ... @@ -383,7 +383,13 @@
383 383 if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
384 384 struct power_domain pd;
385 385 if (!power_domain_get(dev, &pd)) {
386   - power_domain_on(&pd);
  386 + if (!(dev->driver->flags & DM_FLAG_IGNORE_POWER_ON)) {
  387 + ret = power_domain_on(&pd);
  388 + if (ret) {
  389 + power_domain_free(&pd);
  390 + goto fail;
  391 + }
  392 + }
387 393 }
388 394 }
389 395 #endif
... ... @@ -62,6 +62,9 @@
62 62 */
63 63 #define DM_FLAG_OS_PREPARE (1 << 10)
64 64  
  65 +/* DM should ignore the power domain on for this driver */
  66 +#define DM_FLAG_IGNORE_POWER_ON (1 << 11)
  67 +
65 68 /*
66 69 * One or multiple of these flags are passed to device_remove() so that
67 70 * a selective device removal as specified by the remove-stage and the