/*
 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

/* Compiler headers */
#include <stdint.h>

/* Early FSP headers */
#include <misc/ct-assert.h>
#include <soc-common/hw-const.h>

/* Hardware headers */
#include <address_map_new.h>

/* Late FSP headers */
#include <tke/tke-tegra-priv.h>
#include <tke/sections-tke.h>                           /* Immune from CT_ASSERT protection */

/* Module-specific FSP headers */
#include <hw-config/vic-irqs.h>

/*
 * Compile-time check for FSP header files
 *   Each FSP header file contains a signature unique to that file, and the
 *   FSP project.  The CT_ASSERT macro (contained in misc/ct-assert.h) can
 *   check for this signature.  If it does not exist, then the build will
 *   abort.
 *
 *   This is a trap for projects which have their own include files of the
 *   same names, but different contents.  This trap ensures that only the
 *   files from the FSP project, are built into the FSP soudce code.
 */
CT_ASSERT(FSP__TKE__TKE_TEGRA_PRIV_H, "Header file missing or invalid.")
CT_ASSERT(FSP__PROCESSOR__IRQS_HW_H, "Header file missing or invalid.")
CT_ASSERT(FSP__SOC_COMMON__HW_CONST_H, "Header file missing or invalid.")

const uint32_t tke_top_base = NV_ADDRESS_MAP_BPMP_TKE_32BITBASE;

SECTION_TKE_DATA
struct tegra_tke_id tegra_tke_id_timer0 = {
    .conf = {
        .base_addr = NV_ADDRESS_MAP_BPMP_TKE_TMR_0_32BITBASE,
        .irq = INTERRUPT_TKE_TIMER_INTR0,
    },
};

SECTION_TKE_DATA
struct tegra_tke_id tegra_tke_id_timer1 = {
    .conf = {
        .base_addr = NV_ADDRESS_MAP_BPMP_TKE_TMR_1_32BITBASE,
        .irq = INTERRUPT_TKE_TIMER_INTR1,
    },
};

SECTION_TKE_DATA
struct tegra_tke_id tegra_tke_id_timer2 = {
    .conf = {
        .base_addr = NV_ADDRESS_MAP_BPMP_TKE_TMR_2_32BITBASE,
        .irq = INTERRUPT_TKE_TIMER_INTR2,
    },
};

SECTION_TKE_DATA
struct tegra_tke_id tegra_tke_id_timer3 = {
    .conf = {
        .base_addr = NV_ADDRESS_MAP_BPMP_TKE_TMR_3_32BITBASE,
        .irq = INTERRUPT_TKE_TIMER_INTR3,
    },
};
