Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Calvin Johnson | cf4c344 | 2018-03-08 15:30:27 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2015-2016 Freescale Semiconductor, Inc. |
| 4 | * Copyright 2017 NXP |
Calvin Johnson | cf4c344 | 2018-03-08 15:30:27 +0530 | [diff] [blame] | 5 | */ |
| 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 | |
| 22 | struct __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 | |
| 30 | struct __packed buf_desc { |
| 31 | u32 ctrl; |
| 32 | u32 status; |
| 33 | u32 data; |
| 34 | u32 next; |
| 35 | }; |
| 36 | |
| 37 | struct 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 | |
| 44 | struct 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 | |
| 51 | int pfe_send(int phy_port, void *data, int length); |
| 52 | int pfe_recv(uchar **pkt_ptr, int *phy_port); |
| 53 | int pfe_tx_done(void); |
| 54 | int pfe_eth_free_pkt(struct udevice *dev, uchar *packet, int length); |
| 55 | int pfe_drv_init(struct pfe_ddr_address *pfe_addr); |
| 56 | int pfe_eth_remove(struct udevice *dev); |
| 57 | |
| 58 | #endif |