linux/drivers/net/ethernet/silan/sc92031.c

// SPDX-License-Identifier: GPL-2.0-only
/*  Silan SC92031 PCI Fast Ethernet Adapter driver
 *
 *  Based on vendor drivers:
 *  Silan Fast Ethernet Netcard Driver:
 *    MODULE_AUTHOR ("gaoyonghong");
 *    MODULE_DESCRIPTION ("SILAN Fast Ethernet driver");
 *    MODULE_LICENSE("GPL");
 *  8139D Fast Ethernet driver:
 *    (C) 2002 by gaoyonghong
 *    MODULE_AUTHOR ("gaoyonghong");
 *    MODULE_DESCRIPTION ("Rsltek 8139D PCI Fast Ethernet Adapter driver");
 *    MODULE_LICENSE("GPL");
 *  Both are almost identical and seem to be based on pci-skeleton.c
 *
 *  Rewritten for 2.6 by Cesar Eduardo Barros
 *
 *  A datasheet for this chip can be found at
 *  http://www.silan.com.cn/english/product/pdf/SC92031AY.pdf 
 */

/* Note about set_mac_address: I don't know how to change the hardware
 * matching, so you need to enable IFF_PROMISC when using it.
 */

#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/crc32.h>

#include <asm/irq.h>

#define SC92031_NAME

/* BAR 0 is MMIO, BAR 1 is PIO */
#define SC92031_USE_PIO

/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). */
static int multicast_filter_limit =;
module_param(multicast_filter_limit, int, 0);
MODULE_PARM_DESC();

static int media;
module_param(media, int, 0);
MODULE_PARM_DESC();

/* Size of the in-memory receive ring. */
#define RX_BUF_LEN_IDX
#define RX_BUF_LEN

/* Number of Tx descriptor registers. */
#define NUM_TX_DESC

/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
#define MAX_ETH_FRAME_SIZE

/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
#define TX_BUF_SIZE
#define TX_BUF_TOT_LEN

/* The following settings are log_2(bytes)-4:  0 == 16 bytes .. 6==1024, 7==end of packet. */
#define RX_FIFO_THRESH

/* Time in jiffies before concluding the transmitter is hung. */
#define TX_TIMEOUT

#define SILAN_STATS_NUM

/* media options */
#define AUTOSELECT
#define M10_HALF
#define M10_FULL
#define M100_HALF
#define M100_FULL

 /* Symbolic offsets to registers. */
enum  silan_registers {};

#define MII_JAB
#define MII_OutputStatus

#define PHY_16_JAB_ENB
#define PHY_16_PORT_ENB

enum IntrStatusBits {};

enum TxStatusBits {};

enum RxStatusBits {};

enum RxConfigBits {};

enum TxConfigBits {};

enum PhyCtrlconfigbits {};

enum FlowCtrlConfigBits {};

enum Config0Bits {};

enum Config1Bits {};

enum MiiCmd0Bits {};

enum MiiStatusBits {};

enum PMConfigBits {};

/* Locking rules:
 * priv->lock protects most of the fields of priv and most of the
 * hardware registers. It does not have to protect against softirqs
 * between sc92031_disable_interrupts and sc92031_enable_interrupts;
 * it also does not need to be used in ->open and ->stop while the
 * device interrupts are off.
 * Not having to protect against softirqs is very useful due to heavy
 * use of mdelay() at _sc92031_reset.
 * Functions prefixed with _sc92031_ must be called with the lock held;
 * functions prefixed with sc92031_ must be called without the lock held.
 */

/* Locking rules for the interrupt:
 * - the interrupt and the tasklet never run at the same time
 * - neither run between sc92031_disable_interrupts and
 *   sc92031_enable_interrupt
 */

struct sc92031_priv {};

/* I don't know which registers can be safely read; however, I can guess
 * MAC0 is one of them. */
static inline void _sc92031_dummy_read(void __iomem *port_base)
{}

static u32 _sc92031_mii_wait(void __iomem *port_base)
{}

static u32 _sc92031_mii_cmd(void __iomem *port_base, u32 cmd0, u32 cmd1)
{}

static void _sc92031_mii_scan(void __iomem *port_base)
{}

static u16 _sc92031_mii_read(void __iomem *port_base, unsigned reg)
{}

static void _sc92031_mii_write(void __iomem *port_base, unsigned reg, u16 val)
{}

static void sc92031_disable_interrupts(struct net_device *dev)
{}

static void sc92031_enable_interrupts(struct net_device *dev)
{}

static void _sc92031_disable_tx_rx(struct net_device *dev)
{}

static void _sc92031_enable_tx_rx(struct net_device *dev)
{}

static void _sc92031_tx_clear(struct net_device *dev)
{}

static void _sc92031_set_mar(struct net_device *dev)
{}

static void _sc92031_set_rx_config(struct net_device *dev)
{}

static bool _sc92031_check_media(struct net_device *dev)
{}

static void _sc92031_phy_reset(struct net_device *dev)
{}

static void _sc92031_reset(struct net_device *dev)
{}

static void _sc92031_tx_tasklet(struct net_device *dev)
{}

static void _sc92031_rx_tasklet_error(struct net_device *dev,
				      u32 rx_status, unsigned rx_size)
{}

static void _sc92031_rx_tasklet(struct net_device *dev)
{}

static void _sc92031_link_tasklet(struct net_device *dev)
{}

static void sc92031_tasklet(struct tasklet_struct *t)
{}

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

static struct net_device_stats *sc92031_get_stats(struct net_device *dev)
{}

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

static int sc92031_open(struct net_device *dev)
{}

static int sc92031_stop(struct net_device *dev)
{}

static void sc92031_set_multicast_list(struct net_device *dev)
{}

static void sc92031_tx_timeout(struct net_device *dev, unsigned int txqueue)
{}

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

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

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

static void sc92031_ethtool_get_wol(struct net_device *dev,
		struct ethtool_wolinfo *wolinfo)
{}

static int sc92031_ethtool_set_wol(struct net_device *dev,
		struct ethtool_wolinfo *wolinfo)
{}

static int sc92031_ethtool_nway_reset(struct net_device *dev)
{}

static const char sc92031_ethtool_stats_strings[SILAN_STATS_NUM][ETH_GSTRING_LEN] =;

static void sc92031_ethtool_get_strings(struct net_device *dev,
		u32 stringset, u8 *data)
{}

static int sc92031_ethtool_get_sset_count(struct net_device *dev, int sset)
{}

static void sc92031_ethtool_get_ethtool_stats(struct net_device *dev,
		struct ethtool_stats *stats, u64 *data)
{}

static const struct ethtool_ops sc92031_ethtool_ops =;


static const struct net_device_ops sc92031_netdev_ops =;

static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void sc92031_remove(struct pci_dev *pdev)
{}

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

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

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

static SIMPLE_DEV_PM_OPS(sc92031_pm_ops, sc92031_suspend, sc92031_resume);

static struct pci_driver sc92031_pci_driver =;

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