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