tegra: hwpm: restructure HWPM driver

- Update HWPM driver to add HAL layer. This will allow support for multiple chips.
- Add below data structure hierarchy for HWPM driver
HWPM driver structure -> chip info struct -> ip info array -> perfmux/perfmon info array
NOTE: To make commit message more legible, using "aperture" instead of "perfmux and/or perfmon"
- Chip info structure contains
  - Array of IP info
  - HAL function pointers
- IP info structure contains IP specific info
  - Number of instances
  - Number of apertures per instance
  - Aperture ranges, strides, static info array
  - Aperture dynamic arrays
- Aperture info structure contains
  - Hw index
  - Physical address info
  - MMIO address info
- Add separate IP info files
- Create separate files that include logic for allowlist, memory buffer, resources, ip, regops to make functions more legible.
- Move probe, ioctl and io functions to os/linux path.
- Add fn, info, register and verbose debug log levels to controls debug messages
  - add debugfs node to update dbg_mask
- Correct MGBE perfmux base address

Jira THWPM-41

Change-Id: I8ffdaa657789e2a187cbb98502d0359bb57f9c54
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2651377
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Vedashree Vidwans
2022-01-07 10:45:35 -08:00
committed by mobile promotions
parent 96db4ef5ab
commit 92be6f7a00
80 changed files with 9465 additions and 4990 deletions

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <stddef.h>
#include <linux/debugfs.h>
#include <tegra_hwpm_log.h>
#include <tegra_hwpm_io.h>
#include <tegra_hwpm.h>
/* FIXME: This is a placeholder for now. We can add debugfs nodes as needed. */
void tegra_soc_hwpm_debugfs_init(struct tegra_soc_hwpm *hwpm)
{
if (!hwpm) {
tegra_hwpm_err(hwpm, "Invalid hwpm struct");
return;
}
hwpm->debugfs_root =
debugfs_create_dir(TEGRA_SOC_HWPM_MODULE_NAME, NULL);
if (!hwpm->debugfs_root) {
tegra_hwpm_err(hwpm, "Failed to create debugfs root directory");
goto fail;
}
/* Debug logs */
debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR, hwpm->debugfs_root,
&hwpm->dbg_mask);
return;
fail:
debugfs_remove_recursive(hwpm->debugfs_root);
hwpm->debugfs_root = NULL;
}
void tegra_soc_hwpm_debugfs_deinit(struct tegra_soc_hwpm *hwpm)
{
if (!hwpm) {
tegra_hwpm_err(hwpm, "Invalid hwpm struct");
return;
}
debugfs_remove_recursive(hwpm->debugfs_root);
hwpm->debugfs_root = NULL;
}