hc
2023-11-06 9df731a176aab8e03b984b681b1bea01ccff6644
u-boot/drivers/power/regulator/regulator-uclass.c
....@@ -8,7 +8,6 @@
88 #include <common.h>
99 #include <errno.h>
1010 #include <dm.h>
11
-#include <dm/device-internal.h>
1211 #include <dm/uclass-internal.h>
1312 #include <power/pmic.h>
1413 #include <power/regulator.h>
....@@ -413,16 +412,10 @@
413412 if (regulator_name_is_unique(dev, uc_pdata->name))
414413 return 0;
415414
416
-#ifdef CONFIG_USING_KERNEL_DTB
417
- printf("Pre-reloc: %s\n", uc_pdata->name);
418
-
419
- return 0;
420
-#else
421415 debug("'%s' of dev: '%s', has nonunique value: '%s\n",
422416 property, dev->name, uc_pdata->name);
423417
424418 return -EINVAL;
425
-#endif
426419 }
427420
428421 static int regulator_pre_probe(struct udevice *dev)
....@@ -505,90 +498,6 @@
505498 return ret;
506499 }
507500
508
-#ifdef CONFIG_USING_KERNEL_DTB
509
-/*
510
- * Skip probed pre-reloc regulators.
511
- *
512
- * Some regulator like fixed/gpio regultor applies a default output state
513
- * when probed. It maybe reverse the state which was set by the pre-reloc
514
- * regulator. Example: vcc3v3_pcie.
515
- */
516
-int regulators_enable_boot_on(bool verbose)
517
-{
518
- struct dm_regulator_uclass_platdata *uc_pdata;
519
- struct udevice *dev;
520
- struct uclass *uc;
521
- char **pre_probed = NULL;
522
- int i = 0, num = 0;
523
- int ret;
524
- bool skip;
525
-
526
- ret = uclass_get(UCLASS_REGULATOR, &uc);
527
- if (ret)
528
- return ret;
529
-
530
- /* find probed pre-reloc regulators */
531
- for (uclass_find_first_device(UCLASS_REGULATOR, &dev);
532
- dev;
533
- uclass_find_next_device(&dev)) {
534
- if (!(dev->flags & DM_FLAG_KNRL_DTB) &&
535
- (dev->flags & DM_FLAG_ACTIVATED))
536
- num++;
537
- }
538
- if (num) {
539
- pre_probed = calloc(num, sizeof(char *));
540
- if (!pre_probed)
541
- return -ENOMEM;
542
-
543
- for (uclass_find_first_device(UCLASS_REGULATOR, &dev);
544
- dev;
545
- uclass_find_next_device(&dev)) {
546
- if (!(dev->flags & DM_FLAG_KNRL_DTB) &&
547
- (dev->flags & DM_FLAG_ACTIVATED)) {
548
- uc_pdata = dev_get_uclass_platdata(dev);
549
- pre_probed[i++] = (char *)uc_pdata->name;
550
- }
551
- }
552
- }
553
-
554
- /* Skip kernel regulators whose name matches probed pre-reloc regulators */
555
- for (uclass_find_first_device(UCLASS_REGULATOR, &dev);
556
- dev;
557
- uclass_find_next_device(&dev)) {
558
- uc_pdata = dev_get_uclass_platdata(dev);
559
- debug("%s: %s%s\n", __func__, uc_pdata->name,
560
- dev->flags & DM_FLAG_KNRL_DTB ? "" : "*");
561
- if (dev->flags & DM_FLAG_KNRL_DTB) {
562
- for (i = 0, skip = false; i < num; i++) {
563
- if (!strcmp(pre_probed[i], uc_pdata->name)) {
564
- skip = true;
565
- break;
566
- }
567
- }
568
- if (skip)
569
- continue;
570
- }
571
-
572
- /* Probe and init */
573
- ret = device_probe(dev);
574
- if (ret)
575
- continue;
576
- ret = regulator_autoset(dev);
577
- if (ret == -EMEDIUMTYPE)
578
- ret = 0;
579
- if (verbose)
580
- regulator_show(dev, ret);
581
- if (ret == -ENOSYS)
582
- ret = 0;
583
- }
584
-
585
- if (pre_probed)
586
- free(pre_probed);
587
-
588
- return ret;
589
-}
590
-
591
-#else
592501 int regulators_enable_boot_on(bool verbose)
593502 {
594503 struct udevice *dev;
....@@ -613,7 +522,6 @@
613522
614523 return ret;
615524 }
616
-#endif
617525
618526 UCLASS_DRIVER(regulator) = {
619527 .id = UCLASS_REGULATOR,