1*14fa93cdSSrikanth Jampala #include <linux/delay.h> 2*14fa93cdSSrikanth Jampala 3*14fa93cdSSrikanth Jampala #include "nitrox_dev.h" 4*14fa93cdSSrikanth Jampala #include "nitrox_csr.h" 5*14fa93cdSSrikanth Jampala 6*14fa93cdSSrikanth Jampala /** 7*14fa93cdSSrikanth Jampala * emu_enable_cores - Enable EMU cluster cores. 8*14fa93cdSSrikanth Jampala * @ndev: N5 device 9*14fa93cdSSrikanth Jampala */ 10*14fa93cdSSrikanth Jampala static void emu_enable_cores(struct nitrox_device *ndev) 11*14fa93cdSSrikanth Jampala { 12*14fa93cdSSrikanth Jampala union emu_se_enable emu_se; 13*14fa93cdSSrikanth Jampala union emu_ae_enable emu_ae; 14*14fa93cdSSrikanth Jampala int i; 15*14fa93cdSSrikanth Jampala 16*14fa93cdSSrikanth Jampala /* AE cores 20 per cluster */ 17*14fa93cdSSrikanth Jampala emu_ae.value = 0; 18*14fa93cdSSrikanth Jampala emu_ae.s.enable = 0xfffff; 19*14fa93cdSSrikanth Jampala 20*14fa93cdSSrikanth Jampala /* SE cores 16 per cluster */ 21*14fa93cdSSrikanth Jampala emu_se.value = 0; 22*14fa93cdSSrikanth Jampala emu_se.s.enable = 0xffff; 23*14fa93cdSSrikanth Jampala 24*14fa93cdSSrikanth Jampala /* enable per cluster cores */ 25*14fa93cdSSrikanth Jampala for (i = 0; i < NR_CLUSTERS; i++) { 26*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, EMU_AE_ENABLEX(i), emu_ae.value); 27*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, EMU_SE_ENABLEX(i), emu_se.value); 28*14fa93cdSSrikanth Jampala } 29*14fa93cdSSrikanth Jampala } 30*14fa93cdSSrikanth Jampala 31*14fa93cdSSrikanth Jampala /** 32*14fa93cdSSrikanth Jampala * nitrox_config_emu_unit - configure EMU unit. 33*14fa93cdSSrikanth Jampala * @ndev: N5 device 34*14fa93cdSSrikanth Jampala */ 35*14fa93cdSSrikanth Jampala void nitrox_config_emu_unit(struct nitrox_device *ndev) 36*14fa93cdSSrikanth Jampala { 37*14fa93cdSSrikanth Jampala union emu_wd_int_ena_w1s emu_wd_int; 38*14fa93cdSSrikanth Jampala union emu_ge_int_ena_w1s emu_ge_int; 39*14fa93cdSSrikanth Jampala u64 offset; 40*14fa93cdSSrikanth Jampala int i; 41*14fa93cdSSrikanth Jampala 42*14fa93cdSSrikanth Jampala /* enable cores */ 43*14fa93cdSSrikanth Jampala emu_enable_cores(ndev); 44*14fa93cdSSrikanth Jampala 45*14fa93cdSSrikanth Jampala /* enable general error and watch dog interrupts */ 46*14fa93cdSSrikanth Jampala emu_ge_int.value = 0; 47*14fa93cdSSrikanth Jampala emu_ge_int.s.se_ge = 0xffff; 48*14fa93cdSSrikanth Jampala emu_ge_int.s.ae_ge = 0xfffff; 49*14fa93cdSSrikanth Jampala emu_wd_int.value = 0; 50*14fa93cdSSrikanth Jampala emu_wd_int.s.se_wd = 1; 51*14fa93cdSSrikanth Jampala 52*14fa93cdSSrikanth Jampala for (i = 0; i < NR_CLUSTERS; i++) { 53*14fa93cdSSrikanth Jampala offset = EMU_WD_INT_ENA_W1SX(i); 54*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, emu_wd_int.value); 55*14fa93cdSSrikanth Jampala offset = EMU_GE_INT_ENA_W1SX(i); 56*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, emu_ge_int.value); 57*14fa93cdSSrikanth Jampala } 58*14fa93cdSSrikanth Jampala } 59*14fa93cdSSrikanth Jampala 60*14fa93cdSSrikanth Jampala static void reset_pkt_input_ring(struct nitrox_device *ndev, int ring) 61*14fa93cdSSrikanth Jampala { 62*14fa93cdSSrikanth Jampala union nps_pkt_in_instr_ctl pkt_in_ctl; 63*14fa93cdSSrikanth Jampala union nps_pkt_in_instr_baoff_dbell pkt_in_dbell; 64*14fa93cdSSrikanth Jampala union nps_pkt_in_done_cnts pkt_in_cnts; 65*14fa93cdSSrikanth Jampala u64 offset; 66*14fa93cdSSrikanth Jampala 67*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INSTR_CTLX(ring); 68*14fa93cdSSrikanth Jampala /* disable the ring */ 69*14fa93cdSSrikanth Jampala pkt_in_ctl.value = nitrox_read_csr(ndev, offset); 70*14fa93cdSSrikanth Jampala pkt_in_ctl.s.enb = 0; 71*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_in_ctl.value); 72*14fa93cdSSrikanth Jampala usleep_range(100, 150); 73*14fa93cdSSrikanth Jampala 74*14fa93cdSSrikanth Jampala /* wait to clear [ENB] */ 75*14fa93cdSSrikanth Jampala do { 76*14fa93cdSSrikanth Jampala pkt_in_ctl.value = nitrox_read_csr(ndev, offset); 77*14fa93cdSSrikanth Jampala } while (pkt_in_ctl.s.enb); 78*14fa93cdSSrikanth Jampala 79*14fa93cdSSrikanth Jampala /* clear off door bell counts */ 80*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INSTR_BAOFF_DBELLX(ring); 81*14fa93cdSSrikanth Jampala pkt_in_dbell.value = 0; 82*14fa93cdSSrikanth Jampala pkt_in_dbell.s.dbell = 0xffffffff; 83*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_in_dbell.value); 84*14fa93cdSSrikanth Jampala 85*14fa93cdSSrikanth Jampala /* clear done counts */ 86*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_DONE_CNTSX(ring); 87*14fa93cdSSrikanth Jampala pkt_in_cnts.value = nitrox_read_csr(ndev, offset); 88*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_in_cnts.value); 89*14fa93cdSSrikanth Jampala usleep_range(50, 100); 90*14fa93cdSSrikanth Jampala } 91*14fa93cdSSrikanth Jampala 92*14fa93cdSSrikanth Jampala void enable_pkt_input_ring(struct nitrox_device *ndev, int ring) 93*14fa93cdSSrikanth Jampala { 94*14fa93cdSSrikanth Jampala union nps_pkt_in_instr_ctl pkt_in_ctl; 95*14fa93cdSSrikanth Jampala u64 offset; 96*14fa93cdSSrikanth Jampala 97*14fa93cdSSrikanth Jampala /* 64-byte instruction size */ 98*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INSTR_CTLX(ring); 99*14fa93cdSSrikanth Jampala pkt_in_ctl.value = nitrox_read_csr(ndev, offset); 100*14fa93cdSSrikanth Jampala pkt_in_ctl.s.is64b = 1; 101*14fa93cdSSrikanth Jampala pkt_in_ctl.s.enb = 1; 102*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_in_ctl.value); 103*14fa93cdSSrikanth Jampala 104*14fa93cdSSrikanth Jampala /* wait for set [ENB] */ 105*14fa93cdSSrikanth Jampala do { 106*14fa93cdSSrikanth Jampala pkt_in_ctl.value = nitrox_read_csr(ndev, offset); 107*14fa93cdSSrikanth Jampala } while (!pkt_in_ctl.s.enb); 108*14fa93cdSSrikanth Jampala } 109*14fa93cdSSrikanth Jampala 110*14fa93cdSSrikanth Jampala /** 111*14fa93cdSSrikanth Jampala * nitrox_config_pkt_input_rings - configure Packet Input Rings 112*14fa93cdSSrikanth Jampala * @ndev: N5 device 113*14fa93cdSSrikanth Jampala */ 114*14fa93cdSSrikanth Jampala void nitrox_config_pkt_input_rings(struct nitrox_device *ndev) 115*14fa93cdSSrikanth Jampala { 116*14fa93cdSSrikanth Jampala int i; 117*14fa93cdSSrikanth Jampala 118*14fa93cdSSrikanth Jampala for (i = 0; i < ndev->nr_queues; i++) { 119*14fa93cdSSrikanth Jampala struct nitrox_cmdq *cmdq = &ndev->pkt_cmdqs[i]; 120*14fa93cdSSrikanth Jampala union nps_pkt_in_instr_rsize pkt_in_rsize; 121*14fa93cdSSrikanth Jampala u64 offset; 122*14fa93cdSSrikanth Jampala 123*14fa93cdSSrikanth Jampala reset_pkt_input_ring(ndev, i); 124*14fa93cdSSrikanth Jampala 125*14fa93cdSSrikanth Jampala /* configure ring base address 16-byte aligned, 126*14fa93cdSSrikanth Jampala * size and interrupt threshold. 127*14fa93cdSSrikanth Jampala */ 128*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INSTR_BADDRX(i); 129*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_IN_INSTR_BADDRX(i), cmdq->dma); 130*14fa93cdSSrikanth Jampala 131*14fa93cdSSrikanth Jampala /* configure ring size */ 132*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INSTR_RSIZEX(i); 133*14fa93cdSSrikanth Jampala pkt_in_rsize.value = 0; 134*14fa93cdSSrikanth Jampala pkt_in_rsize.s.rsize = ndev->qlen; 135*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_in_rsize.value); 136*14fa93cdSSrikanth Jampala 137*14fa93cdSSrikanth Jampala /* set high threshold for pkt input ring interrupts */ 138*14fa93cdSSrikanth Jampala offset = NPS_PKT_IN_INT_LEVELSX(i); 139*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, 0xffffffff); 140*14fa93cdSSrikanth Jampala 141*14fa93cdSSrikanth Jampala enable_pkt_input_ring(ndev, i); 142*14fa93cdSSrikanth Jampala } 143*14fa93cdSSrikanth Jampala } 144*14fa93cdSSrikanth Jampala 145*14fa93cdSSrikanth Jampala static void reset_pkt_solicit_port(struct nitrox_device *ndev, int port) 146*14fa93cdSSrikanth Jampala { 147*14fa93cdSSrikanth Jampala union nps_pkt_slc_ctl pkt_slc_ctl; 148*14fa93cdSSrikanth Jampala union nps_pkt_slc_cnts pkt_slc_cnts; 149*14fa93cdSSrikanth Jampala u64 offset; 150*14fa93cdSSrikanth Jampala 151*14fa93cdSSrikanth Jampala /* disable slc port */ 152*14fa93cdSSrikanth Jampala offset = NPS_PKT_SLC_CTLX(port); 153*14fa93cdSSrikanth Jampala pkt_slc_ctl.value = nitrox_read_csr(ndev, offset); 154*14fa93cdSSrikanth Jampala pkt_slc_ctl.s.enb = 0; 155*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_slc_ctl.value); 156*14fa93cdSSrikanth Jampala usleep_range(100, 150); 157*14fa93cdSSrikanth Jampala 158*14fa93cdSSrikanth Jampala /* wait to clear [ENB] */ 159*14fa93cdSSrikanth Jampala do { 160*14fa93cdSSrikanth Jampala pkt_slc_ctl.value = nitrox_read_csr(ndev, offset); 161*14fa93cdSSrikanth Jampala } while (pkt_slc_ctl.s.enb); 162*14fa93cdSSrikanth Jampala 163*14fa93cdSSrikanth Jampala /* clear slc counters */ 164*14fa93cdSSrikanth Jampala offset = NPS_PKT_SLC_CNTSX(port); 165*14fa93cdSSrikanth Jampala pkt_slc_cnts.value = nitrox_read_csr(ndev, offset); 166*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_slc_cnts.value); 167*14fa93cdSSrikanth Jampala usleep_range(50, 100); 168*14fa93cdSSrikanth Jampala } 169*14fa93cdSSrikanth Jampala 170*14fa93cdSSrikanth Jampala void enable_pkt_solicit_port(struct nitrox_device *ndev, int port) 171*14fa93cdSSrikanth Jampala { 172*14fa93cdSSrikanth Jampala union nps_pkt_slc_ctl pkt_slc_ctl; 173*14fa93cdSSrikanth Jampala u64 offset; 174*14fa93cdSSrikanth Jampala 175*14fa93cdSSrikanth Jampala offset = NPS_PKT_SLC_CTLX(port); 176*14fa93cdSSrikanth Jampala pkt_slc_ctl.value = 0; 177*14fa93cdSSrikanth Jampala pkt_slc_ctl.s.enb = 1; 178*14fa93cdSSrikanth Jampala 179*14fa93cdSSrikanth Jampala /* 180*14fa93cdSSrikanth Jampala * 8 trailing 0x00 bytes will be added 181*14fa93cdSSrikanth Jampala * to the end of the outgoing packet. 182*14fa93cdSSrikanth Jampala */ 183*14fa93cdSSrikanth Jampala pkt_slc_ctl.s.z = 1; 184*14fa93cdSSrikanth Jampala /* enable response header */ 185*14fa93cdSSrikanth Jampala pkt_slc_ctl.s.rh = 1; 186*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_slc_ctl.value); 187*14fa93cdSSrikanth Jampala 188*14fa93cdSSrikanth Jampala /* wait to set [ENB] */ 189*14fa93cdSSrikanth Jampala do { 190*14fa93cdSSrikanth Jampala pkt_slc_ctl.value = nitrox_read_csr(ndev, offset); 191*14fa93cdSSrikanth Jampala } while (!pkt_slc_ctl.s.enb); 192*14fa93cdSSrikanth Jampala } 193*14fa93cdSSrikanth Jampala 194*14fa93cdSSrikanth Jampala static void config_single_pkt_solicit_port(struct nitrox_device *ndev, 195*14fa93cdSSrikanth Jampala int port) 196*14fa93cdSSrikanth Jampala { 197*14fa93cdSSrikanth Jampala union nps_pkt_slc_int_levels pkt_slc_int; 198*14fa93cdSSrikanth Jampala u64 offset; 199*14fa93cdSSrikanth Jampala 200*14fa93cdSSrikanth Jampala reset_pkt_solicit_port(ndev, port); 201*14fa93cdSSrikanth Jampala 202*14fa93cdSSrikanth Jampala offset = NPS_PKT_SLC_INT_LEVELSX(port); 203*14fa93cdSSrikanth Jampala pkt_slc_int.value = 0; 204*14fa93cdSSrikanth Jampala /* time interrupt threshold */ 205*14fa93cdSSrikanth Jampala pkt_slc_int.s.timet = 0x3fffff; 206*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, pkt_slc_int.value); 207*14fa93cdSSrikanth Jampala 208*14fa93cdSSrikanth Jampala enable_pkt_solicit_port(ndev, port); 209*14fa93cdSSrikanth Jampala } 210*14fa93cdSSrikanth Jampala 211*14fa93cdSSrikanth Jampala void nitrox_config_pkt_solicit_ports(struct nitrox_device *ndev) 212*14fa93cdSSrikanth Jampala { 213*14fa93cdSSrikanth Jampala int i; 214*14fa93cdSSrikanth Jampala 215*14fa93cdSSrikanth Jampala for (i = 0; i < ndev->nr_queues; i++) 216*14fa93cdSSrikanth Jampala config_single_pkt_solicit_port(ndev, i); 217*14fa93cdSSrikanth Jampala } 218*14fa93cdSSrikanth Jampala 219*14fa93cdSSrikanth Jampala /** 220*14fa93cdSSrikanth Jampala * enable_nps_interrupts - enable NPS interrutps 221*14fa93cdSSrikanth Jampala * @ndev: N5 device. 222*14fa93cdSSrikanth Jampala * 223*14fa93cdSSrikanth Jampala * This includes NPS core, packet in and slc interrupts. 224*14fa93cdSSrikanth Jampala */ 225*14fa93cdSSrikanth Jampala static void enable_nps_interrupts(struct nitrox_device *ndev) 226*14fa93cdSSrikanth Jampala { 227*14fa93cdSSrikanth Jampala union nps_core_int_ena_w1s core_int; 228*14fa93cdSSrikanth Jampala 229*14fa93cdSSrikanth Jampala /* NPS core interrutps */ 230*14fa93cdSSrikanth Jampala core_int.value = 0; 231*14fa93cdSSrikanth Jampala core_int.s.host_wr_err = 1; 232*14fa93cdSSrikanth Jampala core_int.s.host_wr_timeout = 1; 233*14fa93cdSSrikanth Jampala core_int.s.exec_wr_timeout = 1; 234*14fa93cdSSrikanth Jampala core_int.s.npco_dma_malform = 1; 235*14fa93cdSSrikanth Jampala core_int.s.host_nps_wr_err = 1; 236*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_CORE_INT_ENA_W1S, core_int.value); 237*14fa93cdSSrikanth Jampala 238*14fa93cdSSrikanth Jampala /* NPS packet in ring interrupts */ 239*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_IN_RERR_LO_ENA_W1S, (~0ULL)); 240*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_IN_RERR_HI_ENA_W1S, (~0ULL)); 241*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_IN_ERR_TYPE_ENA_W1S, (~0ULL)); 242*14fa93cdSSrikanth Jampala /* NPS packet slc port interrupts */ 243*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_SLC_RERR_HI_ENA_W1S, (~0ULL)); 244*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_SLC_RERR_LO_ENA_W1S, (~0ULL)); 245*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_PKT_SLC_ERR_TYPE_ENA_W1S, (~0uLL)); 246*14fa93cdSSrikanth Jampala } 247*14fa93cdSSrikanth Jampala 248*14fa93cdSSrikanth Jampala void nitrox_config_nps_unit(struct nitrox_device *ndev) 249*14fa93cdSSrikanth Jampala { 250*14fa93cdSSrikanth Jampala union nps_core_gbl_vfcfg core_gbl_vfcfg; 251*14fa93cdSSrikanth Jampala 252*14fa93cdSSrikanth Jampala /* endian control information */ 253*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_CORE_CONTROL, 1ULL); 254*14fa93cdSSrikanth Jampala 255*14fa93cdSSrikanth Jampala /* disable ILK interface */ 256*14fa93cdSSrikanth Jampala core_gbl_vfcfg.value = 0; 257*14fa93cdSSrikanth Jampala core_gbl_vfcfg.s.ilk_disable = 1; 258*14fa93cdSSrikanth Jampala core_gbl_vfcfg.s.cfg = PF_MODE; 259*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, NPS_CORE_GBL_VFCFG, core_gbl_vfcfg.value); 260*14fa93cdSSrikanth Jampala /* config input and solicit ports */ 261*14fa93cdSSrikanth Jampala nitrox_config_pkt_input_rings(ndev); 262*14fa93cdSSrikanth Jampala nitrox_config_pkt_solicit_ports(ndev); 263*14fa93cdSSrikanth Jampala 264*14fa93cdSSrikanth Jampala /* enable interrupts */ 265*14fa93cdSSrikanth Jampala enable_nps_interrupts(ndev); 266*14fa93cdSSrikanth Jampala } 267*14fa93cdSSrikanth Jampala 268*14fa93cdSSrikanth Jampala void nitrox_config_pom_unit(struct nitrox_device *ndev) 269*14fa93cdSSrikanth Jampala { 270*14fa93cdSSrikanth Jampala union pom_int_ena_w1s pom_int; 271*14fa93cdSSrikanth Jampala int i; 272*14fa93cdSSrikanth Jampala 273*14fa93cdSSrikanth Jampala /* enable pom interrupts */ 274*14fa93cdSSrikanth Jampala pom_int.value = 0; 275*14fa93cdSSrikanth Jampala pom_int.s.illegal_dport = 1; 276*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, POM_INT_ENA_W1S, pom_int.value); 277*14fa93cdSSrikanth Jampala 278*14fa93cdSSrikanth Jampala /* enable perf counters */ 279*14fa93cdSSrikanth Jampala for (i = 0; i < ndev->hw.se_cores; i++) 280*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, POM_PERF_CTL, BIT_ULL(i)); 281*14fa93cdSSrikanth Jampala } 282*14fa93cdSSrikanth Jampala 283*14fa93cdSSrikanth Jampala /** 284*14fa93cdSSrikanth Jampala * nitrox_config_rand_unit - enable N5 random number unit 285*14fa93cdSSrikanth Jampala * @ndev: N5 device 286*14fa93cdSSrikanth Jampala */ 287*14fa93cdSSrikanth Jampala void nitrox_config_rand_unit(struct nitrox_device *ndev) 288*14fa93cdSSrikanth Jampala { 289*14fa93cdSSrikanth Jampala union efl_rnm_ctl_status efl_rnm_ctl; 290*14fa93cdSSrikanth Jampala u64 offset; 291*14fa93cdSSrikanth Jampala 292*14fa93cdSSrikanth Jampala offset = EFL_RNM_CTL_STATUS; 293*14fa93cdSSrikanth Jampala efl_rnm_ctl.value = nitrox_read_csr(ndev, offset); 294*14fa93cdSSrikanth Jampala efl_rnm_ctl.s.ent_en = 1; 295*14fa93cdSSrikanth Jampala efl_rnm_ctl.s.rng_en = 1; 296*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, efl_rnm_ctl.value); 297*14fa93cdSSrikanth Jampala } 298*14fa93cdSSrikanth Jampala 299*14fa93cdSSrikanth Jampala void nitrox_config_efl_unit(struct nitrox_device *ndev) 300*14fa93cdSSrikanth Jampala { 301*14fa93cdSSrikanth Jampala int i; 302*14fa93cdSSrikanth Jampala 303*14fa93cdSSrikanth Jampala for (i = 0; i < NR_CLUSTERS; i++) { 304*14fa93cdSSrikanth Jampala union efl_core_int_ena_w1s efl_core_int; 305*14fa93cdSSrikanth Jampala u64 offset; 306*14fa93cdSSrikanth Jampala 307*14fa93cdSSrikanth Jampala /* EFL core interrupts */ 308*14fa93cdSSrikanth Jampala offset = EFL_CORE_INT_ENA_W1SX(i); 309*14fa93cdSSrikanth Jampala efl_core_int.value = 0; 310*14fa93cdSSrikanth Jampala efl_core_int.s.len_ovr = 1; 311*14fa93cdSSrikanth Jampala efl_core_int.s.d_left = 1; 312*14fa93cdSSrikanth Jampala efl_core_int.s.epci_decode_err = 1; 313*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, efl_core_int.value); 314*14fa93cdSSrikanth Jampala 315*14fa93cdSSrikanth Jampala offset = EFL_CORE_VF_ERR_INT0_ENA_W1SX(i); 316*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 317*14fa93cdSSrikanth Jampala offset = EFL_CORE_VF_ERR_INT1_ENA_W1SX(i); 318*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 319*14fa93cdSSrikanth Jampala } 320*14fa93cdSSrikanth Jampala } 321*14fa93cdSSrikanth Jampala 322*14fa93cdSSrikanth Jampala void nitrox_config_bmi_unit(struct nitrox_device *ndev) 323*14fa93cdSSrikanth Jampala { 324*14fa93cdSSrikanth Jampala union bmi_ctl bmi_ctl; 325*14fa93cdSSrikanth Jampala union bmi_int_ena_w1s bmi_int_ena; 326*14fa93cdSSrikanth Jampala u64 offset; 327*14fa93cdSSrikanth Jampala 328*14fa93cdSSrikanth Jampala /* no threshold limits for PCIe */ 329*14fa93cdSSrikanth Jampala offset = BMI_CTL; 330*14fa93cdSSrikanth Jampala bmi_ctl.value = nitrox_read_csr(ndev, offset); 331*14fa93cdSSrikanth Jampala bmi_ctl.s.max_pkt_len = 0xff; 332*14fa93cdSSrikanth Jampala bmi_ctl.s.nps_free_thrsh = 0xff; 333*14fa93cdSSrikanth Jampala bmi_ctl.s.nps_hdrq_thrsh = 0x7a; 334*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, bmi_ctl.value); 335*14fa93cdSSrikanth Jampala 336*14fa93cdSSrikanth Jampala /* enable interrupts */ 337*14fa93cdSSrikanth Jampala offset = BMI_INT_ENA_W1S; 338*14fa93cdSSrikanth Jampala bmi_int_ena.value = 0; 339*14fa93cdSSrikanth Jampala bmi_int_ena.s.max_len_err_nps = 1; 340*14fa93cdSSrikanth Jampala bmi_int_ena.s.pkt_rcv_err_nps = 1; 341*14fa93cdSSrikanth Jampala bmi_int_ena.s.fpf_undrrn = 1; 342*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, bmi_int_ena.value); 343*14fa93cdSSrikanth Jampala } 344*14fa93cdSSrikanth Jampala 345*14fa93cdSSrikanth Jampala void nitrox_config_bmo_unit(struct nitrox_device *ndev) 346*14fa93cdSSrikanth Jampala { 347*14fa93cdSSrikanth Jampala union bmo_ctl2 bmo_ctl2; 348*14fa93cdSSrikanth Jampala u64 offset; 349*14fa93cdSSrikanth Jampala 350*14fa93cdSSrikanth Jampala /* no threshold limits for PCIe */ 351*14fa93cdSSrikanth Jampala offset = BMO_CTL2; 352*14fa93cdSSrikanth Jampala bmo_ctl2.value = nitrox_read_csr(ndev, offset); 353*14fa93cdSSrikanth Jampala bmo_ctl2.s.nps_slc_buf_thrsh = 0xff; 354*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, bmo_ctl2.value); 355*14fa93cdSSrikanth Jampala } 356*14fa93cdSSrikanth Jampala 357*14fa93cdSSrikanth Jampala void invalidate_lbc(struct nitrox_device *ndev) 358*14fa93cdSSrikanth Jampala { 359*14fa93cdSSrikanth Jampala union lbc_inval_ctl lbc_ctl; 360*14fa93cdSSrikanth Jampala union lbc_inval_status lbc_stat; 361*14fa93cdSSrikanth Jampala u64 offset; 362*14fa93cdSSrikanth Jampala 363*14fa93cdSSrikanth Jampala /* invalidate LBC */ 364*14fa93cdSSrikanth Jampala offset = LBC_INVAL_CTL; 365*14fa93cdSSrikanth Jampala lbc_ctl.value = nitrox_read_csr(ndev, offset); 366*14fa93cdSSrikanth Jampala lbc_ctl.s.cam_inval_start = 1; 367*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, lbc_ctl.value); 368*14fa93cdSSrikanth Jampala 369*14fa93cdSSrikanth Jampala offset = LBC_INVAL_STATUS; 370*14fa93cdSSrikanth Jampala 371*14fa93cdSSrikanth Jampala do { 372*14fa93cdSSrikanth Jampala lbc_stat.value = nitrox_read_csr(ndev, offset); 373*14fa93cdSSrikanth Jampala } while (!lbc_stat.s.done); 374*14fa93cdSSrikanth Jampala } 375*14fa93cdSSrikanth Jampala 376*14fa93cdSSrikanth Jampala void nitrox_config_lbc_unit(struct nitrox_device *ndev) 377*14fa93cdSSrikanth Jampala { 378*14fa93cdSSrikanth Jampala union lbc_int_ena_w1s lbc_int_ena; 379*14fa93cdSSrikanth Jampala u64 offset; 380*14fa93cdSSrikanth Jampala 381*14fa93cdSSrikanth Jampala invalidate_lbc(ndev); 382*14fa93cdSSrikanth Jampala 383*14fa93cdSSrikanth Jampala /* enable interrupts */ 384*14fa93cdSSrikanth Jampala offset = LBC_INT_ENA_W1S; 385*14fa93cdSSrikanth Jampala lbc_int_ena.value = 0; 386*14fa93cdSSrikanth Jampala lbc_int_ena.s.dma_rd_err = 1; 387*14fa93cdSSrikanth Jampala lbc_int_ena.s.over_fetch_err = 1; 388*14fa93cdSSrikanth Jampala lbc_int_ena.s.cam_inval_abort = 1; 389*14fa93cdSSrikanth Jampala lbc_int_ena.s.cam_hard_err = 1; 390*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, lbc_int_ena.value); 391*14fa93cdSSrikanth Jampala 392*14fa93cdSSrikanth Jampala offset = LBC_PLM_VF1_64_INT_ENA_W1S; 393*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 394*14fa93cdSSrikanth Jampala offset = LBC_PLM_VF65_128_INT_ENA_W1S; 395*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 396*14fa93cdSSrikanth Jampala 397*14fa93cdSSrikanth Jampala offset = LBC_ELM_VF1_64_INT_ENA_W1S; 398*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 399*14fa93cdSSrikanth Jampala offset = LBC_ELM_VF65_128_INT_ENA_W1S; 400*14fa93cdSSrikanth Jampala nitrox_write_csr(ndev, offset, (~0ULL)); 401*14fa93cdSSrikanth Jampala } 402