Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ccree: simplify ioread/iowrite

Registers ioread/iowrite operations were done via macros,
sometime using a "magical" implicit parameter.

Replace all register access with simple inline macros.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gilad Ben-Yossef and committed by
Greg Kroah-Hartman
7f5ce9dd 57a1f2a0

+78 -166
-33
drivers/staging/ccree/cc_hal.h
··· 1 - /* 2 - * Copyright (C) 2012-2017 ARM Limited or its affiliates. 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 as 6 - * 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 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 - */ 16 - 17 - /* pseudo cc_hal.h for cc7x_perf_test_driver (to be able to include code from 18 - * CC drivers). 19 - */ 20 - 21 - #ifndef __CC_HAL_H__ 22 - #define __CC_HAL_H__ 23 - 24 - #include <linux/io.h> 25 - 26 - #define READ_REGISTER(_addr) ioread32((_addr)) 27 - #define WRITE_REGISTER(_addr, _data) iowrite32((_data), (_addr)) 28 - 29 - #define CC_HAL_WRITE_REGISTER(offset, val) \ 30 - WRITE_REGISTER(cc_base + (offset), val) 31 - #define CC_HAL_READ_REGISTER(offset) READ_REGISTER(cc_base + (offset)) 32 - 33 - #endif
-35
drivers/staging/ccree/cc_regs.h
··· 1 - /* 2 - * Copyright (C) 2012-2017 ARM Limited or its affiliates. 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 as 6 - * 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 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 - */ 16 - 17 - /*! 18 - * @file 19 - * @brief This file contains macro definitions for accessing ARM TrustZone 20 - * CryptoCell register space. 21 - */ 22 - 23 - #ifndef _CC_REGS_H_ 24 - #define _CC_REGS_H_ 25 - 26 - #include <linux/bitfield.h> 27 - 28 - #define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \ 29 - DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \ 30 - DX_AXIM_MON_COMP_VALUE_BIT_SHIFT) 31 - 32 - /* Register name mangling macro */ 33 - #define CC_REG(reg_name) DX_ ## reg_name ## _REG_OFFSET 34 - 35 - #endif /*_CC_REGS_H_*/
-25
drivers/staging/ccree/dx_reg_base_host.h
··· 1 - /* 2 - * Copyright (C) 2012-2017 ARM Limited or its affiliates. 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 as 6 - * 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 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 - */ 16 - 17 - #ifndef __DX_REG_BASE_HOST_H__ 18 - #define __DX_REG_BASE_HOST_H__ 19 - 20 - #define DX_BASE_CC 0x80000000 21 - #define DX_BASE_HOST_RGF 0x0UL 22 - #define DX_BASE_CRY_KERNEL 0x0UL 23 - #define DX_BASE_ROM 0x40000000 24 - 25 - #endif /*__DX_REG_BASE_HOST_H__*/
+21 -26
drivers/staging/ccree/ssi_driver.c
··· 91 91 static irqreturn_t cc_isr(int irq, void *dev_id) 92 92 { 93 93 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)dev_id; 94 - void __iomem *cc_base = drvdata->cc_base; 95 94 struct device *dev = drvdata_to_dev(drvdata); 96 95 u32 irr; 97 96 u32 imr; ··· 98 99 /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */ 99 100 100 101 /* read the interrupt status */ 101 - irr = CC_HAL_READ_REGISTER(CC_REG(HOST_IRR)); 102 + irr = cc_ioread(drvdata, CC_REG(HOST_IRR)); 102 103 dev_dbg(dev, "Got IRR=0x%08X\n", irr); 103 104 if (unlikely(irr == 0)) { /* Probably shared interrupt line */ 104 105 dev_err(dev, "Got interrupt with empty IRR\n"); 105 106 return IRQ_NONE; 106 107 } 107 - imr = CC_HAL_READ_REGISTER(CC_REG(HOST_IMR)); 108 + imr = cc_ioread(drvdata, CC_REG(HOST_IMR)); 108 109 109 110 /* clear interrupt - must be before processing events */ 110 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_ICR), irr); 111 + cc_iowrite(drvdata, CC_REG(HOST_ICR), irr); 111 112 112 113 drvdata->irq = irr; 113 114 /* Completion interrupt - most probable */ 114 115 if (likely((irr & SSI_COMP_IRQ_MASK) != 0)) { 115 116 /* Mask AXI completion interrupt - will be unmasked in Deferred service handler */ 116 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IMR), imr | SSI_COMP_IRQ_MASK); 117 + cc_iowrite(drvdata, CC_REG(HOST_IMR), imr | SSI_COMP_IRQ_MASK); 117 118 irr &= ~SSI_COMP_IRQ_MASK; 118 119 complete_request(drvdata); 119 120 } ··· 121 122 /* TEE FIPS interrupt */ 122 123 if (likely((irr & SSI_GPR0_IRQ_MASK) != 0)) { 123 124 /* Mask interrupt - will be unmasked in Deferred service handler */ 124 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IMR), imr | SSI_GPR0_IRQ_MASK); 125 + cc_iowrite(drvdata, CC_REG(HOST_IMR), imr | SSI_GPR0_IRQ_MASK); 125 126 irr &= ~SSI_GPR0_IRQ_MASK; 126 127 fips_handler(drvdata); 127 128 } ··· 131 132 u32 axi_err; 132 133 133 134 /* Read the AXI error ID */ 134 - axi_err = CC_HAL_READ_REGISTER(CC_REG(AXIM_MON_ERR)); 135 + axi_err = cc_ioread(drvdata, CC_REG(AXIM_MON_ERR)); 135 136 dev_dbg(dev, "AXI completion error: axim_mon_err=0x%08X\n", 136 137 axi_err); 137 138 ··· 150 151 int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) 151 152 { 152 153 unsigned int val, cache_params; 153 - void __iomem *cc_base = drvdata->cc_base; 154 154 struct device *dev = drvdata_to_dev(drvdata); 155 155 156 156 /* Unmask all AXI interrupt sources AXI_CFG1 register */ 157 - val = CC_HAL_READ_REGISTER(CC_REG(AXIM_CFG)); 158 - CC_HAL_WRITE_REGISTER(CC_REG(AXIM_CFG), val & ~SSI_AXI_IRQ_MASK); 157 + val = cc_ioread(drvdata, CC_REG(AXIM_CFG)); 158 + cc_iowrite(drvdata, CC_REG(AXIM_CFG), val & ~SSI_AXI_IRQ_MASK); 159 159 dev_dbg(dev, "AXIM_CFG=0x%08X\n", 160 - CC_HAL_READ_REGISTER(CC_REG(AXIM_CFG))); 160 + cc_ioread(drvdata, CC_REG(AXIM_CFG))); 161 161 162 162 /* Clear all pending interrupts */ 163 - val = CC_HAL_READ_REGISTER(CC_REG(HOST_IRR)); 163 + val = cc_ioread(drvdata, CC_REG(HOST_IRR)); 164 164 dev_dbg(dev, "IRR=0x%08X\n", val); 165 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_ICR), val); 165 + cc_iowrite(drvdata, CC_REG(HOST_ICR), val); 166 166 167 167 /* Unmask relevant interrupt cause */ 168 168 val = (unsigned int)(~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | 169 169 SSI_GPR0_IRQ_MASK)); 170 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IMR), val); 170 + cc_iowrite(drvdata, CC_REG(HOST_IMR), val); 171 171 172 172 #ifdef DX_HOST_IRQ_TIMER_INIT_VAL_REG_OFFSET 173 173 #ifdef DX_IRQ_DELAY 174 174 /* Set CC IRQ delay */ 175 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IRQ_TIMER_INIT_VAL), 176 - DX_IRQ_DELAY); 175 + cc_iowrite(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL), DX_IRQ_DELAY); 177 176 #endif 178 - if (CC_HAL_READ_REGISTER(CC_REG(HOST_IRQ_TIMER_INIT_VAL)) > 0) { 177 + if (cc_ioread(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL)) > 0) { 179 178 dev_dbg(dev, "irq_delay=%d CC cycles\n", 180 - CC_HAL_READ_REGISTER(CC_REG(HOST_IRQ_TIMER_INIT_VAL))); 179 + cc_ioread(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL))); 181 180 } 182 181 #endif 183 182 184 183 cache_params = (drvdata->coherent ? CC_COHERENT_CACHE_PARAMS : 0x0); 185 184 186 - val = CC_HAL_READ_REGISTER(CC_REG(AXIM_CACHE_PARAMS)); 185 + val = cc_ioread(drvdata, CC_REG(AXIM_CACHE_PARAMS)); 187 186 188 187 if (is_probe) 189 188 dev_info(dev, "Cache params previous: 0x%08X\n", val); 190 189 191 - CC_HAL_WRITE_REGISTER(CC_REG(AXIM_CACHE_PARAMS), 192 - cache_params); 193 - val = CC_HAL_READ_REGISTER(CC_REG(AXIM_CACHE_PARAMS)); 190 + cc_iowrite(drvdata, CC_REG(AXIM_CACHE_PARAMS), cache_params); 191 + val = cc_ioread(drvdata, CC_REG(AXIM_CACHE_PARAMS)); 194 192 195 193 if (is_probe) 196 194 dev_info(dev, "Cache params current: 0x%08X (expect: 0x%08X)\n", ··· 276 280 } 277 281 278 282 /* Verify correct mapping */ 279 - signature_val = CC_HAL_READ_REGISTER(CC_REG(HOST_SIGNATURE)); 283 + signature_val = cc_ioread(new_drvdata, CC_REG(HOST_SIGNATURE)); 280 284 if (signature_val != DX_DEV_SIGNATURE) { 281 285 dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", 282 286 signature_val, (u32)DX_DEV_SIGNATURE); ··· 288 292 /* Display HW versions */ 289 293 dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", 290 294 SSI_DEV_NAME_STR, 291 - CC_HAL_READ_REGISTER(CC_REG(HOST_VERSION)), 295 + cc_ioread(new_drvdata, CC_REG(HOST_VERSION)), 292 296 DRV_MODULE_VERSION); 293 297 294 298 rc = init_cc_regs(new_drvdata, true); ··· 406 410 void fini_cc_regs(struct ssi_drvdata *drvdata) 407 411 { 408 412 /* Mask all interrupts */ 409 - WRITE_REGISTER(drvdata->cc_base + 410 - CC_REG(HOST_IMR), 0xFFFFFFFF); 413 + cc_iowrite(drvdata, CC_REG(HOST_IMR), 0xFFFFFFFF); 411 414 } 412 415 413 416 static void cleanup_cc_resources(struct platform_device *plat_dev)
+17 -3
drivers/staging/ccree/ssi_driver.h
··· 40 40 #include <linux/platform_device.h> 41 41 42 42 /* Registers definitions from shared/hw/ree_include */ 43 - #include "dx_reg_base_host.h" 44 43 #include "dx_host.h" 45 - #include "cc_regs.h" 46 44 #include "dx_reg_common.h" 47 - #include "cc_hal.h" 48 45 #define CC_SUPPORT_SHA DX_DEV_SHA_MAX 49 46 #include "cc_crypto_ctx.h" 50 47 #include "ssi_sysfs.h" ··· 69 72 #define SSI_AXI_ERR_IRQ_MASK BIT(DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT) 70 73 71 74 #define SSI_COMP_IRQ_MASK BIT(DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT) 75 + 76 + #define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \ 77 + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \ 78 + DX_AXIM_MON_COMP_VALUE_BIT_SHIFT) 79 + 80 + /* Register name mangling macro */ 81 + #define CC_REG(reg_name) DX_ ## reg_name ## _REG_OFFSET 72 82 73 83 /* TEE FIPS status interrupt */ 74 84 #define SSI_GPR0_IRQ_MASK BIT(DX_HOST_IRR_GPR0_BIT_SHIFT) ··· 191 187 void fini_cc_regs(struct ssi_drvdata *drvdata); 192 188 int cc_clk_on(struct ssi_drvdata *drvdata); 193 189 void cc_clk_off(struct ssi_drvdata *drvdata); 190 + 191 + static inline void cc_iowrite(struct ssi_drvdata *drvdata, u32 reg, u32 val) 192 + { 193 + iowrite32(val, (drvdata->cc_base + reg)); 194 + } 195 + 196 + static inline u32 cc_ioread(struct ssi_drvdata *drvdata, u32 reg) 197 + { 198 + return ioread32(drvdata->cc_base + reg); 199 + } 194 200 195 201 #endif /*__SSI_DRIVER_H__*/ 196 202
+4 -8
drivers/staging/ccree/ssi_fips.c
··· 19 19 20 20 #include "ssi_config.h" 21 21 #include "ssi_driver.h" 22 - #include "cc_hal.h" 23 22 #include "ssi_fips.h" 24 23 25 24 static void fips_dsr(unsigned long devarg); ··· 33 34 static bool cc_get_tee_fips_status(struct ssi_drvdata *drvdata) 34 35 { 35 36 u32 reg; 36 - void __iomem *cc_base = drvdata->cc_base; 37 37 38 - reg = CC_HAL_READ_REGISTER(CC_REG(GPR_HOST)); 38 + reg = cc_ioread(drvdata, CC_REG(GPR_HOST)); 39 39 return (reg == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)); 40 40 } 41 41 ··· 44 46 */ 45 47 void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool status) 46 48 { 47 - void __iomem *cc_base = drvdata->cc_base; 48 49 int val = CC_FIPS_SYNC_REE_STATUS; 49 50 50 51 val |= (status ? CC_FIPS_SYNC_MODULE_OK : CC_FIPS_SYNC_MODULE_ERROR); 51 52 52 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_GPR0), val); 53 + cc_iowrite(drvdata, CC_REG(HOST_GPR0), val); 53 54 } 54 55 55 56 void ssi_fips_fini(struct ssi_drvdata *drvdata) ··· 86 89 { 87 90 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg; 88 91 struct device *dev = drvdata_to_dev(drvdata); 89 - void __iomem *cc_base = drvdata->cc_base; 90 92 u32 irq, state, val; 91 93 92 94 irq = (drvdata->irq & (SSI_GPR0_IRQ_MASK)); 93 95 94 96 if (irq) { 95 - state = CC_HAL_READ_REGISTER(CC_REG(GPR_HOST)); 97 + state = cc_ioread(drvdata, CC_REG(GPR_HOST)); 96 98 97 99 if (state != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)) 98 100 tee_fips_error(dev); ··· 101 105 * unmask AXI completion interrupt. 102 106 */ 103 107 val = (CC_REG(HOST_IMR) & ~irq); 104 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IMR), val); 108 + cc_iowrite(drvdata, CC_REG(HOST_IMR), val); 105 109 } 106 110 107 111 /* The function called once at driver entry point .*/
+2 -2
drivers/staging/ccree/ssi_pm.c
··· 41 41 int rc; 42 42 43 43 dev_dbg(dev, "set HOST_POWER_DOWN_EN\n"); 44 - WRITE_REGISTER(drvdata->cc_base + CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE); 44 + cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE); 45 45 rc = ssi_request_mgr_runtime_suspend_queue(drvdata); 46 46 if (rc != 0) { 47 47 dev_err(dev, "ssi_request_mgr_runtime_suspend_queue (%x)\n", ··· 60 60 (struct ssi_drvdata *)dev_get_drvdata(dev); 61 61 62 62 dev_dbg(dev, "unset HOST_POWER_DOWN_EN\n"); 63 - WRITE_REGISTER(drvdata->cc_base + CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE); 63 + cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE); 64 64 65 65 rc = cc_clk_on(drvdata); 66 66 if (rc) {
+29 -28
drivers/staging/ccree/ssi_request_mgr.c
··· 122 122 dev_dbg(dev, "Initializing completion tasklet\n"); 123 123 tasklet_init(&req_mgr_h->comptask, comp_handler, (unsigned long)drvdata); 124 124 #endif 125 - req_mgr_h->hw_queue_size = READ_REGISTER(drvdata->cc_base + 126 - CC_REG(DSCRPTR_QUEUE_SRAM_SIZE)); 125 + req_mgr_h->hw_queue_size = cc_ioread(drvdata, 126 + CC_REG(DSCRPTR_QUEUE_SRAM_SIZE)); 127 127 dev_dbg(dev, "hw_queue_size=0x%08X\n", req_mgr_h->hw_queue_size); 128 128 if (req_mgr_h->hw_queue_size < MIN_HW_QUEUE_SIZE) { 129 129 dev_err(dev, "Invalid HW queue size = %u (Min. required is %u)\n", ··· 197 197 } 198 198 199 199 static inline int request_mgr_queues_status_check( 200 - struct device *dev, 200 + struct ssi_drvdata *drvdata, 201 201 struct ssi_request_mgr_handle *req_mgr_h, 202 - void __iomem *cc_base, 203 202 unsigned int total_seq_len) 204 203 { 205 204 unsigned long poll_queue; 205 + struct device *dev = drvdata_to_dev(drvdata); 206 206 207 207 /* SW queue is checked only once as it will not 208 208 * be chaned during the poll becasue the spinlock_bh ··· 222 222 /* Wait for space in HW queue. Poll constant num of iterations. */ 223 223 for (poll_queue = 0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue++) { 224 224 req_mgr_h->q_free_slots = 225 - CC_HAL_READ_REGISTER(CC_REG(DSCRPTR_QUEUE_CONTENT)); 225 + cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT)); 226 226 if (unlikely(req_mgr_h->q_free_slots < 227 227 req_mgr_h->min_free_hw_slots)) { 228 228 req_mgr_h->min_free_hw_slots = req_mgr_h->q_free_slots; ··· 288 288 * in case iv gen add the max size and in case of no dout add 1 289 289 * for the internal completion descriptor 290 290 */ 291 - rc = request_mgr_queues_status_check(dev, req_mgr_h, cc_base, 291 + rc = request_mgr_queues_status_check(drvdata, req_mgr_h, 292 292 max_required_seq_len); 293 293 if (likely(rc == 0)) 294 294 /* There is enough place in the queue */ ··· 404 404 int send_request_init( 405 405 struct ssi_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len) 406 406 { 407 - struct device *dev = drvdata_to_dev(drvdata); 408 407 void __iomem *cc_base = drvdata->cc_base; 409 408 struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; 410 409 unsigned int total_seq_len = len; /*initial sequence length*/ 411 410 int rc = 0; 412 411 413 412 /* Wait for space in HW and SW FIFO. Poll for as much as FIFO_TIMEOUT. */ 414 - rc = request_mgr_queues_status_check(dev, req_mgr_h, cc_base, 413 + rc = request_mgr_queues_status_check(drvdata, req_mgr_h, 415 414 total_seq_len); 416 415 if (unlikely(rc != 0)) 417 416 return rc; ··· 421 422 422 423 /* Update the free slots in HW queue */ 423 424 req_mgr_h->q_free_slots = 424 - CC_HAL_READ_REGISTER(CC_REG(DSCRPTR_QUEUE_CONTENT)); 425 + cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT)); 425 426 426 427 return 0; 427 428 } ··· 485 486 486 487 dev_info(dev, "Delay\n"); 487 488 for (i = 0; i < 1000000; i++) 488 - axi_err = READ_REGISTER(drvdata->cc_base + CC_REG(AXIM_MON_ERR)); 489 + axi_err = cc_ioread(drvdata, 490 + CC_REG(AXIM_MON_ERR)); 489 491 } 490 492 #endif /* COMPLETION_DELAY */ 491 493 ··· 507 507 } 508 508 } 509 509 510 - static inline u32 cc_axi_comp_count(void __iomem *cc_base) 510 + static inline u32 cc_axi_comp_count(struct ssi_drvdata *drvdata) 511 511 { 512 - /* The CC_HAL_READ_REGISTER macro implictly requires and uses 513 - * a base MMIO register address variable named cc_base. 514 - */ 515 512 return FIELD_GET(AXIM_MON_COMP_VALUE, 516 - CC_HAL_READ_REGISTER(CC_REG(AXIM_MON_COMP))); 513 + cc_ioread(drvdata, CC_REG(AXIM_MON_COMP))); 517 514 } 518 515 519 516 /* Deferred service handler, run as interrupt-fired tasklet */ 520 517 static void comp_handler(unsigned long devarg) 521 518 { 522 519 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg; 523 - void __iomem *cc_base = drvdata->cc_base; 524 520 struct ssi_request_mgr_handle *request_mgr_handle = 525 521 drvdata->request_mgr_handle; 526 522 ··· 525 529 irq = (drvdata->irq & SSI_COMP_IRQ_MASK); 526 530 527 531 if (irq & SSI_COMP_IRQ_MASK) { 528 - /* To avoid the interrupt from firing as we unmask it, we clear it now */ 529 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_ICR), SSI_COMP_IRQ_MASK); 532 + /* To avoid the interrupt from firing as we unmask it, 533 + * we clear it now 534 + */ 535 + cc_iowrite(drvdata, CC_REG(HOST_ICR), SSI_COMP_IRQ_MASK); 530 536 531 - /* Avoid race with above clear: Test completion counter once more */ 537 + /* Avoid race with above clear: Test completion counter 538 + * once more 539 + */ 532 540 request_mgr_handle->axi_completed += 533 - cc_axi_comp_count(cc_base); 541 + cc_axi_comp_count(drvdata); 534 542 535 543 while (request_mgr_handle->axi_completed) { 536 544 do { ··· 543 543 * request_mgr_handle->axi_completed is 0. 544 544 */ 545 545 request_mgr_handle->axi_completed = 546 - cc_axi_comp_count(cc_base); 546 + cc_axi_comp_count(drvdata); 547 547 } while (request_mgr_handle->axi_completed > 0); 548 548 549 - /* To avoid the interrupt from firing as we unmask it, we clear it now */ 550 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_ICR), SSI_COMP_IRQ_MASK); 549 + cc_iowrite(drvdata, CC_REG(HOST_ICR), 550 + SSI_COMP_IRQ_MASK); 551 551 552 - /* Avoid race with above clear: Test completion counter once more */ 553 552 request_mgr_handle->axi_completed += 554 - cc_axi_comp_count(cc_base); 553 + cc_axi_comp_count(drvdata); 555 554 } 556 555 } 557 - /* after verifing that there is nothing to do, Unmask AXI completion interrupt */ 558 - CC_HAL_WRITE_REGISTER(CC_REG(HOST_IMR), 559 - CC_HAL_READ_REGISTER(CC_REG(HOST_IMR)) & ~irq); 556 + /* after verifing that there is nothing to do, 557 + * unmask AXI completion interrupt 558 + */ 559 + cc_iowrite(drvdata, CC_REG(HOST_IMR), 560 + cc_ioread(drvdata, CC_REG(HOST_IMR)) & ~irq); 560 561 } 561 562 562 563 /*
+5 -6
drivers/staging/ccree/ssi_sysfs.c
··· 29 29 { 30 30 struct ssi_drvdata *drvdata = sys_get_drvdata(); 31 31 u32 register_value; 32 - void __iomem *cc_base = drvdata->cc_base; 33 32 int offset = 0; 34 33 35 - register_value = CC_HAL_READ_REGISTER(CC_REG(HOST_SIGNATURE)); 34 + register_value = cc_ioread(drvdata, CC_REG(HOST_SIGNATURE)); 36 35 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_SIGNATURE ", DX_HOST_SIGNATURE_REG_OFFSET, register_value); 37 - register_value = CC_HAL_READ_REGISTER(CC_REG(HOST_IRR)); 36 + register_value = cc_ioread(drvdata, CC_REG(HOST_IRR)); 38 37 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_IRR ", DX_HOST_IRR_REG_OFFSET, register_value); 39 - register_value = CC_HAL_READ_REGISTER(CC_REG(HOST_POWER_DOWN_EN)); 38 + register_value = cc_ioread(drvdata, CC_REG(HOST_POWER_DOWN_EN)); 40 39 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_POWER_DOWN_EN ", DX_HOST_POWER_DOWN_EN_REG_OFFSET, register_value); 41 - register_value = CC_HAL_READ_REGISTER(CC_REG(AXIM_MON_ERR)); 40 + register_value = cc_ioread(drvdata, CC_REG(AXIM_MON_ERR)); 42 41 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "AXIM_MON_ERR ", DX_AXIM_MON_ERR_REG_OFFSET, register_value); 43 - register_value = CC_HAL_READ_REGISTER(CC_REG(DSCRPTR_QUEUE_CONTENT)); 42 + register_value = cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT)); 44 43 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "DSCRPTR_QUEUE_CONTENT", DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET, register_value); 45 44 return offset; 46 45 }