linux/drivers/net/ethernet/davicom/dm9000.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *      Davicom DM9000 Fast Ethernet driver for Linux.
 * 	Copyright (C) 1997  Sten Wang
 *
 * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved.
 *
 * Additional updates, Copyright:
 *	Ben Dooks <[email protected]>
 *	Sascha Hauer <[email protected]>
 */

#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/crc32.h>
#include <linux/mii.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/ethtool.h>
#include <linux/dm9000.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/regulator/consumer.h>
#include <linux/gpio/consumer.h>

#include <asm/delay.h>
#include <asm/irq.h>
#include <asm/io.h>

#include "dm9000.h"

/* Board/System/Debug information/definition ---------------- */

#define DM9000_PHY

#define CARDNAME

/*
 * Transmit timeout, default 5 seconds.
 */
static int watchdog =;
module_param(watchdog, int, 0400);
MODULE_PARM_DESC();

/*
 * Debug messages level
 */
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

/* DM9000 register address locking.
 *
 * The DM9000 uses an address register to control where data written
 * to the data register goes. This means that the address register
 * must be preserved over interrupts or similar calls.
 *
 * During interrupt and other critical calls, a spinlock is used to
 * protect the system, but the calls themselves save the address
 * in the address register in case they are interrupting another
 * access to the device.
 *
 * For general accesses a lock is provided so that calls which are
 * allowed to sleep are serialised so that the address register does
 * not need to be saved. This lock also serves to serialise access
 * to the EEPROM and PHY access registers which are shared between
 * these two devices.
 */

/* The driver supports the original DM9000E, and now the two newer
 * devices, DM9000A and DM9000B.
 */

enum dm9000_type {};

/* Structure/enum declaration ------------------------------- */
struct board_info {};

/* debug code */

#define dm9000_dbg(db, lev, msg...)

static inline struct board_info *to_dm9000_board(struct net_device *dev)
{}

/* DM9000 network board routine ---------------------------- */

/*
 *   Read a byte from I/O port
 */
static u8
ior(struct board_info *db, int reg)
{}

/*
 *   Write a byte to I/O port
 */

static void
iow(struct board_info *db, int reg, int value)
{}

static void
dm9000_reset(struct board_info *db)
{}

/* routines for sending block to chip */

static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
{}

static void dm9000_outblk_16bit(void __iomem *reg, void *data, int count)
{}

static void dm9000_outblk_32bit(void __iomem *reg, void *data, int count)
{}

/* input block from chip to memory */

static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count)
{}


static void dm9000_inblk_16bit(void __iomem *reg, void *data, int count)
{}

static void dm9000_inblk_32bit(void __iomem *reg, void *data, int count)
{}

/* dump block from chip to null */

static void dm9000_dumpblk_8bit(void __iomem *reg, int count)
{}

static void dm9000_dumpblk_16bit(void __iomem *reg, int count)
{}

static void dm9000_dumpblk_32bit(void __iomem *reg, int count)
{}

/*
 * Sleep, either by using msleep() or if we are suspending, then
 * use mdelay() to sleep.
 */
static void dm9000_msleep(struct board_info *db, unsigned int ms)
{}

/* Read a word from phyxcer */
static int
dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
{}

/* Write a word to phyxcer */
static void
dm9000_phy_write(struct net_device *dev,
		 int phyaddr_unused, int reg, int value)
{}

/* dm9000_set_io
 *
 * select the specified set of io routines to use with the
 * device
 */

static void dm9000_set_io(struct board_info *db, int byte_width)
{}

static void dm9000_schedule_poll(struct board_info *db)
{}

static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
{}

static unsigned int
dm9000_read_locked(struct board_info *db, int reg)
{}

static int dm9000_wait_eeprom(struct board_info *db)
{}

/*
 *  Read a word data from EEPROM
 */
static void
dm9000_read_eeprom(struct board_info *db, int offset, u8 *to)
{}

/*
 * Write a word data to SROM
 */
