linux/drivers/net/ethernet/dec/tulip/uli526x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*


*/

#define pr_fmt(fmt)

#define DRV_NAME

#include <linux/module.h>

#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/dma-mapping.h>
#include <linux/bitops.h>

#include <asm/processor.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <linux/uaccess.h>

#define uw32(reg, val)
#define ur32(reg)

/* Board/System/Debug information/definition ---------------- */
#define PCI_ULI5261_ID
#define PCI_ULI5263_ID

#define ULI526X_IO_SIZE
#define TX_DESC_CNT
#define RX_DESC_CNT
#define TX_FREE_DESC_CNT
#define TX_WAKE_DESC_CNT
#define DESC_ALL_CNT
#define TX_BUF_ALLOC
#define RX_ALLOC_SIZE
#define ULI526X_RESET
#define CR0_DEFAULT
#define CR6_DEFAULT
#define CR7_DEFAULT
#define CR15_DEFAULT
#define TDES0_ERR_MASK
#define MAX_PACKET_SIZE
#define ULI5261_MAX_MULTICAST
#define RX_COPY_SIZE
#define MAX_CHECK_PACKET

#define ULI526X_10MHF
#define ULI526X_100MHF
#define ULI526X_10MFD
#define ULI526X_100MFD
#define ULI526X_AUTO

#define ULI526X_TXTH_72
#define ULI526X_TXTH_96
#define ULI526X_TXTH_128
#define ULI526X_TXTH_256
#define ULI526X_TXTH_512
#define ULI526X_TXTH_1K

#define ULI526X_TIMER_WUT
#define ULI526X_TX_TIMEOUT
#define ULI526X_TX_KICK

#define ULI526X_DBUG(dbug_now, msg, value)

#define SHOW_MEDIA_TYPE(mode)


/* CR9 definition: SROM/MII */
#define CR9_SROM_READ
#define CR9_SRCS
#define CR9_SRCLK
#define CR9_CRDOUT
#define SROM_DATA_0
#define SROM_DATA_1
#define PHY_DATA_1
#define PHY_DATA_0
#define MDCLKH

#define PHY_POWER_DOWN

#define SROM_V41_CODE

/* Structure/enum declaration ------------------------------- */
struct tx_desc {} __attribute__(( aligned ));

struct rx_desc {} __attribute__(( aligned ));

struct uli526x_board_info {};

enum uli526x_offsets {};

enum uli526x_CR6_bits {};

/* Global variable declaration ----------------------------- */
static int uli526x_debug;
static unsigned char uli526x_media_mode =;
static u32 uli526x_cr6_user_set;

/* For module input parameter */
static int debug;
static u32 cr6set;
static int mode =;

/* function declaration ------------------------------------- */
static int uli526x_open(struct net_device *);
static netdev_tx_t uli526x_start_xmit(struct sk_buff *,
					    struct net_device *);
static int uli526x_stop(struct net_device *);
static void uli526x_set_filter_mode(struct net_device *);
static const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(struct uli526x_board_info *, int);
static irqreturn_t uli526x_interrupt(int, void *);
#ifdef CONFIG_NET_POLL_CONTROLLER
static void uli526x_poll(struct net_device *dev);
#endif
static void uli526x_descriptor_init(struct net_device *, void __iomem *);
static void allocate_rx_buffer(struct net_device *);
static void update_cr6(u32, void __iomem *);
static void send_filter_frame(struct net_device *, int);
static u16 phy_readby_cr9(struct uli526x_board_info *, u8, u8);
static u16 phy_readby_cr10(struct uli526x_board_info *, u8, u8);
static void phy_writeby_cr9(struct uli526x_board_info *, u8, u8, u16);
static void phy_writeby_cr10(struct uli526x_board_info *, u8, u8, u16);
static void phy_write_1bit(struct uli526x_board_info *db, u32);
static u16 phy_read_1bit(struct uli526x_board_info *db);
static u8 uli526x_sense_speed(struct uli526x_board_info *);
static void uli526x_process_mode(struct uli526x_board_info *);
static void uli526x_timer(struct timer_list *t);
static void uli526x_rx_packet(struct net_device *, struct uli526x_board_info *);
static void uli526x_free_tx_pkt(struct net_device *, struct uli526x_board_info *);
static void uli526x_reuse_skb(struct uli526x_board_info *, struct sk_buff *);
static void uli526x_dynamic_reset(struct net_device *);
static void uli526x_free_rxbuffer(struct uli526x_board_info *);
static void uli526x_init(struct net_device *);
static void uli526x_set_phyxcer(struct uli526x_board_info *);

static void srom_clk_write(struct uli526x_board_info *db, u32 data)
{}

/* ULI526X network board routine ---------------------------- */

static const struct net_device_ops netdev_ops =;

/*
 *	Search ULI526X board, allocate space and register it
 */

static int uli526x_init_one(struct pci_dev *pdev,
			    const struct pci_device_id *ent)
{}


static void uli526x_remove_one(struct pci_dev *pdev)
{}


/*
 *	Open the interface.
 *	The interface is opened whenever "ifconfig" activates it.
 */

static int uli526x_open(struct net_device *dev)
{}


/*	Initialize ULI526X board
 *	Reset ULI526X board
 *	Initialize TX/Rx descriptor chain structure
 *	Send the set-up frame
 *	Enable Tx/Rx machine
 */

static void uli526x_init(struct net_device *dev)
{}


/*
 *	Hardware start transmission.
 *	Send a packet to media from the upper layer.
 */

static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
					    struct net_device *dev)
{}


/*
 *	Stop the interface.
 *	The interface is stopped when it is brought.
 */

static int uli526x_stop(struct net_device *dev)
{}


