aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-06-11 02:29:36 -0700
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-08-12 00:22:12 -0700
commitec21e2ec367697b4803e82662bdff6c8567745fc (patch)
treecdb42f597ff5e60516bdab59d306006fd1fafd1c /drivers/net/ucc_geth.c
parent5346ebf6db077d963e9d81af9df290d7f5532492 (diff)
freescale: Move the Freescale drivers
Move the Freescale drivers into drivers/net/ethernet/freescale/ and make the necessary Kconfig and Makefile changes. CC: Sandeep Gopalpet <sandeep.kumar@freescale.com> CC: Andy Fleming <afleming@freescale.com> CC: Shlomi Gridish <gridish@freescale.com> CC: Li Yang <leoli@freescale.com> CC: Pantelis Antoniou <pantelis.antoniou@gmail.com> CC: Vitaly Bordug <vbordug@ru.mvista.com> CC: Dan Malek <dmalek@jlc.net> CC: Sylvain Munaut <tnt@246tNt.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c4026
1 files changed, 0 insertions, 4026 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
deleted file mode 100644
index 42f8e31b0bb..00000000000
--- a/drivers/net/ucc_geth.c
+++ /dev/null
@@ -1,4026 +0,0 @@
-/*
- * Copyright (C) 2006-2009 Freescale Semicondutor, Inc. All rights reserved.
- *
- * Author: Shlomi Gridish <gridish@freescale.com>
- * Li Yang <leoli@freescale.com>
- *
- * Description:
- * QE UCC Gigabit Ethernet Driver
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/stddef.h>
-#include <linux/interrupt.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-#include <linux/dma-mapping.h>
-#include <linux/mii.h>
-#include <linux/phy.h>
-#include <linux/workqueue.h>
-#include <linux/of_mdio.h>
-#include <linux/of_net.h>
-#include <linux/of_platform.h>
-
-#include <asm/uaccess.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
-#include <asm/ucc.h>
-#include <asm/ucc_fast.h>
-#include <asm/machdep.h>
-
-#include "ucc_geth.h"
-#include "fsl_pq_mdio.h"
-
-#undef DEBUG
-
-#define ugeth_printk(level, format, arg...) \
- printk(level format "\n", ## arg)
-
-#define ugeth_dbg(format, arg...) \
- ugeth_printk(KERN_DEBUG , format , ## arg)
-#define ugeth_err(format, arg...) \
- ugeth_printk(KERN_ERR , format , ## arg)
-#define ugeth_info(format, arg...) \
- ugeth_printk(KERN_INFO , format , ## arg)
-#define ugeth_warn(format, arg...) \
- ugeth_printk(KERN_WARNING , format , ## arg)
-
-#ifdef UGETH_VERBOSE_DEBUG
-#define ugeth_vdbg ugeth_dbg
-#else
-#define ugeth_vdbg(fmt, args...) do { } while (0)
-#endif /* UGETH_VERBOSE_DEBUG */
-#define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
-
-
-static DEFINE_SPINLOCK(ugeth_lock);
-
-static struct {
- u32 msg_enable;
-} debug = { -1 };
-
-module_param_named(debug, debug.msg_enable, int, 0);
-MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)");
-
-static struct ucc_geth_info ugeth_primary_info = {
- .uf_info = {
- .bd_mem_part = MEM_PART_SYSTEM,
- .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES,
- .max_rx_buf_length = 1536,
- /* adjusted at startup if max-speed 1000 */
- .urfs = UCC_GETH_URFS_INIT,
- .urfet = UCC_GETH_URFET_INIT,
- .urfset = UCC_GETH_URFSET_INIT,
- .utfs = UCC_GETH_UTFS_INIT,
- .utfet = UCC_GETH_UTFET_INIT,
- .utftt = UCC_GETH_UTFTT_INIT,
- .ufpt = 256,
- .mode = UCC_FAST_PROTOCOL_MODE_ETHERNET,
- .ttx_trx = UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_NORMAL,
- .tenc = UCC_FAST_TX_ENCODING_NRZ,
- .renc = UCC_FAST_RX_ENCODING_NRZ,
- .tcrc = UCC_FAST_16_BIT_CRC,
- .synl = UCC_FAST_SYNC_LEN_NOT_USED,
- },
- .numQueuesTx = 1,
- .numQueuesRx = 1,
- .extendedFilteringChainPointer = ((uint32_t) NULL),
- .typeorlen = 3072 /*1536 */ ,
- .nonBackToBackIfgPart1 = 0x40,
- .nonBackToBackIfgPart2 = 0x60,
- .miminumInterFrameGapEnforcement = 0x50,
- .backToBackInterFrameGap = 0x60,
- .mblinterval = 128,
- .nortsrbytetime = 5,
- .fracsiz = 1,
- .strictpriorityq = 0xff,
- .altBebTruncation = 0xa,
- .excessDefer = 1,
- .maxRetransmission = 0xf,
- .collisionWindow = 0x37,
- .receiveFlowControl = 1,
- .transmitFlowControl = 1,
- .maxGroupAddrInHash = 4,
- .maxIndAddrInHash = 4,
- .prel = 7,
- .maxFrameLength = 1518,
- .minFrameLength = 64,
- .maxD1Length = 1520,
- .maxD2Length = 1520,
- .vlantype = 0x8100,
- .ecamptr = ((uint32_t) NULL),
- .eventRegMask = UCCE_OTHER,
- .pausePeriod = 0xf000,
- .interruptcoalescingmaxvalue = {1, 1, 1, 1, 1, 1, 1, 1},
- .bdRingLenTx = {
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN,
- TX_BD_RING_LEN},
-
- .bdRingLenRx = {
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN,
- RX_BD_RING_LEN},
-
- .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
- .largestexternallookupkeysize =
- QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
- .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
- UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
- UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
- .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
- .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
- .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
- .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE,
- .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC,
- .numThreadsTx = UCC_GETH_NUM_OF_THREADS_1,
- .numThreadsRx = UCC_GETH_NUM_OF_THREADS_1,
- .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
- .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
-};
-
-static struct ucc_geth_info ugeth_info[8];
-
-#ifdef DEBUG
-static void mem_disp(u8 *addr, int size)
-{
- u8 *i;
- int size16Aling = (size >> 4) << 4;
- int size4Aling = (size >> 2) << 2;
- int notAlign = 0;
- if (size % 16)
- notAlign = 1;
-
- for (i = addr; (u32) i < (u32) addr + size16Aling; i += 16)
- printk("0x%08x: %08x %08x %08x %08x\r\n",
- (u32) i,
- *((u32 *) (i)),
- *((u32 *) (i + 4)),
- *((u32 *) (i + 8)), *((u32 *) (i + 12)));
- if (notAlign == 1)
- printk("0x%08x: ", (u32) i);
- for (; (u32) i < (u32) addr + size4Aling; i += 4)
- printk("%08x ", *((u32 *) (i)));
- for (; (u32) i < (u32) addr + size; i++)
- printk("%02x", *((u8 *) (i)));
- if (notAlign == 1)
- printk("\r\n");
-}
-#endif /* DEBUG */
-
-static struct list_head *dequeue(struct list_head *lh)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&ugeth_lock, flags);
- if (!list_empty(lh)) {
- struct list_head *node = lh->next;
- list_del(node);
- spin_unlock_irqrestore(&ugeth_lock, flags);
- return node;
- } else {
- spin_unlock_irqrestore(&ugeth_lock, flags);
- return NULL;
- }
-}
-
-static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth,
- u8 __iomem *bd)
-{
- struct sk_buff *skb = NULL;
-
- skb = __skb_dequeue(&ugeth->rx_recycle);
- if (!skb)
- skb = dev_alloc_skb(ugeth->ug_info->uf_info.max_rx_buf_length +
- UCC_GETH_RX_DATA_BUF_ALIGNMENT);
- if (skb == NULL)
- return NULL;
-
- /* We need the data buffer to be aligned properly. We will reserve
- * as many bytes as needed to align the data properly
- */
- skb_reserve(skb,
- UCC_GETH_RX_DATA_BUF_ALIGNMENT -
- (((unsigned)skb->data) & (UCC_GETH_RX_DATA_BUF_ALIGNMENT -
- 1)));
-
- skb->dev = ugeth->ndev;
-
- out_be32(&((struct qe_bd __iomem *)bd)->buf,
- dma_map_single(ugeth->dev,
- skb->data,
- ugeth->ug_info->uf_info.max_rx_buf_length +
- UCC_GETH_RX_DATA_BUF_ALIGNMENT,
- DMA_FROM_DEVICE));
-
- out_be32((u32 __iomem *)bd,
- (R_E | R_I | (in_be32((u32 __iomem*)bd) & R_W)));
-
- return skb;
-}
-
-static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ)
-{
- u8 __iomem *bd;
- u32 bd_status;
- struct sk_buff *skb;
- int i;
-
- bd = ugeth->p_rx_bd_ring[rxQ];
- i = 0;
-
- do {
- bd_status = in_be32((u32 __iomem *)bd);
- skb = get_new_skb(ugeth, bd);
-
- if (!skb) /* If can not allocate data buffer,
- abort. Cleanup will be elsewhere */
- return -ENOMEM;
-
- ugeth->rx_skbuff[rxQ][i] = skb;
-
- /* advance the BD pointer */
- bd += sizeof(struct qe_bd);
- i++;
- } while (!(bd_status & R_W));
-
- return 0;
-}
-
-static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
- u32 *p_start,
- u8 num_entries,
- u32 thread_size,
- u32 thread_alignment,
- unsigned int risc,
- int skip_page_for_first_entry)
-{
- u32 init_enet_offset;
- u8 i;
- int snum;
-
- for (i = 0; i < num_entries; i++) {
- if ((snum = qe_get_snum()) < 0) {
- if (netif_msg_ifup(ugeth))
- ugeth_err("fill_init_enet_entries: Can not get SNUM.");
- return snum;
- }
- if ((i == 0) && skip_page_for_first_entry)
- /* First entry of Rx does not have page */
- init_enet_offset = 0;
- else {
- init_enet_offset =
- qe_muram_alloc(thread_size, thread_alignment);
- if (IS_ERR_VALUE(init_enet_offset)) {
- if (netif_msg_ifup(ugeth))
- ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory.");
- qe_put_snum((u8) snum);
- return -ENOMEM;
- }
- }
- *(p_start++) =
- ((u8) snum << ENET_INIT_PARAM_SNUM_SHIFT) | init_enet_offset
- | risc;
- }
-
- return 0;
-}
-
-static int return_init_enet_entries(struct ucc_geth_private *ugeth,
- u32 *p_start,
- u8 num_entries,
- unsigned int risc,
- int skip_page_for_first_entry)
-{
- u32 init_enet_offset;
- u8 i;
- int snum;
-
- for (i = 0; i < num_entries; i++) {
- u32 val = *p_start;
-
- /* Check that this entry was actually valid --
- needed in case failed in allocations */
- if ((val & ENET_INIT_PARAM_RISC_MASK) == risc) {
- snum =
- (u32) (val & ENET_INIT_PARAM_SNUM_MASK) >>
- ENET_INIT_PARAM_SNUM_SHIFT;
- qe_put_snum((u8) snum);
- if (!((i == 0) && skip_page_for_first_entry)) {
- /* First entry of Rx does not have page */
- init_enet_offset =
- (val & ENET_INIT_PARAM_PTR_MASK);
- qe_muram_free(init_enet_offset);
- }
- *p_start++ = 0;
- }
- }
-
- return 0;
-}
-
-#ifdef DEBUG
-static int dump_init_enet_entries(struct ucc_geth_private *ugeth,
- u32 __iomem *p_start,
- u8 num_entries,
- u32 thread_size,
- unsigned int risc,
- int skip_page_for_first_entry)
-{
- u32 init_enet_offset;
- u8 i;
- int snum;
-
- for (i = 0; i < num_entries; i++) {
- u32 val = in_be32(p_start);
-
- /* Check that this entry was actually valid --
- needed in case failed in allocations */
- if ((val & ENET_INIT_PARAM_RISC_MASK) == risc) {
- snum =
- (u32) (val & ENET_INIT_PARAM_SNUM_MASK) >>
- ENET_INIT_PARAM_SNUM_SHIFT;
- qe_put_snum((u8) snum);
- if (!((i == 0) && skip_page_for_first_entry)) {
- /* First entry of Rx does not have page */
- init_enet_offset =
- (in_be32(p_start) &
- ENET_INIT_PARAM_PTR_MASK);
- ugeth_info("Init enet entry %d:", i);
- ugeth_info("Base address: 0x%08x",
- (u32)
- qe_muram_addr(init_enet_offset));
- mem_disp(qe_muram_addr(init_enet_offset),
- thread_size);
- }
- p_start++;
- }
- }
-
- return 0;
-}
-#endif
-
-static void put_enet_addr_container(struct enet_addr_container *enet_addr_cont)
-{
- kfree(enet_addr_cont);
-}
-
-static void set_mac_addr(__be16 __iomem *reg, u8 *mac)
-{
- out_be16(&reg[0], ((u16)mac[5] << 8) | mac[4]);
- out_be16(&reg[1], ((u16)mac[3] << 8) | mac[2]);
- out_be16(&reg[2], ((u16)mac[1] << 8) | mac[0]);
-}
-
-static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num)
-{
- struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt;
-
- if (!(paddr_num < NUM_OF_PADDRS)) {
- ugeth_warn("%s: Illagel paddr_num.", __func__);
- return -EINVAL;
- }
-
- p_82xx_addr_filt =
- (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth->p_rx_glbl_pram->
- addressfiltering;
-
- /* Writing address ff.ff.ff.ff.ff.ff disables address
- recognition for this register */
- out_be16(&p_82xx_addr_filt->paddr[paddr_num].h, 0xffff);
- out_be16(&p_82xx_addr_filt->paddr[paddr_num].m, 0xffff);
- out_be16(&p_82xx_addr_filt->paddr[paddr_num].l, 0xffff);
-
- return 0;
-}
-
-static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
- u8 *p_enet_addr)
-{
- struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt;
- u32 cecr_subblock;
-
- p_82xx_addr_filt =
- (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth->p_rx_glbl_pram->
- addressfiltering;
-
- cecr_subblock =
- ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
-
- /* Ethernet frames are defined in Little Endian mode,
- therefore to insert */
- /* the address to the hash (Big Endian mode), we reverse the bytes.*/
-
- set_mac_addr(&p_82xx_addr_filt->taddr.h, p_enet_addr);
-
- qe_issue_cmd(QE_SET_GROUP_ADDRESS, cecr_subblock,
- QE_CR_PROTOCOL_ETHERNET, 0);
-}
-
-static inline int compare_addr(u8 **addr1, u8 **addr2)
-{
- return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS);
-}
-
-#ifdef DEBUG
-static void get_statistics(struct ucc_geth_private *ugeth,
- struct ucc_geth_tx_firmware_statistics *
- tx_firmware_statistics,
- struct ucc_geth_rx_firmware_statistics *
- rx_firmware_statistics,
- struct ucc_geth_hardware_statistics *hardware_statistics)
-{
- struct ucc_fast __iomem *uf_regs;
- struct ucc_geth __iomem *ug_regs;
- struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram;
- struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram;
-
- ug_regs = ugeth->ug_regs;
- uf_regs = (struct ucc_fast __iomem *) ug_regs;
- p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram;
- p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram;
-
- /* Tx firmware only if user handed pointer and driver actually
- gathers Tx firmware statistics */
- if (tx_firmware_statistics && p_tx_fw_statistics_pram) {
- tx_firmware_statistics->sicoltx =
- in_be32(&p_tx_fw_statistics_pram->sicoltx);
- tx_firmware_statistics->mulcoltx =
- in_be32(&p_tx_fw_statistics_pram->mulcoltx);
- tx_firmware_statistics->latecoltxfr =
- in_be32(&p_tx_fw_statistics_pram->latecoltxfr);
- tx_firmware_statistics->frabortduecol =
- in_be32(&p_tx_fw_statistics_pram->frabortduecol);
- tx_firmware_statistics->frlostinmactxer =
- in_be32(&p_tx_fw_statistics_pram->frlostinmactxer);
- tx_firmware_statistics->carriersenseertx =
- in_be32(&p_tx_fw_statistics_pram->carriersenseertx);
- tx_firmware_statistics->frtxok =
- in_be32(&p_tx_fw_statistics_pram->frtxok);
- tx_firmware_statistics->txfrexcessivedefer =
- in_be32(&p_tx_fw_statistics_pram->txfrexcessivedefer);
- tx_firmware_statistics->txpkts256 =
- in_be32(&p_tx_fw_statistics_pram->txpkts256);
- tx_firmware_statistics->txpkts512 =
- in_be32(&p_tx_fw_statistics_pram->txpkts512);
- tx_firmware_statistics->txpkts1024 =
- in_be32(&p_tx_fw_statistics_pram->txpkts1024);
- tx_firmware_statistics->txpktsjumbo =
- in_be32(&p_tx_fw_statistics_pram->txpktsjumbo);
- }
-
- /* Rx firmware only if user handed pointer and driver actually
- * gathers Rx firmware statistics */
- if (rx_firmware_statistics && p_rx_fw_statistics_pram) {
- int i;
- rx_firmware_statistics->frrxfcser =
- in_be32(&p_rx_fw_statistics_pram->frrxfcser);
- rx_firmware_statistics->fraligner =
- in_be32(&p_rx_fw_statistics_pram->fraligner);
- rx_firmware_statistics->inrangelenrxer =
- in_be32(&p_rx_fw_statistics_pram->inrangelenrxer);
- rx_firmware_statistics->outrangelenrxer =
- in_be32(&p_rx_fw_statistics_pram->outrangelenrxer);
- rx_firmware_statistics->frtoolong =
- in_be32(&p_rx_fw_statistics_pram->frtoolong);
- rx_firmware_statistics->runt =
- in_be32(&p_rx_fw_statistics_pram->runt);
- rx_firmware_statistics->verylongevent =
- in_be32(&p_rx_fw_statistics_pram->verylongevent);
- rx_firmware_statistics->symbolerror =
- in_be32(&p_rx_fw_statistics_pram->symbolerror);
- rx_firmware_statistics->dropbsy =
- in_be32(&p_rx_fw_statistics_pram->dropbsy);
- for (i = 0; i < 0x8; i++)
- rx_firmware_statistics->res0[i] =
- p_rx_fw_statistics_pram->res0[i];
- rx_firmware_statistics->mismatchdrop =
- in_be32(&p_rx_fw_statistics_pram->mismatchdrop);
- rx_firmware_statistics->underpkts =
- in_be32(&p_rx_fw_statistics_pram->underpkts);
- rx_firmware_statistics->pkts256 =
- in_be32(&p_rx_fw_statistics_pram->pkts256);
- rx_firmware_statistics->pkts512 =
- in_be32(&p_rx_fw_statistics_pram->pkts512);
- rx_firmware_statistics->pkts1024 =
- in_be32(&p_rx_fw_statistics_pram->pkts1024);
- rx_firmware_statistics->pktsjumbo =
- in_be32(&p_rx_fw_statistics_pram->pktsjumbo);
- rx_firmware_statistics->frlossinmacer =
- in_be32(&p_rx_fw_statistics_pram->frlossinmacer);
- rx_firmware_statistics->pausefr =
- in_be32(&p_rx_fw_statistics_pram->pausefr);
- for (i = 0; i < 0x4; i++)
- rx_firmware_statistics->res1[i] =
- p_rx_fw_statistics_pram->res1[i];
- rx_firmware_statistics->removevlan =
- in_be32(&p_rx_fw_statistics_pram->removevlan);
- rx_firmware_statistics->replacevlan =
- in_be32(&p_rx_fw_statistics_pram->replacevlan);
- rx_firmware_statistics->insertvlan =
- in_be32(&p_rx_fw_statistics_pram->insertvlan);
- }
-
- /* Hardware only if user handed pointer and driver actually
- gathers hardware statistics */
- if (hardware_statistics &&
- (in_be32(&uf_regs->upsmr) & UCC_GETH_UPSMR_HSE)) {
- hardware_statistics->tx64 = in_be32(&ug_regs->tx64);
- hardware_statistics->tx127 = in_be32(&ug_regs->tx127);
- hardware_statistics->tx255 = in_be32(&ug_regs->tx255);
- hardware_statistics->rx64 = in_be32(&ug_regs->rx64);
- hardware_statistics->rx127 = in_be32(&ug_regs->rx127);
- hardware_statistics->rx255 = in_be32(&ug_regs->rx255);
- hardware_statistics->txok = in_be32(&ug_regs->txok);
- hardware_statistics->txcf = in_be16(&ug_regs->txcf);
- hardware_statistics->tmca = in_be32(&ug_regs->tmca);
- hardware_statistics->tbca = in_be32(&ug_regs->tbca);
- hardware_statistics->rxfok = in_be32(&ug_regs->rxfok);
- hardware_statistics->rxbok = in_be32(&ug_regs->rxbok);
- hardware_statistics->rbyt = in_be32(&ug_regs->rbyt);
- hardware_statistics->rmca = in_be32(&ug_regs->rmca);
- hardware_statistics->rbca = in_be32(&ug_regs->rbca);
- }
-}
-
-static void dump_bds(struct ucc_geth_private *ugeth)
-{
- int i;
- int length;
-
- for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) {
- if (ugeth->p_tx_bd_ring[i]) {
- length =
- (ugeth->ug_info->bdRingLenTx[i] *
- sizeof(struct qe_bd));
- ugeth_info("TX BDs[%d]", i);
- mem_disp(ugeth->p_tx_bd_ring[i], length);
- }
- }
- for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) {
- if (ugeth->p_rx_bd_ring[i]) {
- length =
- (ugeth->ug_info->bdRingLenRx[i] *
- sizeof(struct qe_bd));
- ugeth_info("RX BDs[%d]", i);
- mem_disp(ugeth->p_rx_bd_ring[i], length);
- }
- }
-}
-
-static void dump_regs(struct ucc_geth_private *ugeth)
-{
- int i;
-
- ugeth_info("UCC%d Geth registers:", ugeth->ug_info->uf_info.ucc_num + 1);
- ugeth_info("Base address: 0x%08x", (u32) ugeth->ug_regs);
-
- ugeth_info("maccfg1 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->maccfg1,
- in_be32(&ugeth->ug_regs->maccfg1));
- ugeth_info("maccfg2 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->maccfg2,
- in_be32(&ugeth->ug_regs->maccfg2));
- ugeth_info("ipgifg : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->ipgifg,
- in_be32(&ugeth->ug_regs->ipgifg));
- ugeth_info("hafdup : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->hafdup,
- in_be32(&ugeth->ug_regs->hafdup));
- ugeth_info("ifctl : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->ifctl,
- in_be32(&ugeth->ug_regs->ifctl));
- ugeth_info("ifstat : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->ifstat,
- in_be32(&ugeth->ug_regs->ifstat));
- ugeth_info("macstnaddr1: addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->macstnaddr1,
- in_be32(&ugeth->ug_regs->macstnaddr1));
- ugeth_info("macstnaddr2: addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->macstnaddr2,
- in_be32(&ugeth->ug_regs->macstnaddr2));
- ugeth_info("uempr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->uempr,
- in_be32(&ugeth->ug_regs->uempr));
- ugeth_info("utbipar : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->utbipar,
- in_be32(&ugeth->ug_regs->utbipar));
- ugeth_info("uescr : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->ug_regs->uescr,
- in_be16(&ugeth->ug_regs->uescr));
- ugeth_info("tx64 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->tx64,
- in_be32(&ugeth->ug_regs->tx64));
- ugeth_info("tx127 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->tx127,
- in_be32(&ugeth->ug_regs->tx127));
- ugeth_info("tx255 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->tx255,
- in_be32(&ugeth->ug_regs->tx255));
- ugeth_info("rx64 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rx64,
- in_be32(&ugeth->ug_regs->rx64));
- ugeth_info("rx127 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rx127,
- in_be32(&ugeth->ug_regs->rx127));
- ugeth_info("rx255 : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rx255,
- in_be32(&ugeth->ug_regs->rx255));
- ugeth_info("txok : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->txok,
- in_be32(&ugeth->ug_regs->txok));
- ugeth_info("txcf : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->ug_regs->txcf,
- in_be16(&ugeth->ug_regs->txcf));
- ugeth_info("tmca : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->tmca,
- in_be32(&ugeth->ug_regs->tmca));
- ugeth_info("tbca : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->tbca,
- in_be32(&ugeth->ug_regs->tbca));
- ugeth_info("rxfok : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rxfok,
- in_be32(&ugeth->ug_regs->rxfok));
- ugeth_info("rxbok : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rxbok,
- in_be32(&ugeth->ug_regs->rxbok));
- ugeth_info("rbyt : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rbyt,
- in_be32(&ugeth->ug_regs->rbyt));
- ugeth_info("rmca : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rmca,
- in_be32(&ugeth->ug_regs->rmca));
- ugeth_info("rbca : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->rbca,
- in_be32(&ugeth->ug_regs->rbca));
- ugeth_info("scar : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->scar,
- in_be32(&ugeth->ug_regs->scar));
- ugeth_info("scam : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->ug_regs->scam,
- in_be32(&ugeth->ug_regs->scam));
-
- if (ugeth->p_thread_data_tx) {
- int numThreadsTxNumerical;
- switch (ugeth->ug_info->numThreadsTx) {
- case UCC_GETH_NUM_OF_THREADS_1:
- numThreadsTxNumerical = 1;
- break;
- case UCC_GETH_NUM_OF_THREADS_2:
- numThreadsTxNumerical = 2;
- break;
- case UCC_GETH_NUM_OF_THREADS_4:
- numThreadsTxNumerical = 4;
- break;
- case UCC_GETH_NUM_OF_THREADS_6:
- numThreadsTxNumerical = 6;
- break;
- case UCC_GETH_NUM_OF_THREADS_8:
- numThreadsTxNumerical = 8;
- break;
- default:
- numThreadsTxNumerical = 0;
- break;
- }
-
- ugeth_info("Thread data TXs:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_thread_data_tx);
- for (i = 0; i < numThreadsTxNumerical; i++) {
- ugeth_info("Thread data TX[%d]:", i);
- ugeth_info("Base address: 0x%08x",
- (u32) & ugeth->p_thread_data_tx[i]);
- mem_disp((u8 *) & ugeth->p_thread_data_tx[i],
- sizeof(struct ucc_geth_thread_data_tx));
- }
- }
- if (ugeth->p_thread_data_rx) {
- int numThreadsRxNumerical;
- switch (ugeth->ug_info->numThreadsRx) {
- case UCC_GETH_NUM_OF_THREADS_1:
- numThreadsRxNumerical = 1;
- break;
- case UCC_GETH_NUM_OF_THREADS_2:
- numThreadsRxNumerical = 2;
- break;
- case UCC_GETH_NUM_OF_THREADS_4:
- numThreadsRxNumerical = 4;
- break;
- case UCC_GETH_NUM_OF_THREADS_6:
- numThreadsRxNumerical = 6;
- break;
- case UCC_GETH_NUM_OF_THREADS_8:
- numThreadsRxNumerical = 8;
- break;
- default:
- numThreadsRxNumerical = 0;
- break;
- }
-
- ugeth_info("Thread data RX:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_thread_data_rx);
- for (i = 0; i < numThreadsRxNumerical; i++) {
- ugeth_info("Thread data RX[%d]:", i);
- ugeth_info("Base address: 0x%08x",
- (u32) & ugeth->p_thread_data_rx[i]);
- mem_disp((u8 *) & ugeth->p_thread_data_rx[i],
- sizeof(struct ucc_geth_thread_data_rx));
- }
- }
- if (ugeth->p_exf_glbl_param) {
- ugeth_info("EXF global param:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_exf_glbl_param);
- mem_disp((u8 *) ugeth->p_exf_glbl_param,
- sizeof(*ugeth->p_exf_glbl_param));
- }
- if (ugeth->p_tx_glbl_pram) {
- ugeth_info("TX global param:");
- ugeth_info("Base address: 0x%08x", (u32) ugeth->p_tx_glbl_pram);
- ugeth_info("temoder : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_tx_glbl_pram->temoder,
- in_be16(&ugeth->p_tx_glbl_pram->temoder));
- ugeth_info("sqptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->sqptr,
- in_be32(&ugeth->p_tx_glbl_pram->sqptr));
- ugeth_info("schedulerbasepointer: addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->schedulerbasepointer,
- in_be32(&ugeth->p_tx_glbl_pram->
- schedulerbasepointer));
- ugeth_info("txrmonbaseptr: addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->txrmonbaseptr,
- in_be32(&ugeth->p_tx_glbl_pram->txrmonbaseptr));
- ugeth_info("tstate : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->tstate,
- in_be32(&ugeth->p_tx_glbl_pram->tstate));
- ugeth_info("iphoffset[0] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[0],
- ugeth->p_tx_glbl_pram->iphoffset[0]);
- ugeth_info("iphoffset[1] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[1],
- ugeth->p_tx_glbl_pram->iphoffset[1]);
- ugeth_info("iphoffset[2] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[2],
- ugeth->p_tx_glbl_pram->iphoffset[2]);
- ugeth_info("iphoffset[3] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[3],
- ugeth->p_tx_glbl_pram->iphoffset[3]);
- ugeth_info("iphoffset[4] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[4],
- ugeth->p_tx_glbl_pram->iphoffset[4]);
- ugeth_info("iphoffset[5] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[5],
- ugeth->p_tx_glbl_pram->iphoffset[5]);
- ugeth_info("iphoffset[6] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[6],
- ugeth->p_tx_glbl_pram->iphoffset[6]);
- ugeth_info("iphoffset[7] : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_tx_glbl_pram->iphoffset[7],
- ugeth->p_tx_glbl_pram->iphoffset[7]);
- ugeth_info("vtagtable[0] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[0],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[0]));
- ugeth_info("vtagtable[1] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[1],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[1]));
- ugeth_info("vtagtable[2] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[2],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[2]));
- ugeth_info("vtagtable[3] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[3],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[3]));
- ugeth_info("vtagtable[4] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[4],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[4]));
- ugeth_info("vtagtable[5] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[5],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[5]));
- ugeth_info("vtagtable[6] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[6],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[6]));
- ugeth_info("vtagtable[7] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->vtagtable[7],
- in_be32(&ugeth->p_tx_glbl_pram->vtagtable[7]));
- ugeth_info("tqptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_tx_glbl_pram->tqptr,
- in_be32(&ugeth->p_tx_glbl_pram->tqptr));
- }
- if (ugeth->p_rx_glbl_pram) {
- ugeth_info("RX global param:");
- ugeth_info("Base address: 0x%08x", (u32) ugeth->p_rx_glbl_pram);
- ugeth_info("remoder : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->remoder,
- in_be32(&ugeth->p_rx_glbl_pram->remoder));
- ugeth_info("rqptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->rqptr,
- in_be32(&ugeth->p_rx_glbl_pram->rqptr));
- ugeth_info("typeorlen : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->typeorlen,
- in_be16(&ugeth->p_rx_glbl_pram->typeorlen));
- ugeth_info("rxgstpack : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_rx_glbl_pram->rxgstpack,
- ugeth->p_rx_glbl_pram->rxgstpack);
- ugeth_info("rxrmonbaseptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->rxrmonbaseptr,
- in_be32(&ugeth->p_rx_glbl_pram->rxrmonbaseptr));
- ugeth_info("intcoalescingptr: addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->intcoalescingptr,
- in_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr));
- ugeth_info("rstate : addr - 0x%08x, val - 0x%02x",
- (u32) & ugeth->p_rx_glbl_pram->rstate,
- ugeth->p_rx_glbl_pram->rstate);
- ugeth_info("mrblr : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->mrblr,
- in_be16(&ugeth->p_rx_glbl_pram->mrblr));
- ugeth_info("rbdqptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->rbdqptr,
- in_be32(&ugeth->p_rx_glbl_pram->rbdqptr));
- ugeth_info("mflr : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->mflr,
- in_be16(&ugeth->p_rx_glbl_pram->mflr));
- ugeth_info("minflr : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->minflr,
- in_be16(&ugeth->p_rx_glbl_pram->minflr));
- ugeth_info("maxd1 : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->maxd1,
- in_be16(&ugeth->p_rx_glbl_pram->maxd1));
- ugeth_info("maxd2 : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->maxd2,
- in_be16(&ugeth->p_rx_glbl_pram->maxd2));
- ugeth_info("ecamptr : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->ecamptr,
- in_be32(&ugeth->p_rx_glbl_pram->ecamptr));
- ugeth_info("l2qt : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l2qt,
- in_be32(&ugeth->p_rx_glbl_pram->l2qt));
- ugeth_info("l3qt[0] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[0],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[0]));
- ugeth_info("l3qt[1] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[1],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[1]));
- ugeth_info("l3qt[2] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[2],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[2]));
- ugeth_info("l3qt[3] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[3],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[3]));
- ugeth_info("l3qt[4] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[4],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[4]));
- ugeth_info("l3qt[5] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[5],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[5]));
- ugeth_info("l3qt[6] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[6],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[6]));
- ugeth_info("l3qt[7] : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->l3qt[7],
- in_be32(&ugeth->p_rx_glbl_pram->l3qt[7]));
- ugeth_info("vlantype : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->vlantype,
- in_be16(&ugeth->p_rx_glbl_pram->vlantype));
- ugeth_info("vlantci : addr - 0x%08x, val - 0x%04x",
- (u32) & ugeth->p_rx_glbl_pram->vlantci,
- in_be16(&ugeth->p_rx_glbl_pram->vlantci));
- for (i = 0; i < 64; i++)
- ugeth_info
- ("addressfiltering[%d]: addr - 0x%08x, val - 0x%02x",
- i,
- (u32) & ugeth->p_rx_glbl_pram->addressfiltering[i],
- ugeth->p_rx_glbl_pram->addressfiltering[i]);
- ugeth_info("exfGlobalParam : addr - 0x%08x, val - 0x%08x",
- (u32) & ugeth->p_rx_glbl_pram->exfGlobalParam,
- in_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam));
- }
- if (ugeth->p_send_q_mem_reg) {
- ugeth_info("Send Q memory registers:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_send_q_mem_reg);
- for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) {
- ugeth_info("SQQD[%d]:", i);
- ugeth_info("Base address: 0x%08x",
- (u32) & ugeth->p_send_q_mem_reg->sqqd[i]);
- mem_disp((u8 *) & ugeth->p_send_q_mem_reg->sqqd[i],
- sizeof(struct ucc_geth_send_queue_qd));
- }
- }
- if (ugeth->p_scheduler) {
- ugeth_info("Scheduler:");
- ugeth_info("Base address: 0x%08x", (u32) ugeth->p_scheduler);
- mem_disp((u8 *) ugeth->p_scheduler,
- sizeof(*ugeth->p_scheduler));
- }
- if (ugeth->p_tx_fw_statistics_pram) {
- ugeth_info("TX FW statistics pram:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_tx_fw_statistics_pram);
- mem_disp((u8 *) ugeth->p_tx_fw_statistics_pram,
- sizeof(*ugeth->p_tx_fw_statistics_pram));
- }
- if (ugeth->p_rx_fw_statistics_pram) {
- ugeth_info("RX FW statistics pram:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_rx_fw_statistics_pram);
- mem_disp((u8 *) ugeth->p_rx_fw_statistics_pram,
- sizeof(*ugeth->p_rx_fw_statistics_pram));
- }
- if (ugeth->p_rx_irq_coalescing_tbl) {
- ugeth_info("RX IRQ coalescing tables:");
- ugeth_info("Base address: 0x%08x",
- (u32) ugeth->p_rx_irq_coalescing_tbl);
- for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) {
- ugeth_info("RX IRQ coalescing table entry[%d]:", i);
- ugeth_info("Base address: 0x%08x",
- (u32) & ugeth->p_rx_irq_coalescing_tbl->
- coalescingentry[i]);