linux/drivers/net/ethernet/freescale/fman/fman_memac.c

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

#define pr_fmt(fmt)

#include "fman_memac.h"
#include "fman.h"
#include "mac.h"

#include <linux/slab.h>
#include <linux/io.h>
#include <linux/pcs-lynx.h>
#include <linux/phy.h>
#include <linux/phy_fixed.h>
#include <linux/phy/phy.h>
#include <linux/of_mdio.h>

/* Num of additional exact match MAC adr regs */
#define MEMAC_NUM_OF_PADDRS

/* Control and Configuration Register (COMMAND_CONFIG) */
#define CMD_CFG_REG_LOWP_RXETY
#define CMD_CFG_TX_LOWP_ENA
#define CMD_CFG_PFC_MODE
#define CMD_CFG_NO_LEN_CHK
#define CMD_CFG_SW_RESET
#define CMD_CFG_TX_PAD_EN
#define CMD_CFG_PAUSE_IGNORE
#define CMD_CFG_CRC_FWD
#define CMD_CFG_PAD_EN
#define CMD_CFG_PROMIS_EN
#define CMD_CFG_RX_EN
#define CMD_CFG_TX_EN

/* Transmit FIFO Sections Register (TX_FIFO_SECTIONS) */
#define TX_FIFO_SECTIONS_TX_EMPTY_MASK
#define TX_FIFO_SECTIONS_TX_AVAIL_MASK
#define TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G
#define TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_1G
#define TX_FIFO_SECTIONS_TX_AVAIL_10G
#define TX_FIFO_SECTIONS_TX_AVAIL_1G
#define TX_FIFO_SECTIONS_TX_AVAIL_SLOW_10G

#define GET_TX_EMPTY_DEFAULT_VALUE(_val)

/* Interface Mode Register (IF_MODE) */

#define IF_MODE_MASK
#define IF_MODE_10G
#define IF_MODE_MII
#define IF_MODE_GMII
#define IF_MODE_RGMII
#define IF_MODE_RGMII_AUTO
#define IF_MODE_RGMII_1000
#define IF_MODE_RGMII_100
#define IF_MODE_RGMII_10
#define IF_MODE_RGMII_SP_MASK
#define IF_MODE_RGMII_FD
#define IF_MODE_HD

/* Hash table Control Register (HASHTABLE_CTRL) */
#define HASH_CTRL_MCAST_EN
/* 26-31 Hash table address code */
#define HASH_CTRL_ADDR_MASK
/* MAC mcast indication */
#define GROUP_ADDRESS
#define HASH_TABLE_SIZE

/* Interrupt Mask Register (IMASK) */
#define MEMAC_IMASK_MGI
#define MEMAC_IMASK_TSECC_ER
#define MEMAC_IMASK_TECC_ER
#define MEMAC_IMASK_RECC_ER

#define MEMAC_ALL_ERRS_IMASK

#define MEMAC_IEVNT_PCS
#define MEMAC_IEVNT_AN
#define MEMAC_IEVNT_LT
#define MEMAC_IEVNT_MGI
#define MEMAC_IEVNT_TS_ECC_ER
#define MEMAC_IEVNT_RX_FIFO_OVFL
#define MEMAC_IEVNT_TX_FIFO_UNFL
#define MEMAC_IEVNT_TX_FIFO_OVFL
#define MEMAC_IEVNT_TX_ECC_ER
#define MEMAC_IEVNT_RX_ECC_ER
#define MEMAC_IEVNT_LI_FAULT
#define MEMAC_IEVNT_RX_EMPTY
#define MEMAC_IEVNT_TX_EMPTY
#define MEMAC_IEVNT_RX_LOWP
#define MEMAC_IEVNT_PHY_LOS
#define MEMAC_IEVNT_REM_FAULT
#define MEMAC_IEVNT_LOC_FAULT

