linux/drivers/net/ethernet/smsc/smsc911x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
 *
 * Copyright (C) 2004-2008 SMSC
 * Copyright (C) 2005-2008 ARM
 *
 ***************************************************************************
 * Rewritten, heavily based on smsc911x simple driver by SMSC.
 * Partly uses io macros from smc91x.c by Nicolas Pitre
 *
 * Supported devices:
 *   LAN9115, LAN9116, LAN9117, LAN9118
 *   LAN9215, LAN9216, LAN9217, LAN9218
 *   LAN9210, LAN9211
 *   LAN9220, LAN9221
 *   LAN89218,LAN9250
 */

#define pr_fmt(fmt)

#include <linux/crc32.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/bug.h>
#include <linux/bitops.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/swab.h>
#include <linux/phy.h>
#include <linux/smsc911x.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_net.h>
#include <linux/acpi.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/gpio/consumer.h>

#include "smsc911x.h"

#define SMSC_CHIPNAME
#define SMSC_MDIONAME
#define SMSC_DRV_VERSION

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();
MODULE_ALIAS();

#if USE_DEBUG > 0
static int debug = 16;
#else
static int debug =;
#endif

module_param(debug, int, 0);
MODULE_PARM_DESC();

struct smsc911x_data;

struct smsc911x_ops {};

#define SMSC911X_NUM_SUPPLIES

struct smsc911x_data {};

/* Easy access to information */
#define __smsc_shift(pdata, reg)

static inline u32 __smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
{}

static inline u32
__smsc911x_reg_read_shift(struct smsc911x_data *pdata, u32 reg)
{}

static inline u32 smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
{}

static inline void __smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
					u32 val)
{}

static inline void
__smsc911x_reg_write_shift(struct smsc911x_data *pdata, u32 reg, u32 val)
{}

static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
				      u32 val)
{}

/* Writes a packet to the TX_DATA_FIFO */
static inline void
smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf,
		      unsigned int wordcount)
{}

/* Writes a packet to the TX_DATA_FIFO - shifted version */
static inline void
smsc911x_tx_writefifo_shift(struct smsc911x_data *pdata, unsigned int *buf,
		      unsigned int wordcount)
{}

/* Reads a packet out of the RX_DATA_FIFO */
static inline void
smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf,
		     unsigned int wordcount)
{}

/* Reads a packet out of the RX_DATA_FIFO - shifted version */
static inline void
smsc911x_rx_readfifo_shift(struct smsc911x_data *pdata, unsigned int *buf,
		     unsigned int wordcount)
{}

/*
 * enable regulator and clock resources.
 */
static int smsc911x_enable_resources(struct platform_device *pdev)
{}

/*
 * disable resources, currently just regulators.
 */
static int smsc911x_disable_resources(struct platform_device *pdev)
{}

/*
 * Request resources, currently just regulators.
 *
 * The SMSC911x has two power pins: vddvario and vdd33a, in designs where
 * these are not always-on we need to request regulators to be turned on
 * before we can try to access the device registers.
 */
static int smsc911x_request_resources(struct platform_device *pdev)
{}

/*
 * Free resources, currently just regulators.
 *
 */
static void smsc911x_free_resources(struct platform_device *pdev)
{}

/* waits for MAC not busy, with timeout.  Only called by smsc911x_mac_read
 * and smsc911x_mac_write, so assumes mac_lock is held */
static int smsc911x_mac_complete(struct smsc911x_data *pdata)
{}

/* Fetches a MAC register value. Assumes mac_lock is acquired */
static u32 smsc911x_mac_read(struct smsc911x_data *pdata, unsigned int offset)
{}

/* Set a mac register, mac_lock must be acquired before calling */
static void smsc911x_mac_write(struct smsc911x_data *pdata,
			       unsigned int offset, u32 val)
{}

/* Get a phy register */
static int smsc911x_mii_read(struct mii_bus *bus, int phyaddr, int regidx)
{}

/* Set a phy register */
static int smsc911x_mii_write(struct mii_bus *bus, int phyaddr, int regidx,
			   u16 val)
{}

/* Switch to external phy. Assumes tx and rx are stopped. */
static void smsc911x_phy_enable_external(struct smsc911x_data *pdata)
{}

/* Autodetects and enables external phy if present on supported chips.
 * autodetection can be overridden by specifying SMSC911X_FORCE_INTERNAL_PHY
 * or SMSC911X_FORCE_EXTERNAL_PHY in the platform_data flags. */
static void smsc911x_phy_initialise_external(struct smsc911x_data *pdata)
{}

/* Fetches a tx status out of the status fifo */
static unsigned int smsc911x_tx_get_txstatus(struct smsc911x_data *pdata)
{}

/* Fetches the next rx status */
static unsigned int smsc911x_rx_get_rxstatus(struct smsc911x_data *pdata)
{}

#ifdef USE_PHY_WORK_AROUND
static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
{}

static int smsc911x_phy_reset(struct smsc911x_data *pdata)
{}