/*
 *	M5261/M5263 insterrupt handler
 *	receive the packet to upper layer, free the transmitted packet
 */

static irqreturn_t uli526x_interrupt(int irq, void *dev_id)
{}

#ifdef CONFIG_NET_POLL_CONTROLLER
static void uli526x_poll(struct net_device *dev)
{}
#endif

/*
 *	Free TX resource after TX complete
 */

static void uli526x_free_tx_pkt(struct net_device *dev,
				struct uli526x_board_info * db)
{}


/*
 *	Receive the come packet and pass to upper layer
 */

static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info * db)
{}


/*
 * Set ULI526X multicast address
 */

static void uli526x_set_filter_mode(struct net_device * dev)
{}

static void
ULi_ethtool_get_link_ksettings(struct uli526x_board_info *db,
			       struct ethtool_link_ksettings *cmd)
{}

static void netdev_get_drvinfo(struct net_device *dev,
			       struct ethtool_drvinfo *info)
{}

static int netdev_get_link_ksettings(struct net_device *dev,
				     struct ethtool_link_ksettings *cmd)
{}

static u32 netdev_get_link(struct net_device *dev) {}

static void uli526x_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static const struct ethtool_ops netdev_ethtool_ops =;

/*
 *	A periodic timer routine
 *	Dynamic media sense, allocate Rx buffer...
 */

static void uli526x_timer(struct timer_list *t)
{}


/*
 *	Stop ULI526X board
 *	Free Tx/Rx allocated memory
 *	Init system variable
 */

static void uli526x_reset_prepare(struct net_device *dev)
{}


/*
 *	Dynamic reset the ULI526X board
 *	Stop ULI526X board
 *	Free Tx/Rx allocated memory
 *	Reset ULI526X board
 *	Re-initialize ULI526X board
 */

static void uli526x_dynamic_reset(struct net_device *dev)
{}

/*
 *	Suspend the interface.
 */

static int __maybe_unused uli526x_suspend(struct device *dev_d)
{}

/*
 *	Resume the interface.
 */

static int __maybe_unused uli526x_resume(struct device *dev_d)
{}

/*
 *	free all allocated rx buffer
 */

static void uli526x_free_rxbuffer(struct uli526x_board_info * db)
{}


/*
 *	Reuse the SK buffer
 */

static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * skb)
{}


/*
 *	Initialize transmit/Receive descriptor
 *	Using Chain structure, and allocate Tx/Rx buffer
 */

static void uli526x_descriptor_init(struct net_device *dev, void __iomem *ioaddr)
{}


/*
 *	Update CR6 value
 *	Firstly stop ULI526X, then written value and start
 */
static void update_cr6(u32 cr6_data, void __iomem *ioaddr)
{}


/*
 *	Send a setup frame for M5261/M5263
 *	This setup frame initialize ULI526X address filter mode
 */

#ifdef __BIG_ENDIAN
#define FLT_SHIFT
#else
#define FLT_SHIFT
#endif

static void send_filter_frame(struct net_device *dev, int mc_cnt)
{}


/*
 *	Allocate rx buffer,
 *	As possible as allocate maxiumn Rx buffer
 */

static void allocate_rx_buffer(struct net_device *dev)
{}


/*
 *	Read one word data from the serial ROM
 */

static u16 read_srom_word(struct uli526x_board_info *db, int offset)
{}


/*
 *	Auto sense the media mode
 */

static u8 uli526x_sense_speed(struct uli526x_board_info * db)
{}


/*
 *	Set 10/100 phyxcer capability
 *	AUTO mode : phyxcer register4 is NIC capability
 *	Force mode: phyxcer register4 is the force media
 */

static void uli526x_set_phyxcer(struct uli526x_board_info *db)
{}


/*
 *	Process op-mode
	AUTO mode : PHY controller in Auto-negotiation Mode
 *	Force mode: PHY controller in force mode with HUB
 *			N-way force capability with SWITCH
 */

static void uli526x_process_mode(struct uli526x_board_info *db)
{}


/* M5261/M5263 Chip */
static void phy_writeby_cr9(struct uli526x_board_info *db, u8 phy_addr,
			    u8 offset, u16 phy_data)
{}

static u16 phy_readby_cr9(struct uli526x_board_info *db, u8 phy_addr, u8 offset)
{}

static u16 phy_readby_cr10(struct uli526x_board_info *db, u8 phy_addr,
			   u8 offset)
{}

static void phy_writeby_cr10(struct uli526x_board_info *db, u8 phy_addr,
			     u8 offset, u16 phy_data)
{}
/*
 *	Write one bit data to Phy Controller
 */

static void phy_write_1bit(struct uli526x_board_info *db, u32 data)
{}


/*
 *	Read one bit phy data from PHY controller
 */

static u16 phy_read_1bit(struct uli526x_board_info *db)
{}


static const struct pci_device_id uli526x_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci, uli526x_pci_tbl);

static SIMPLE_DEV_PM_OPS(uli526x_pm_ops, uli526x_suspend, uli526x_resume);

static struct pci_driver uli526x_driver =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

module_param(debug, int, 0644);
module_param(mode, int, 0);
module_param(cr6set, int, 0);
MODULE_PARM_DESC();
MODULE_PARM_DESC();

/*	Description:
 *	when user used insmod to add module, system invoked init_module()
 *	to register the services.
 */

static int __init uli526x_init_module(void)
{}


/*
 *	Description:
 *	when user used rmmod to delete module, system invoked clean_module()
 *	to un-register all registered services.
 */

static void __exit uli526x_cleanup_module(void)
{}

module_init();
module_exit(uli526x_cleanup_module);