mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-23 01:35:10 +03:00
tegra: hwpm: add support for next2 chip
- add next2 init chip info logic - add next2 device id - Update logic of chip info functions to support next2 chip. Modify the functions to use formal "if defined()" macro instead of "ifdef". - Execute support-soc-tools property only on silicon platform - Separate OOT module_init symbol from postcore_init call on previos kernel. Jira THWPM-64 Change-Id: I408c99ff84507a685db6195cb71364d939931d53 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2757457 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
170c9552c8
commit
5e116ff176
@@ -20,9 +20,13 @@
|
|||||||
#include <tegra_hwpm.h>
|
#include <tegra_hwpm.h>
|
||||||
|
|
||||||
#include <hal/t234/t234_init.h>
|
#include <hal/t234/t234_init.h>
|
||||||
|
|
||||||
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
||||||
#include <tegra_hwpm_next1_init.h>
|
#include <tegra_hwpm_next1_init.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_TEGRA_NEXT2_HWPM
|
||||||
|
#include <tegra_hwpm_next2_init.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm,
|
static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm,
|
||||||
@@ -50,7 +54,12 @@ static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#ifdef CONFIG_TEGRA_NEXT2_HWPM
|
||||||
|
err = tegra_hwpm_next2_init_chip_info(
|
||||||
|
hwpm, chip_id, chip_id_rev);
|
||||||
|
#else
|
||||||
tegra_hwpm_err(hwpm, "Chip 0x%x not supported", chip_id);
|
tegra_hwpm_err(hwpm, "Chip 0x%x not supported", chip_id);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
|
|
||||||
#include <tegra_hwpm_types.h>
|
#include <tegra_hwpm_types.h>
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
|
||||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TEGRA_HWPM_IP_INACTIVE ~(0U)
|
#define TEGRA_HWPM_IP_INACTIVE ~(0U)
|
||||||
|
|
||||||
/* These macro values should match TEGRA_SOC_HWPM_IP_STATUS_* */
|
/* These macro values should match TEGRA_SOC_HWPM_IP_STATUS_* */
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
#define TEGRA_HWPM_SOC_H
|
#define TEGRA_HWPM_SOC_H
|
||||||
|
|
||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
|
#define CHIP_ID_UNKNOWN 0x0U
|
||||||
|
#define CHIP_ID_REV_UNKNOWN 0x0U
|
||||||
|
|
||||||
#define PLAT_SI 0
|
#define PLAT_SI 0
|
||||||
#define PLAT_PRE_SI_QT 1
|
#define PLAT_PRE_SI_QT 1
|
||||||
#define PLAT_PRE_SI_VDK 8
|
#define PLAT_PRE_SI_VDK 8
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
#include <linux/bitmap.h>
|
#include <linux/bitmap.h>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ static const struct of_device_id tegra_soc_hwpm_of_match[] = {
|
|||||||
},
|
},
|
||||||
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
||||||
#include <os/linux/next1_driver.h>
|
#include <os/linux/next1_driver.h>
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_TEGRA_NEXT2_HWPM
|
||||||
|
#include <os/linux/next2_driver.h>
|
||||||
#endif
|
#endif
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
@@ -57,6 +60,10 @@ static bool tegra_hwpm_read_support_soc_tools_prop(struct platform_device *pdev)
|
|||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
bool allow_node = of_property_read_bool(np, "support-soc-tools");
|
bool allow_node = of_property_read_bool(np, "support-soc-tools");
|
||||||
|
|
||||||
|
if (!tegra_hwpm_is_platform_silicon()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!allow_node) {
|
if (!allow_node) {
|
||||||
tegra_hwpm_err(NULL, "support-soc-tools is absent");
|
tegra_hwpm_err(NULL, "support-soc-tools is absent");
|
||||||
}
|
}
|
||||||
@@ -263,7 +270,11 @@ static void __exit tegra_hwpm_exit(void)
|
|||||||
platform_driver_unregister(&tegra_soc_hwpm_pdrv);
|
platform_driver_unregister(&tegra_soc_hwpm_pdrv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
|
module_init(tegra_hwpm_init);
|
||||||
|
#else
|
||||||
postcore_initcall(tegra_hwpm_init);
|
postcore_initcall(tegra_hwpm_init);
|
||||||
|
#endif
|
||||||
module_exit(tegra_hwpm_exit);
|
module_exit(tegra_hwpm_exit);
|
||||||
|
|
||||||
MODULE_ALIAS(TEGRA_SOC_HWPM_MODULE_NAME);
|
MODULE_ALIAS(TEGRA_SOC_HWPM_MODULE_NAME);
|
||||||
|
|||||||
@@ -21,19 +21,33 @@
|
|||||||
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
|
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
|
||||||
#include <os/linux/next1_soc_utils.h>
|
#include <os/linux/next1_soc_utils.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(CONFIG_TEGRA_NEXT2_HWPM)
|
||||||
|
#include <os/linux/next2_soc_utils.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 tegra_hwpm_get_chip_id_impl(void)
|
u32 tegra_hwpm_get_chip_id_impl(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
|
u32 chip_id = CHIP_ID_UNKNOWN;
|
||||||
|
|
||||||
if (of_machine_is_compatible("nvidia,tegra234")) {
|
if (of_machine_is_compatible("nvidia,tegra234")) {
|
||||||
return 0x23U;
|
chip_id = 0x23U;
|
||||||
|
return chip_id;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
|
||||||
return tegra_hwpm_next1_get_chip_id_impl();
|
chip_id = tegra_hwpm_next1_get_chip_id_impl();
|
||||||
#else
|
if (chip_id != CHIP_ID_UNKNOWN) {
|
||||||
return 0x0U;
|
return chip_id;
|
||||||
#endif /* CONFIG_TEGRA_NEXT1_HWPM */
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_TEGRA_NEXT2_HWPM)
|
||||||
|
chip_id = tegra_hwpm_next2_get_chip_id_impl();
|
||||||
|
if (chip_id != CHIP_ID_UNKNOWN) {
|
||||||
|
return chip_id;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return chip_id;
|
||||||
#else
|
#else
|
||||||
return (u32)tegra_get_chip_id();
|
return (u32)tegra_get_chip_id();
|
||||||
#endif /* CONFIG_TEGRA_HWPM_OOT */
|
#endif /* CONFIG_TEGRA_HWPM_OOT */
|
||||||
@@ -42,14 +56,25 @@ u32 tegra_hwpm_get_chip_id_impl(void)
|
|||||||
u32 tegra_hwpm_get_major_rev_impl(void)
|
u32 tegra_hwpm_get_major_rev_impl(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
|
u32 chip_id_rev = CHIP_ID_REV_UNKNOWN;
|
||||||
|
|
||||||
if (of_machine_is_compatible("nvidia,tegra234")) {
|
if (of_machine_is_compatible("nvidia,tegra234")) {
|
||||||
return 0x4U;
|
chip_id_rev = 0x4U;
|
||||||
|
return chip_id_rev;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
|
||||||
return tegra_hwpm_next1_get_major_rev_impl();
|
chip_id_rev = tegra_hwpm_next1_get_major_rev_impl();
|
||||||
#else
|
if (chip_id_rev != CHIP_ID_REV_UNKNOWN) {
|
||||||
return 0x0U;
|
return chip_id_rev;
|
||||||
#endif /* CONFIG_TEGRA_NEXT1_HWPM */
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_TEGRA_NEXT2_HWPM)
|
||||||
|
chip_id_rev = tegra_hwpm_next2_get_major_rev_impl();
|
||||||
|
if (chip_id_rev != CHIP_ID_REV_UNKNOWN) {
|
||||||
|
return chip_id_rev;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return chip_id_rev;
|
||||||
#else
|
#else
|
||||||
return (u32)tegra_get_major_rev();
|
return (u32)tegra_get_major_rev();
|
||||||
#endif
|
#endif
|
||||||
@@ -67,14 +92,25 @@ u32 tegra_hwpm_chip_get_revision_impl(void)
|
|||||||
u32 tegra_hwpm_get_platform_impl(void)
|
u32 tegra_hwpm_get_platform_impl(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
|
u32 plat = PLAT_INVALID;
|
||||||
|
|
||||||
if (of_machine_is_compatible("nvidia,tegra234")) {
|
if (of_machine_is_compatible("nvidia,tegra234")) {
|
||||||
return PLAT_SI;
|
plat = PLAT_SI;
|
||||||
|
return plat;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_TEGRA_NEXT1_HWPM
|
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
|
||||||
return tegra_hwpm_next1_get_platform_impl();
|
plat = tegra_hwpm_next1_get_major_rev_impl();
|
||||||
#else
|
if (plat != PLAT_INVALID) {
|
||||||
return PLAT_INVALID;
|
return plat;
|
||||||
#endif /* CONFIG_TEGRA_NEXT1_HWPM */
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_TEGRA_NEXT2_HWPM)
|
||||||
|
plat = tegra_hwpm_next2_get_major_rev_impl();
|
||||||
|
if (plat != PLAT_INVALID) {
|
||||||
|
return plat;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return plat;
|
||||||
#else
|
#else
|
||||||
return (u32)tegra_get_platform();
|
return (u32)tegra_get_platform();
|
||||||
#endif
|
#endif
|
||||||
@@ -83,7 +119,7 @@ u32 tegra_hwpm_get_platform_impl(void)
|
|||||||
bool tegra_hwpm_is_platform_silicon_impl(void)
|
bool tegra_hwpm_is_platform_silicon_impl(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
#if defined(CONFIG_TEGRA_HWPM_OOT)
|
||||||
return tegra_platform_is_silicon();
|
return tegra_hwpm_get_platform() == PLAT_SI;
|
||||||
#else
|
#else
|
||||||
return tegra_platform_is_silicon();
|
return tegra_platform_is_silicon();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user