Lines Matching refs:bank
40 static int adf_reserve_ring(struct adf_etr_bank_data *bank, u32 ring) in adf_reserve_ring() argument
42 spin_lock(&bank->lock); in adf_reserve_ring()
43 if (bank->ring_mask & (1 << ring)) { in adf_reserve_ring()
44 spin_unlock(&bank->lock); in adf_reserve_ring()
47 bank->ring_mask |= (1 << ring); in adf_reserve_ring()
48 spin_unlock(&bank->lock); in adf_reserve_ring()
52 static void adf_unreserve_ring(struct adf_etr_bank_data *bank, u32 ring) in adf_unreserve_ring() argument
54 spin_lock(&bank->lock); in adf_unreserve_ring()
55 bank->ring_mask &= ~(1 << ring); in adf_unreserve_ring()
56 spin_unlock(&bank->lock); in adf_unreserve_ring()
59 static void adf_enable_ring_irq(struct adf_etr_bank_data *bank, u32 ring) in adf_enable_ring_irq() argument
61 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev); in adf_enable_ring_irq()
63 spin_lock_bh(&bank->lock); in adf_enable_ring_irq()
64 bank->irq_mask |= (1 << ring); in adf_enable_ring_irq()
65 spin_unlock_bh(&bank->lock); in adf_enable_ring_irq()
66 csr_ops->write_csr_int_col_en(bank->csr_addr, bank->bank_number, in adf_enable_ring_irq()
67 bank->irq_mask); in adf_enable_ring_irq()
68 csr_ops->write_csr_int_col_ctl(bank->csr_addr, bank->bank_number, in adf_enable_ring_irq()
69 bank->irq_coalesc_timer); in adf_enable_ring_irq()
72 static void adf_disable_ring_irq(struct adf_etr_bank_data *bank, u32 ring) in adf_disable_ring_irq() argument
74 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev); in adf_disable_ring_irq()
76 spin_lock_bh(&bank->lock); in adf_disable_ring_irq()
77 bank->irq_mask &= ~(1 << ring); in adf_disable_ring_irq()
78 spin_unlock_bh(&bank->lock); in adf_disable_ring_irq()
79 csr_ops->write_csr_int_col_en(bank->csr_addr, bank->bank_number, in adf_disable_ring_irq()
80 bank->irq_mask); in adf_disable_ring_irq()
90 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(ring->bank->accel_dev); in adf_send_message()
104 csr_ops->write_csr_ring_tail(ring->bank->csr_addr, in adf_send_message()
105 ring->bank->bank_number, ring->ring_number, in adf_send_message()
114 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(ring->bank->accel_dev); in adf_handle_response()
129 csr_ops->write_csr_ring_head(ring->bank->csr_addr, in adf_handle_response()
130 ring->bank->bank_number, in adf_handle_response()
138 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(ring->bank->accel_dev); in adf_configure_tx_ring()
141 csr_ops->write_csr_ring_config(ring->bank->csr_addr, in adf_configure_tx_ring()
142 ring->bank->bank_number, in adf_configure_tx_ring()
149 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(ring->bank->accel_dev); in adf_configure_rx_ring()
155 csr_ops->write_csr_ring_config(ring->bank->csr_addr, in adf_configure_rx_ring()
156 ring->bank->bank_number, in adf_configure_rx_ring()
162 struct adf_etr_bank_data *bank = ring->bank; in adf_init_ring() local
163 struct adf_accel_dev *accel_dev = bank->accel_dev; in adf_init_ring()
196 csr_ops->write_csr_ring_base(ring->bank->csr_addr, in adf_init_ring()
197 ring->bank->bank_number, ring->ring_number, in adf_init_ring()
211 dma_free_coherent(&GET_DEV(ring->bank->accel_dev), in adf_cleanup_ring()
225 struct adf_etr_bank_data *bank; in adf_create_ring() local
261 bank = &transport_data->banks[bank_num]; in adf_create_ring()
262 if (adf_reserve_ring(bank, ring_num)) { in adf_create_ring()
267 ring = &bank->rings[ring_num]; in adf_create_ring()
269 ring->bank = bank; in adf_create_ring()
294 adf_enable_ring_irq(bank, ring->ring_number); in adf_create_ring()
299 adf_unreserve_ring(bank, ring_num); in adf_create_ring()
306 struct adf_etr_bank_data *bank = ring->bank; in adf_remove_ring() local
307 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev); in adf_remove_ring()
310 adf_disable_ring_irq(bank, ring->ring_number); in adf_remove_ring()
314 csr_ops->write_csr_ring_config(bank->csr_addr, bank->bank_number, in adf_remove_ring()
316 csr_ops->write_csr_ring_base(bank->csr_addr, bank->bank_number, in adf_remove_ring()
319 adf_unreserve_ring(bank, ring->ring_number); in adf_remove_ring()
325 static void adf_ring_response_handler(struct adf_etr_bank_data *bank) in adf_ring_response_handler() argument
327 struct adf_accel_dev *accel_dev = bank->accel_dev; in adf_ring_response_handler()
333 empty_rings = csr_ops->read_csr_e_stat(bank->csr_addr, in adf_ring_response_handler()
334 bank->bank_number); in adf_ring_response_handler()
335 empty_rings = ~empty_rings & bank->irq_mask; in adf_ring_response_handler()
338 adf_handle_response(&bank->rings[i]); in adf_ring_response_handler()
343 struct adf_etr_bank_data *bank = (void *)bank_addr; in adf_response_handler() local
344 struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev); in adf_response_handler()
347 adf_ring_response_handler(bank); in adf_response_handler()
349 csr_ops->write_csr_int_flag_and_col(bank->csr_addr, bank->bank_number, in adf_response_handler()
350 bank->irq_mask); in adf_response_handler()
370 static void adf_get_coalesc_timer(struct adf_etr_bank_data *bank, in adf_get_coalesc_timer() argument
374 if (adf_get_cfg_int(bank->accel_dev, section, in adf_get_coalesc_timer()
376 bank_num_in_accel, &bank->irq_coalesc_timer)) in adf_get_coalesc_timer()
377 bank->irq_coalesc_timer = ADF_COALESCING_DEF_TIME; in adf_get_coalesc_timer()
379 if (ADF_COALESCING_MAX_TIME < bank->irq_coalesc_timer || in adf_get_coalesc_timer()
380 ADF_COALESCING_MIN_TIME > bank->irq_coalesc_timer) in adf_get_coalesc_timer()
381 bank->irq_coalesc_timer = ADF_COALESCING_DEF_TIME; in adf_get_coalesc_timer()
385 struct adf_etr_bank_data *bank, in adf_init_bank() argument
398 memset(bank, 0, sizeof(*bank)); in adf_init_bank()
399 bank->bank_number = bank_num; in adf_init_bank()
400 bank->csr_addr = csr_addr; in adf_init_bank()
401 bank->accel_dev = accel_dev; in adf_init_bank()
402 spin_lock_init(&bank->lock); in adf_init_bank()
406 bank->rings = kzalloc_node(size, GFP_KERNEL, in adf_init_bank()
408 if (!bank->rings) in adf_init_bank()
417 adf_get_coalesc_timer(bank, "Accelerator0", bank_num); in adf_init_bank()
419 bank->irq_coalesc_timer = ADF_COALESCING_MIN_TIME; in adf_init_bank()
425 ring = &bank->rings[i]; in adf_init_bank()
439 tx_ring = &bank->rings[i - hw_data->tx_rx_gap]; in adf_init_bank()
443 if (adf_bank_debugfs_add(bank)) { in adf_init_bank()
456 ring = &bank->rings[i]; in adf_init_bank()
460 kfree(bank->rings); in adf_init_bank()
524 static void cleanup_bank(struct adf_etr_bank_data *bank) in cleanup_bank() argument
526 struct adf_accel_dev *accel_dev = bank->accel_dev; in cleanup_bank()
532 struct adf_etr_ring_data *ring = &bank->rings[i]; in cleanup_bank()
534 if (bank->ring_mask & (1 << i)) in cleanup_bank()
540 kfree(bank->rings); in cleanup_bank()
541 adf_bank_debugfs_rm(bank); in cleanup_bank()
542 memset(bank, 0, sizeof(*bank)); in cleanup_bank()