Files
linux-hwpm/include/tegra_hwpm_io.h
Vedashree Vidwans 92be6f7a00 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
2022-02-09 09:46:25 -08:00

66 lines
2.0 KiB
C

/*
* 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.
*/
#ifndef TEGRA_HWPM_IO_H
#define TEGRA_HWPM_IO_H
/**
* Sets a particular field value in input data.
*
* Uses mask to clear specific bit positions in curr_val. field_val
* is used to set the bits in curr_val to be returned.
* Note: Function does not perform any validation of input parameters.
*
* curr_val [in] Current input data value.
*
* mask [in] Mask of the bits to be updated.
*
* field_val [in] Value to change the mask bits to.
*
* Returns updated value.
*/
static inline u32 set_field(u32 curr_val, u32 mask, u32 field_val)
{
return ((curr_val & ~mask) | field_val);
}
/**
* Retrieve value of specific bits from input data.
* Note: Function does not perform any validation of input parameters.
*
* input_data [in] Data to retrieve value from.
*
* mask [in] Mask of the bits to get value from.
*
* Return value from input_data corresponding to mask bits.
*/
static inline u32 get_field(u32 input_data, u32 mask)
{
return (input_data & mask);
}
struct tegra_soc_hwpm;
struct hwpm_ip_aperture;
u32 tegra_hwpm_readl(struct tegra_soc_hwpm *hwpm,
struct hwpm_ip_aperture *aperture, u64 addr);
void tegra_hwpm_writel(struct tegra_soc_hwpm *hwpm,
struct hwpm_ip_aperture *aperture, u64 addr, u32 val);
u32 regops_readl(struct tegra_soc_hwpm *hwpm,
struct hwpm_ip_aperture *aperture, u64 addr);
void regops_writel(struct tegra_soc_hwpm *hwpm,
struct hwpm_ip_aperture *aperture, u64 addr, u32 val);
#endif /* TEGRA_HWPM_IO_H */