1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright 2018 NXP 4 */ 5 6 #ifndef SC_TYPES_H 7 #define SC_TYPES_H 8 9 /* Includes */ 10 #include <linux/types.h> 11 12 /* Defines */ 13 /* 14 * This type is used to declare a handle for an IPC communication 15 * channel. Its meaning is specific to the IPC implementation. 16 */ 17 typedef u64 sc_ipc_t; 18 19 /* Defines for common frequencies */ 20 #define SC_32KHZ 32768U /* 32KHz */ 21 #define SC_10MHZ 10000000U /* 10MHz */ 22 #define SC_20MHZ 20000000U /* 20MHz */ 23 #define SC_25MHZ 25000000U /* 25MHz */ 24 #define SC_27MHZ 27000000U /* 27MHz */ 25 #define SC_40MHZ 40000000U /* 40MHz */ 26 #define SC_45MHZ 45000000U /* 45MHz */ 27 #define SC_50MHZ 50000000U /* 50MHz */ 28 #define SC_60MHZ 60000000U /* 60MHz */ 29 #define SC_66MHZ 66666666U /* 66MHz */ 30 #define SC_74MHZ 74250000U /* 74.25MHz */ 31 #define SC_80MHZ 80000000U /* 80MHz */ 32 #define SC_83MHZ 83333333U /* 83MHz */ 33 #define SC_84MHZ 84375000U /* 84.37MHz */ 34 #define SC_100MHZ 100000000U /* 100MHz */ 35 #define SC_114MHZ 114000000U /* 114MHz */ 36 #define SC_125MHZ 125000000U /* 125MHz */ 37 #define SC_133MHZ 133333333U /* 133MHz */ 38 #define SC_135MHZ 135000000U /* 135MHz */ 39 #define SC_150MHZ 150000000U /* 150MHz */ 40 #define SC_160MHZ 160000000U /* 160MHz */ 41 #define SC_166MHZ 166666666U /* 166MHz */ 42 #define SC_175MHZ 175000000U /* 175MHz */ 43 #define SC_180MHZ 180000000U /* 180MHz */ 44 #define SC_200MHZ 200000000U /* 200MHz */ 45 #define SC_250MHZ 250000000U /* 250MHz */ 46 #define SC_266MHZ 266666666U /* 266MHz */ 47 #define SC_300MHZ 300000000U /* 300MHz */ 48 #define SC_312MHZ 312500000U /* 312.5MHZ */ 49 #define SC_320MHZ 320000000U /* 320MHz */ 50 #define SC_325MHZ 325000000U /* 325MHz */ 51 #define SC_333MHZ 333333333U /* 333MHz */ 52 #define SC_350MHZ 350000000U /* 350MHz */ 53 #define SC_372MHZ 372000000U /* 372MHz */ 54 #define SC_375MHZ 375000000U /* 375MHz */ 55 #define SC_400MHZ 400000000U /* 400MHz */ 56 #define SC_465MHZ 465000000U /* 465MHz */ 57 #define SC_500MHZ 500000000U /* 500MHz */ 58 #define SC_594MHZ 594000000U /* 594MHz */ 59 #define SC_625MHZ 625000000U /* 625MHz */ 60 #define SC_640MHZ 640000000U /* 640MHz */ 61 #define SC_650MHZ 650000000U /* 650MHz */ 62 #define SC_667MHZ 666666667U /* 667MHz */ 63 #define SC_675MHZ 675000000U /* 675MHz */ 64 #define SC_700MHZ 700000000U /* 700MHz */ 65 #define SC_720MHZ 720000000U /* 720MHz */ 66 #define SC_750MHZ 750000000U /* 750MHz */ 67 #define SC_800MHZ 800000000U /* 800MHz */ 68 #define SC_850MHZ 850000000U /* 850MHz */ 69 #define SC_900MHZ 900000000U /* 900MHz */ 70 #define SC_1000MHZ 1000000000U /* 1GHz */ 71 #define SC_1060MHZ 1060000000U /* 1.06GHz */ 72 #define SC_1188MHZ 1188000000U /* 1.188GHz */ 73 #define SC_1260MHZ 1260000000U /* 1.26GHz */ 74 #define SC_1280MHZ 1280000000U /* 1.28GHz */ 75 #define SC_1300MHZ 1300000000U /* 1.3GHz */ 76 #define SC_1400MHZ 1400000000U /* 1.4GHz */ 77 #define SC_1500MHZ 1500000000U /* 1.5GHz */ 78 #define SC_1600MHZ 1600000000U /* 1.6GHz */ 79 #define SC_1800MHZ 1800000000U /* 1.8GHz */ 80 #define SC_1860MHZ 1860000000U /* 1.86GHz */ 81 #define SC_2000MHZ 2000000000U /* 2.0GHz */ 82 #define SC_2112MHZ 2112000000U /* 2.12GHz */ 83 84 /* Defines for 24M related frequencies */ 85 #define SC_8MHZ 8000000U /* 8MHz */ 86 #define SC_12MHZ 12000000U /* 12MHz */ 87 #define SC_19MHZ 19800000U /* 19.8MHz */ 88 #define SC_24MHZ 24000000U /* 24MHz */ 89 #define SC_48MHZ 48000000U /* 48MHz */ 90 #define SC_120MHZ 120000000U /* 120MHz */ 91 #define SC_132MHZ 132000000U /* 132MHz */ 92 #define SC_144MHZ 144000000U /* 144MHz */ 93 #define SC_192MHZ 192000000U /* 192MHz */ 94 #define SC_211MHZ 211200000U /* 211.2MHz */ 95 #define SC_228MHZ 228000000U /* 233MHz */ 96 #define SC_240MHZ 240000000U /* 240MHz */ 97 #define SC_264MHZ 264000000U /* 264MHz */ 98 #define SC_352MHZ 352000000U /* 352MHz */ 99 #define SC_360MHZ 360000000U /* 360MHz */ 100 #define SC_384MHZ 384000000U /* 384MHz */ 101 #define SC_396MHZ 396000000U /* 396MHz */ 102 #define SC_432MHZ 432000000U /* 432MHz */ 103 #define SC_456MHZ 456000000U /* 466MHz */ 104 #define SC_480MHZ 480000000U /* 480MHz */ 105 #define SC_600MHZ 600000000U /* 600MHz */ 106 #define SC_744MHZ 744000000U /* 744MHz */ 107 #define SC_792MHZ 792000000U /* 792MHz */ 108 #define SC_864MHZ 864000000U /* 864MHz */ 109 #define SC_912MHZ 912000000U /* 912MHz */ 110 #define SC_960MHZ 960000000U /* 960MHz */ 111 #define SC_1056MHZ 1056000000U /* 1056MHz */ 112 #define SC_1104MHZ 1104000000U /* 1104MHz */ 113 #define SC_1200MHZ 1200000000U /* 1.2GHz */ 114 #define SC_1464MHZ 1464000000U /* 1.464GHz */ 115 #define SC_2400MHZ 2400000000U /* 2.4GHz */ 116 117 /* Defines for A/V related frequencies */ 118 #define SC_62MHZ 62937500U /* 62.9375MHz */ 119 #define SC_755MHZ 755250000U /* 755.25MHz */ 120 121 /* Defines for type widths */ 122 #define SC_FADDR_W 36U /* Width of sc_faddr_t */ 123 #define SC_BOOL_W 1U /* Width of sc_bool_t */ 124 #define SC_ERR_W 4U /* Width of sc_err_t */ 125 #define SC_RSRC_W 10U /* Width of sc_rsrc_t */ 126 #define SC_CTRL_W 6U /* Width of sc_ctrl_t */ 127 128 /* Defines for sc_bool_t */ 129 #define SC_FALSE ((sc_bool_t)0U) 130 #define SC_TRUE ((sc_bool_t)1U) 131 132 /* Defines for sc_err_t */ 133 #define SC_ERR_NONE 0U /* Success */ 134 #define SC_ERR_VERSION 1U /* Incompatible API version */ 135 #define SC_ERR_CONFIG 2U /* Configuration error */ 136 #define SC_ERR_PARM 3U /* Bad parameter */ 137 #define SC_ERR_NOACCESS 4U /* Permission error (no access) */ 138 #define SC_ERR_LOCKED 5U /* Permission error (locked) */ 139 #define SC_ERR_UNAVAILABLE 6U /* Unavailable (out of resources) */ 140 #define SC_ERR_NOTFOUND 7U /* Not found */ 141 #define SC_ERR_NOPOWER 8U /* No power */ 142 #define SC_ERR_IPC 9U /* Generic IPC error */ 143 #define SC_ERR_BUSY 10U /* Resource is currently busy/active */ 144 #define SC_ERR_FAIL 11U /* General I/O failure */ 145 #define SC_ERR_LAST 12U 146 147 /* Defines for sc_ctrl_t. */ 148 #define SC_C_TEMP 0U 149 #define SC_C_TEMP_HI 1U 150 #define SC_C_TEMP_LOW 2U 151 #define SC_C_PXL_LINK_MST1_ADDR 3U 152 #define SC_C_PXL_LINK_MST2_ADDR 4U 153 #define SC_C_PXL_LINK_MST_ENB 5U 154 #define SC_C_PXL_LINK_MST1_ENB 6U 155 #define SC_C_PXL_LINK_MST2_ENB 7U 156 #define SC_C_PXL_LINK_SLV1_ADDR 8U 157 #define SC_C_PXL_LINK_SLV2_ADDR 9U 158 #define SC_C_PXL_LINK_MST_VLD 10U 159 #define SC_C_PXL_LINK_MST1_VLD 11U 160 #define SC_C_PXL_LINK_MST2_VLD 12U 161 #define SC_C_SINGLE_MODE 13U 162 #define SC_C_ID 14U 163 #define SC_C_PXL_CLK_POLARITY 15U 164 #define SC_C_LINESTATE 16U 165 #define SC_C_PCIE_G_RST 17U 166 #define SC_C_PCIE_BUTTON_RST 18U 167 #define SC_C_PCIE_PERST 19U 168 #define SC_C_PHY_RESET 20U 169 #define SC_C_PXL_LINK_RATE_CORRECTION 21U 170 #define SC_C_PANIC 22U 171 #define SC_C_PRIORITY_GROUP 23U 172 #define SC_C_TXCLK 24U 173 #define SC_C_CLKDIV 25U 174 #define SC_C_DISABLE_50 26U 175 #define SC_C_DISABLE_125 27U 176 #define SC_C_SEL_125 28U 177 #define SC_C_MODE 29U 178 #define SC_C_SYNC_CTRL0 30U 179 #define SC_C_KACHUNK_CNT 31U 180 #define SC_C_KACHUNK_SEL 32U 181 #define SC_C_SYNC_CTRL1 33U 182 #define SC_C_DPI_RESET 34U 183 #define SC_C_MIPI_RESET 35U 184 #define SC_C_DUAL_MODE 36U 185 #define SC_C_VOLTAGE 37U 186 #define SC_C_PXL_LINK_SEL 38U 187 #define SC_C_OFS_SEL 39U 188 #define SC_C_OFS_AUDIO 40U 189 #define SC_C_OFS_PERIPH 41U 190 #define SC_C_OFS_IRQ 42U 191 #define SC_C_RST0 43U 192 #define SC_C_RST1 44U 193 #define SC_C_SEL0 45U 194 #define SC_C_LAST 46U 195 196 #define SC_P_ALL ((sc_pad_t)UINT16_MAX) /* All pads */ 197 198 /* Types */ 199 200 /* This type is used to store a boolean */ 201 typedef u8 sc_bool_t; 202 203 /* This type is used to store a system (full-size) address. */ 204 typedef u64 sc_faddr_t; 205 206 /* This type is used to indicate error response for most functions. */ 207 typedef u8 sc_err_t; 208 209 /* 210 * This type is used to indicate a resource. Resources include peripherals 211 * and bus masters (but not memory regions). Note items from list should 212 * never be changed or removed (only added to at the end of the list). 213 */ 214 typedef u16 sc_rsrc_t; 215 216 /* This type is used to indicate a control. */ 217 typedef u8 sc_ctrl_t; 218 219 /* 220 * This type is used to indicate a pad. Valid values are SoC specific. 221 * 222 * Refer to the SoC [Pad List](@ref PADS) for valid pad values. 223 */ 224 typedef u16 sc_pad_t; 225 226 #endif /* SC_TYPES_H */ 227