.. | .. |
---|
17 | 17 | #include <linux/hrtimer.h> |
---|
18 | 18 | #include <linux/miscdevice.h> |
---|
19 | 19 | |
---|
20 | | -#ifndef FPGA_PLATFORM |
---|
21 | | -#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE |
---|
22 | 20 | #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> |
---|
25 | 23 | |
---|
26 | 24 | #include "rknpu_job.h" |
---|
27 | 25 | #include "rknpu_fence.h" |
---|
.. | .. |
---|
30 | 28 | |
---|
31 | 29 | #define DRIVER_NAME "rknpu" |
---|
32 | 30 | #define DRIVER_DESC "RKNPU driver" |
---|
33 | | -#define DRIVER_DATE "20220829" |
---|
| 31 | +#define DRIVER_DATE "20231121" |
---|
34 | 32 | #define DRIVER_MAJOR 0 |
---|
35 | | -#define DRIVER_MINOR 8 |
---|
36 | | -#define DRIVER_PATCHLEVEL 2 |
---|
| 33 | +#define DRIVER_MINOR 9 |
---|
| 34 | +#define DRIVER_PATCHLEVEL 3 |
---|
37 | 35 | |
---|
38 | 36 | #define LOG_TAG "RKNPU" |
---|
39 | 37 | |
---|
.. | .. |
---|
54 | 52 | #define LOG_DEV_DEBUG(dev, fmt, args...) dev_dbg(dev, LOG_TAG ": " fmt, ##args) |
---|
55 | 53 | #define LOG_DEV_ERROR(dev, fmt, args...) dev_err(dev, LOG_TAG ": " fmt, ##args) |
---|
56 | 54 | |
---|
57 | | -struct npu_reset_data { |
---|
| 55 | +struct rknpu_reset_data { |
---|
58 | 56 | const char *srst_a_name; |
---|
59 | 57 | const char *srst_h_name; |
---|
60 | 58 | }; |
---|
.. | .. |
---|
66 | 64 | __u32 pc_data_amount_scale; |
---|
67 | 65 | __u32 pc_task_number_bits; |
---|
68 | 66 | __u32 pc_task_number_mask; |
---|
| 67 | + __u32 pc_task_status_offset; |
---|
| 68 | + __u32 pc_dma_ctrl; |
---|
69 | 69 | __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; |
---|
72 | 72 | int num_irqs; |
---|
73 | 73 | int num_resets; |
---|
| 74 | + __u64 nbuf_phyaddr; |
---|
| 75 | + __u64 nbuf_size; |
---|
| 76 | + __u64 max_submit_number; |
---|
| 77 | + __u32 core_mask; |
---|
74 | 78 | }; |
---|
75 | 79 | |
---|
76 | 80 | struct rknpu_timer { |
---|
77 | | - __u32 busy_time; |
---|
78 | | - __u32 busy_time_record; |
---|
| 81 | + ktime_t busy_time; |
---|
| 82 | + ktime_t total_busy_time; |
---|
79 | 83 | }; |
---|
80 | 84 | |
---|
81 | 85 | struct rknpu_subcore_data { |
---|
.. | .. |
---|
97 | 101 | void __iomem *base[RKNPU_MAX_CORES]; |
---|
98 | 102 | struct device *dev; |
---|
99 | 103 | #ifdef CONFIG_ROCKCHIP_RKNPU_DRM_GEM |
---|
| 104 | + struct device *fake_dev; |
---|
100 | 105 | struct drm_device *drm_dev; |
---|
101 | 106 | #endif |
---|
102 | 107 | #ifdef CONFIG_ROCKCHIP_RKNPU_DMA_HEAP |
---|
.. | .. |
---|
124 | 129 | struct thermal_cooling_device *devfreq_cooling; |
---|
125 | 130 | struct devfreq *devfreq; |
---|
126 | 131 | unsigned long ondemand_freq; |
---|
127 | | -#ifndef FPGA_PLATFORM |
---|
128 | | -#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE |
---|
129 | 132 | struct rockchip_opp_info opp_info; |
---|
130 | | -#endif |
---|
131 | | -#endif |
---|
132 | 133 | unsigned long current_freq; |
---|
133 | 134 | unsigned long current_volt; |
---|
134 | 135 | int bypass_irq_handler; |
---|
.. | .. |
---|
147 | 148 | ktime_t kt; |
---|
148 | 149 | phys_addr_t sram_start; |
---|
149 | 150 | phys_addr_t sram_end; |
---|
| 151 | + phys_addr_t nbuf_start; |
---|
| 152 | + phys_addr_t nbuf_end; |
---|
150 | 153 | uint32_t sram_size; |
---|
| 154 | + uint32_t nbuf_size; |
---|
151 | 155 | void __iomem *sram_base_io; |
---|
| 156 | + void __iomem *nbuf_base_io; |
---|
152 | 157 | struct rknpu_mm *sram_mm; |
---|
153 | 158 | unsigned long power_put_delay; |
---|
154 | 159 | }; |
---|
155 | 160 | |
---|
| 161 | +struct rknpu_session { |
---|
| 162 | + struct rknpu_device *rknpu_dev; |
---|
| 163 | + struct list_head list; |
---|
| 164 | +}; |
---|
| 165 | + |
---|
156 | 166 | int rknpu_power_get(struct rknpu_device *rknpu_dev); |
---|
157 | 167 | int rknpu_power_put(struct rknpu_device *rknpu_dev); |
---|
158 | 168 | |
---|