1 /*
2  * Copyright 2015-2016 Freescale Semiconductor, Inc.
3  * Copyright 2017 NXP
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __PFE_DRIVER_H__
9 #define __PFE_DRIVER_H__
10 
11 #include <net/pfe_eth/pfe/pfe_hw.h>
12 #include <dm/platform_data/pfe_dm_eth.h>
13 
14 #define HIF_RX_DESC_NT		64
15 #define	HIF_TX_DESC_NT		64
16 
17 #define RX_BD_BASEADDR		(HIF_DESC_BASEADDR)
18 #define TX_BD_BASEADDR		(HIF_DESC_BASEADDR + HIF_TX_DESC_SIZE)
19 
20 #define MIN_PKT_SIZE		56
21 #define MAX_FRAME_SIZE		2048
22 
23 struct __packed hif_header_s {
24 	u8	port_no; /* Carries input port no for host rx packets and
25 			  * output port no for tx pkts
26 			  */
27 	u8 reserved0;
28 	u32 reserved2;
29 };
30 
31 struct __packed buf_desc {
32 	u32 ctrl;
33 	u32 status;
34 	u32 data;
35 	u32 next;
36 };
37 
38 struct rx_desc_s {
39 	struct buf_desc *rx_base;
40 	unsigned int rx_base_pa;
41 	int rx_to_read;
42 	int rx_ring_size;
43 };
44 
45 struct tx_desc_s {
46 	struct buf_desc *tx_base;
47 	unsigned int tx_base_pa;
48 	int tx_to_send;
49 	int tx_ring_size;
50 };
51 
52 int pfe_send(int phy_port, void *data, int length);
53 int pfe_recv(uchar **pkt_ptr, int *phy_port);
54 int pfe_tx_done(void);
55 int pfe_eth_free_pkt(struct udevice *dev, uchar *packet, int length);
56 int pfe_drv_init(struct pfe_ddr_address  *pfe_addr);
57 int pfe_eth_remove(struct udevice *dev);
58 
59 #endif
60