Make sure that all devices that are powered up by uboot
are powered down before bringing up kernel.
Else the subsystem/device will never be powered down by SCFW even though
from the kernel's point of view it should be powered down.
Benefiting from power domain driver, We have implemented the function "power_off_pd_devices"
to power off all active devices. No need to explicitly power off them in board_quiesce_devices.
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit
3ab7cc26500eb78407bc6454a48f4d5f0ebf4f60)
enum boot_device get_boot_device(void);
int print_bootinfo(void);
+void power_off_pd_devices(const char* permanent_on_devices[], int size);
#include <errno.h>
#include <asm/arch/sci/sci.h>
#include <power-domain.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
#include <thermal.h>
#include <elf.h>
#include <asm/arch/sid.h>
.flags = DM_FLAG_PRE_RELOC,
};
#endif
+
+static bool check_device_power_off(struct udevice *dev,
+ const char* permanent_on_devices[], int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (!strcmp(dev->name, permanent_on_devices[i]))
+ return false;
+ }
+
+ return true;
+}
+
+void power_off_pd_devices(const char* permanent_on_devices[], int size)
+{
+ struct udevice *dev;
+ struct power_domain pd;
+
+ for (uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev); dev;
+ uclass_find_next_device(&dev)) {
+
+ if (device_active(dev)) {
+ /* Power off active pd devices except the permanent power on devices */
+ if (check_device_power_off(dev, permanent_on_devices, size)) {
+ pd.dev = dev;
+ power_domain_off(&pd);
+ }
+ }
+ }
+}
#include <power-domain.h>
#include <cdns3-uboot.h>
#include <asm/arch/lpcg.h>
+#include <bootm.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
}
+void board_quiesce_devices()
+{
+ const char *power_on_devices[] = {
+ "dma_lpuart0",
+ };
+
+ power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices));
+}
+
void detail_board_ddr_info(void)
{
puts("\nDDR ");
#include "../common/tcpc.h"
#include <cdns3-uboot.h>
#include <asm/arch/lpcg.h>
+#include <bootm.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
}
+void board_quiesce_devices(void)
+{
+ const char *power_on_devices[] = {
+ "dma_lpuart0",
+ };
+
+ power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices));
+}
+
void detail_board_ddr_info(void)
{
puts("\nDDR ");
#include <power-domain.h>
#include <cdns3-uboot.h>
#include <asm/arch/lpcg.h>
+#include <bootm.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
}
+void board_quiesce_devices()
+{
+ const char *power_on_devices[] = {
+ "dma_lpuart0",
+
+ /* HIFI DSP boot */
+ "audio_sai0",
+ "audio_ocram",
+ };
+
+ power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices));
+}
+
void detail_board_ddr_info(void)
{
puts("\nDDR ");
#include "../common/tcpc.h"
#include <cdns3-uboot.h>
#include <asm/arch/lpcg.h>
+#include <bootm.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
}
+void board_quiesce_devices()
+{
+ const char *power_on_devices[] = {
+ "dma_lpuart0",
+
+ /* HIFI DSP boot */
+ "audio_sai0",
+ "audio_ocram",
+ };
+
+ power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices));
+}
+
void detail_board_ddr_info(void)
{
puts("\nDDR ");