summaryrefslogtreecommitdiff
path: root/include/pfe_eth/pfe_driver.h
blob: 28997b4ae9daebd37125a4e2070fb7947c23406c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright 2015-2016 Freescale Semiconductor, Inc.
 * Copyright 2017 NXP
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __PFE_DRIVER_H__
#define __PFE_DRIVER_H__

#include "pfe/pfe.h"

#define HIF_RX_DESC_NT		64
#define	HIF_TX_DESC_NT		64

#define RX_BD_BASEADDR		(HIF_DESC_BASEADDR)
#define TX_BD_BASEADDR		(HIF_DESC_BASEADDR + HIF_TX_DESC_SIZE)

#define MIN_PKT_SIZE		56
#define MAX_FRAME_SIZE		2048

struct __packed hif_header_s {
	u8	port_no; /* Carries input port no for host rx packets and
			  * output port no for tx pkts
			  */
	u8 reserved0;
	u32 reserved2;
};

struct __packed buf_desc {
	u32 ctrl;
	u32 status;
	u32 data;
	u32 next;
};

struct rx_desc_s {
	struct buf_desc *rx_base;
	unsigned int rx_base_pa;
	int rx_to_read;
	int rx_ring_size;
};

struct tx_desc_s {
	struct buf_desc *tx_base;
	unsigned int tx_base_pa;
	int tx_to_send;
	int tx_ring_size;
};

int pfe_send(int phy_port, void *data, int length);
int pfe_recv(unsigned int *pkt_ptr, int *phy_port);
int pfe_tx_done(void);

#endif