linux/drivers/net/ethernet/freescale/fman/fman.h

/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/*
 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
 * Copyright 2020 NXP
 */

#ifndef __FM_H
#define __FM_H

#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>

/* FM Frame descriptor macros  */
/* Frame queue Context Override */
#define FM_FD_CMD_FCO
#define FM_FD_CMD_RPD
#define FM_FD_CMD_UPD
#define FM_FD_CMD_DTC

/* TX-Port: Unsupported Format */
#define FM_FD_ERR_UNSUPPORTED_FORMAT
/* TX Port: Length Error */
#define FM_FD_ERR_LENGTH
#define FM_FD_ERR_DMA

/* IPR frame (not error) */
#define FM_FD_IPR
/* IPR non-consistent-sp */
#define FM_FD_ERR_IPR_NCSP
/* IPR error */
#define FM_FD_ERR_IPR
/* IPR timeout */
#define FM_FD_ERR_IPR_TO
/* TX Port: Length Error */
#define FM_FD_ERR_IPRE

/* Rx FIFO overflow, FCS error, code error, running disparity error
 * (SGMII and TBI modes), FIFO parity error. PHY Sequence error,
 * PHY error control character detected.
 */
#define FM_FD_ERR_PHYSICAL
/* Frame too long OR Frame size exceeds max_length_frame  */
#define FM_FD_ERR_SIZE
/* classification discard */
#define FM_FD_ERR_CLS_DISCARD
/* Extract Out of Frame */
#define FM_FD_ERR_EXTRACTION
/* No Scheme Selected */
#define FM_FD_ERR_NO_SCHEME
/* Keysize Overflow */
#define FM_FD_ERR_KEYSIZE_OVERFLOW
/* Frame color is red */
#define FM_FD_ERR_COLOR_RED
/* Frame color is yellow */
#define FM_FD_ERR_COLOR_YELLOW
/* Parser Time out Exceed */
#define FM_FD_ERR_PRS_TIMEOUT
/* Invalid Soft Parser instruction */
#define FM_FD_ERR_PRS_ILL_INSTRUCT
/* Header error was identified during parsing */
#define FM_FD_ERR_PRS_HDR_ERR
/* Frame parsed beyind 256 first bytes */
#define FM_FD_ERR_BLOCK_LIMIT_EXCEEDED

/* non Frame-Manager error */
#define FM_FD_RX_STATUS_ERR_NON_FM

/* FMan driver defines */
#define FMAN_BMI_FIFO_UNITS
#define OFFSET_UNITS

/* BMan defines */
#define BM_MAX_NUM_OF_POOLS
#define FMAN_PORT_MAX_EXT_POOLS_NUM

struct fman; /* FMan data */

/* Enum for defining port types */
enum fman_port_type {};

struct fman_rev_info {};

enum fman_exceptions {};

/* Parse results memory layout */
struct fman_prs_result {};

/* A structure for defining buffer prefix area content. */
struct fman_buffer_prefix_content {};

/* A structure of information about each of the external
 * buffer pools used by a port or storage-profile.
 */
struct fman_ext_pool_params {};

/* A structure for informing the driver about the external
 * buffer pools allocated in the BM and used by a port or a
 * storage-profile.
 */
struct fman_ext_pools {};

/* A structure for defining BM pool depletion criteria */
struct fman_buf_pool_depletion {};

/* Enum for inter-module interrupts registration */
enum fman_event_modules {};

/* Enum for interrupts types */
enum fman_intr_type {};

/* Enum for inter-module interrupts registration */
enum fman_inter_module_event {};

struct fman_intr_src {};

/** fman_exceptions_cb
 * fman         - Pointer to FMan
 * exception    - The exception.
 *
 * Exceptions user callback routine, will be called upon an exception
 * passing the exception identification.
 *
 * Return: irq status
 */
fman_exceptions_cb;
/** fman_bus_error_cb
 * fman         - Pointer to FMan
 * port_id      - Port id
 * addr         - Address that caused the error
 * tnum         - Owner of error
 * liodn        - Logical IO device number
 *
 * Bus error user callback routine, will be called upon bus error,
 * passing parameters describing the errors and the owner.
 *
 * Return: IRQ status
 */
fman_bus_error_cb;

/* Structure that holds information received from device tree */
struct fman_dts_params {};

struct fman {};

/* Structure for port-FM communication during fman_port_init. */
struct fman_port_init_params {};

void fman_get_revision(struct fman *fman, struct fman_rev_info *rev_info);

void fman_register_intr(struct fman *fman, enum fman_event_modules mod,
			u8 mod_id, enum fman_intr_type intr_type,
			void (*f_isr)(void *h_src_arg), void *h_src_arg);

void fman_unregister_intr(struct fman *fman, enum fman_event_modules mod,
			  u8 mod_id, enum fman_intr_type intr_type);

int fman_set_port_params(struct fman *fman,
			 struct fman_port_init_params *port_params);

int fman_reset_mac(struct fman *fman, u8 mac_id);

u16 fman_get_clock_freq(struct fman *fman);

u32 fman_get_bmi_max_fifo_size(struct fman *fman);

int fman_set_mac_max_frame(struct fman *fman, u8 mac_id, u16 mfl);

u32 fman_get_qman_channel_id(struct fman *fman, u32 port_id);

struct resource *fman_get_mem_region(struct fman *fman);

u16 fman_get_max_frm(void);

int fman_get_rx_extra_headroom(void);

#ifdef CONFIG_DPAA_ERRATUM_A050385
bool fman_has_errata_a050385(void);
#endif

struct fman *fman_bind(struct device *dev);

#endif /* __FM_H */