hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rknpu/include/rknpu_drv.h
....@@ -17,11 +17,9 @@
1717 #include <linux/hrtimer.h>
1818 #include <linux/miscdevice.h>
1919
20
-#ifndef FPGA_PLATFORM
21
-#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
2220 #include <soc/rockchip/rockchip_opp_select.h>
23
-#endif
24
-#endif
21
+#include <soc/rockchip/rockchip_system_monitor.h>
22
+#include <soc/rockchip/rockchip_ipa.h>
2523
2624 #include "rknpu_job.h"
2725 #include "rknpu_fence.h"
....@@ -30,10 +28,10 @@
3028
3129 #define DRIVER_NAME "rknpu"
3230 #define DRIVER_DESC "RKNPU driver"
33
-#define DRIVER_DATE "20220829"
31
+#define DRIVER_DATE "20231121"
3432 #define DRIVER_MAJOR 0
35
-#define DRIVER_MINOR 8
36
-#define DRIVER_PATCHLEVEL 2
33
+#define DRIVER_MINOR 9
34
+#define DRIVER_PATCHLEVEL 3
3735
3836 #define LOG_TAG "RKNPU"
3937
....@@ -54,7 +52,7 @@
5452 #define LOG_DEV_DEBUG(dev, fmt, args...) dev_dbg(dev, LOG_TAG ": " fmt, ##args)
5553 #define LOG_DEV_ERROR(dev, fmt, args...) dev_err(dev, LOG_TAG ": " fmt, ##args)
5654
57
-struct npu_reset_data {
55
+struct rknpu_reset_data {
5856 const char *srst_a_name;
5957 const char *srst_h_name;
6058 };
....@@ -66,16 +64,22 @@
6664 __u32 pc_data_amount_scale;
6765 __u32 pc_task_number_bits;
6866 __u32 pc_task_number_mask;
67
+ __u32 pc_task_status_offset;
68
+ __u32 pc_dma_ctrl;
6969 __u32 bw_enable;
70
- const struct npu_irqs_data *irqs;
71
- const struct npu_reset_data *resets;
70
+ const struct rknpu_irqs_data *irqs;
71
+ const struct rknpu_reset_data *resets;
7272 int num_irqs;
7373 int num_resets;
74
+ __u64 nbuf_phyaddr;
75
+ __u64 nbuf_size;
76
+ __u64 max_submit_number;
77
+ __u32 core_mask;
7478 };
7579
7680 struct rknpu_timer {
77
- __u32 busy_time;
78
- __u32 busy_time_record;
81
+ ktime_t busy_time;
82
+ ktime_t total_busy_time;
7983 };
8084
8185 struct rknpu_subcore_data {
....@@ -97,6 +101,7 @@
97101 void __iomem *base[RKNPU_MAX_CORES];
98102 struct device *dev;
99103 #ifdef CONFIG_ROCKCHIP_RKNPU_DRM_GEM
104
+ struct device *fake_dev;
100105 struct drm_device *drm_dev;
101106 #endif
102107 #ifdef CONFIG_ROCKCHIP_RKNPU_DMA_HEAP
....@@ -124,11 +129,7 @@
124129 struct thermal_cooling_device *devfreq_cooling;
125130 struct devfreq *devfreq;
126131 unsigned long ondemand_freq;
127
-#ifndef FPGA_PLATFORM
128
-#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
129132 struct rockchip_opp_info opp_info;
130
-#endif
131
-#endif
132133 unsigned long current_freq;
133134 unsigned long current_volt;
134135 int bypass_irq_handler;
....@@ -147,12 +148,21 @@
147148 ktime_t kt;
148149 phys_addr_t sram_start;
149150 phys_addr_t sram_end;
151
+ phys_addr_t nbuf_start;
152
+ phys_addr_t nbuf_end;
150153 uint32_t sram_size;
154
+ uint32_t nbuf_size;
151155 void __iomem *sram_base_io;
156
+ void __iomem *nbuf_base_io;
152157 struct rknpu_mm *sram_mm;
153158 unsigned long power_put_delay;
154159 };
155160
161
+struct rknpu_session {
162
+ struct rknpu_device *rknpu_dev;
163
+ struct list_head list;
164
+};
165
+
156166 int rknpu_power_get(struct rknpu_device *rknpu_dev);
157167 int rknpu_power_put(struct rknpu_device *rknpu_dev);
158168