static void
dm9000_write_eeprom(struct board_info *db, int offset, u8 *data)
{}

/* ethtool ops */

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

static u32 dm9000_get_msglevel(struct net_device *dev)
{}

static void dm9000_set_msglevel(struct net_device *dev, u32 value)
{}

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

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

static int dm9000_nway_reset(struct net_device *dev)
{}

static int dm9000_set_features(struct net_device *dev,
	netdev_features_t features)
{}

static u32 dm9000_get_link(struct net_device *dev)
{}

#define DM_EEPROM_MAGIC

static int dm9000_get_eeprom_len(struct net_device *dev)
{}

static int dm9000_get_eeprom(struct net_device *dev,
			     struct ethtool_eeprom *ee, u8 *data)
{}

static int dm9000_set_eeprom(struct net_device *dev,
			     struct ethtool_eeprom *ee, u8 *data)
{}

static void dm9000_get_wol(struct net_device *dev, struct ethtool_wolinfo *w)
{}

static int dm9000_set_wol(struct net_device *dev, struct ethtool_wolinfo *w)
{}

static const struct ethtool_ops dm9000_ethtool_ops =;

static void dm9000_show_carrier(struct board_info *db,
				unsigned carrier, unsigned nsr)
{}

static void
dm9000_poll_work(struct work_struct *w)
{}

/* dm9000_release_board
 *
 * release a board, and any mapped resources
 */

static void
dm9000_release_board(struct platform_device *pdev, struct board_info *db)
{}

static unsigned char dm9000_type_to_char(enum dm9000_type type)
{}

/*
 *  Set DM9000 multicast address
 */
static void
dm9000_hash_table_unlocked(struct net_device *dev)
{}

static void
dm9000_hash_table(struct net_device *dev)
{}

static void
dm9000_mask_interrupts(struct board_info *db)
{}

static void
dm9000_unmask_interrupts(struct board_info *db)
{}

/*
 * Initialize dm9000 board
 */
static void
dm9000_init_dm9000(struct net_device *dev)
{}

/* Our watchdog timed out. Called by the networking layer */
static void dm9000_timeout(struct net_device *dev, unsigned int txqueue)
{}

static void dm9000_send_packet(struct net_device *dev,
			       int ip_summed,
			       u16 pkt_len)
{}

/*
 *  Hardware start transmission.
 *  Send a packet to media from the upper layer.
 */
static netdev_tx_t
dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
{}

/*
 * DM9000 interrupt handler
 * receive the packet to upper layer, free the transmitted packet
 */

static void dm9000_tx_done(struct net_device *dev, struct board_info *db)
{}

struct dm9000_rxhdr {} __packed;

/*
 *  Received a packet and pass to upper layer
 */
static void
dm9000_rx(struct net_device *dev)
{}

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

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

#ifdef CONFIG_NET_POLL_CONTROLLER
/*
 *Used by netconsole
 */
static void dm9000_poll_controller(struct net_device *dev)
{}
#endif

/*
 *  Open the interface.
 *  The interface is opened whenever "ifconfig" actives it.
 */
static int
dm9000_open(struct net_device *dev)
{}

static void
dm9000_shutdown(struct net_device *dev)
{}

/*
 * Stop the interface.
 * The interface is stopped when it is brought.
 */
static int
dm9000_stop(struct net_device *ndev)
{}

static const struct net_device_ops dm9000_netdev_ops =;

static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
{}

/*
 * Search DM9000 board, allocate space and register it
 */
static int
dm9000_probe(struct platform_device *pdev)
{}

static int
dm9000_drv_suspend(struct device *dev)
{}

static int
dm9000_drv_resume(struct device *dev)
{}

static const struct dev_pm_ops dm9000_drv_pm_ops =;

static void dm9000_drv_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_OF
static const struct of_device_id dm9000_of_matches[] =;
MODULE_DEVICE_TABLE(of, dm9000_of_matches);
#endif

static struct platform_driver dm9000_driver =;

module_platform_driver();

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