#define DEFAULT_PAUSE_QUANTA
#define DEFAULT_FRAME_LENGTH
#define DEFAULT_TX_IPG_LENGTH

#define CLXY_PAUSE_QUANTA_CLX_PQNT
#define CLXY_PAUSE_QUANTA_CLY_PQNT
#define CLXY_PAUSE_THRESH_CLX_QTH
#define CLXY_PAUSE_THRESH_CLY_QTH

struct mac_addr {};

/* memory map */
struct memac_regs {};

struct memac_cfg {};

struct fman_mac {};

static void add_addr_in_paddr(struct memac_regs __iomem *regs, const u8 *adr,
			      u8 paddr_num)
{}

static int reset(struct memac_regs __iomem *regs)
{}

static void set_exception(struct memac_regs __iomem *regs, u32 val,
			  bool enable)
{}

static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg,
		u32 exceptions)
{}

static void set_dflts(struct memac_cfg *cfg)
{}

static u32 get_mac_addr_hash_code(u64 eth_addr)
{}

static int check_init_parameters(struct fman_mac *memac)
{}

static int get_exception_flag(enum fman_mac_exceptions exception)
{}

static void memac_err_exception(void *handle)
{}

static void memac_exception(void *handle)
{}

static void free_init_resources(struct fman_mac *memac)
{}

static int memac_enable(struct fman_mac *memac)
{}

static void memac_disable(struct fman_mac *memac)
{}

static int memac_set_promiscuous(struct fman_mac *memac, bool new_val)
{}

static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority,
				     u16 pause_time, u16 thresh_time)
{}

static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en)
{}

static unsigned long memac_get_caps(struct phylink_config *config,
				    phy_interface_t interface)
{}

/**
 * memac_if_mode() - Convert an interface mode into an IF_MODE config
 * @interface: A phy interface mode
 *
 * Return: A configuration word, suitable for programming into the lower bits
 *         of %IF_MODE.
 */
static u32 memac_if_mode(phy_interface_t interface)
{}

static struct phylink_pcs *memac_select_pcs(struct phylink_config *config,
					    phy_interface_t iface)
{}

static int memac_prepare(struct phylink_config *config, unsigned int mode,
			 phy_interface_t iface)
{}

static void memac_mac_config(struct phylink_config *config, unsigned int mode,
			     const struct phylink_link_state *state)
{}

static void memac_link_up(struct phylink_config *config, struct phy_device *phy,
			  unsigned int mode, phy_interface_t interface,
			  int speed, int duplex, bool tx_pause, bool rx_pause)
{}

static void memac_link_down(struct phylink_config *config, unsigned int mode,
			    phy_interface_t interface)
{}

static const struct phylink_mac_ops memac_mac_ops =;

static int memac_modify_mac_address(struct fman_mac *memac,
				    const enet_addr_t *enet_addr)
{}

static int memac_add_hash_mac_address(struct fman_mac *memac,
				      enet_addr_t *eth_addr)
{}

static int memac_set_allmulti(struct fman_mac *memac, bool enable)
{}

static int memac_set_tstamp(struct fman_mac *memac, bool enable)
{}

static int memac_del_hash_mac_address(struct fman_mac *memac,
				      enet_addr_t *eth_addr)
{}

static int memac_set_exception(struct fman_mac *memac,
			       enum fman_mac_exceptions exception, bool enable)
{}

static int memac_init(struct fman_mac *memac)
{}

static void pcs_put(struct phylink_pcs *pcs)
{}

static int memac_free(struct fman_mac *memac)
{}

static struct fman_mac *memac_config(struct mac_device *mac_dev,
				     struct fman_mac_params *params)
{}

static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node,
					    int index)
{}

static bool memac_supports(struct mac_device *mac_dev, phy_interface_t iface)
{}

int memac_initialization(struct mac_device *mac_dev,
			 struct device_node *mac_node,
			 struct fman_mac_params *params)
{}