1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
9 tim_lf_irq(void *param)
11 uintptr_t base = (uintptr_t)param;
15 ring = (base >> 12) & 0xFF;
17 intr = plt_read64(base + TIM_LF_NRSPERR_INT);
18 plt_err("TIM RING %d TIM_LF_NRSPERR_INT=0x%" PRIx64 "", ring, intr);
19 intr = plt_read64(base + TIM_LF_RAS_INT);
20 plt_err("TIM RING %d TIM_LF_RAS_INT=0x%" PRIx64 "", ring, intr);
23 plt_write64(intr, base + TIM_LF_NRSPERR_INT);
24 plt_write64(intr, base + TIM_LF_RAS_INT);
28 tim_lf_register_irq(uintptr_t base, struct plt_intr_handle *handle,
34 vec = msix_offset + TIM_LF_INT_VEC_NRSPERR_INT;
36 /* Clear err interrupt */
37 plt_write64(~0ull, base + TIM_LF_NRSPERR_INT);
38 /* Set used interrupt vectors */
39 rc = dev_irq_register(handle, tim_lf_irq, (void *)base, vec);
40 /* Enable hw interrupt */
41 plt_write64(~0ull, base + TIM_LF_NRSPERR_INT_ENA_W1S);
43 vec = msix_offset + TIM_LF_INT_VEC_RAS_INT;
45 /* Clear err interrupt */
46 plt_write64(~0ull, base + TIM_LF_RAS_INT);
47 /* Set used interrupt vectors */
48 rc = dev_irq_register(handle, tim_lf_irq, (void *)base, vec);
49 /* Enable hw interrupt */
50 plt_write64(~0ull, base + TIM_LF_RAS_INT_ENA_W1S);
56 tim_register_irq_priv(struct roc_tim *roc_tim, struct plt_intr_handle *handle,
57 uint8_t ring_id, uint16_t msix_offset)
59 struct dev *dev = &roc_sso_to_sso_priv(roc_tim->roc_sso)->dev;
62 if (msix_offset == MSIX_VECTOR_INVALID) {
63 plt_err("Invalid MSIX offset for TIM LF %d", ring_id);
67 base = dev->bar2 + (RVU_BLOCK_ADDR_TIM << 20 | ring_id << 12);
68 return tim_lf_register_irq(base, handle, msix_offset);
72 tim_lf_unregister_irq(uintptr_t base, struct plt_intr_handle *handle,
77 vec = msix_offset + TIM_LF_INT_VEC_NRSPERR_INT;
79 /* Clear err interrupt */
80 plt_write64(~0ull, base + TIM_LF_NRSPERR_INT_ENA_W1C);
81 dev_irq_unregister(handle, tim_lf_irq, (void *)base, vec);
83 vec = msix_offset + TIM_LF_INT_VEC_RAS_INT;
85 /* Clear err interrupt */
86 plt_write64(~0ull, base + TIM_LF_RAS_INT_ENA_W1C);
87 dev_irq_unregister(handle, tim_lf_irq, (void *)base, vec);
91 tim_unregister_irq_priv(struct roc_tim *roc_tim, struct plt_intr_handle *handle,
92 uint8_t ring_id, uint16_t msix_offset)
94 struct dev *dev = &roc_sso_to_sso_priv(roc_tim->roc_sso)->dev;
97 if (msix_offset == MSIX_VECTOR_INVALID) {
98 plt_err("Invalid MSIX offset for TIM LF %d", ring_id);
102 base = dev->bar2 + (RVU_BLOCK_ADDR_TIM << 20 | ring_id << 12);
103 tim_lf_unregister_irq(base, handle, msix_offset);