Lines Matching refs:ppe_common
58 hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common) in hns_ppe_common_get_ioaddr() argument
60 return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; in hns_ppe_common_get_ioaddr()
71 struct ppe_common_cb *ppe_common; in hns_ppe_common_get_cfg() local
79 ppe_common = devm_kzalloc(dsaf_dev->dev, in hns_ppe_common_get_cfg()
80 struct_size(ppe_common, ppe_cb, ppe_num), in hns_ppe_common_get_cfg()
82 if (!ppe_common) in hns_ppe_common_get_cfg()
85 ppe_common->ppe_num = ppe_num; in hns_ppe_common_get_cfg()
86 ppe_common->dsaf_dev = dsaf_dev; in hns_ppe_common_get_cfg()
87 ppe_common->comm_index = comm_index; in hns_ppe_common_get_cfg()
89 ppe_common->ppe_mode = PPE_COMMON_MODE_SERVICE; in hns_ppe_common_get_cfg()
91 ppe_common->ppe_mode = PPE_COMMON_MODE_DEBUG; in hns_ppe_common_get_cfg()
92 ppe_common->dev = dsaf_dev->dev; in hns_ppe_common_get_cfg()
94 ppe_common->io_base = hns_ppe_common_get_ioaddr(ppe_common); in hns_ppe_common_get_cfg()
96 dsaf_dev->ppe_common[comm_index] = ppe_common; in hns_ppe_common_get_cfg()
104 dsaf_dev->ppe_common[comm_index] = NULL; in hns_ppe_common_free_cfg()
107 static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common, in hns_ppe_get_iobase() argument
110 return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; in hns_ppe_get_iobase()
113 static void hns_ppe_get_cfg(struct ppe_common_cb *ppe_common) in hns_ppe_get_cfg() argument
117 u32 ppe_num = ppe_common->ppe_num; in hns_ppe_get_cfg()
120 ppe_cb = &ppe_common->ppe_cb[i]; in hns_ppe_get_cfg()
121 ppe_cb->dev = ppe_common->dev; in hns_ppe_get_cfg()
123 ppe_cb->ppe_common_cb = ppe_common; in hns_ppe_get_cfg()
125 ppe_cb->io_base = hns_ppe_get_iobase(ppe_common, i); in hns_ppe_get_cfg()
152 static void hns_ppe_set_qid_mode(struct ppe_common_cb *ppe_common, in hns_ppe_set_qid_mode() argument
155 dsaf_set_dev_field(ppe_common, PPE_COM_CFG_QID_MODE_REG, in hns_ppe_set_qid_mode()
165 static void hns_ppe_set_qid(struct ppe_common_cb *ppe_common, u32 qid) in hns_ppe_set_qid() argument
167 u32 qid_mod = dsaf_read_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG); in hns_ppe_set_qid()
173 dsaf_write_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG, qid_mod); in hns_ppe_set_qid()
194 static int hns_ppe_common_init_hw(struct ppe_common_cb *ppe_common) in hns_ppe_common_init_hw() argument
197 struct dsaf_device *dsaf_dev = ppe_common->dsaf_dev; in hns_ppe_common_init_hw()
205 if (ppe_common->ppe_mode == PPE_COMMON_MODE_SERVICE) { in hns_ppe_common_init_hw()
210 hns_ppe_set_qid(ppe_common, 0); in hns_ppe_common_init_hw()
239 dev_err(ppe_common->dev, in hns_ppe_common_init_hw()
244 hns_ppe_set_qid_mode(ppe_common, qid_mode); in hns_ppe_common_init_hw()
247 dsaf_set_dev_bit(ppe_common, PPE_COM_COMMON_CNT_CLR_CE_REG, in hns_ppe_common_init_hw()
358 static void hns_ppe_uninit_ex(struct ppe_common_cb *ppe_common) in hns_ppe_uninit_ex() argument
362 for (i = 0; i < ppe_common->ppe_num; i++) { in hns_ppe_uninit_ex()
363 if (ppe_common->dsaf_dev->mac_cb[i]) in hns_ppe_uninit_ex()
364 hns_ppe_uninit_hw(&ppe_common->ppe_cb[i]); in hns_ppe_uninit_ex()
365 memset(&ppe_common->ppe_cb[i], 0, sizeof(struct hns_ppe_cb)); in hns_ppe_uninit_ex()
374 if (dsaf_dev->ppe_common[i]) in hns_ppe_uninit()
375 hns_ppe_uninit_ex(dsaf_dev->ppe_common[i]); in hns_ppe_uninit()
391 struct ppe_common_cb *ppe_common; in hns_ppe_reset_common() local
393 ppe_common = dsaf_dev->ppe_common[ppe_common_index]; in hns_ppe_reset_common()
394 ret = hns_ppe_common_init_hw(ppe_common); in hns_ppe_reset_common()
398 for (i = 0; i < ppe_common->ppe_num; i++) { in hns_ppe_reset_common()
401 hns_ppe_init_hw(&ppe_common->ppe_cb[i]); in hns_ppe_reset_common()
519 hns_ppe_get_cfg(dsaf_dev->ppe_common[i]); in hns_ppe_init()
542 struct ppe_common_cb *ppe_common = ppe_cb->ppe_common_cb; in hns_ppe_get_regs() local
548 regs[0] = dsaf_read_dev(ppe_common, PPE_COM_CFG_QID_MODE_REG); in hns_ppe_get_regs()
549 regs[1] = dsaf_read_dev(ppe_common, PPE_COM_INTEN_REG); in hns_ppe_get_regs()
550 regs[2] = dsaf_read_dev(ppe_common, PPE_COM_RINT_REG); in hns_ppe_get_regs()
551 regs[3] = dsaf_read_dev(ppe_common, PPE_COM_INTSTS_REG); in hns_ppe_get_regs()
552 regs[4] = dsaf_read_dev(ppe_common, PPE_COM_COMMON_CNT_CLR_CE_REG); in hns_ppe_get_regs()
556 regs[5 + i] = dsaf_read_dev(ppe_common, offset); in hns_ppe_get_regs()
559 = dsaf_read_dev(ppe_common, offset); in hns_ppe_get_regs()
562 = dsaf_read_dev(ppe_common, offset); in hns_ppe_get_regs()
565 = dsaf_read_dev(ppe_common, offset); in hns_ppe_get_regs()