Alan Kwong | a62eeb8 | 2017-04-19 08:57:55 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _SDE_HW_VBIF_H |
| 14 | #define _SDE_HW_VBIF_H |
| 15 | |
| 16 | #include "sde_hw_catalog.h" |
| 17 | #include "sde_hw_mdss.h" |
| 18 | #include "sde_hw_util.h" |
| 19 | |
| 20 | struct sde_hw_vbif; |
| 21 | |
| 22 | /** |
| 23 | * struct sde_hw_vbif_ops : Interface to the VBIF hardware driver functions |
| 24 | * Assumption is these functions will be called after clocks are enabled |
| 25 | */ |
| 26 | struct sde_hw_vbif_ops { |
| 27 | /** |
| 28 | * set_limit_conf - set transaction limit config |
| 29 | * @vbif: vbif context driver |
| 30 | * @xin_id: client interface identifier |
| 31 | * @rd: true for read limit; false for write limit |
| 32 | * @limit: outstanding transaction limit |
| 33 | */ |
| 34 | void (*set_limit_conf)(struct sde_hw_vbif *vbif, |
| 35 | u32 xin_id, bool rd, u32 limit); |
| 36 | |
| 37 | /** |
| 38 | * get_limit_conf - get transaction limit config |
| 39 | * @vbif: vbif context driver |
| 40 | * @xin_id: client interface identifier |
| 41 | * @rd: true for read limit; false for write limit |
| 42 | * @return: outstanding transaction limit |
| 43 | */ |
| 44 | u32 (*get_limit_conf)(struct sde_hw_vbif *vbif, |
| 45 | u32 xin_id, bool rd); |
| 46 | |
| 47 | /** |
| 48 | * set_halt_ctrl - set halt control |
| 49 | * @vbif: vbif context driver |
| 50 | * @xin_id: client interface identifier |
| 51 | * @enable: halt control enable |
| 52 | */ |
| 53 | void (*set_halt_ctrl)(struct sde_hw_vbif *vbif, |
| 54 | u32 xin_id, bool enable); |
| 55 | |
| 56 | /** |
| 57 | * get_halt_ctrl - get halt control |
| 58 | * @vbif: vbif context driver |
| 59 | * @xin_id: client interface identifier |
| 60 | * @return: halt control enable |
| 61 | */ |
| 62 | bool (*get_halt_ctrl)(struct sde_hw_vbif *vbif, |
| 63 | u32 xin_id); |
Alan Kwong | a62eeb8 | 2017-04-19 08:57:55 -0700 | [diff] [blame] | 64 | |
| 65 | /** |
| 66 | * set_qos_remap - set QoS priority remap |
| 67 | * @vbif: vbif context driver |
| 68 | * @xin_id: client interface identifier |
| 69 | * @level: priority level |
| 70 | * @remap_level: remapped level |
| 71 | */ |
| 72 | void (*set_qos_remap)(struct sde_hw_vbif *vbif, |
| 73 | u32 xin_id, u32 level, u32 remap_level); |
Clarence Ip | 7f0de63 | 2017-05-31 14:59:14 -0400 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * set_mem_type - set memory type |
| 77 | * @vbif: vbif context driver |
| 78 | * @xin_id: client interface identifier |
| 79 | * @value: memory type value |
| 80 | */ |
| 81 | void (*set_mem_type)(struct sde_hw_vbif *vbif, |
| 82 | u32 xin_id, u32 value); |
Veera Sundaram Sankaran | 7952540 | 2017-07-31 14:17:23 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
Clarence Ip | 980405d | 2017-08-08 18:33:44 -0400 | [diff] [blame] | 85 | * clear_errors - clear any vbif errors |
| 86 | * This function clears any detected pending/source errors |
| 87 | * on the VBIF interface, and optionally returns the detected |
| 88 | * error mask(s). |
| 89 | * @vbif: vbif context driver |
| 90 | * @pnd_errors: pointer to pending error reporting variable |
| 91 | * @src_errors: pointer to source error reporting variable |
| 92 | */ |
| 93 | void (*clear_errors)(struct sde_hw_vbif *vbif, |
| 94 | u32 *pnd_errors, u32 *src_errors); |
| 95 | |
| 96 | /** |
Veera Sundaram Sankaran | 7952540 | 2017-07-31 14:17:23 -0700 | [diff] [blame] | 97 | * set_write_gather_en - set write_gather enable |
| 98 | * @vbif: vbif context driver |
| 99 | * @xin_id: client interface identifier |
| 100 | */ |
| 101 | void (*set_write_gather_en)(struct sde_hw_vbif *vbif, u32 xin_id); |
Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | struct sde_hw_vbif { |
| 105 | /* base */ |
| 106 | struct sde_hw_blk_reg_map hw; |
| 107 | |
| 108 | /* vbif */ |
| 109 | enum sde_vbif idx; |
| 110 | const struct sde_vbif_cfg *cap; |
| 111 | |
| 112 | /* ops */ |
| 113 | struct sde_hw_vbif_ops ops; |
| 114 | }; |
| 115 | |
| 116 | /** |
| 117 | * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx |
| 118 | * @idx: Interface index for which driver object is required |
| 119 | * @addr: Mapped register io address of MDSS |
| 120 | * @m: Pointer to mdss catalog data |
| 121 | */ |
| 122 | struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx, |
| 123 | void __iomem *addr, |
| 124 | const struct sde_mdss_cfg *m); |
| 125 | |
| 126 | void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif); |
| 127 | |
| 128 | #endif /*_SDE_HW_VBIF_H */ |