luckfox-pico-sdk/sysdrv/source/uboot/u-boot/drivers/power/domain/tegra186-power-domain.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

67 lines
1.6 KiB
C

/*
* Copyright (c) 2016, NVIDIA CORPORATION.
*
* SPDX-License-Identifier: GPL-2.0
*/
#include <common.h>
#include <dm.h>
#include <misc.h>
#include <power-domain-uclass.h>
#include <asm/arch-tegra/bpmp_abi.h>
#define UPDATE BIT(0)
#define ON BIT(1)
static int tegra186_power_domain_common(struct power_domain *power_domain,
bool on)
{
struct mrq_pg_update_state_request req;
int on_state = on ? ON : 0;
int ret;
req.partition_id = power_domain->id;
req.logic_state = UPDATE | on_state;
req.sram_state = UPDATE | on_state;
/*
* Drivers manage their own clocks so they don't get out of sync, and
* since some power domains have many clocks, only a subset of which
* are actually needed depending on use-case.
*/
req.clock_state = UPDATE;
ret = misc_call(power_domain->dev->parent, MRQ_PG_UPDATE_STATE, &req,
sizeof(req), NULL, 0);
if (ret < 0)
return ret;
return 0;
}
static int tegra186_power_domain_on(struct power_domain *power_domain)
{
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
power_domain, power_domain->dev, power_domain->id);
return tegra186_power_domain_common(power_domain, true);
}
static int tegra186_power_domain_off(struct power_domain *power_domain)
{
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
power_domain, power_domain->dev, power_domain->id);
return tegra186_power_domain_common(power_domain, false);
}
struct power_domain_ops tegra186_power_domain_ops = {
.on = tegra186_power_domain_on,
.off = tegra186_power_domain_off,
};
U_BOOT_DRIVER(tegra186_power_domain) = {
.name = "tegra186_power_domain",
.id = UCLASS_POWER_DOMAIN,
.ops = &tegra186_power_domain_ops,
};