| 1 | /* SPDX-License-Identifier: GPL-2.0 or MIT */ |
| 2 | /* Copyright 2025 ARM Limited. All rights reserved. */ |
| 3 | |
| 4 | #ifndef __PANTHOR_HW_H__ |
| 5 | #define __PANTHOR_HW_H__ |
| 6 | |
| 7 | #include "panthor_device.h" |
| 8 | #include "panthor_regs.h" |
| 9 | |
| 10 | /** |
| 11 | * struct panthor_hw_ops - HW operations that are specific to a GPU |
| 12 | */ |
| 13 | struct panthor_hw_ops { |
| 14 | /** @soft_reset: Soft reset function pointer */ |
| 15 | int (*soft_reset)(struct panthor_device *ptdev); |
| 16 | |
| 17 | /** @l2_power_off: L2 power off function pointer */ |
| 18 | void (*l2_power_off)(struct panthor_device *ptdev); |
| 19 | |
| 20 | /** @l2_power_on: L2 power on function pointer */ |
| 21 | int (*l2_power_on)(struct panthor_device *ptdev); |
| 22 | }; |
| 23 | |
| 24 | /** |
| 25 | * struct panthor_hw - GPU specific register mapping and functions |
| 26 | */ |
| 27 | struct panthor_hw { |
| 28 | /** @features: Bitmap containing panthor_hw_feature */ |
| 29 | |
| 30 | /** @ops: Panthor HW specific operations */ |
| 31 | struct panthor_hw_ops ops; |
| 32 | }; |
| 33 | |
| 34 | int panthor_hw_init(struct panthor_device *ptdev); |
| 35 | |
| 36 | static inline int panthor_hw_soft_reset(struct panthor_device *ptdev) |
| 37 | { |
| 38 | return ptdev->hw->ops.soft_reset(ptdev); |
| 39 | } |
| 40 | |
| 41 | static inline int panthor_hw_l2_power_on(struct panthor_device *ptdev) |
| 42 | { |
| 43 | return ptdev->hw->ops.l2_power_on(ptdev); |
| 44 | } |
| 45 | |
| 46 | static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev) |
| 47 | { |
| 48 | ptdev->hw->ops.l2_power_off(ptdev); |
| 49 | } |
| 50 | |
| 51 | static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev) |
| 52 | { |
| 53 | return GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) >= 14; |
| 54 | } |
| 55 | |
| 56 | #endif /* __PANTHOR_HW_H__ */ |
| 57 | |