static int smsc911x_phy_loopbacktest(struct net_device *dev)
{}
#endif				/* USE_PHY_WORK_AROUND */

static void smsc911x_phy_update_flowcontrol(struct smsc911x_data *pdata)
{}

/* Update link mode if anything has changed.  Called periodically when the
 * PHY is in polling mode, even if nothing has changed. */
static void smsc911x_phy_adjust_link(struct net_device *dev)
{}

static int smsc911x_mii_probe(struct net_device *dev)
{}

static int smsc911x_mii_init(struct platform_device *pdev,
			     struct net_device *dev)
{}

/* Gets the number of tx statuses in the fifo */
static unsigned int smsc911x_tx_get_txstatcount(struct smsc911x_data *pdata)
{}

/* Reads tx statuses and increments counters where necessary */
static void smsc911x_tx_update_txcounters(struct net_device *dev)
{}

/* Increments the Rx error counters */
static void
smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat)
{}

/* Quickly dumps bad packets */
static void
smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords)
{}

/* NAPI poll function */
static int smsc911x_poll(struct napi_struct *napi, int budget)
{}

/* Returns hash bit number for given MAC address
 * Example:
 * 01 00 5E 00 00 01 -> returns bit number 31 */
static unsigned int smsc911x_hash(char addr[ETH_ALEN])
{}

static void smsc911x_rx_multicast_update(struct smsc911x_data *pdata)
{}

static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
{}

static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata)
{}

static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
{}

static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)
{}

static int smsc911x_soft_reset(struct smsc911x_data *pdata)
{}

/* Sets the device MAC address to dev_addr, called with mac_lock held */
static void
smsc911x_set_hw_mac_address(struct smsc911x_data *pdata, const u8 dev_addr[6])
{}

static void smsc911x_disable_irq_chip(struct net_device *dev)
{}

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

static int smsc911x_open(struct net_device *dev)
{}

/* Entry point for stopping the interface */
static int smsc911x_stop(struct net_device *dev)
{}

/* Entry point for transmitting a packet */
static netdev_tx_t
smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{}

/* Entry point for getting status counters */
static struct net_device_stats *smsc911x_get_stats(struct net_device *dev)
{}

/* Entry point for setting addressing modes */
static void smsc911x_set_multicast_list(struct net_device *dev)
{}

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

static int smsc911x_set_mac_address(struct net_device *dev, void *p)
{}

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

static u32 smsc911x_ethtool_getmsglevel(struct net_device *dev)
{}

static void smsc911x_ethtool_setmsglevel(struct net_device *dev, u32 level)
{}

static int smsc911x_ethtool_getregslen(struct net_device *dev)
{}

static void
smsc911x_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs,
			 void *buf)
{}

static void smsc911x_eeprom_enable_access(struct smsc911x_data *pdata)
{}

static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
{}

static int smsc911x_eeprom_read_location(struct smsc911x_data *pdata,
					 u8 address, u8 *data)
{}

static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
					  u8 address, u8 data)
{}

static int smsc911x_ethtool_get_eeprom_len(struct net_device *dev)
{}

static int smsc911x_ethtool_get_eeprom(struct net_device *dev,
				       struct ethtool_eeprom *eeprom, u8 *data)
{}

static int smsc911x_ethtool_set_eeprom(struct net_device *dev,
				       struct ethtool_eeprom *eeprom, u8 *data)
{}

static const struct ethtool_ops smsc911x_ethtool_ops =;

static const struct net_device_ops smsc911x_netdev_ops =;

/* copies the current mac address from hardware to dev->dev_addr */
static void smsc911x_read_mac_address(struct net_device *dev)
{}

/* Initializing private device structures, only called from probe */
static int smsc911x_init(struct net_device *dev)
{}

static void smsc911x_drv_remove(struct platform_device *pdev)
{}

/* standard register acces */
static const struct smsc911x_ops standard_smsc911x_ops =;

/* shifted register access */
static const struct smsc911x_ops shifted_smsc911x_ops =;

static int smsc911x_probe_config(struct smsc911x_platform_config *config,
				 struct device *dev)
{}

static int smsc911x_drv_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM
/* This implementation assumes the devices remains powered on its VDDVARIO
 * pins during suspend. */

/* TODO: implement freeze/thaw callbacks for hibernation.*/

static int smsc911x_suspend(struct device *dev)
{}

static int smsc911x_resume(struct device *dev)
{}

static const struct dev_pm_ops smsc911x_pm_ops =;

#define SMSC911X_PM_OPS

#else
#define SMSC911X_PM_OPS
#endif

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

#ifdef CONFIG_ACPI
static const struct acpi_device_id smsc911x_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, smsc911x_acpi_match);
#endif

static struct platform_driver smsc911x_driver =;

/* Entry point for loading the module */
static int __init smsc911x_init_module(void)
{}

/* entry point for unloading the module */
static void __exit smsc911x_cleanup_module(void)
{}

module_init();
module_exit(smsc911x_cleanup_module);