hc
2023-11-06 9df731a176aab8e03b984b681b1bea01ccff6644
u-boot/arch/arm/mach-rockchip/rv1126/rv1126.c
....@@ -63,6 +63,9 @@
6363 #define PMU_PWR_DWN_ST (0x108)
6464 #define PMU_PWR_GATE_SFTCON (0x110)
6565
66
+#define PMU_BUS_IDLE_NPU BIT(18)
67
+#define PMU_BUS_IDLE_VEPU BIT(9)
68
+
6669 #define CRU_BASE 0xFF490000
6770 #define CRU_CLKSEL_CON02 0x108
6871 #define CRU_CLKSEL_CON03 0x10c
....@@ -548,6 +551,7 @@
548551 * CONFIG_DM_RAMDISK: for ramboot that without SPL.
549552 */
550553 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_DM_RAMDISK)
554
+ u32 pd_st, idle_st;
551555 int delay;
552556
553557 /*
....@@ -624,11 +628,7 @@
624628 do {
625629 udelay(1);
626630 delay--;
627
- if (delay == 0) {
628
- printf("Fail to set domain.");
629
- hang();
630
- }
631
- } while (readl(PMU_BASE_ADDR + PMU_PWR_DWN_ST));
631
+ } while (delay && readl(PMU_BASE_ADDR + PMU_PWR_DWN_ST));
632632
633633 /* release all idle request */
634634 writel(0xffff0000, PMU_BASE_ADDR + PMU_BUS_IDLE_SFTCON(0));
....@@ -639,22 +639,30 @@
639639 do {
640640 udelay(1);
641641 delay--;
642
- if (delay == 0) {
643
- printf("Fail to get ack on domain.\n");
644
- hang();
645
- }
646
- } while (readl(PMU_BASE_ADDR + PMU_BUS_IDLE_ACK));
642
+ } while (delay && readl(PMU_BASE_ADDR + PMU_BUS_IDLE_ACK));
647643
648644 delay = 1000;
649645 /* wait idle status */
650646 do {
651647 udelay(1);
652648 delay--;
653
- if (delay == 0) {
654
- printf("Fail to set idle on domain.\n");
655
- hang();
656
- }
657
- } while (readl(PMU_BASE_ADDR + PMU_BUS_IDLE_ST));
649
+ } while (delay && readl(PMU_BASE_ADDR + PMU_BUS_IDLE_ST));
650
+
651
+ pd_st = readl(PMU_BASE_ADDR + PMU_PWR_DWN_ST);
652
+ idle_st = readl(PMU_BASE_ADDR + PMU_BUS_IDLE_ST);
653
+
654
+ if (pd_st || idle_st) {
655
+ printf("PMU_PWR_DOWN_ST: 0x%08x\n", pd_st);
656
+ printf("PMU_BUS_IDLE_ST: 0x%08x\n", idle_st);
657
+
658
+ if (idle_st & PMU_BUS_IDLE_NPU)
659
+ printf("Failed to enable PD_NPU, please check VDD_NPU is supplied\n");
660
+
661
+ if (idle_st & PMU_BUS_IDLE_VEPU)
662
+ printf("Failed to enable PD_VEPU, please check VDD_VEPU is supplied\n");
663
+
664
+ hang();
665
+ }
658666
659667 writel(0x303, USB_HOST_PRIORITY_REG);
660668 writel(0x303, USB_OTG_PRIORITY_REG);