Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef _LINUX_QCOM_GENI_SE |
| 16 | #define _LINUX_QCOM_GENI_SE |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 17 | #include <linux/clk.h> |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 18 | #include <linux/dma-direction.h> |
| 19 | #include <linux/io.h> |
| 20 | #include <linux/list.h> |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 21 | #include <linux/msm-bus.h> |
| 22 | #include <linux/msm-bus-board.h> |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 23 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 24 | /* Transfer mode supported by GENI Serial Engines */ |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 25 | enum se_xfer_mode { |
| 26 | INVALID, |
| 27 | FIFO_MODE, |
| 28 | GSI_DMA, |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 29 | SE_DMA, |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 32 | /* Protocols supported by GENI Serial Engines */ |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 33 | enum se_protocol_types { |
| 34 | NONE, |
| 35 | SPI, |
| 36 | UART, |
| 37 | I2C, |
| 38 | I3C |
| 39 | }; |
| 40 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 41 | /** |
| 42 | * struct geni_se_rsc - GENI Serial Engine Resource |
| 43 | * @wrapper_dev: Pointer to the parent QUPv3 core. |
| 44 | * @se_clk: Handle to the core serial engine clock. |
| 45 | * @m_ahb_clk: Handle to the primary AHB clock. |
| 46 | * @s_ahb_clk: Handle to the secondary AHB clock. |
| 47 | * @ab_list: List Head of Average bus banwidth list. |
| 48 | * @ab: Average bus bandwidth request value. |
| 49 | * @ib_list: List Head of Instantaneous bus banwidth list. |
| 50 | * @ib: Instantaneous bus bandwidth request value. |
| 51 | * @geni_pinctrl: Handle to the pinctrl configuration. |
| 52 | * @geni_gpio_active: Handle to the default/active pinctrl state. |
| 53 | * @geni_gpi_sleep: Handle to the sleep pinctrl state. |
| 54 | */ |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 55 | struct se_geni_rsc { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 56 | struct device *wrapper_dev; |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 57 | struct clk *se_clk; |
| 58 | struct clk *m_ahb_clk; |
| 59 | struct clk *s_ahb_clk; |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 60 | struct list_head ab_list; |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 61 | unsigned long ab; |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 62 | struct list_head ib_list; |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 63 | unsigned long ib; |
| 64 | struct pinctrl *geni_pinctrl; |
| 65 | struct pinctrl_state *geni_gpio_active; |
| 66 | struct pinctrl_state *geni_gpio_sleep; |
| 67 | }; |
| 68 | |
| 69 | #define PINCTRL_DEFAULT "default" |
| 70 | #define PINCTRL_SLEEP "sleep" |
| 71 | |
Girish Mahadevan | 2ef85af | 2017-02-14 14:42:22 -0700 | [diff] [blame] | 72 | /* Common SE registers */ |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 73 | #define GENI_INIT_CFG_REVISION (0x0) |
| 74 | #define GENI_S_INIT_CFG_REVISION (0x4) |
| 75 | #define GENI_FORCE_DEFAULT_REG (0x20) |
| 76 | #define GENI_OUTPUT_CTRL (0x24) |
| 77 | #define GENI_CGC_CTRL (0x28) |
| 78 | #define SE_GENI_STATUS (0x40) |
| 79 | #define GENI_SER_M_CLK_CFG (0x48) |
| 80 | #define GENI_SER_S_CLK_CFG (0x4C) |
| 81 | #define GENI_CLK_CTRL_RO (0x60) |
| 82 | #define GENI_IF_DISABLE_RO (0x64) |
| 83 | #define GENI_FW_REVISION_RO (0x68) |
| 84 | #define GENI_FW_S_REVISION_RO (0x6C) |
| 85 | #define SE_GENI_CLK_SEL (0x7C) |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 86 | #define SE_GENI_BYTE_GRAN (0x254) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 87 | #define SE_GENI_DMA_MODE_EN (0x258) |
| 88 | #define SE_GENI_TX_PACKING_CFG0 (0x260) |
| 89 | #define SE_GENI_TX_PACKING_CFG1 (0x264) |
| 90 | #define SE_GENI_RX_PACKING_CFG0 (0x284) |
| 91 | #define SE_GENI_RX_PACKING_CFG1 (0x288) |
| 92 | #define SE_GENI_M_CMD0 (0x600) |
| 93 | #define SE_GENI_M_CMD_CTRL_REG (0x604) |
| 94 | #define SE_GENI_M_IRQ_STATUS (0x610) |
| 95 | #define SE_GENI_M_IRQ_EN (0x614) |
| 96 | #define SE_GENI_M_IRQ_CLEAR (0x618) |
| 97 | #define SE_GENI_S_CMD0 (0x630) |
| 98 | #define SE_GENI_S_CMD_CTRL_REG (0x634) |
| 99 | #define SE_GENI_S_IRQ_STATUS (0x640) |
| 100 | #define SE_GENI_S_IRQ_EN (0x644) |
| 101 | #define SE_GENI_S_IRQ_CLEAR (0x648) |
| 102 | #define SE_GENI_TX_FIFOn (0x700) |
| 103 | #define SE_GENI_RX_FIFOn (0x780) |
| 104 | #define SE_GENI_TX_FIFO_STATUS (0x800) |
| 105 | #define SE_GENI_RX_FIFO_STATUS (0x804) |
| 106 | #define SE_GENI_TX_WATERMARK_REG (0x80C) |
| 107 | #define SE_GENI_RX_WATERMARK_REG (0x810) |
| 108 | #define SE_GENI_RX_RFR_WATERMARK_REG (0x814) |
Girish Mahadevan | 7115f4e | 2017-03-15 15:18:34 -0600 | [diff] [blame] | 109 | #define SE_GENI_IOS (0x908) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 110 | #define SE_GENI_M_GP_LENGTH (0x910) |
| 111 | #define SE_GENI_S_GP_LENGTH (0x914) |
Girish Mahadevan | a95a361 | 2017-04-19 11:49:24 -0600 | [diff] [blame] | 112 | #define SE_GSI_EVENT_EN (0xE18) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 113 | #define SE_IRQ_EN (0xE1C) |
| 114 | #define SE_HW_PARAM_0 (0xE24) |
| 115 | #define SE_HW_PARAM_1 (0xE28) |
| 116 | #define SE_DMA_GENERAL_CFG (0xE30) |
| 117 | |
| 118 | /* GENI_OUTPUT_CTRL fields */ |
| 119 | #define DEFAULT_IO_OUTPUT_CTRL_MSK (GENMASK(6, 0)) |
| 120 | |
| 121 | /* GENI_FORCE_DEFAULT_REG fields */ |
| 122 | #define FORCE_DEFAULT (BIT(0)) |
| 123 | |
| 124 | /* GENI_CGC_CTRL fields */ |
| 125 | #define CFG_AHB_CLK_CGC_ON (BIT(0)) |
| 126 | #define CFG_AHB_WR_ACLK_CGC_ON (BIT(1)) |
| 127 | #define DATA_AHB_CLK_CGC_ON (BIT(2)) |
| 128 | #define SCLK_CGC_ON (BIT(3)) |
| 129 | #define TX_CLK_CGC_ON (BIT(4)) |
| 130 | #define RX_CLK_CGC_ON (BIT(5)) |
| 131 | #define EXT_CLK_CGC_ON (BIT(6)) |
| 132 | #define PROG_RAM_HCLK_OFF (BIT(8)) |
| 133 | #define PROG_RAM_SCLK_OFF (BIT(9)) |
| 134 | #define DEFAULT_CGC_EN (GENMASK(6, 0)) |
| 135 | |
| 136 | /* GENI_STATUS fields */ |
| 137 | #define M_GENI_CMD_ACTIVE (BIT(0)) |
| 138 | #define S_GENI_CMD_ACTIVE (BIT(12)) |
| 139 | |
| 140 | /* GENI_SER_M_CLK_CFG/GENI_SER_S_CLK_CFG */ |
| 141 | #define SER_CLK_EN (BIT(0)) |
| 142 | #define CLK_DIV_MSK (GENMASK(15, 4)) |
| 143 | #define CLK_DIV_SHFT (4) |
| 144 | |
| 145 | /* CLK_CTRL_RO fields */ |
| 146 | |
| 147 | /* IF_DISABLE_RO fields */ |
| 148 | |
| 149 | /* FW_REVISION_RO fields */ |
| 150 | #define FW_REV_PROTOCOL_MSK (GENMASK(15, 8)) |
| 151 | #define FW_REV_PROTOCOL_SHFT (8) |
| 152 | |
Girish Mahadevan | 2ef85af | 2017-02-14 14:42:22 -0700 | [diff] [blame] | 153 | /* GENI_CLK_SEL fields */ |
| 154 | #define CLK_SEL_MSK (GENMASK(2, 0)) |
| 155 | |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 156 | /* SE_GENI_DMA_MODE_EN */ |
| 157 | #define GENI_DMA_MODE_EN (BIT(0)) |
| 158 | |
| 159 | /* GENI_M_CMD0 fields */ |
| 160 | #define M_OPCODE_MSK (GENMASK(31, 27)) |
| 161 | #define M_OPCODE_SHFT (27) |
| 162 | #define M_PARAMS_MSK (GENMASK(26, 0)) |
| 163 | |
| 164 | /* GENI_M_CMD_CTRL_REG */ |
| 165 | #define M_GENI_CMD_CANCEL BIT(2) |
| 166 | #define M_GENI_CMD_ABORT BIT(1) |
| 167 | #define M_GENI_DISABLE BIT(0) |
| 168 | |
| 169 | /* GENI_S_CMD0 fields */ |
| 170 | #define S_OPCODE_MSK (GENMASK(31, 27)) |
| 171 | #define S_OPCODE_SHFT (27) |
| 172 | #define S_PARAMS_MSK (GENMASK(26, 0)) |
| 173 | |
| 174 | /* GENI_S_CMD_CTRL_REG */ |
| 175 | #define S_GENI_CMD_CANCEL (BIT(2)) |
| 176 | #define S_GENI_CMD_ABORT (BIT(1)) |
| 177 | #define S_GENI_DISABLE (BIT(0)) |
| 178 | |
| 179 | /* GENI_M_IRQ_EN fields */ |
| 180 | #define M_CMD_DONE_EN (BIT(0)) |
| 181 | #define M_CMD_OVERRUN_EN (BIT(1)) |
| 182 | #define M_ILLEGAL_CMD_EN (BIT(2)) |
| 183 | #define M_CMD_FAILURE_EN (BIT(3)) |
| 184 | #define M_CMD_CANCEL_EN (BIT(4)) |
| 185 | #define M_CMD_ABORT_EN (BIT(5)) |
| 186 | #define M_TIMESTAMP_EN (BIT(6)) |
| 187 | #define M_RX_IRQ_EN (BIT(7)) |
| 188 | #define M_GP_SYNC_IRQ_0_EN (BIT(8)) |
| 189 | #define M_GP_IRQ_0_EN (BIT(9)) |
| 190 | #define M_GP_IRQ_1_EN (BIT(10)) |
| 191 | #define M_GP_IRQ_2_EN (BIT(11)) |
| 192 | #define M_GP_IRQ_3_EN (BIT(12)) |
| 193 | #define M_GP_IRQ_4_EN (BIT(13)) |
| 194 | #define M_GP_IRQ_5_EN (BIT(14)) |
| 195 | #define M_IO_DATA_DEASSERT_EN (BIT(22)) |
| 196 | #define M_IO_DATA_ASSERT_EN (BIT(23)) |
| 197 | #define M_RX_FIFO_RD_ERR_EN (BIT(24)) |
| 198 | #define M_RX_FIFO_WR_ERR_EN (BIT(25)) |
| 199 | #define M_RX_FIFO_WATERMARK_EN (BIT(26)) |
| 200 | #define M_RX_FIFO_LAST_EN (BIT(27)) |
| 201 | #define M_TX_FIFO_RD_ERR_EN (BIT(28)) |
| 202 | #define M_TX_FIFO_WR_ERR_EN (BIT(29)) |
| 203 | #define M_TX_FIFO_WATERMARK_EN (BIT(30)) |
| 204 | #define M_SEC_IRQ_EN (BIT(31)) |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 205 | #define M_COMMON_GENI_M_IRQ_EN (GENMASK(6, 1) | \ |
| 206 | M_IO_DATA_DEASSERT_EN | \ |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 207 | M_IO_DATA_ASSERT_EN | M_RX_FIFO_RD_ERR_EN | \ |
| 208 | M_RX_FIFO_WR_ERR_EN | M_TX_FIFO_RD_ERR_EN | \ |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 209 | M_TX_FIFO_WR_ERR_EN) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 210 | |
| 211 | /* GENI_S_IRQ_EN fields */ |
| 212 | #define S_CMD_DONE_EN (BIT(0)) |
| 213 | #define S_CMD_OVERRUN_EN (BIT(1)) |
| 214 | #define S_ILLEGAL_CMD_EN (BIT(2)) |
| 215 | #define S_CMD_FAILURE_EN (BIT(3)) |
| 216 | #define S_CMD_CANCEL_EN (BIT(4)) |
| 217 | #define S_CMD_ABORT_EN (BIT(5)) |
| 218 | #define S_GP_SYNC_IRQ_0_EN (BIT(8)) |
| 219 | #define S_GP_IRQ_0_EN (BIT(9)) |
| 220 | #define S_GP_IRQ_1_EN (BIT(10)) |
| 221 | #define S_GP_IRQ_2_EN (BIT(11)) |
| 222 | #define S_GP_IRQ_3_EN (BIT(12)) |
| 223 | #define S_GP_IRQ_4_EN (BIT(13)) |
| 224 | #define S_GP_IRQ_5_EN (BIT(14)) |
| 225 | #define S_IO_DATA_DEASSERT_EN (BIT(22)) |
| 226 | #define S_IO_DATA_ASSERT_EN (BIT(23)) |
| 227 | #define S_RX_FIFO_RD_ERR_EN (BIT(24)) |
| 228 | #define S_RX_FIFO_WR_ERR_EN (BIT(25)) |
| 229 | #define S_RX_FIFO_WATERMARK_EN (BIT(26)) |
| 230 | #define S_RX_FIFO_LAST_EN (BIT(27)) |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 231 | #define S_COMMON_GENI_S_IRQ_EN (GENMASK(5, 1) | GENMASK(13, 9) | \ |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 232 | S_RX_FIFO_RD_ERR_EN | S_RX_FIFO_WR_ERR_EN) |
| 233 | |
| 234 | /* GENI_/TX/RX/RX_RFR/_WATERMARK_REG fields */ |
| 235 | #define WATERMARK_MSK (GENMASK(5, 0)) |
| 236 | |
| 237 | /* GENI_TX_FIFO_STATUS fields */ |
| 238 | #define TX_FIFO_WC (GENMASK(27, 0)) |
| 239 | |
| 240 | /* GENI_RX_FIFO_STATUS fields */ |
| 241 | #define RX_LAST (BIT(31)) |
| 242 | #define RX_LAST_BYTE_VALID_MSK (GENMASK(30, 28)) |
| 243 | #define RX_LAST_BYTE_VALID_SHFT (28) |
| 244 | #define RX_FIFO_WC_MSK (GENMASK(24, 0)) |
| 245 | |
Girish Mahadevan | a95a361 | 2017-04-19 11:49:24 -0600 | [diff] [blame] | 246 | /* SE_GSI_EVENT_EN fields */ |
| 247 | #define DMA_RX_EVENT_EN (BIT(0)) |
| 248 | #define DMA_TX_EVENT_EN (BIT(1)) |
| 249 | #define GENI_M_EVENT_EN (BIT(2)) |
| 250 | #define GENI_S_EVENT_EN (BIT(3)) |
| 251 | |
Girish Mahadevan | 7115f4e | 2017-03-15 15:18:34 -0600 | [diff] [blame] | 252 | /* SE_GENI_IOS fields */ |
| 253 | #define IO2_DATA_IN (BIT(1)) |
| 254 | #define RX_DATA_IN (BIT(0)) |
| 255 | |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 256 | /* SE_IRQ_EN fields */ |
| 257 | #define DMA_RX_IRQ_EN (BIT(0)) |
| 258 | #define DMA_TX_IRQ_EN (BIT(1)) |
| 259 | #define GENI_M_IRQ_EN (BIT(2)) |
| 260 | #define GENI_S_IRQ_EN (BIT(3)) |
| 261 | |
| 262 | /* SE_HW_PARAM_0 fields */ |
| 263 | #define TX_FIFO_WIDTH_MSK (GENMASK(29, 24)) |
| 264 | #define TX_FIFO_WIDTH_SHFT (24) |
| 265 | #define TX_FIFO_DEPTH_MSK (GENMASK(21, 16)) |
| 266 | #define TX_FIFO_DEPTH_SHFT (16) |
| 267 | |
| 268 | /* SE_HW_PARAM_1 fields */ |
| 269 | #define RX_FIFO_WIDTH_MSK (GENMASK(29, 24)) |
| 270 | #define RX_FIFO_WIDTH_SHFT (24) |
| 271 | #define RX_FIFO_DEPTH_MSK (GENMASK(21, 16)) |
| 272 | #define RX_FIFO_DEPTH_SHFT (16) |
| 273 | |
| 274 | /* SE_DMA_GENERAL_CFG */ |
| 275 | #define DMA_RX_CLK_CGC_ON (BIT(0)) |
| 276 | #define DMA_TX_CLK_CGC_ON (BIT(1)) |
| 277 | #define DMA_AHB_SLV_CFG_ON (BIT(2)) |
| 278 | #define AHB_SEC_SLV_CLK_CGC_ON (BIT(3)) |
| 279 | #define DUMMY_RX_NON_BUFFERABLE (BIT(4)) |
| 280 | #define RX_DMA_ZERO_PADDING_EN (BIT(5)) |
| 281 | #define RX_DMA_IRQ_DELAY_MSK (GENMASK(8, 6)) |
| 282 | #define RX_DMA_IRQ_DELAY_SHFT (6) |
| 283 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 284 | #define SE_DMA_TX_PTR_L (0xC30) |
| 285 | #define SE_DMA_TX_PTR_H (0xC34) |
| 286 | #define SE_DMA_TX_ATTR (0xC38) |
| 287 | #define SE_DMA_TX_LEN (0xC3C) |
| 288 | #define SE_DMA_TX_IRQ_STAT (0xC40) |
| 289 | #define SE_DMA_TX_IRQ_CLR (0xC44) |
| 290 | #define SE_DMA_TX_IRQ_EN (0xC48) |
| 291 | #define SE_DMA_TX_IRQ_EN_SET (0xC4C) |
| 292 | #define SE_DMA_TX_IRQ_EN_CLR (0xC50) |
| 293 | #define SE_DMA_TX_LEN_IN (0xC54) |
| 294 | #define SE_DMA_TX_FSM_RST (0xC58) |
| 295 | #define SE_DMA_TX_MAX_BURST (0xC5C) |
| 296 | |
| 297 | #define SE_DMA_RX_PTR_L (0xD30) |
| 298 | #define SE_DMA_RX_PTR_H (0xD34) |
| 299 | #define SE_DMA_RX_ATTR (0xD38) |
| 300 | #define SE_DMA_RX_LEN (0xD3C) |
| 301 | #define SE_DMA_RX_IRQ_STAT (0xD40) |
| 302 | #define SE_DMA_RX_IRQ_CLR (0xD44) |
| 303 | #define SE_DMA_RX_IRQ_EN (0xD48) |
| 304 | #define SE_DMA_RX_IRQ_EN_SET (0xD4C) |
| 305 | #define SE_DMA_RX_IRQ_EN_CLR (0xD50) |
| 306 | #define SE_DMA_RX_LEN_IN (0xD54) |
| 307 | #define SE_DMA_RX_FSM_RST (0xD58) |
| 308 | #define SE_DMA_RX_MAX_BURST (0xD5C) |
| 309 | #define SE_DMA_RX_FLUSH (0xD60) |
| 310 | |
Karthikeyan Ramasubramanian | a576657 | 2017-04-19 11:31:42 -0600 | [diff] [blame] | 311 | /* SE_DMA_TX_IRQ_STAT Register fields */ |
| 312 | #define TX_DMA_DONE (BIT(0)) |
| 313 | #define TX_EOT (BIT(1)) |
| 314 | #define TX_SBE (BIT(2)) |
| 315 | #define TX_RESET_DONE (BIT(3)) |
| 316 | |
| 317 | /* SE_DMA_RX_IRQ_STAT Register fields */ |
| 318 | #define RX_DMA_DONE (BIT(0)) |
| 319 | #define RX_EOT (BIT(1)) |
| 320 | #define RX_SBE (BIT(2)) |
| 321 | #define RX_RESET_DONE (BIT(3)) |
| 322 | #define RX_FLUSH_DONE (BIT(4)) |
| 323 | #define RX_GENI_GP_IRQ (GENMASK(10, 5)) |
| 324 | #define RX_GENI_CANCEL_IRQ (BIT(11)) |
| 325 | #define RX_GENI_GP_IRQ_EXT (GENMASK(13, 12)) |
| 326 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 327 | #define DEFAULT_BUS_WIDTH (4) |
| 328 | #define DEFAULT_SE_CLK (19200000) |
| 329 | |
| 330 | #define GENI_SE_ERR(log_ctx, print, dev, x...) do { \ |
| 331 | if (log_ctx) \ |
| 332 | ipc_log_string(log_ctx, x); \ |
| 333 | if (print) { \ |
| 334 | if (dev) \ |
| 335 | dev_err((dev), x); \ |
| 336 | else \ |
| 337 | pr_err(x); \ |
| 338 | } \ |
| 339 | } while (0) |
| 340 | |
| 341 | #define GENI_SE_DBG(log_ctx, print, dev, x...) do { \ |
| 342 | if (log_ctx) \ |
| 343 | ipc_log_string(log_ctx, x); \ |
| 344 | if (print) { \ |
| 345 | if (dev) \ |
| 346 | dev_dbg((dev), x); \ |
| 347 | else \ |
| 348 | pr_debug(x); \ |
| 349 | } \ |
| 350 | } while (0) |
| 351 | |
| 352 | |
| 353 | #ifdef CONFIG_QCOM_GENI_SE |
| 354 | /** |
| 355 | * geni_read_reg_nolog() - Helper function to read from a GENI register |
| 356 | * @base: Base address of the serial engine's register block. |
| 357 | * @offset: Offset within the serial engine's register block. |
| 358 | * |
| 359 | * Return: Return the contents of the register. |
| 360 | */ |
| 361 | unsigned int geni_read_reg_nolog(void __iomem *base, int offset); |
| 362 | |
| 363 | /** |
| 364 | * geni_write_reg_nolog() - Helper function to write into a GENI register |
| 365 | * @value: Value to be written into the register. |
| 366 | * @base: Base address of the serial engine's register block. |
| 367 | * @offset: Offset within the serial engine's register block. |
| 368 | */ |
| 369 | void geni_write_reg_nolog(unsigned int value, void __iomem *base, int offset); |
| 370 | |
| 371 | /** |
| 372 | * geni_read_reg() - Helper function to read from a GENI register |
| 373 | * @base: Base address of the serial engine's register block. |
| 374 | * @offset: Offset within the serial engine's register block. |
| 375 | * |
| 376 | * Return: Return the contents of the register. |
| 377 | */ |
| 378 | unsigned int geni_read_reg(void __iomem *base, int offset); |
| 379 | |
| 380 | /** |
| 381 | * geni_write_reg() - Helper function to write into a GENI register |
| 382 | * @value: Value to be written into the register. |
| 383 | * @base: Base address of the serial engine's register block. |
| 384 | * @offset: Offset within the serial engine's register block. |
| 385 | */ |
| 386 | void geni_write_reg(unsigned int value, void __iomem *base, int offset); |
| 387 | |
| 388 | /** |
| 389 | * get_se_proto() - Read the protocol configured for a serial engine |
| 390 | * @base: Base address of the serial engine's register block. |
| 391 | * |
| 392 | * Return: Protocol value as configured in the serial engine. |
| 393 | */ |
| 394 | int get_se_proto(void __iomem *base); |
| 395 | |
| 396 | /** |
| 397 | * geni_se_init() - Initialize the GENI Serial Engine |
| 398 | * @base: Base address of the serial engine's register block. |
| 399 | * @rx_wm: Receive watermark to be configured. |
| 400 | * @rx_rfr_wm: Ready-for-receive watermark to be configured. |
| 401 | * |
| 402 | * This function is used to initialize the GENI serial engine, configure |
| 403 | * the transfer mode, receive watermark and ready-for-receive watermarks. |
| 404 | * |
| 405 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 406 | */ |
| 407 | int geni_se_init(void __iomem *base, unsigned int rx_wm, unsigned int rx_rfr); |
| 408 | |
| 409 | /** |
| 410 | * geni_se_select_mode() - Select the serial engine transfer mode |
| 411 | * @base: Base address of the serial engine's register block. |
| 412 | * @mode: Transfer mode to be selected. |
| 413 | * |
| 414 | * Return: 0 on success, standard Linux error codes on failure. |
| 415 | */ |
| 416 | int geni_se_select_mode(void __iomem *base, int mode); |
| 417 | |
| 418 | /** |
| 419 | * geni_setup_m_cmd() - Setup the primary sequencer |
| 420 | * @base: Base address of the serial engine's register block. |
| 421 | * @cmd: Command/Operation to setup in the primary sequencer. |
| 422 | * @params: Parameter for the sequencer command. |
| 423 | * |
| 424 | * This function is used to configure the primary sequencer with the |
| 425 | * command and its assoicated parameters. |
| 426 | */ |
| 427 | void geni_setup_m_cmd(void __iomem *base, u32 cmd, u32 params); |
| 428 | |
| 429 | /** |
| 430 | * geni_setup_s_cmd() - Setup the secondary sequencer |
| 431 | * @base: Base address of the serial engine's register block. |
| 432 | * @cmd: Command/Operation to setup in the secondary sequencer. |
| 433 | * @params: Parameter for the sequencer command. |
| 434 | * |
| 435 | * This function is used to configure the secondary sequencer with the |
| 436 | * command and its assoicated parameters. |
| 437 | */ |
| 438 | void geni_setup_s_cmd(void __iomem *base, u32 cmd, u32 params); |
| 439 | |
| 440 | /** |
| 441 | * geni_cancel_m_cmd() - Cancel the command configured in the primary sequencer |
| 442 | * @base: Base address of the serial engine's register block. |
| 443 | * |
| 444 | * This function is used to cancel the currently configured command in the |
| 445 | * primary sequencer. |
| 446 | */ |
| 447 | void geni_cancel_m_cmd(void __iomem *base); |
| 448 | |
| 449 | /** |
| 450 | * geni_cancel_s_cmd() - Cancel the command configured in the secondary |
| 451 | * sequencer |
| 452 | * @base: Base address of the serial engine's register block. |
| 453 | * |
| 454 | * This function is used to cancel the currently configured command in the |
| 455 | * secondary sequencer. |
| 456 | */ |
| 457 | void geni_cancel_s_cmd(void __iomem *base); |
| 458 | |
| 459 | /** |
| 460 | * geni_abort_m_cmd() - Abort the command configured in the primary sequencer |
| 461 | * @base: Base address of the serial engine's register block. |
| 462 | * |
| 463 | * This function is used to force abort the currently configured command in the |
| 464 | * primary sequencer. |
| 465 | */ |
| 466 | void geni_abort_m_cmd(void __iomem *base); |
| 467 | |
| 468 | /** |
| 469 | * geni_abort_s_cmd() - Abort the command configured in the secondary |
| 470 | * sequencer |
| 471 | * @base: Base address of the serial engine's register block. |
| 472 | * |
| 473 | * This function is used to force abort the currently configured command in the |
| 474 | * secondary sequencer. |
| 475 | */ |
| 476 | void geni_abort_s_cmd(void __iomem *base); |
| 477 | |
| 478 | /** |
| 479 | * get_tx_fifo_depth() - Get the TX fifo depth of the serial engine |
| 480 | * @base: Base address of the serial engine's register block. |
| 481 | * |
| 482 | * This function is used to get the depth i.e. number of elements in the |
| 483 | * TX fifo of the serial engine. |
| 484 | * |
| 485 | * Return: TX fifo depth in units of FIFO words. |
| 486 | */ |
| 487 | int get_tx_fifo_depth(void __iomem *base); |
| 488 | |
| 489 | /** |
| 490 | * get_tx_fifo_width() - Get the TX fifo width of the serial engine |
| 491 | * @base: Base address of the serial engine's register block. |
| 492 | * |
| 493 | * This function is used to get the width i.e. word size per element in the |
| 494 | * TX fifo of the serial engine. |
| 495 | * |
| 496 | * Return: TX fifo width in bits. |
| 497 | */ |
| 498 | int get_tx_fifo_width(void __iomem *base); |
| 499 | |
| 500 | /** |
| 501 | * get_rx_fifo_depth() - Get the RX fifo depth of the serial engine |
| 502 | * @base: Base address of the serial engine's register block. |
| 503 | * |
| 504 | * This function is used to get the depth i.e. number of elements in the |
| 505 | * RX fifo of the serial engine. |
| 506 | * |
| 507 | * Return: RX fifo depth in units of FIFO words. |
| 508 | */ |
| 509 | int get_rx_fifo_depth(void __iomem *base); |
| 510 | |
| 511 | /** |
| 512 | * se_get_packing_config() - Get the packing configuration based on input |
| 513 | * @bpw: Bits of data per transfer word. |
| 514 | * @pack_words: Number of words per fifo element. |
| 515 | * @msb_to_lsb: Transfer from MSB to LSB or vice-versa. |
| 516 | * @cfg0: Output buffer to hold the first half of configuration. |
| 517 | * @cfg1: Output buffer to hold the second half of configuration. |
| 518 | * |
| 519 | * This function is used to calculate the packing configuration based on |
| 520 | * the input packing requirement and the configuration logic. |
| 521 | */ |
| 522 | void se_get_packing_config(int bpw, int pack_words, bool msb_to_lsb, |
| 523 | unsigned long *cfg0, unsigned long *cfg1); |
| 524 | |
| 525 | /** |
| 526 | * se_config_packing() - Packing configuration of the serial engine |
| 527 | * @base: Base address of the serial engine's register block. |
| 528 | * @bpw: Bits of data per transfer word. |
| 529 | * @pack_words: Number of words per fifo element. |
| 530 | * @msb_to_lsb: Transfer from MSB to LSB or vice-versa. |
| 531 | * |
| 532 | * This function is used to configure the packing rules for the current |
| 533 | * transfer. |
| 534 | */ |
| 535 | void se_config_packing(void __iomem *base, int bpw, int pack_words, |
| 536 | bool msb_to_lsb); |
| 537 | |
| 538 | /** |
| 539 | * se_geni_resources_off() - Turn off resources associated with the serial |
| 540 | * engine |
| 541 | * @rsc: Handle to resources associated with the serial engine. |
| 542 | * |
| 543 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 544 | */ |
| 545 | int se_geni_resources_off(struct se_geni_rsc *rsc); |
| 546 | |
| 547 | /** |
| 548 | * se_geni_resources_on() - Turn on resources associated with the serial |
| 549 | * engine |
| 550 | * @rsc: Handle to resources associated with the serial engine. |
| 551 | * |
| 552 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 553 | */ |
| 554 | int se_geni_resources_on(struct se_geni_rsc *rsc); |
| 555 | |
| 556 | /** |
| 557 | * geni_se_resources_init() - Init the SE resource structure |
| 558 | * @rsc: SE resource structure to be initialized. |
| 559 | * @ab: Initial Average bus bandwidth request value. |
| 560 | * @ib: Initial Instantaneous bus bandwidth request value. |
| 561 | * |
| 562 | * Return: 0 on success, standard Linux error codes on failure. |
| 563 | */ |
| 564 | int geni_se_resources_init(struct se_geni_rsc *rsc, |
| 565 | unsigned long ab, unsigned long ib); |
| 566 | |
| 567 | /** |
Karthikeyan Ramasubramanian | 8bef5ea | 2017-05-11 17:02:46 -0600 | [diff] [blame] | 568 | * geni_se_clk_tbl_get() - Get the clock table to program DFS |
| 569 | * @rsc: Resource for which the clock table is requested. |
| 570 | * @tbl: Table in which the output is returned. |
| 571 | * |
| 572 | * This function is called by the protocol drivers to determine the different |
| 573 | * clock frequencies supported by Serail Engine Core Clock. The protocol |
| 574 | * drivers use the output to determine the clock frequency index to be |
| 575 | * programmed into DFS. |
| 576 | * |
| 577 | * Return: number of valid performance levels in the table on success, |
| 578 | * standard Linux error codes on failure. |
| 579 | */ |
| 580 | int geni_se_clk_tbl_get(struct se_geni_rsc *rsc, unsigned long **tbl); |
| 581 | |
| 582 | /** |
| 583 | * geni_se_clk_freq_match() - Get the matching or closest SE clock frequency |
| 584 | * @rsc: Resource for which the clock frequency is requested. |
| 585 | * @req_freq: Requested clock frequency. |
| 586 | * @index: Index of the resultant frequency in the table. |
| 587 | * @res_freq: Resultant frequency which matches or is closer to the |
| 588 | * requested frequency. |
| 589 | * @exact: Flag to indicate exact multiple requirement of the requested |
| 590 | * frequency . |
| 591 | * |
| 592 | * This function is called by the protocol drivers to determine the matching |
| 593 | * or closest frequency of the Serial Engine clock to be selected in order |
| 594 | * to meet the performance requirements. |
| 595 | * |
| 596 | * Return: 0 on success, standard Linux error codes on failure. |
| 597 | */ |
| 598 | int geni_se_clk_freq_match(struct se_geni_rsc *rsc, unsigned long req_freq, |
| 599 | unsigned int *index, unsigned long *res_freq, |
| 600 | bool exact); |
| 601 | |
| 602 | /** |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 603 | * geni_se_tx_dma_prep() - Prepare the Serial Engine for TX DMA transfer |
| 604 | * @wrapper_dev: QUPv3 Wrapper Device to which the TX buffer is mapped. |
| 605 | * @base: Base address of the SE register block. |
| 606 | * @tx_buf: Pointer to the TX buffer. |
| 607 | * @tx_len: Length of the TX buffer. |
| 608 | * @tx_dma: Pointer to store the mapped DMA address. |
| 609 | * |
| 610 | * This function is used to prepare the buffers for DMA TX. |
| 611 | * |
| 612 | * Return: 0 on success, standard Linux error codes on error/failure. |
| 613 | */ |
| 614 | int geni_se_tx_dma_prep(struct device *wrapper_dev, void __iomem *base, |
| 615 | void *tx_buf, int tx_len, dma_addr_t *tx_dma); |
| 616 | |
| 617 | /** |
| 618 | * geni_se_rx_dma_prep() - Prepare the Serial Engine for RX DMA transfer |
| 619 | * @wrapper_dev: QUPv3 Wrapper Device to which the TX buffer is mapped. |
| 620 | * @base: Base address of the SE register block. |
| 621 | * @rx_buf: Pointer to the RX buffer. |
| 622 | * @rx_len: Length of the RX buffer. |
| 623 | * @rx_dma: Pointer to store the mapped DMA address. |
| 624 | * |
| 625 | * This function is used to prepare the buffers for DMA RX. |
| 626 | * |
| 627 | * Return: 0 on success, standard Linux error codes on error/failure. |
| 628 | */ |
| 629 | int geni_se_rx_dma_prep(struct device *wrapper_dev, void __iomem *base, |
| 630 | void *rx_buf, int rx_len, dma_addr_t *rx_dma); |
| 631 | |
| 632 | /** |
| 633 | * geni_se_tx_dma_unprep() - Unprepare the Serial Engine after TX DMA transfer |
| 634 | * @wrapper_dev: QUPv3 Wrapper Device to which the TX buffer is mapped. |
| 635 | * @tx_dma: DMA address of the TX buffer. |
| 636 | * @tx_len: Length of the TX buffer. |
| 637 | * |
| 638 | * This function is used to unprepare the DMA buffers after DMA TX. |
| 639 | */ |
| 640 | void geni_se_tx_dma_unprep(struct device *wrapper_dev, |
| 641 | dma_addr_t tx_dma, int tx_len); |
| 642 | |
| 643 | /** |
| 644 | * geni_se_rx_dma_unprep() - Unprepare the Serial Engine after RX DMA transfer |
| 645 | * @wrapper_dev: QUPv3 Wrapper Device to which the TX buffer is mapped. |
| 646 | * @rx_dma: DMA address of the RX buffer. |
| 647 | * @rx_len: Length of the RX buffer. |
| 648 | * |
| 649 | * This function is used to unprepare the DMA buffers after DMA RX. |
| 650 | */ |
| 651 | void geni_se_rx_dma_unprep(struct device *wrapper_dev, |
| 652 | dma_addr_t rx_dma, int rx_len); |
| 653 | |
| 654 | /** |
| 655 | * geni_se_qupv3_hw_version() - Read the QUPv3 Hardware version |
| 656 | * @wrapper_dev: Pointer to the corresponding QUPv3 wrapper core. |
| 657 | * @major: Buffer for Major Version field. |
| 658 | * @minor: Buffer for Minor Version field. |
| 659 | * @step: Buffer for Step Version field. |
| 660 | * |
| 661 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 662 | */ |
| 663 | int geni_se_qupv3_hw_version(struct device *wrapper_dev, unsigned int *major, |
| 664 | unsigned int *minor, unsigned int *step); |
| 665 | |
| 666 | /** |
| 667 | * geni_se_iommu_map_buf() - Map a single buffer into QUPv3 context bank |
| 668 | * @wrapper_dev: Pointer to the corresponding QUPv3 wrapper core. |
| 669 | * @iova: Pointer in which the mapped virtual address is stored. |
| 670 | * @buf: Address of the buffer that needs to be mapped. |
| 671 | * @size: Size of the buffer. |
| 672 | * @dir: Direction of the DMA transfer. |
| 673 | * |
| 674 | * This function is used to map an already allocated buffer into the |
| 675 | * QUPv3 context bank device space. |
| 676 | * |
| 677 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 678 | */ |
| 679 | int geni_se_iommu_map_buf(struct device *wrapper_dev, dma_addr_t *iova, |
| 680 | void *buf, size_t size, enum dma_data_direction dir); |
| 681 | |
| 682 | /** |
| 683 | * geni_se_iommu_alloc_buf() - Allocate & map a single buffer into QUPv3 |
| 684 | * context bank |
| 685 | * @wrapper_dev: Pointer to the corresponding QUPv3 wrapper core. |
| 686 | * @iova: Pointer in which the mapped virtual address is stored. |
| 687 | * @size: Size of the buffer. |
| 688 | * |
| 689 | * This function is used to allocate a buffer and map it into the |
| 690 | * QUPv3 context bank device space. |
| 691 | * |
| 692 | * Return: address of the buffer on success, NULL or ERR_PTR on |
| 693 | * failure/error. |
| 694 | */ |
| 695 | void *geni_se_iommu_alloc_buf(struct device *wrapper_dev, dma_addr_t *iova, |
| 696 | size_t size); |
| 697 | |
| 698 | /** |
| 699 | * geni_se_iommu_unmap_buf() - Unmap a single buffer from QUPv3 context bank |
| 700 | * @wrapper_dev: Pointer to the corresponding QUPv3 wrapper core. |
| 701 | * @iova: Pointer in which the mapped virtual address is stored. |
| 702 | * @size: Size of the buffer. |
| 703 | * @dir: Direction of the DMA transfer. |
| 704 | * |
| 705 | * This function is used to unmap an already mapped buffer from the |
| 706 | * QUPv3 context bank device space. |
| 707 | * |
| 708 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 709 | */ |
| 710 | int geni_se_iommu_unmap_buf(struct device *wrapper_dev, dma_addr_t *iova, |
| 711 | size_t size, enum dma_data_direction dir); |
| 712 | |
| 713 | /** |
| 714 | * geni_se_iommu_free_buf() - Unmap & free a single buffer from QUPv3 |
| 715 | * context bank |
| 716 | * @wrapper_dev: Pointer to the corresponding QUPv3 wrapper core. |
| 717 | * @iova: Pointer in which the mapped virtual address is stored. |
| 718 | * @buf: Address of the buffer. |
| 719 | * @size: Size of the buffer. |
| 720 | * |
| 721 | * This function is used to unmap and free a buffer from the |
| 722 | * QUPv3 context bank device space. |
| 723 | * |
| 724 | * Return: 0 on success, standard Linux error codes on failure/error. |
| 725 | */ |
| 726 | int geni_se_iommu_free_buf(struct device *wrapper_dev, dma_addr_t *iova, |
| 727 | void *buf, size_t size); |
| 728 | |
| 729 | #else |
Girish Mahadevan | bd9b44f | 2017-04-11 13:11:10 -0600 | [diff] [blame] | 730 | static inline unsigned int geni_read_reg_nolog(void __iomem *base, int offset) |
| 731 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 732 | return 0; |
Girish Mahadevan | bd9b44f | 2017-04-11 13:11:10 -0600 | [diff] [blame] | 733 | } |
| 734 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 735 | static inline void geni_write_reg_nolog(unsigned int value, |
| 736 | void __iomem *base, int offset) |
Girish Mahadevan | bd9b44f | 2017-04-11 13:11:10 -0600 | [diff] [blame] | 737 | { |
Girish Mahadevan | bd9b44f | 2017-04-11 13:11:10 -0600 | [diff] [blame] | 738 | } |
| 739 | |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 740 | static inline unsigned int geni_read_reg(void __iomem *base, int offset) |
| 741 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 742 | return 0; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 743 | } |
| 744 | |
| 745 | static inline void geni_write_reg(unsigned int value, void __iomem *base, |
| 746 | int offset) |
| 747 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 748 | } |
| 749 | |
| 750 | static inline int get_se_proto(void __iomem *base) |
| 751 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 752 | return -ENXIO; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 753 | } |
| 754 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 755 | static inline int geni_se_init(void __iomem *base, |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 756 | unsigned int rx_wm, unsigned int rx_rfr) |
| 757 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 758 | return -ENXIO; |
| 759 | } |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 760 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 761 | static inline int geni_se_select_mode(void __iomem *base, int mode) |
| 762 | { |
| 763 | return -ENXIO; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | static inline void geni_setup_m_cmd(void __iomem *base, u32 cmd, |
| 767 | u32 params) |
| 768 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | static inline void geni_setup_s_cmd(void __iomem *base, u32 cmd, |
| 772 | u32 params) |
| 773 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | static inline void geni_cancel_m_cmd(void __iomem *base) |
| 777 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 778 | } |
| 779 | |
| 780 | static inline void geni_cancel_s_cmd(void __iomem *base) |
| 781 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | static inline void geni_abort_m_cmd(void __iomem *base) |
| 785 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 786 | } |
| 787 | |
Girish Mahadevan | 24f5659 | 2017-04-15 17:35:05 -0600 | [diff] [blame] | 788 | static inline void geni_abort_s_cmd(void __iomem *base) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 789 | { |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | static inline int get_tx_fifo_depth(void __iomem *base) |
| 793 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 794 | return -ENXIO; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | static inline int get_tx_fifo_width(void __iomem *base) |
| 798 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 799 | return -ENXIO; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 800 | } |
| 801 | |
| 802 | static inline int get_rx_fifo_depth(void __iomem *base) |
| 803 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 804 | return -ENXIO; |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 805 | } |
| 806 | |
Girish Mahadevan | b1ab172 | 2017-04-27 16:39:11 -0600 | [diff] [blame] | 807 | static inline void se_get_packing_config(int bpw, int pack_words, |
| 808 | bool msb_to_lsb, unsigned long *cfg0, |
| 809 | unsigned long *cfg1) |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 810 | { |
Girish Mahadevan | b1ab172 | 2017-04-27 16:39:11 -0600 | [diff] [blame] | 811 | } |
| 812 | |
| 813 | static inline void se_config_packing(void __iomem *base, int bpw, |
| 814 | int pack_words, bool msb_to_lsb) |
| 815 | { |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 816 | } |
| 817 | |
| 818 | static inline int se_geni_resources_on(struct se_geni_rsc *rsc) |
| 819 | { |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 820 | return -ENXIO; |
Girish Mahadevan | ebeed35 | 2016-11-23 10:59:29 -0700 | [diff] [blame] | 821 | } |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 822 | |
| 823 | static inline int se_geni_resources_off(struct se_geni_rsc *rsc) |
| 824 | { |
| 825 | return -ENXIO; |
| 826 | } |
| 827 | |
| 828 | static inline int geni_se_resources_init(struct se_geni_rsc *rsc, |
| 829 | unsigned long ab, unsigned long ib) |
| 830 | { |
| 831 | return -ENXIO; |
| 832 | } |
| 833 | |
Karthikeyan Ramasubramanian | 8bef5ea | 2017-05-11 17:02:46 -0600 | [diff] [blame] | 834 | static inline int geni_se_clk_tbl_get(struct se_geni_rsc *rsc, |
| 835 | unsigned long **tbl) |
| 836 | { |
| 837 | return -ENXIO; |
| 838 | } |
| 839 | |
| 840 | static inline int geni_se_clk_freq_match(struct se_geni_rsc *rsc, |
| 841 | unsigned long req_freq, unsigned int *index, |
| 842 | unsigned long *res_freq, bool exact) |
| 843 | { |
| 844 | return -ENXIO; |
| 845 | } |
| 846 | |
Karthikeyan Ramasubramanian | 0d578b7 | 2017-04-26 10:44:02 -0600 | [diff] [blame] | 847 | static inline int geni_se_tx_dma_prep(struct device *wrapper_dev, |
| 848 | void __iomem *base, void *tx_buf, int tx_len, dma_addr_t *tx_dma) |
| 849 | { |
| 850 | return -ENXIO; |
| 851 | } |
| 852 | |
| 853 | static inline int geni_se_rx_dma_prep(struct device *wrapper_dev, |
| 854 | void __iomem *base, void *rx_buf, int rx_len, dma_addr_t *rx_dma) |
| 855 | { |
| 856 | return -ENXIO; |
| 857 | } |
| 858 | |
| 859 | static inline void geni_se_tx_dma_unprep(struct device *wrapper_dev, |
| 860 | dma_addr_t tx_dma, int tx_len) |
| 861 | { |
| 862 | } |
| 863 | |
| 864 | static inline void geni_se_rx_dma_unprep(struct device *wrapper_dev, |
| 865 | dma_addr_t rx_dma, int rx_len) |
| 866 | { |
| 867 | } |
| 868 | |
| 869 | static inline int geni_se_qupv3_hw_version(struct device *wrapper_dev, |
| 870 | unsigned int *major, unsigned int *minor, unsigned int *step) |
| 871 | { |
| 872 | return -ENXIO; |
| 873 | } |
| 874 | |
| 875 | static inline int geni_se_iommu_map_buf(struct device *wrapper_dev, |
| 876 | dma_addr_t *iova, void *buf, size_t size, enum dma_data_direction dir) |
| 877 | { |
| 878 | return -ENXIO; |
| 879 | } |
| 880 | |
| 881 | static inline void *geni_se_iommu_alloc_buf(struct device *wrapper_dev, |
| 882 | dma_addr_t *iova, size_t size) |
| 883 | { |
| 884 | return NULL; |
| 885 | } |
| 886 | |
| 887 | static inline int geni_se_iommu_unmap_buf(struct device *wrapper_dev, |
| 888 | dma_addr_t *iova, size_t size, enum dma_data_direction dir) |
| 889 | { |
| 890 | return -ENXIO; |
| 891 | |
| 892 | } |
| 893 | |
| 894 | static inline int geni_se_iommu_free_buf(struct device *wrapper_dev, |
| 895 | dma_addr_t *iova, void *buf, size_t size) |
| 896 | { |
| 897 | return -ENXIO; |
| 898 | } |
| 899 | |
| 900 | #endif |
Sagar Dharia | 7c927c0 | 2016-11-23 11:51:43 -0700 | [diff] [blame] | 901 | #endif |