linux-zen-desktop/drivers/interconnect/qcom/icc-rpm.h

122 lines
3.3 KiB
C
Raw Permalink Normal View History

2023-08-30 17:31:07 +02:00
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 Linaro Ltd
*/
#ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H
#define __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H
#include <dt-bindings/interconnect/qcom,icc.h>
#define RPM_BUS_MASTER_REQ 0x73616d62
#define RPM_BUS_SLAVE_REQ 0x766c7362
#define to_qcom_provider(_provider) \
container_of(_provider, struct qcom_icc_provider, provider)
enum qcom_icc_type {
QCOM_ICC_NOC,
QCOM_ICC_BIMC,
QCOM_ICC_QNOC,
};
2023-10-24 12:59:35 +02:00
#define NUM_BUS_CLKS 2
2023-08-30 17:31:07 +02:00
/**
* struct qcom_icc_provider - Qualcomm specific interconnect provider
* @provider: generic interconnect provider
2023-10-24 12:59:35 +02:00
* @num_bus_clks: the total number of bus_clks clk_bulk_data entries (0 or 2)
* @num_intf_clks: the total number of intf_clks clk_bulk_data entries
2023-08-30 17:31:07 +02:00
* @type: the ICC provider type
* @regmap: regmap for QoS registers read/write access
2023-10-24 12:59:35 +02:00
* @qos_offset: offset to QoS registers
2023-08-30 17:31:07 +02:00
* @bus_clk_rate: bus clock rate in Hz
2023-10-24 12:59:35 +02:00
* @bus_clks: the clk_bulk_data table of bus clocks
* @intf_clks: a clk_bulk_data array of interface clocks
* @is_on: whether the bus is powered on
2023-08-30 17:31:07 +02:00
*/
struct qcom_icc_provider {
struct icc_provider provider;
2023-10-24 12:59:35 +02:00
int num_bus_clks;
int num_intf_clks;
2023-08-30 17:31:07 +02:00
enum qcom_icc_type type;
struct regmap *regmap;
unsigned int qos_offset;
2023-10-24 12:59:35 +02:00
u64 bus_clk_rate[NUM_BUS_CLKS];
struct clk_bulk_data bus_clks[NUM_BUS_CLKS];
struct clk_bulk_data *intf_clks;
bool is_on;
2023-08-30 17:31:07 +02:00
};
/**
* struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters
* @areq_prio: node requests priority
* @prio_level: priority level for bus communication
* @limit_commands: activate/deactivate limiter mode during runtime
* @ap_owned: indicates if the node is owned by the AP or by the RPM
* @qos_mode: default qos mode for this node
* @qos_port: qos port number for finding qos registers of this node
* @urg_fwd_en: enable urgent forwarding
*/
struct qcom_icc_qos {
u32 areq_prio;
u32 prio_level;
bool limit_commands;
bool ap_owned;
int qos_mode;
int qos_port;
bool urg_fwd_en;
};
/**
* struct qcom_icc_node - Qualcomm specific interconnect nodes
* @name: the node name used in debugfs
* @id: a unique node identifier
* @links: an array of nodes where we can go next while traversing
* @num_links: the total number of @links
2023-10-24 12:59:35 +02:00
* @channels: number of channels at this node (e.g. DDR channels)
2023-08-30 17:31:07 +02:00
* @buswidth: width of the interconnect between a node and the bus (bytes)
* @sum_avg: current sum aggregate value of all avg bw requests
* @max_peak: current max aggregate value of all peak bw requests
* @mas_rpm_id: RPM id for devices that are bus masters
* @slv_rpm_id: RPM id for devices that are bus slaves
* @qos: NoC QoS setting parameters
*/
struct qcom_icc_node {
unsigned char *name;
u16 id;
const u16 *links;
u16 num_links;
2023-10-24 12:59:35 +02:00
u16 channels;
2023-08-30 17:31:07 +02:00
u16 buswidth;
u64 sum_avg[QCOM_ICC_NUM_BUCKETS];
u64 max_peak[QCOM_ICC_NUM_BUCKETS];
int mas_rpm_id;
int slv_rpm_id;
struct qcom_icc_qos qos;
};
struct qcom_icc_desc {
struct qcom_icc_node * const *nodes;
size_t num_nodes;
2023-10-24 12:59:35 +02:00
const char * const *bus_clocks;
const char * const *intf_clocks;
size_t num_intf_clocks;
bool no_clk_scaling;
2023-08-30 17:31:07 +02:00
enum qcom_icc_type type;
const struct regmap_config *regmap_cfg;
unsigned int qos_offset;
};
2023-10-24 12:59:35 +02:00
/* Valid for all bus types */
enum qos_mode {
NOC_QOS_MODE_INVALID = 0,
NOC_QOS_MODE_FIXED,
NOC_QOS_MODE_BYPASS,
};
2023-08-30 17:31:07 +02:00
int qnoc_probe(struct platform_device *pdev);
int qnoc_remove(struct platform_device *pdev);
#endif