Searched refs:npe (Results 1 - 5 of 5) sorted by relevance

/linux-4.4.14/arch/arm/mach-ixp4xx/include/mach/
H A Dnpe.h17 struct npe { struct
26 static inline const char *npe_name(struct npe *npe) npe_name() argument
28 return npe_names[npe->id]; npe_name()
31 int npe_running(struct npe *npe);
32 int npe_send_message(struct npe *npe, const void *msg, const char *what);
33 int npe_recv_message(struct npe *npe, void *msg, const char *what);
34 int npe_send_recv_message(struct npe *npe, void *msg, const char *what);
35 int npe_load_firmware(struct npe *npe, const char *name, struct device *dev);
36 struct npe *npe_request(unsigned id);
37 void npe_release(struct npe *npe);
/linux-4.4.14/arch/arm/mach-ixp4xx/
H A Dixp4xx_npe.c23 #include <mach/npe.h>
125 #define print_npe(pri, npe, fmt, ...) \
126 printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__)
129 #define debug_msg(npe, fmt, ...) \
130 print_npe(KERN_DEBUG, npe, fmt, ## __VA_ARGS__)
132 #define debug_msg(npe, fmt, ...)
153 static struct npe npe_tab[NPE_COUNT] = {
169 int npe_running(struct npe *npe) npe_running() argument
171 return (__raw_readl(&npe->regs->exec_status_cmd) & STAT_RUN) != 0; npe_running()
174 static void npe_cmd_write(struct npe *npe, u32 addr, int cmd, u32 data) npe_cmd_write() argument
176 __raw_writel(data, &npe->regs->exec_data); npe_cmd_write()
177 __raw_writel(addr, &npe->regs->exec_addr); npe_cmd_write()
178 __raw_writel(cmd, &npe->regs->exec_status_cmd); npe_cmd_write()
181 static u32 npe_cmd_read(struct npe *npe, u32 addr, int cmd) npe_cmd_read() argument
183 __raw_writel(addr, &npe->regs->exec_addr); npe_cmd_read()
184 __raw_writel(cmd, &npe->regs->exec_status_cmd); npe_cmd_read()
188 __raw_readl(&npe->regs->exec_data); npe_cmd_read()
189 __raw_readl(&npe->regs->exec_data); npe_cmd_read()
190 return __raw_readl(&npe->regs->exec_data); npe_cmd_read()
193 static void npe_clear_active(struct npe *npe, u32 reg) npe_clear_active() argument
195 u32 val = npe_cmd_read(npe, reg, CMD_RD_ECS_REG); npe_clear_active()
196 npe_cmd_write(npe, reg, CMD_WR_ECS_REG, val & ~ECS_REG_0_ACTIVE); npe_clear_active()
199 static void npe_start(struct npe *npe) npe_start() argument
202 npe_clear_active(npe, ECS_PRI_1_CTXT_REG_0); npe_start()
203 npe_clear_active(npe, ECS_PRI_2_CTXT_REG_0); npe_start()
204 npe_clear_active(npe, ECS_DBG_CTXT_REG_0); npe_start()
206 __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); npe_start()
207 __raw_writel(CMD_NPE_START, &npe->regs->exec_status_cmd); npe_start()
210 static void npe_stop(struct npe *npe) npe_stop() argument
212 __raw_writel(CMD_NPE_STOP, &npe->regs->exec_status_cmd); npe_stop()
213 __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); /*FIXME?*/ npe_stop()
216 static int __must_check npe_debug_instr(struct npe *npe, u32 instr, u32 ctx, npe_debug_instr() argument
223 npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, npe_debug_instr()
231 npe_cmd_write(npe, ECS_DBG_CTXT_REG_1, CMD_WR_ECS_REG, npe_debug_instr()
236 __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); npe_debug_instr()
239 npe_cmd_write(npe, ECS_INSTRUCT_REG, CMD_WR_ECS_REG, instr); npe_debug_instr()
243 wc = __raw_readl(&npe->regs->watch_count); npe_debug_instr()
246 __raw_writel(CMD_NPE_STEP, &npe->regs->exec_status_cmd); npe_debug_instr()
250 if (wc != __raw_readl(&npe->regs->watch_count)) npe_debug_instr()
255 print_npe(KERN_ERR, npe, "reset: npe_debug_instr(): timeout\n"); npe_debug_instr()
259 static int __must_check npe_logical_reg_write8(struct npe *npe, u32 addr, npe_logical_reg_write8() argument
267 return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ npe_logical_reg_write8()
270 static int __must_check npe_logical_reg_write16(struct npe *npe, u32 addr, npe_logical_reg_write16() argument
278 return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ npe_logical_reg_write16()
281 static int __must_check npe_logical_reg_write32(struct npe *npe, u32 addr, npe_logical_reg_write32() argument
285 if (npe_logical_reg_write16(npe, addr, val >> 16, ctx)) npe_logical_reg_write32()
287 return npe_logical_reg_write16(npe, addr + 2, val & 0xFFFF, ctx); npe_logical_reg_write32()
290 static int npe_reset(struct npe *npe) npe_reset() argument
295 ctl = (__raw_readl(&npe->regs->messaging_control) | 0x3F000000) & npe_reset()
299 __raw_writel(ctl & 0x3F00FFFF, &npe->regs->messaging_control); npe_reset()
303 exec_count = __raw_readl(&npe->regs->exec_count); npe_reset()
304 __raw_writel(0, &npe->regs->exec_count); npe_reset()
307 ctx_reg2 = npe_cmd_read(npe, ECS_DBG_CTXT_REG_2, CMD_RD_ECS_REG); npe_reset()
308 npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2 | npe_reset()
312 while (__raw_readl(&npe->regs->watchpoint_fifo) & WFIFO_VALID) npe_reset()
314 while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) npe_reset()
316 print_npe(KERN_DEBUG, npe, "npe_reset: read FIFO = 0x%X\n", npe_reset()
317 __raw_readl(&npe->regs->in_out_fifo)); npe_reset()
319 while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) npe_reset()
322 if (npe_debug_instr(npe, INSTR_RD_FIFO, 0, 0)) npe_reset()
326 __raw_writel(RESET_MBOX_STAT, &npe->regs->mailbox_status); npe_reset()
328 if (npe_debug_instr(npe, INSTR_RESET_MBOX, 0, 0)) npe_reset()
333 if (npe_logical_reg_write16(npe, NPE_REGMAP, val >> 1, 0)) npe_reset()
336 if (npe_logical_reg_write32(npe, (val & 1) * 4, 0, 0)) npe_reset()
344 val = npe_cmd_read(npe, ECS_BG_CTXT_REG_0, CMD_RD_ECS_REG); npe_reset()
347 npe_cmd_write(npe, ECS_BG_CTXT_REG_0, CMD_WR_ECS_REG, val); npe_reset()
352 if (npe_logical_reg_write8(npe, NPE_STEVT, 0x80, i)) npe_reset()
354 if (npe_logical_reg_write16(npe, NPE_STARTPC, 0, i)) npe_reset()
358 if (npe_logical_reg_write16(npe, NPE_REGMAP, 0x820, i)) npe_reset()
360 if (npe_logical_reg_write8(npe, NPE_CINDEX, 0, i)) npe_reset()
366 npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, 0); npe_reset()
368 __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); npe_reset()
370 __raw_writel(exec_count, &npe->regs->exec_count); npe_reset()
371 npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2); npe_reset()
375 npe_cmd_write(npe, ecs_reset[val].reg, CMD_WR_ECS_REG, npe_reset()
379 __raw_writel(CMD_CLR_PROFILE_CNT, &npe->regs->exec_status_cmd); npe_reset()
381 __raw_writel(0, &npe->regs->exec_count); npe_reset()
382 __raw_writel(0, &npe->regs->action_points[0]); npe_reset()
383 __raw_writel(0, &npe->regs->action_points[1]); npe_reset()
384 __raw_writel(0, &npe->regs->action_points[2]); npe_reset()
385 __raw_writel(0, &npe->regs->action_points[3]); npe_reset()
386 __raw_writel(0, &npe->regs->watch_count); npe_reset()
391 ~(IXP4XX_FEATURE_RESET_NPEA << npe->id)); npe_reset()
394 (IXP4XX_FEATURE_RESET_NPEA << npe->id)); npe_reset()
397 (IXP4XX_FEATURE_RESET_NPEA << npe->id)) npe_reset()
404 npe_stop(npe); npe_reset()
407 __raw_writel(ctl, &npe->regs->messaging_control); npe_reset()
412 int npe_send_message(struct npe *npe, const void *msg, const char *what) npe_send_message() argument
417 debug_msg(npe, "Trying to send message %s [%08X:%08X]\n", npe_send_message()
420 if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) { npe_send_message()
421 debug_msg(npe, "NPE input FIFO not empty\n"); npe_send_message()
425 __raw_writel(send[0], &npe->regs->in_out_fifo); npe_send_message()
427 if (!(__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNF)) { npe_send_message()
428 debug_msg(npe, "NPE input FIFO full\n"); npe_send_message()
432 __raw_writel(send[1], &npe->regs->in_out_fifo); npe_send_message()
435 (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE)) { npe_send_message()
441 debug_msg(npe, "Timeout sending message\n"); npe_send_message()
446 debug_msg(npe, "Sending a message took %i cycles\n", cycles); npe_send_message()
451 int npe_recv_message(struct npe *npe, void *msg, const char *what) npe_recv_message() argument
456 debug_msg(npe, "Trying to receive message %s\n", what); npe_recv_message()
459 if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) { npe_recv_message()
460 recv[cnt++] = __raw_readl(&npe->regs->in_out_fifo); npe_recv_message()
471 debug_msg(npe, "Received [%08X]\n", recv[0]); npe_recv_message()
474 debug_msg(npe, "Received [%08X:%08X]\n", recv[0], recv[1]); npe_recv_message()
479 debug_msg(npe, "Timeout waiting for message\n"); npe_recv_message()
484 debug_msg(npe, "Receiving a message took %i cycles\n", cycles); npe_recv_message()
489 int npe_send_recv_message(struct npe *npe, void *msg, const char *what) npe_send_recv_message() argument
494 if ((result = npe_send_message(npe, msg, what)) != 0) npe_send_recv_message()
496 if ((result = npe_recv_message(npe, recv, what)) != 0) npe_send_recv_message()
500 debug_msg(npe, "Message %s: unexpected message received\n", npe_send_recv_message()
508 int npe_load_firmware(struct npe *npe, const char *name, struct device *dev) npe_load_firmware() argument
541 print_npe(KERN_ERR, npe, "incomplete firmware file\n"); npe_load_firmware()
547 print_npe(KERN_DEBUG, npe, "firmware: %08X %08X %08X (0x%X bytes)\n", npe_load_firmware()
555 print_npe(KERN_ERR, npe, "bad firmware file magic: 0x%X\n", npe_load_firmware()
560 print_npe(KERN_ERR, npe, npe_load_firmware()
564 if (((image->id >> 24) & 0xF /* NPE ID */) != npe->id) { npe_load_firmware()
565 print_npe(KERN_ERR, npe, "firmware file NPE ID mismatch\n"); npe_load_firmware()
573 print_npe(KERN_INFO, npe, "IXP43x/IXP46x firmware ignored on " npe_load_firmware()
578 if (npe_running(npe)) { npe_load_firmware()
579 print_npe(KERN_INFO, npe, "unable to load firmware, NPE is " npe_load_firmware()
585 npe_stop(npe); npe_load_firmware()
586 npe_reset(npe); npe_load_firmware()
589 print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " npe_load_firmware()
594 if (!npe->id) npe_load_firmware()
609 print_npe(KERN_INFO, npe, "firmware EOF block marker not " npe_load_firmware()
615 print_npe(KERN_DEBUG, npe, "%i firmware blocks found\n", blocks); npe_load_firmware()
622 print_npe(KERN_INFO, npe, "invalid offset 0x%X of " npe_load_firmware()
637 print_npe(KERN_INFO, npe, "invalid firmware block #%i " npe_load_firmware()
642 print_npe(KERN_INFO, npe, "firmware block #%i doesn't " npe_load_firmware()
651 npe_cmd_write(npe, cb->npe_addr + j, cmd, cb->data[j]); npe_load_firmware()
654 npe_start(npe); npe_load_firmware()
655 if (!npe_running(npe)) npe_load_firmware()
656 print_npe(KERN_ERR, npe, "unable to start\n"); npe_load_firmware()
661 print_npe(KERN_INFO, npe, "firmware block #%i doesn't fit in NPE " npe_load_firmware()
671 struct npe *npe_request(unsigned id) npe_request()
680 void npe_release(struct npe *npe) npe_release() argument
692 struct npe *npe = &npe_tab[i]; npe_init_module() local
696 if (!(npe->mem_res = request_mem_region(npe->regs_phys, npe_init_module()
698 npe_name(npe)))) { npe_init_module()
699 print_npe(KERN_ERR, npe, npe_init_module()
704 if (npe_reset(npe)) npe_init_module()
706 npe->valid = 1; npe_init_module()
/linux-4.4.14/drivers/net/ethernet/xscale/
H A Dixp4xx_eth.c40 #include <mach/npe.h>
171 struct npe *npe; member in struct:port
1204 struct npe *npe = port->npe; eth_open() local
1208 if (!npe_running(npe)) { eth_open()
1209 err = npe_load_firmware(npe, npe_name(npe), &dev->dev); eth_open()
1213 if (npe_recv_message(npe, &msg, "ETH_GET_STATUS")) { eth_open()
1215 npe_name(npe)); eth_open()
1231 if (npe_send_recv_message(port->npe, &msg, "ETH_SET_RXQ")) eth_open()
1243 if (npe_send_recv_message(port->npe, &msg, "ETH_SET_MAC")) eth_open()
1249 if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) eth_open()
1326 if (npe_send_recv_message(port->npe, &msg, "ETH_ENABLE_LOOPBACK")) eth_close()
1379 if (npe_send_recv_message(port->npe, &msg, "ETH_DISABLE_LOOPBACK")) eth_close()
1444 if (!(port->npe = npe_request(NPE_ID(port->id)))) { eth_init_one()
1482 npe_name(port->npe)); eth_init_one()
1492 npe_release(port->npe); eth_init_one()
1506 npe_release(port->npe); eth_remove_one()
/linux-4.4.14/drivers/net/wan/
H A Dixp4xx_hss.c25 #include <mach/npe.h>
258 struct npe *npe; member in struct:port
363 if (npe_send_message(port->npe, msg, what)) { hss_npe_send()
365 port->id, val[0], val[1], npe_name(port->npe)); hss_npe_send()
449 if (npe_recv_message(port->npe, &msg, "HSS_LOAD_CONFIG") || hss_config()
457 npe_recv_message(port->npe, &msg, "FLUSH_IT"); hss_config()
480 if (npe_recv_message(port->npe, &msg, "PORT_ERROR_READ")) { hss_get_status()
518 if (!npe_running(port->npe) && hss_load_firmware()
519 (err = npe_load_firmware(port->npe, npe_name(port->npe), hss_load_firmware()
1339 if ((port->npe = npe_request(0)) == NULL) { hss_init_one()
1374 npe_release(port->npe); hss_init_one()
1386 npe_release(port->npe); hss_remove_one()
/linux-4.4.14/drivers/crypto/
H A Dixp4xx_crypto.c32 #include <mach/npe.h>
222 static struct npe *npe_c;

Completed in 179 milliseconds