#include <linux/delay.h>
#include <linux/etherdevice.h>
#include <linux/mii.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/phy.h>
#include <linux/in.h>
#include <linux/io.h>
#include <linux/ip.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/dma-mapping.h>
#include <linux/processor.h>
#include <linux/platform_data/xilinx-ll-temac.h>
#include "ll_temac.h"
#define TX_BD_NUM_DEFAULT …
#define RX_BD_NUM_DEFAULT …
#define TX_BD_NUM_MAX …
#define RX_BD_NUM_MAX …
static u32 _temac_ior_be(struct temac_local *lp, int offset)
{ … }
static void _temac_iow_be(struct temac_local *lp, int offset, u32 value)
{ … }
static u32 _temac_ior_le(struct temac_local *lp, int offset)
{ … }
static void _temac_iow_le(struct temac_local *lp, int offset, u32 value)
{ … }
static bool hard_acs_rdy(struct temac_local *lp)
{ … }
static bool hard_acs_rdy_or_timeout(struct temac_local *lp, ktime_t timeout)
{ … }
#define HARD_ACS_RDY_POLL_NS …
int temac_indirect_busywait(struct temac_local *lp)
{ … }
u32 temac_indirect_in32(struct temac_local *lp, int reg)
{ … }
u32 temac_indirect_in32_locked(struct temac_local *lp, int reg)
{ … }
void temac_indirect_out32(struct temac_local *lp, int reg, u32 value)
{ … }
void temac_indirect_out32_locked(struct temac_local *lp, int reg, u32 value)
{ … }
static u32 temac_dma_in32_be(struct temac_local *lp, int reg)
{ … }
static u32 temac_dma_in32_le(struct temac_local *lp, int reg)
{ … }
static void temac_dma_out32_be(struct temac_local *lp, int reg, u32 value)
{ … }
static void temac_dma_out32_le(struct temac_local *lp, int reg, u32 value)
{ … }
#ifdef CONFIG_PPC_DCR
static u32 temac_dma_dcr_in(struct temac_local *lp, int reg)
{
return dcr_read(lp->sdma_dcrs, reg);
}
static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value)
{
dcr_write(lp->sdma_dcrs, reg, value);
}
static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
struct device_node *np)
{
unsigned int dcrs;
dcrs = dcr_resource_start(np, 0);
if (dcrs != 0) {
lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
lp->dma_in = temac_dma_dcr_in;
lp->dma_out = temac_dma_dcr_out;
dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
return 0;
}
return -1;
}
#else
static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
struct device_node *np)
{ … }
#endif
static void temac_dma_bd_release(struct net_device *ndev)
{ … }
static int temac_dma_bd_init(struct net_device *ndev)
{ … }
static void temac_do_set_mac_address(struct net_device *ndev)
{ … }
static int temac_init_mac_address(struct net_device *ndev, const void *address)
{ … }
static int temac_set_mac_address(struct net_device *ndev, void *p)
{ … }
static void temac_set_multicast_list(struct net_device *ndev)
{ … }
static struct temac_option { … } temac_options[] = …;
static u32 temac_setoptions(struct net_device *ndev, u32 options)
{ … }
static void temac_device_reset(struct net_device *ndev)
{ … }
static void temac_adjust_link(struct net_device *ndev)
{ … }
#ifdef CONFIG_64BIT
static void ptr_to_txbd(void *p, struct cdmac_bd *bd)
{ … }
static void *ptr_from_txbd(struct cdmac_bd *bd)
{ … }
#else
static void ptr_to_txbd(void *p, struct cdmac_bd *bd)
{
bd->app4 = (u32)p;
}
static void *ptr_from_txbd(struct cdmac_bd *bd)
{
return (void *)(bd->app4);
}
#endif
static void temac_start_xmit_done(struct net_device *ndev)
{ … }
static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag)
{ … }
static netdev_tx_t
temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{ … }
static int ll_temac_recv_buffers_available(struct temac_local *lp)
{ … }
static void ll_temac_recv(struct net_device *ndev)
{ … }
static void ll_temac_restart_work_func(struct work_struct *work)
{ … }
static irqreturn_t ll_temac_tx_irq(int irq, void *_ndev)
{ … }
static irqreturn_t ll_temac_rx_irq(int irq, void *_ndev)
{ … }
static int temac_open(struct net_device *ndev)
{ … }
static int temac_stop(struct net_device *ndev)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void
temac_poll_controller(struct net_device *ndev)
{ … }
#endif
static const struct net_device_ops temac_netdev_ops = …;
static ssize_t temac_show_llink_regs(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(llink_regs, 0440, temac_show_llink_regs, NULL);
static struct attribute *temac_device_attrs[] = …;
static const struct attribute_group temac_attr_group = …;
static void
ll_temac_ethtools_get_ringparam(struct net_device *ndev,
struct ethtool_ringparam *ering,
struct kernel_ethtool_ringparam *kernel_ering,
struct netlink_ext_ack *extack)
{ … }
static int
ll_temac_ethtools_set_ringparam(struct net_device *ndev,
struct ethtool_ringparam *ering,
struct kernel_ethtool_ringparam *kernel_ering,
struct netlink_ext_ack *extack)
{ … }
static int
ll_temac_ethtools_get_coalesce(struct net_device *ndev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int
ll_temac_ethtools_set_coalesce(struct net_device *ndev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static const struct ethtool_ops temac_ethtool_ops = …;
static int temac_probe(struct platform_device *pdev)
{ … }
static void temac_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id temac_of_match[] = …;
MODULE_DEVICE_TABLE(of, temac_of_match);
static struct platform_driver temac_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;