2006-08-15 02:00:11 -04:00
|
|
|
/*
|
2007-05-11 19:25:07 -04:00
|
|
|
* Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
|
2006-08-15 02:00:11 -04:00
|
|
|
*
|
|
|
|
* Author: Shlomi Gridish <gridish@freescale.com>
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
* Li Yang <leoli@freescale.com>
|
2006-08-15 02:00:11 -04:00
|
|
|
*
|
|
|
|
* 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/fsl_devices.h>
|
|
|
|
#include <linux/mii.h>
|
2007-04-13 02:26:03 -04:00
|
|
|
#include <linux/phy.h>
|
2007-01-09 13:31:38 -05:00
|
|
|
#include <linux/workqueue.h>
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2006-11-15 13:29:35 -05:00
|
|
|
#include <asm/of_platform.h>
|
2006-08-15 02:00:11 -04:00
|
|
|
#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 "ucc_geth.h"
|
2007-04-13 02:26:03 -04:00
|
|
|
#include "ucc_geth_mii.h"
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
#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 */
|
2007-07-18 23:48:29 -04:00
|
|
|
#define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-07-18 23:47:47 -04:00
|
|
|
void uec_set_ethtool_ops(struct net_device *netdev);
|
2007-10-15 09:43:50 -04:00
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
static DEFINE_SPINLOCK(ugeth_lock);
|
|
|
|
|
2007-07-18 23:48:29 -04:00
|
|
|
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)");
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct ucc_geth_info ugeth_primary_info = {
|
2006-08-15 02:00:11 -04:00
|
|
|
.uf_info = {
|
|
|
|
.bd_mem_part = MEM_PART_SYSTEM,
|
|
|
|
.rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES,
|
|
|
|
.max_rx_buf_length = 1536,
|
2007-04-13 02:26:03 -04:00
|
|
|
/* adjusted at startup if max-speed 1000 */
|
2006-08-15 02:00:11 -04:00
|
|
|
.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,
|
2007-07-18 23:47:47 -04:00
|
|
|
.transmitFlowControl = 1,
|
2006-08-15 02:00:11 -04:00
|
|
|
.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,
|
2007-07-18 23:47:47 -04:00
|
|
|
.statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
|
|
|
|
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
|
|
|
|
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
|
2006-08-15 02:00:11 -04:00
|
|
|
.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_4,
|
|
|
|
.numThreadsRx = UCC_GETH_NUM_OF_THREADS_4,
|
|
|
|
.riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
|
|
|
|
.riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
|
|
|
|
};
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct ucc_geth_info ugeth_info[8];
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
#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 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_FILTERING
|
|
|
|
static void enqueue(struct list_head *node, struct list_head *lh)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
2006-12-07 14:31:07 -05:00
|
|
|
spin_lock_irqsave(&ugeth_lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
list_add_tail(node, lh);
|
2006-12-07 14:31:07 -05:00
|
|
|
spin_unlock_irqrestore(&ugeth_lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_FILTERING */
|
|
|
|
|
|
|
|
static struct list_head *dequeue(struct list_head *lh)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
2006-12-07 14:31:07 -05:00
|
|
|
spin_lock_irqsave(&ugeth_lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (!list_empty(lh)) {
|
|
|
|
struct list_head *node = lh->next;
|
|
|
|
list_del(node);
|
2006-12-07 14:31:07 -05:00
|
|
|
spin_unlock_irqrestore(&ugeth_lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
return node;
|
|
|
|
} else {
|
2006-12-07 14:31:07 -05:00
|
|
|
spin_unlock_irqrestore(&ugeth_lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, u8 *bd)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
struct sk_buff *skb = NULL;
|
|
|
|
|
|
|
|
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->dev;
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
out_be32(&((struct qe_bd *)bd)->buf,
|
2006-08-15 02:00:11 -04:00
|
|
|
dma_map_single(NULL,
|
|
|
|
skb->data,
|
|
|
|
ugeth->ug_info->uf_info.max_rx_buf_length +
|
|
|
|
UCC_GETH_RX_DATA_BUF_ALIGNMENT,
|
|
|
|
DMA_FROM_DEVICE));
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
out_be32((u32 *)bd, (R_E | R_I | (in_be32((u32 *)bd) & R_W)));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
u8 *bd;
|
|
|
|
u32 bd_status;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
bd = ugeth->p_rx_bd_ring[rxQ];
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
do {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd_status = in_be32((u32*)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
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 */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
i++;
|
|
|
|
} while (!(bd_status & R_W));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
|
2006-08-15 02:00:11 -04:00
|
|
|
volatile u32 *p_start,
|
|
|
|
u8 num_entries,
|
|
|
|
u32 thread_size,
|
|
|
|
u32 thread_alignment,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enum qe_risc_allocation risc,
|
2006-08-15 02:00:11 -04:00
|
|
|
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) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("fill_init_enet_entries: Can not get SNUM.");
|
2006-08-15 02:00:11 -04:00
|
|
|
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);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(init_enet_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory.");
|
2006-08-15 02:00:11 -04:00
|
|
|
qe_put_snum((u8) snum);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*(p_start++) =
|
|
|
|
((u8) snum << ENET_INIT_PARAM_SNUM_SHIFT) | init_enet_offset
|
|
|
|
| risc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int return_init_enet_entries(struct ucc_geth_private *ugeth,
|
2006-08-15 02:00:11 -04:00
|
|
|
volatile u32 *p_start,
|
|
|
|
u8 num_entries,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enum qe_risc_allocation risc,
|
2006-08-15 02:00:11 -04:00
|
|
|
int skip_page_for_first_entry)
|
|
|
|
{
|
|
|
|
u32 init_enet_offset;
|
|
|
|
u8 i;
|
|
|
|
int snum;
|
|
|
|
|
|
|
|
for (i = 0; i < num_entries; i++) {
|
|
|
|
/* Check that this entry was actually valid --
|
|
|
|
needed in case failed in allocations */
|
|
|
|
if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) {
|
|
|
|
snum =
|
|
|
|
(u32) (*p_start & 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);
|
|
|
|
qe_muram_free(init_enet_offset);
|
|
|
|
}
|
|
|
|
*(p_start++) = 0; /* Just for cosmetics */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int dump_init_enet_entries(struct ucc_geth_private *ugeth,
|
2006-08-15 02:00:11 -04:00
|
|
|
volatile u32 *p_start,
|
|
|
|
u8 num_entries,
|
|
|
|
u32 thread_size,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enum qe_risc_allocation risc,
|
2006-08-15 02:00:11 -04:00
|
|
|
int skip_page_for_first_entry)
|
|
|
|
{
|
|
|
|
u32 init_enet_offset;
|
|
|
|
u8 i;
|
|
|
|
int snum;
|
|
|
|
|
|
|
|
for (i = 0; i < num_entries; i++) {
|
|
|
|
/* Check that this entry was actually valid --
|
|
|
|
needed in case failed in allocations */
|
|
|
|
if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) {
|
|
|
|
snum =
|
|
|
|
(u32) (*p_start & 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
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_FILTERING
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct enet_addr_container *get_enet_addr_container(void)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct enet_addr_container *enet_addr_cont;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* allocate memory */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enet_addr_cont = kmalloc(sizeof(struct enet_addr_container), GFP_KERNEL);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (!enet_addr_cont) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ugeth_err("%s: No memory for enet_addr_container object.",
|
2006-08-15 02:00:11 -04:00
|
|
|
__FUNCTION__);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return enet_addr_cont;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_FILTERING */
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void put_enet_addr_container(struct enet_addr_container *enet_addr_cont)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
kfree(enet_addr_cont);
|
|
|
|
}
|
|
|
|
|
2007-01-09 13:31:38 -05:00
|
|
|
static void set_mac_addr(__be16 __iomem *reg, u8 *mac)
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
{
|
|
|
|
out_be16(®[0], ((u16)mac[5] << 8) | mac[4]);
|
|
|
|
out_be16(®[1], ((u16)mac[3] << 8) | mac[2]);
|
|
|
|
out_be16(®[2], ((u16)mac[1] << 8) | mac[0]);
|
|
|
|
}
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
#ifdef CONFIG_UGETH_FILTERING
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int hw_add_addr_in_paddr(struct ucc_geth_private *ugeth,
|
|
|
|
u8 *p_enet_addr, u8 paddr_num)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
if (!(paddr_num < NUM_OF_PADDRS)) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ugeth_warn("%s: Illegal paddr_num.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
|
2006-08-15 02:00:11 -04:00
|
|
|
addressfiltering;
|
|
|
|
|
|
|
|
/* Ethernet frames are defined in Little Endian mode, */
|
|
|
|
/* therefore to insert the address we reverse the bytes. */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
set_mac_addr(&p_82xx_addr_filt->paddr[paddr_num].h, p_enet_addr);
|
2006-08-15 02:00:11 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_FILTERING */
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
if (!(paddr_num < NUM_OF_PADDRS)) {
|
|
|
|
ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
|
2006-08-15 02:00:11 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
|
|
|
|
u8 *p_enet_addr)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 cecr_subblock;
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
|
2006-08-15 02:00:11 -04:00
|
|
|
addressfiltering;
|
|
|
|
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
|
|
|
|
|
|
|
|
/* Ethernet frames are defined in Little Endian mode,
|
|
|
|
therefor to insert */
|
|
|
|
/* the address to the hash (Big Endian mode), we reverse the bytes.*/
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
|
|
|
|
set_mac_addr(&p_82xx_addr_filt->taddr.h, p_enet_addr);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
qe_issue_cmd(QE_SET_GROUP_ADDRESS, cecr_subblock,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
QE_CR_PROTOCOL_ETHERNET, 0);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_MAGIC_PACKET
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void magic_packet_detection_enable(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
struct ucc_geth *ug_regs;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 maccfg2, uccm;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
ug_regs = ugeth->ug_regs;
|
|
|
|
|
|
|
|
/* Enable interrupts for magic packet detection */
|
|
|
|
uccm = in_be32(uccf->p_uccm);
|
|
|
|
uccm |= UCCE_MPD;
|
|
|
|
out_be32(uccf->p_uccm, uccm);
|
|
|
|
|
|
|
|
/* Enable magic packet detection */
|
|
|
|
maccfg2 = in_be32(&ug_regs->maccfg2);
|
|
|
|
maccfg2 |= MACCFG2_MPE;
|
|
|
|
out_be32(&ug_regs->maccfg2, maccfg2);
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void magic_packet_detection_disable(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
struct ucc_geth *ug_regs;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 maccfg2, uccm;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
ug_regs = ugeth->ug_regs;
|
|
|
|
|
|
|
|
/* Disable interrupts for magic packet detection */
|
|
|
|
uccm = in_be32(uccf->p_uccm);
|
|
|
|
uccm &= ~UCCE_MPD;
|
|
|
|
out_be32(uccf->p_uccm, uccm);
|
|
|
|
|
|
|
|
/* Disable magic packet detection */
|
|
|
|
maccfg2 = in_be32(&ug_regs->maccfg2);
|
|
|
|
maccfg2 &= ~MACCFG2_MPE;
|
|
|
|
out_be32(&ug_regs->maccfg2, maccfg2);
|
|
|
|
}
|
|
|
|
#endif /* MAGIC_PACKET */
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static inline int compare_addr(u8 **addr1, u8 **addr2)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void get_statistics(struct ucc_geth_private *ugeth,
|
|
|
|
struct ucc_geth_tx_firmware_statistics *
|
2006-08-15 02:00:11 -04:00
|
|
|
tx_firmware_statistics,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_rx_firmware_statistics *
|
2006-08-15 02:00:11 -04:00
|
|
|
rx_firmware_statistics,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_hardware_statistics *hardware_statistics)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast *uf_regs;
|
|
|
|
struct ucc_geth *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;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ug_regs = ugeth->ug_regs;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
uf_regs = (struct ucc_fast *) ug_regs;
|
2006-08-15 02:00:11 -04:00
|
|
|
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) & 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void dump_bds(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
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] *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct qe_bd));
|
2006-08-15 02:00:11 -04:00
|
|
|
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] *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct qe_bd));
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth_info("RX BDs[%d]", i);
|
|
|
|
mem_disp(ugeth->p_rx_bd_ring[i], length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void dump_regs(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ugeth_info("UCC%d Geth registers:", ugeth->ug_info->uf_info.ucc_num);
|
|
|
|
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],
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_data_tx));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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],
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_data_rx));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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],
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_send_queue_qd));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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]);
|
|
|
|
ugeth_info
|
|
|
|
("interruptcoalescingmaxvalue: addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_irq_coalescing_tbl->
|
|
|
|
coalescingentry[i].interruptcoalescingmaxvalue,
|
|
|
|
in_be32(&ugeth->p_rx_irq_coalescing_tbl->
|
|
|
|
coalescingentry[i].
|
|
|
|
interruptcoalescingmaxvalue));
|
|
|
|
ugeth_info
|
|
|
|
("interruptcoalescingcounter : addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_irq_coalescing_tbl->
|
|
|
|
coalescingentry[i].interruptcoalescingcounter,
|
|
|
|
in_be32(&ugeth->p_rx_irq_coalescing_tbl->
|
|
|
|
coalescingentry[i].
|
|
|
|
interruptcoalescingcounter));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ugeth->p_rx_bd_qs_tbl) {
|
|
|
|
ugeth_info("RX BD QS tables:");
|
|
|
|
ugeth_info("Base address: 0x%08x", (u32) ugeth->p_rx_bd_qs_tbl);
|
|
|
|
for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) {
|
|
|
|
ugeth_info("RX BD QS table[%d]:", i);
|
|
|
|
ugeth_info("Base address: 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_bd_qs_tbl[i]);
|
|
|
|
ugeth_info
|
|
|
|
("bdbaseptr : addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_bd_qs_tbl[i].bdbaseptr,
|
|
|
|
in_be32(&ugeth->p_rx_bd_qs_tbl[i].bdbaseptr));
|
|
|
|
ugeth_info
|
|
|
|
("bdptr : addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_bd_qs_tbl[i].bdptr,
|
|
|
|
in_be32(&ugeth->p_rx_bd_qs_tbl[i].bdptr));
|
|
|
|
ugeth_info
|
|
|
|
("externalbdbaseptr: addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
|
|
|
|
in_be32(&ugeth->p_rx_bd_qs_tbl[i].
|
|
|
|
externalbdbaseptr));
|
|
|
|
ugeth_info
|
|
|
|
("externalbdptr : addr - 0x%08x, val - 0x%08x",
|
|
|
|
(u32) & ugeth->p_rx_bd_qs_tbl[i].externalbdptr,
|
|
|
|
in_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdptr));
|
|
|
|
ugeth_info("ucode RX Prefetched BDs:");
|
|
|
|
ugeth_info("Base address: 0x%08x",
|
|
|
|
(u32)
|
|
|
|
qe_muram_addr(in_be32
|
|
|
|
(&ugeth->p_rx_bd_qs_tbl[i].
|
|
|
|
bdbaseptr)));
|
|
|
|
mem_disp((u8 *)
|
|
|
|
qe_muram_addr(in_be32
|
|
|
|
(&ugeth->p_rx_bd_qs_tbl[i].
|
|
|
|
bdbaseptr)),
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_rx_prefetched_bds));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ugeth->p_init_enet_param_shadow) {
|
|
|
|
int size;
|
|
|
|
ugeth_info("Init enet param shadow:");
|
|
|
|
ugeth_info("Base address: 0x%08x",
|
|
|
|
(u32) ugeth->p_init_enet_param_shadow);
|
|
|
|
mem_disp((u8 *) ugeth->p_init_enet_param_shadow,
|
|
|
|
sizeof(*ugeth->p_init_enet_param_shadow));
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
size = sizeof(struct ucc_geth_thread_rx_pram);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ugeth->ug_info->rxExtendedFiltering) {
|
|
|
|
size +=
|
|
|
|
THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING;
|
|
|
|
if (ugeth->ug_info->largestexternallookupkeysize ==
|
|
|
|
QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
|
|
|
|
size +=
|
|
|
|
THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8;
|
|
|
|
if (ugeth->ug_info->largestexternallookupkeysize ==
|
|
|
|
QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES)
|
|
|
|
size +=
|
|
|
|
THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16;
|
|
|
|
}
|
|
|
|
|
|
|
|
dump_init_enet_entries(ugeth,
|
|
|
|
&(ugeth->p_init_enet_param_shadow->
|
|
|
|
txthread[0]),
|
|
|
|
ENET_INIT_PARAM_MAX_ENTRIES_TX,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_tx_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->ug_info->riscTx, 0);
|
|
|
|
dump_init_enet_entries(ugeth,
|
|
|
|
&(ugeth->p_init_enet_param_shadow->
|
|
|
|
rxthread[0]),
|
|
|
|
ENET_INIT_PARAM_MAX_ENTRIES_RX, size,
|
|
|
|
ugeth->ug_info->riscRx, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
static void init_default_reg_vals(volatile u32 *upsmr_register,
|
|
|
|
volatile u32 *maccfg1_register,
|
|
|
|
volatile u32 *maccfg2_register)
|
|
|
|
{
|
|
|
|
out_be32(upsmr_register, UCC_GETH_UPSMR_INIT);
|
|
|
|
out_be32(maccfg1_register, UCC_GETH_MACCFG1_INIT);
|
|
|
|
out_be32(maccfg2_register, UCC_GETH_MACCFG2_INIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_half_duplex_params(int alt_beb,
|
|
|
|
int back_pressure_no_backoff,
|
|
|
|
int no_backoff,
|
|
|
|
int excess_defer,
|
|
|
|
u8 alt_beb_truncation,
|
|
|
|
u8 max_retransmissions,
|
|
|
|
u8 collision_window,
|
|
|
|
volatile u32 *hafdup_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
if ((alt_beb_truncation > HALFDUP_ALT_BEB_TRUNCATION_MAX) ||
|
|
|
|
(max_retransmissions > HALFDUP_MAX_RETRANSMISSION_MAX) ||
|
|
|
|
(collision_window > HALFDUP_COLLISION_WINDOW_MAX))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
value = (u32) (alt_beb_truncation << HALFDUP_ALT_BEB_TRUNCATION_SHIFT);
|
|
|
|
|
|
|
|
if (alt_beb)
|
|
|
|
value |= HALFDUP_ALT_BEB;
|
|
|
|
if (back_pressure_no_backoff)
|
|
|
|
value |= HALFDUP_BACK_PRESSURE_NO_BACKOFF;
|
|
|
|
if (no_backoff)
|
|
|
|
value |= HALFDUP_NO_BACKOFF;
|
|
|
|
if (excess_defer)
|
|
|
|
value |= HALFDUP_EXCESSIVE_DEFER;
|
|
|
|
|
|
|
|
value |= (max_retransmissions << HALFDUP_MAX_RETRANSMISSION_SHIFT);
|
|
|
|
|
|
|
|
value |= collision_window;
|
|
|
|
|
|
|
|
out_be32(hafdup_register, value);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
|
|
|
|
u8 non_btb_ipg,
|
|
|
|
u8 min_ifg,
|
|
|
|
u8 btb_ipg,
|
|
|
|
volatile u32 *ipgifg_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
/* Non-Back-to-back IPG part 1 should be <= Non-Back-to-back
|
|
|
|
IPG part 2 */
|
|
|
|
if (non_btb_cs_ipg > non_btb_ipg)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if ((non_btb_cs_ipg > IPGIFG_NON_BACK_TO_BACK_IFG_PART1_MAX) ||
|
|
|
|
(non_btb_ipg > IPGIFG_NON_BACK_TO_BACK_IFG_PART2_MAX) ||
|
|
|
|
/*(min_ifg > IPGIFG_MINIMUM_IFG_ENFORCEMENT_MAX) || */
|
|
|
|
(btb_ipg > IPGIFG_BACK_TO_BACK_IFG_MAX))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
value |=
|
|
|
|
((non_btb_cs_ipg << IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT) &
|
|
|
|
IPGIFG_NBTB_CS_IPG_MASK);
|
|
|
|
value |=
|
|
|
|
((non_btb_ipg << IPGIFG_NON_BACK_TO_BACK_IFG_PART2_SHIFT) &
|
|
|
|
IPGIFG_NBTB_IPG_MASK);
|
|
|
|
value |=
|
|
|
|
((min_ifg << IPGIFG_MINIMUM_IFG_ENFORCEMENT_SHIFT) &
|
|
|
|
IPGIFG_MIN_IFG_MASK);
|
|
|
|
value |= (btb_ipg & IPGIFG_BTB_IPG_MASK);
|
|
|
|
|
|
|
|
out_be32(ipgifg_register, value);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-07-18 23:47:47 -04:00
|
|
|
int init_flow_control_params(u32 automatic_flow_control_mode,
|
2006-08-15 02:00:11 -04:00
|
|
|
int rx_flow_control_enable,
|
|
|
|
int tx_flow_control_enable,
|
|
|
|
u16 pause_period,
|
|
|
|
u16 extension_field,
|
|
|
|
volatile u32 *upsmr_register,
|
|
|
|
volatile u32 *uempr_register,
|
|
|
|
volatile u32 *maccfg1_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
/* Set UEMPR register */
|
|
|
|
value = (u32) pause_period << UEMPR_PAUSE_TIME_VALUE_SHIFT;
|
|
|
|
value |= (u32) extension_field << UEMPR_EXTENDED_PAUSE_TIME_VALUE_SHIFT;
|
|
|
|
out_be32(uempr_register, value);
|
|
|
|
|
|
|
|
/* Set UPSMR register */
|
|
|
|
value = in_be32(upsmr_register);
|
|
|
|
value |= automatic_flow_control_mode;
|
|
|
|
out_be32(upsmr_register, value);
|
|
|
|
|
|
|
|
value = in_be32(maccfg1_register);
|
|
|
|
if (rx_flow_control_enable)
|
|
|
|
value |= MACCFG1_FLOW_RX;
|
|
|
|
if (tx_flow_control_enable)
|
|
|
|
value |= MACCFG1_FLOW_TX;
|
|
|
|
out_be32(maccfg1_register, value);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_hw_statistics_gathering_mode(int enable_hardware_statistics,
|
|
|
|
int auto_zero_hardware_statistics,
|
|
|
|
volatile u32 *upsmr_register,
|
|
|
|
volatile u16 *uescr_register)
|
|
|
|
{
|
|
|
|
u32 upsmr_value = 0;
|
|
|
|
u16 uescr_value = 0;
|
|
|
|
/* Enable hardware statistics gathering if requested */
|
|
|
|
if (enable_hardware_statistics) {
|
|
|
|
upsmr_value = in_be32(upsmr_register);
|
|
|
|
upsmr_value |= UPSMR_HSE;
|
|
|
|
out_be32(upsmr_register, upsmr_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear hardware statistics counters */
|
|
|
|
uescr_value = in_be16(uescr_register);
|
|
|
|
uescr_value |= UESCR_CLRCNT;
|
|
|
|
/* Automatically zero hardware statistics counters on read,
|
|
|
|
if requested */
|
|
|
|
if (auto_zero_hardware_statistics)
|
|
|
|
uescr_value |= UESCR_AUTOZ;
|
|
|
|
out_be16(uescr_register, uescr_value);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_firmware_statistics_gathering_mode(int
|
|
|
|
enable_tx_firmware_statistics,
|
|
|
|
int enable_rx_firmware_statistics,
|
|
|
|
volatile u32 *tx_rmon_base_ptr,
|
|
|
|
u32 tx_firmware_statistics_structure_address,
|
|
|
|
volatile u32 *rx_rmon_base_ptr,
|
|
|
|
u32 rx_firmware_statistics_structure_address,
|
|
|
|
volatile u16 *temoder_register,
|
|
|
|
volatile u32 *remoder_register)
|
|
|
|
{
|
|
|
|
/* Note: this function does not check if */
|
|
|
|
/* the parameters it receives are NULL */
|
|
|
|
u16 temoder_value;
|
|
|
|
u32 remoder_value;
|
|
|
|
|
|
|
|
if (enable_tx_firmware_statistics) {
|
|
|
|
out_be32(tx_rmon_base_ptr,
|
|
|
|
tx_firmware_statistics_structure_address);
|
|
|
|
temoder_value = in_be16(temoder_register);
|
|
|
|
temoder_value |= TEMODER_TX_RMON_STATISTICS_ENABLE;
|
|
|
|
out_be16(temoder_register, temoder_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enable_rx_firmware_statistics) {
|
|
|
|
out_be32(rx_rmon_base_ptr,
|
|
|
|
rx_firmware_statistics_structure_address);
|
|
|
|
remoder_value = in_be32(remoder_register);
|
|
|
|
remoder_value |= REMODER_RX_RMON_STATISTICS_ENABLE;
|
|
|
|
out_be32(remoder_register, remoder_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_mac_station_addr_regs(u8 address_byte_0,
|
|
|
|
u8 address_byte_1,
|
|
|
|
u8 address_byte_2,
|
|
|
|
u8 address_byte_3,
|
|
|
|
u8 address_byte_4,
|
|
|
|
u8 address_byte_5,
|
|
|
|
volatile u32 *macstnaddr1_register,
|
|
|
|
volatile u32 *macstnaddr2_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
/* Example: for a station address of 0x12345678ABCD, */
|
|
|
|
/* 0x12 is byte 0, 0x34 is byte 1 and so on and 0xCD is byte 5 */
|
|
|
|
|
|
|
|
/* MACSTNADDR1 Register: */
|
|
|
|
|
|
|
|
/* 0 7 8 15 */
|
|
|
|
/* station address byte 5 station address byte 4 */
|
|
|
|
/* 16 23 24 31 */
|
|
|
|
/* station address byte 3 station address byte 2 */
|
|
|
|
value |= (u32) ((address_byte_2 << 0) & 0x000000FF);
|
|
|
|
value |= (u32) ((address_byte_3 << 8) & 0x0000FF00);
|
|
|
|
value |= (u32) ((address_byte_4 << 16) & 0x00FF0000);
|
|
|
|
value |= (u32) ((address_byte_5 << 24) & 0xFF000000);
|
|
|
|
|
|
|
|
out_be32(macstnaddr1_register, value);
|
|
|
|
|
|
|
|
/* MACSTNADDR2 Register: */
|
|
|
|
|
|
|
|
/* 0 7 8 15 */
|
|
|
|
/* station address byte 1 station address byte 0 */
|
|
|
|
/* 16 23 24 31 */
|
|
|
|
/* reserved reserved */
|
|
|
|
value = 0;
|
|
|
|
value |= (u32) ((address_byte_0 << 16) & 0x00FF0000);
|
|
|
|
value |= (u32) ((address_byte_1 << 24) & 0xFF000000);
|
|
|
|
|
|
|
|
out_be32(macstnaddr2_register, value);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_check_frame_length_mode(int length_check,
|
|
|
|
volatile u32 *maccfg2_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
value = in_be32(maccfg2_register);
|
|
|
|
|
|
|
|
if (length_check)
|
|
|
|
value |= MACCFG2_LC;
|
|
|
|
else
|
|
|
|
value &= ~MACCFG2_LC;
|
|
|
|
|
|
|
|
out_be32(maccfg2_register, value);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_preamble_length(u8 preamble_length,
|
|
|
|
volatile u32 *maccfg2_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
if ((preamble_length < 3) || (preamble_length > 7))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
value = in_be32(maccfg2_register);
|
|
|
|
value &= ~MACCFG2_PREL_MASK;
|
|
|
|
value |= (preamble_length << MACCFG2_PREL_SHIFT);
|
|
|
|
out_be32(maccfg2_register, value);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_rx_parameters(int reject_broadcast,
|
|
|
|
int receive_short_frames,
|
|
|
|
int promiscuous, volatile u32 *upsmr_register)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
value = in_be32(upsmr_register);
|
|
|
|
|
|
|
|
if (reject_broadcast)
|
|
|
|
value |= UPSMR_BRO;
|
|
|
|
else
|
|
|
|
value &= ~UPSMR_BRO;
|
|
|
|
|
|
|
|
if (receive_short_frames)
|
|
|
|
value |= UPSMR_RSH;
|
|
|
|
else
|
|
|
|
value &= ~UPSMR_RSH;
|
|
|
|
|
|
|
|
if (promiscuous)
|
|
|
|
value |= UPSMR_PRO;
|
|
|
|
else
|
|
|
|
value &= ~UPSMR_PRO;
|
|
|
|
|
|
|
|
out_be32(upsmr_register, value);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_max_rx_buff_len(u16 max_rx_buf_len,
|
|
|
|
volatile u16 *mrblr_register)
|
|
|
|
{
|
|
|
|
/* max_rx_buf_len value must be a multiple of 128 */
|
|
|
|
if ((max_rx_buf_len == 0)
|
|
|
|
|| (max_rx_buf_len % UCC_GETH_MRBLR_ALIGNMENT))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
out_be16(mrblr_register, max_rx_buf_len);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int init_min_frame_len(u16 min_frame_length,
|
|
|
|
volatile u16 *minflr_register,
|
|
|
|
volatile u16 *mrblr_register)
|
|
|
|
{
|
|
|
|
u16 mrblr_value = 0;
|
|
|
|
|
|
|
|
mrblr_value = in_be16(mrblr_register);
|
|
|
|
if (min_frame_length >= (mrblr_value - 4))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
out_be16(minflr_register, min_frame_length);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int adjust_enet_interface(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_info *ug_info;
|
|
|
|
struct ucc_geth *ug_regs;
|
|
|
|
struct ucc_fast *uf_regs;
|
2007-04-13 02:26:03 -04:00
|
|
|
int ret_val;
|
|
|
|
u32 upsmr, maccfg2, tbiBaseAddress;
|
2006-08-15 02:00:11 -04:00
|
|
|
u16 value;
|
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
|
|
|
ug_info = ugeth->ug_info;
|
|
|
|
ug_regs = ugeth->ug_regs;
|
|
|
|
uf_regs = ugeth->uccf->uf_regs;
|
|
|
|
|
|
|
|
/* Set MACCFG2 */
|
|
|
|
maccfg2 = in_be32(&ug_regs->maccfg2);
|
|
|
|
maccfg2 &= ~MACCFG2_INTERFACE_MODE_MASK;
|
2007-04-13 02:26:03 -04:00
|
|
|
if ((ugeth->max_speed == SPEED_10) ||
|
|
|
|
(ugeth->max_speed == SPEED_100))
|
2006-08-15 02:00:11 -04:00
|
|
|
maccfg2 |= MACCFG2_INTERFACE_MODE_NIBBLE;
|
2007-04-13 02:26:03 -04:00
|
|
|
else if (ugeth->max_speed == SPEED_1000)
|
2006-08-15 02:00:11 -04:00
|
|
|
maccfg2 |= MACCFG2_INTERFACE_MODE_BYTE;
|
|
|
|
maccfg2 |= ug_info->padAndCrc;
|
|
|
|
out_be32(&ug_regs->maccfg2, maccfg2);
|
|
|
|
|
|
|
|
/* Set UPSMR */
|
|
|
|
upsmr = in_be32(&uf_regs->upsmr);
|
|
|
|
upsmr &= ~(UPSMR_RPM | UPSMR_R10M | UPSMR_TBIM | UPSMR_RMM);
|
2007-04-13 02:26:03 -04:00
|
|
|
if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
|
2007-11-26 17:17:58 -05:00
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
|
2007-04-13 02:26:03 -04:00
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
|
2006-08-15 02:00:11 -04:00
|
|
|
upsmr |= UPSMR_RPM;
|
2007-04-13 02:26:03 -04:00
|
|
|
switch (ugeth->max_speed) {
|
|
|
|
case SPEED_10:
|
|
|
|
upsmr |= UPSMR_R10M;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case SPEED_100:
|
|
|
|
if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI)
|
|
|
|
upsmr |= UPSMR_RMM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
|
2006-08-15 02:00:11 -04:00
|
|
|
upsmr |= UPSMR_TBIM;
|
2007-04-13 02:26:03 -04:00
|
|
|
}
|
2006-08-15 02:00:11 -04:00
|
|
|
out_be32(&uf_regs->upsmr, upsmr);
|
|
|
|
|
|
|
|
/* Disable autonegotiation in tbi mode, because by default it
|
|
|
|
comes up in autonegotiation mode. */
|
|
|
|
/* Note that this depends on proper setting in utbipar register. */
|
2007-04-13 02:26:03 -04:00
|
|
|
if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
|
2006-08-15 02:00:11 -04:00
|
|
|
tbiBaseAddress = in_be32(&ug_regs->utbipar);
|
|
|
|
tbiBaseAddress &= UTBIPAR_PHY_ADDRESS_MASK;
|
|
|
|
tbiBaseAddress >>= UTBIPAR_PHY_ADDRESS_SHIFT;
|
2007-04-13 02:26:03 -04:00
|
|
|
value = ugeth->phydev->bus->read(ugeth->phydev->bus,
|
|
|
|
(u8) tbiBaseAddress, ENET_TBI_MII_CR);
|
2006-08-15 02:00:11 -04:00
|
|
|
value &= ~0x1000; /* Turn off autonegotiation */
|
2007-04-13 02:26:03 -04:00
|
|
|
ugeth->phydev->bus->write(ugeth->phydev->bus,
|
|
|
|
(u8) tbiBaseAddress, ENET_TBI_MII_CR, value);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2);
|
|
|
|
|
|
|
|
ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2);
|
|
|
|
if (ret_val != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: Preamble length must be between 3 and 7 inclusive.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called every time the controller might need to be made
|
|
|
|
* aware of new link state. The PHY code conveys this
|
|
|
|
* information through variables in the ugeth structure, and this
|
|
|
|
* function converts those variables into the appropriate
|
|
|
|
* register values, and can bring down the device if needed.
|
|
|
|
*/
|
2007-04-13 02:26:03 -04:00
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
static void adjust_link(struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
|
|
|
struct ucc_geth *ug_regs;
|
2007-04-13 02:26:03 -04:00
|
|
|
struct ucc_fast *uf_regs;
|
|
|
|
struct phy_device *phydev = ugeth->phydev;
|
|
|
|
unsigned long flags;
|
|
|
|
int new_state = 0;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ug_regs = ugeth->ug_regs;
|
2007-04-13 02:26:03 -04:00
|
|
|
uf_regs = ugeth->uccf->uf_regs;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
spin_lock_irqsave(&ugeth->lock, flags);
|
|
|
|
|
|
|
|
if (phydev->link) {
|
|
|
|
u32 tempval = in_be32(&ug_regs->maccfg2);
|
|
|
|
u32 upsmr = in_be32(&uf_regs->upsmr);
|
2006-08-15 02:00:11 -04:00
|
|
|
/* Now we make sure that we can be in full duplex mode.
|
|
|
|
* If not, we operate in half-duplex mode. */
|
2007-04-13 02:26:03 -04:00
|
|
|
if (phydev->duplex != ugeth->oldduplex) {
|
|
|
|
new_state = 1;
|
|
|
|
if (!(phydev->duplex))
|
2006-08-15 02:00:11 -04:00
|
|
|
tempval &= ~(MACCFG2_FDX);
|
2007-04-13 02:26:03 -04:00
|
|
|
else
|
2006-08-15 02:00:11 -04:00
|
|
|
tempval |= MACCFG2_FDX;
|
2007-04-13 02:26:03 -04:00
|
|
|
ugeth->oldduplex = phydev->duplex;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
if (phydev->speed != ugeth->oldspeed) {
|
|
|
|
new_state = 1;
|
|
|
|
switch (phydev->speed) {
|
|
|
|
case SPEED_1000:
|
|
|
|
tempval = ((tempval &
|
|
|
|
~(MACCFG2_INTERFACE_MODE_MASK)) |
|
|
|
|
MACCFG2_INTERFACE_MODE_BYTE);
|
2007-02-08 04:34:42 -05:00
|
|
|
break;
|
2007-04-13 02:26:03 -04:00
|
|
|
case SPEED_100:
|
|
|
|
case SPEED_10:
|
|
|
|
tempval = ((tempval &
|
|
|
|
~(MACCFG2_INTERFACE_MODE_MASK)) |
|
|
|
|
MACCFG2_INTERFACE_MODE_NIBBLE);
|
|
|
|
/* if reduced mode, re-set UPSMR.R10M */
|
|
|
|
if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
|
2007-11-26 17:17:58 -05:00
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
|
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
|
2007-04-13 02:26:03 -04:00
|
|
|
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
|
|
|
|
if (phydev->speed == SPEED_10)
|
|
|
|
upsmr |= UPSMR_R10M;
|
|
|
|
else
|
|
|
|
upsmr &= ~(UPSMR_R10M);
|
|
|
|
}
|
2006-08-15 02:00:11 -04:00
|
|
|
break;
|
|
|
|
default:
|
2007-04-13 02:26:03 -04:00
|
|
|
if (netif_msg_link(ugeth))
|
|
|
|
ugeth_warn(
|
|
|
|
"%s: Ack! Speed (%d) is not 10/100/1000!",
|
|
|
|
dev->name, phydev->speed);
|
2006-08-15 02:00:11 -04:00
|
|
|
break;
|
|
|
|
}
|
2007-04-13 02:26:03 -04:00
|
|
|
ugeth->oldspeed = phydev->speed;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
out_be32(&ug_regs->maccfg2, tempval);
|
|
|
|
out_be32(&uf_regs->upsmr, upsmr);
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
if (!ugeth->oldlink) {
|
2007-04-13 02:26:03 -04:00
|
|
|
new_state = 1;
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->oldlink = 1;
|
|
|
|
netif_schedule(dev);
|
|
|
|
}
|
2007-04-13 02:26:03 -04:00
|
|
|
} else if (ugeth->oldlink) {
|
|
|
|
new_state = 1;
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->oldlink = 0;
|
|
|
|
ugeth->oldspeed = 0;
|
|
|
|
ugeth->oldduplex = -1;
|
|
|
|
}
|
2007-04-13 02:26:03 -04:00
|
|
|
|
|
|
|
if (new_state && netif_msg_link(ugeth))
|
|
|
|
phy_print_status(phydev);
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&ugeth->lock, flags);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Configure the PHY for dev.
|
|
|
|
* returns 0 if success. -1 if failure
|
|
|
|
*/
|
|
|
|
static int init_phy(struct net_device *dev)
|
|
|
|
{
|
2007-04-13 02:26:03 -04:00
|
|
|
struct ucc_geth_private *priv = netdev_priv(dev);
|
|
|
|
struct phy_device *phydev;
|
|
|
|
char phy_id[BUS_ID_SIZE];
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
priv->oldlink = 0;
|
|
|
|
priv->oldspeed = 0;
|
|
|
|
priv->oldduplex = -1;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->ug_info->mdio_bus,
|
|
|
|
priv->ug_info->phy_address);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
if (IS_ERR(phydev)) {
|
|
|
|
printk("%s: Could not attach to PHY\n", dev->name);
|
|
|
|
return PTR_ERR(phydev);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
phydev->supported &= (ADVERTISED_10baseT_Half |
|
2006-08-15 02:00:11 -04:00
|
|
|
ADVERTISED_10baseT_Full |
|
|
|
|
ADVERTISED_100baseT_Half |
|
2007-04-13 02:26:03 -04:00
|
|
|
ADVERTISED_100baseT_Full);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
if (priv->max_speed == SPEED_1000)
|
|
|
|
phydev->supported |= ADVERTISED_1000baseT_Full;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
phydev->advertising = phydev->supported;
|
2006-12-07 14:31:26 -05:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
priv->phydev = phydev;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 cecr_subblock;
|
|
|
|
u32 temp;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
/* Mask GRACEFUL STOP TX interrupt bit and clear it */
|
|
|
|
temp = in_be32(uccf->p_uccm);
|
|
|
|
temp &= ~UCCE_GRA;
|
|
|
|
out_be32(uccf->p_uccm, temp);
|
|
|
|
out_be32(uccf->p_ucce, UCCE_GRA); /* clear by writing 1 */
|
|
|
|
|
|
|
|
/* Issue host command */
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
|
|
|
|
qe_issue_cmd(QE_GRACEFUL_STOP_TX, cecr_subblock,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
QE_CR_PROTOCOL_ETHERNET, 0);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Wait for command to complete */
|
|
|
|
do {
|
|
|
|
temp = in_be32(uccf->p_ucce);
|
|
|
|
} while (!(temp & UCCE_GRA));
|
|
|
|
|
|
|
|
uccf->stopped_tx = 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 cecr_subblock;
|
|
|
|
u8 temp;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
/* Clear acknowledge bit */
|
|
|
|
temp = ugeth->p_rx_glbl_pram->rxgstpack;
|
|
|
|
temp &= ~GRACEFUL_STOP_ACKNOWLEDGE_RX;
|
|
|
|
ugeth->p_rx_glbl_pram->rxgstpack = temp;
|
|
|
|
|
|
|
|
/* Keep issuing command and checking acknowledge bit until
|
|
|
|
it is asserted, according to spec */
|
|
|
|
do {
|
|
|
|
/* Issue host command */
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.
|
|
|
|
ucc_num);
|
|
|
|
qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
QE_CR_PROTOCOL_ETHERNET, 0);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
temp = ugeth->p_rx_glbl_pram->rxgstpack;
|
|
|
|
} while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX));
|
|
|
|
|
|
|
|
uccf->stopped_rx = 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_restart_tx(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 cecr_subblock;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_issue_cmd(QE_RESTART_TX, cecr_subblock, QE_CR_PROTOCOL_ETHERNET, 0);
|
2006-08-15 02:00:11 -04:00
|
|
|
uccf->stopped_tx = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_restart_rx(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 cecr_subblock;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_issue_cmd(QE_RESTART_RX, cecr_subblock, QE_CR_PROTOCOL_ETHERNET,
|
2006-08-15 02:00:11 -04:00
|
|
|
0);
|
|
|
|
uccf->stopped_rx = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
int enabled_tx, enabled_rx;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
/* check if the UCC number is in range. */
|
|
|
|
if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
enabled_tx = uccf->enabled_tx;
|
|
|
|
enabled_rx = uccf->enabled_rx;
|
|
|
|
|
|
|
|
/* Get Tx and Rx going again, in case this channel was actively
|
|
|
|
disabled. */
|
|
|
|
if ((mode & COMM_DIR_TX) && (!enabled_tx) && uccf->stopped_tx)
|
|
|
|
ugeth_restart_tx(ugeth);
|
|
|
|
if ((mode & COMM_DIR_RX) && (!enabled_rx) && uccf->stopped_rx)
|
|
|
|
ugeth_restart_rx(ugeth);
|
|
|
|
|
|
|
|
ucc_fast_enable(uccf, mode); /* OK to do even if not disabled */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast_private *uccf;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
/* check if the UCC number is in range. */
|
|
|
|
if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Stop any transmissions */
|
|
|
|
if ((mode & COMM_DIR_TX) && uccf->enabled_tx && !uccf->stopped_tx)
|
|
|
|
ugeth_graceful_stop_tx(ugeth);
|
|
|
|
|
|
|
|
/* Stop any receptions */
|
|
|
|
if ((mode & COMM_DIR_RX) && uccf->enabled_rx && !uccf->stopped_rx)
|
|
|
|
ugeth_graceful_stop_rx(ugeth);
|
|
|
|
|
|
|
|
ucc_fast_disable(ugeth->uccf, mode); /* OK to do even if not enabled */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void ugeth_dump_regs(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
ucc_fast_dump_regs(ugeth->uccf);
|
|
|
|
dump_regs(ugeth);
|
|
|
|
dump_bds(ugeth);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_FILTERING
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_ext_filtering_serialize_tad(struct ucc_geth_tad_params *
|
2006-08-15 02:00:11 -04:00
|
|
|
p_UccGethTadParams,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct qe_fltr_tad *qe_fltr_tad)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
u16 temp;
|
|
|
|
|
|
|
|
/* Zero serialized TAD */
|
|
|
|
memset(qe_fltr_tad, 0, QE_FLTR_TAD_SIZE);
|
|
|
|
|
|
|
|
qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_V; /* Must have this */
|
|
|
|
if (p_UccGethTadParams->rx_non_dynamic_extended_features_mode ||
|
|
|
|
(p_UccGethTadParams->vtag_op != UCC_GETH_VLAN_OPERATION_TAGGED_NOP)
|
|
|
|
|| (p_UccGethTadParams->vnontag_op !=
|
|
|
|
UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP)
|
|
|
|
)
|
|
|
|
qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_EF;
|
|
|
|
if (p_UccGethTadParams->reject_frame)
|
|
|
|
qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_REJ;
|
|
|
|
temp =
|
|
|
|
(u16) (((u16) p_UccGethTadParams->
|
|
|
|
vtag_op) << UCC_GETH_TAD_VTAG_OP_SHIFT);
|
|
|
|
qe_fltr_tad->serialized[0] |= (u8) (temp >> 8); /* upper bits */
|
|
|
|
|
|
|
|
qe_fltr_tad->serialized[1] |= (u8) (temp & 0x00ff); /* lower bits */
|
|
|
|
if (p_UccGethTadParams->vnontag_op ==
|
|
|
|
UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT)
|
|
|
|
qe_fltr_tad->serialized[1] |= UCC_GETH_TAD_V_NON_VTAG_OP;
|
|
|
|
qe_fltr_tad->serialized[1] |=
|
|
|
|
p_UccGethTadParams->rqos << UCC_GETH_TAD_RQOS_SHIFT;
|
|
|
|
|
|
|
|
qe_fltr_tad->serialized[2] |=
|
|
|
|
p_UccGethTadParams->vpri << UCC_GETH_TAD_V_PRIORITY_SHIFT;
|
|
|
|
/* upper bits */
|
|
|
|
qe_fltr_tad->serialized[2] |= (u8) (p_UccGethTadParams->vid >> 8);
|
|
|
|
/* lower bits */
|
|
|
|
qe_fltr_tad->serialized[3] |= (u8) (p_UccGethTadParams->vid & 0x00ff);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct enet_addr_container_t
|
|
|
|
*ugeth_82xx_filtering_get_match_addr_in_hash(struct ucc_geth_private *ugeth,
|
|
|
|
struct enet_addr *p_enet_addr)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct enet_addr_container *enet_addr_cont;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct list_head *p_lh;
|
|
|
|
u16 i, num;
|
|
|
|
int32_t j;
|
|
|
|
u8 *p_counter;
|
|
|
|
|
|
|
|
if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) {
|
|
|
|
p_lh = &ugeth->group_hash_q;
|
|
|
|
p_counter = &(ugeth->numGroupAddrInHash);
|
|
|
|
} else {
|
|
|
|
p_lh = &ugeth->ind_hash_q;
|
|
|
|
p_counter = &(ugeth->numIndAddrInHash);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p_lh)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
num = *p_counter;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++) {
|
|
|
|
enet_addr_cont =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct enet_addr_container *)
|
2006-08-15 02:00:11 -04:00
|
|
|
ENET_ADDR_CONT_ENTRY(dequeue(p_lh));
|
|
|
|
for (j = ENET_NUM_OCTETS_PER_ADDRESS - 1; j >= 0; j--) {
|
|
|
|
if ((*p_enet_addr)[j] != (enet_addr_cont->address)[j])
|
|
|
|
break;
|
|
|
|
if (j == 0)
|
|
|
|
return enet_addr_cont; /* Found */
|
|
|
|
}
|
|
|
|
enqueue(p_lh, &enet_addr_cont->node); /* Put it back */
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_82xx_filtering_add_addr_in_hash(struct ucc_geth_private *ugeth,
|
|
|
|
struct enet_addr *p_enet_addr)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enum ucc_geth_enet_address_recognition_location location;
|
|
|
|
struct enet_addr_container *enet_addr_cont;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct list_head *p_lh;
|
|
|
|
u8 i;
|
|
|
|
u32 limit;
|
|
|
|
u8 *p_counter;
|
|
|
|
|
|
|
|
if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) {
|
|
|
|
p_lh = &ugeth->group_hash_q;
|
|
|
|
limit = ugeth->ug_info->maxGroupAddrInHash;
|
|
|
|
location =
|
|
|
|
UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH;
|
|
|
|
p_counter = &(ugeth->numGroupAddrInHash);
|
|
|
|
} else {
|
|
|
|
p_lh = &ugeth->ind_hash_q;
|
|
|
|
limit = ugeth->ug_info->maxIndAddrInHash;
|
|
|
|
location =
|
|
|
|
UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH;
|
|
|
|
p_counter = &(ugeth->numIndAddrInHash);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((enet_addr_cont =
|
|
|
|
ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr))) {
|
|
|
|
list_add(p_lh, &enet_addr_cont->node); /* Put it back */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if ((!p_lh) || (!(*p_counter < limit)))
|
|
|
|
return -EBUSY;
|
|
|
|
if (!(enet_addr_cont = get_enet_addr_container()))
|
|
|
|
return -ENOMEM;
|
|
|
|
for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++)
|
|
|
|
(enet_addr_cont->address)[i] = (*p_enet_addr)[i];
|
|
|
|
enet_addr_cont->location = location;
|
|
|
|
enqueue(p_lh, &enet_addr_cont->node); /* Put it back */
|
|
|
|
++(*p_counter);
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
hw_add_addr_in_hash(ugeth, enet_addr_cont->address);
|
2006-08-15 02:00:11 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_82xx_filtering_clear_addr_in_hash(struct ucc_geth_private *ugeth,
|
|
|
|
struct enet_addr *p_enet_addr)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
|
|
|
struct enet_addr_container *enet_addr_cont;
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
enum comm_dir comm_dir;
|
2006-08-15 02:00:11 -04:00
|
|
|
u16 i, num;
|
|
|
|
struct list_head *p_lh;
|
|
|
|
u32 *addr_h, *addr_l;
|
|
|
|
u8 *p_counter;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
|
2006-08-15 02:00:11 -04:00
|
|
|
addressfiltering;
|
|
|
|
|
|
|
|
if (!
|
|
|
|
(enet_addr_cont =
|
|
|
|
ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr)))
|
|
|
|
return -ENOENT;
|
|
|
|
|
|
|
|
/* It's been found and removed from the CQ. */
|
|
|
|
/* Now destroy its container */
|
|
|
|
put_enet_addr_container(enet_addr_cont);
|
|
|
|
|
|
|
|
if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) {
|
|
|
|
addr_h = &(p_82xx_addr_filt->gaddr_h);
|
|
|
|
addr_l = &(p_82xx_addr_filt->gaddr_l);
|
|
|
|
p_lh = &ugeth->group_hash_q;
|
|
|
|
p_counter = &(ugeth->numGroupAddrInHash);
|
|
|
|
} else {
|
|
|
|
addr_h = &(p_82xx_addr_filt->iaddr_h);
|
|
|
|
addr_l = &(p_82xx_addr_filt->iaddr_l);
|
|
|
|
p_lh = &ugeth->ind_hash_q;
|
|
|
|
p_counter = &(ugeth->numIndAddrInHash);
|
|
|
|
}
|
|
|
|
|
|
|
|
comm_dir = 0;
|
|
|
|
if (uccf->enabled_tx)
|
|
|
|
comm_dir |= COMM_DIR_TX;
|
|
|
|
if (uccf->enabled_rx)
|
|
|
|
comm_dir |= COMM_DIR_RX;
|
|
|
|
if (comm_dir)
|
|
|
|
ugeth_disable(ugeth, comm_dir);
|
|
|
|
|
|
|
|
/* Clear the hash table. */
|
|
|
|
out_be32(addr_h, 0x00000000);
|
|
|
|
out_be32(addr_l, 0x00000000);
|
|
|
|
|
|
|
|
/* Add all remaining CQ elements back into hash */
|
|
|
|
num = --(*p_counter);
|
|
|
|
for (i = 0; i < num; i++) {
|
|
|
|
enet_addr_cont =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct enet_addr_container *)
|
2006-08-15 02:00:11 -04:00
|
|
|
ENET_ADDR_CONT_ENTRY(dequeue(p_lh));
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
hw_add_addr_in_hash(ugeth, enet_addr_cont->address);
|
2006-08-15 02:00:11 -04:00
|
|
|
enqueue(p_lh, &enet_addr_cont->node); /* Put it back */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (comm_dir)
|
|
|
|
ugeth_enable(ugeth, comm_dir);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_FILTERING */
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_82xx_filtering_clear_all_addr_in_hash(struct ucc_geth_private *
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
enum enet_addr_type
|
2006-08-15 02:00:11 -04:00
|
|
|
enet_addr_type)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
enum comm_dir comm_dir;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct list_head *p_lh;
|
|
|
|
u16 i, num;
|
|
|
|
u32 *addr_h, *addr_l;
|
|
|
|
u8 *p_counter;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram->
|
2006-08-15 02:00:11 -04:00
|
|
|
addressfiltering;
|
|
|
|
|
|
|
|
if (enet_addr_type == ENET_ADDR_TYPE_GROUP) {
|
|
|
|
addr_h = &(p_82xx_addr_filt->gaddr_h);
|
|
|
|
addr_l = &(p_82xx_addr_filt->gaddr_l);
|
|
|
|
p_lh = &ugeth->group_hash_q;
|
|
|
|
p_counter = &(ugeth->numGroupAddrInHash);
|
|
|
|
} else if (enet_addr_type == ENET_ADDR_TYPE_INDIVIDUAL) {
|
|
|
|
addr_h = &(p_82xx_addr_filt->iaddr_h);
|
|
|
|
addr_l = &(p_82xx_addr_filt->iaddr_l);
|
|
|
|
p_lh = &ugeth->ind_hash_q;
|
|
|
|
p_counter = &(ugeth->numIndAddrInHash);
|
|
|
|
} else
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
comm_dir = 0;
|
|
|
|
if (uccf->enabled_tx)
|
|
|
|
comm_dir |= COMM_DIR_TX;
|
|
|
|
if (uccf->enabled_rx)
|
|
|
|
comm_dir |= COMM_DIR_RX;
|
|
|
|
if (comm_dir)
|
|
|
|
ugeth_disable(ugeth, comm_dir);
|
|
|
|
|
|
|
|
/* Clear the hash table. */
|
|
|
|
out_be32(addr_h, 0x00000000);
|
|
|
|
out_be32(addr_l, 0x00000000);
|
|
|
|
|
|
|
|
if (!p_lh)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
num = *p_counter;
|
|
|
|
|
|
|
|
/* Delete all remaining CQ elements */
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
put_enet_addr_container(ENET_ADDR_CONT_ENTRY(dequeue(p_lh)));
|
|
|
|
|
|
|
|
*p_counter = 0;
|
|
|
|
|
|
|
|
if (comm_dir)
|
|
|
|
ugeth_enable(ugeth, comm_dir);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_FILTERING
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_82xx_filtering_add_addr_in_paddr(struct ucc_geth_private *ugeth,
|
|
|
|
struct enet_addr *p_enet_addr,
|
2006-08-15 02:00:11 -04:00
|
|
|
u8 paddr_num)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((*p_enet_addr)[0] & ENET_GROUP_ADDR)
|
|
|
|
ugeth_warn
|
|
|
|
("%s: multicast address added to paddr will have no "
|
|
|
|
"effect - is this what you wanted?",
|
|
|
|
__FUNCTION__);
|
|
|
|
|
|
|
|
ugeth->indAddrRegUsed[paddr_num] = 1; /* mark this paddr as used */
|
|
|
|
/* store address in our database */
|
|
|
|
for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++)
|
|
|
|
ugeth->paddr[paddr_num][i] = (*p_enet_addr)[i];
|
|
|
|
/* put in hardware */
|
|
|
|
return hw_add_addr_in_paddr(ugeth, p_enet_addr, paddr_num);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_FILTERING */
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ugeth_82xx_filtering_clear_addr_in_paddr(struct ucc_geth_private *ugeth,
|
2006-08-15 02:00:11 -04:00
|
|
|
u8 paddr_num)
|
|
|
|
{
|
|
|
|
ugeth->indAddrRegUsed[paddr_num] = 0; /* mark this paddr as not used */
|
|
|
|
return hw_clear_addr_in_paddr(ugeth, paddr_num);/* clear in hardware */
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void ucc_geth_memclean(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
u16 i, j;
|
|
|
|
u8 *bd;
|
|
|
|
|
|
|
|
if (!ugeth)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ugeth->uccf)
|
|
|
|
ucc_fast_free(ugeth->uccf);
|
|
|
|
|
|
|
|
if (ugeth->p_thread_data_tx) {
|
|
|
|
qe_muram_free(ugeth->thread_dat_tx_offset);
|
|
|
|
ugeth->p_thread_data_tx = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_thread_data_rx) {
|
|
|
|
qe_muram_free(ugeth->thread_dat_rx_offset);
|
|
|
|
ugeth->p_thread_data_rx = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_exf_glbl_param) {
|
|
|
|
qe_muram_free(ugeth->exf_glbl_param_offset);
|
|
|
|
ugeth->p_exf_glbl_param = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_rx_glbl_pram) {
|
|
|
|
qe_muram_free(ugeth->rx_glbl_pram_offset);
|
|
|
|
ugeth->p_rx_glbl_pram = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_tx_glbl_pram) {
|
|
|
|
qe_muram_free(ugeth->tx_glbl_pram_offset);
|
|
|
|
ugeth->p_tx_glbl_pram = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_send_q_mem_reg) {
|
|
|
|
qe_muram_free(ugeth->send_q_mem_reg_offset);
|
|
|
|
ugeth->p_send_q_mem_reg = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_scheduler) {
|
|
|
|
qe_muram_free(ugeth->scheduler_offset);
|
|
|
|
ugeth->p_scheduler = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_tx_fw_statistics_pram) {
|
|
|
|
qe_muram_free(ugeth->tx_fw_statistics_pram_offset);
|
|
|
|
ugeth->p_tx_fw_statistics_pram = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_rx_fw_statistics_pram) {
|
|
|
|
qe_muram_free(ugeth->rx_fw_statistics_pram_offset);
|
|
|
|
ugeth->p_rx_fw_statistics_pram = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_rx_irq_coalescing_tbl) {
|
|
|
|
qe_muram_free(ugeth->rx_irq_coalescing_tbl_offset);
|
|
|
|
ugeth->p_rx_irq_coalescing_tbl = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_rx_bd_qs_tbl) {
|
|
|
|
qe_muram_free(ugeth->rx_bd_qs_tbl_offset);
|
|
|
|
ugeth->p_rx_bd_qs_tbl = NULL;
|
|
|
|
}
|
|
|
|
if (ugeth->p_init_enet_param_shadow) {
|
|
|
|
return_init_enet_entries(ugeth,
|
|
|
|
&(ugeth->p_init_enet_param_shadow->
|
|
|
|
rxthread[0]),
|
|
|
|
ENET_INIT_PARAM_MAX_ENTRIES_RX,
|
|
|
|
ugeth->ug_info->riscRx, 1);
|
|
|
|
return_init_enet_entries(ugeth,
|
|
|
|
&(ugeth->p_init_enet_param_shadow->
|
|
|
|
txthread[0]),
|
|
|
|
ENET_INIT_PARAM_MAX_ENTRIES_TX,
|
|
|
|
ugeth->ug_info->riscTx, 0);
|
|
|
|
kfree(ugeth->p_init_enet_param_shadow);
|
|
|
|
ugeth->p_init_enet_param_shadow = NULL;
|
|
|
|
}
|
|
|
|
for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) {
|
|
|
|
bd = ugeth->p_tx_bd_ring[i];
|
2007-04-13 02:26:29 -04:00
|
|
|
if (!bd)
|
|
|
|
continue;
|
2006-08-15 02:00:11 -04:00
|
|
|
for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
|
|
|
|
if (ugeth->tx_skbuff[i][j]) {
|
|
|
|
dma_unmap_single(NULL,
|
2007-09-13 11:23:33 -04:00
|
|
|
((struct qe_bd *)bd)->buf,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(in_be32((u32 *)bd) &
|
2006-08-15 02:00:11 -04:00
|
|
|
BD_LENGTH_MASK),
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
dev_kfree_skb_any(ugeth->tx_skbuff[i][j]);
|
|
|
|
ugeth->tx_skbuff[i][j] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
kfree(ugeth->tx_skbuff[i]);
|
|
|
|
|
|
|
|
if (ugeth->p_tx_bd_ring[i]) {
|
|
|
|
if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_SYSTEM)
|
|
|
|
kfree((void *)ugeth->tx_bd_ring_offset[i]);
|
|
|
|
else if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_MURAM)
|
|
|
|
qe_muram_free(ugeth->tx_bd_ring_offset[i]);
|
|
|
|
ugeth->p_tx_bd_ring[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) {
|
|
|
|
if (ugeth->p_rx_bd_ring[i]) {
|
|
|
|
/* Return existing data buffers in ring */
|
|
|
|
bd = ugeth->p_rx_bd_ring[i];
|
|
|
|
for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) {
|
|
|
|
if (ugeth->rx_skbuff[i][j]) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
dma_unmap_single(NULL,
|
|
|
|
((struct qe_bd *)bd)->buf,
|
|
|
|
ugeth->ug_info->
|
|
|
|
uf_info.max_rx_buf_length +
|
|
|
|
UCC_GETH_RX_DATA_BUF_ALIGNMENT,
|
|
|
|
DMA_FROM_DEVICE);
|
|
|
|
dev_kfree_skb_any(
|
|
|
|
ugeth->rx_skbuff[i][j]);
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->rx_skbuff[i][j] = NULL;
|
|
|
|
}
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
kfree(ugeth->rx_skbuff[i]);
|
|
|
|
|
|
|
|
if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_SYSTEM)
|
|
|
|
kfree((void *)ugeth->rx_bd_ring_offset[i]);
|
|
|
|
else if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_MURAM)
|
|
|
|
qe_muram_free(ugeth->rx_bd_ring_offset[i]);
|
|
|
|
ugeth->p_rx_bd_ring[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (!list_empty(&ugeth->group_hash_q))
|
|
|
|
put_enet_addr_container(ENET_ADDR_CONT_ENTRY
|
|
|
|
(dequeue(&ugeth->group_hash_q)));
|
|
|
|
while (!list_empty(&ugeth->ind_hash_q))
|
|
|
|
put_enet_addr_container(ENET_ADDR_CONT_ENTRY
|
|
|
|
(dequeue(&ugeth->ind_hash_q)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ucc_geth_set_multi(struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct dev_mc_list *dmi;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_fast *uf_regs;
|
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
2007-10-17 05:05:41 -04:00
|
|
|
int i;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth = netdev_priv(dev);
|
|
|
|
|
|
|
|
uf_regs = ugeth->uccf->uf_regs;
|
|
|
|
|
|
|
|
if (dev->flags & IFF_PROMISC) {
|
|
|
|
|
|
|
|
uf_regs->upsmr |= UPSMR_PRO;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
uf_regs->upsmr &= ~UPSMR_PRO;
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
p_rx_glbl_pram->addressfiltering;
|
|
|
|
|
|
|
|
if (dev->flags & IFF_ALLMULTI) {
|
|
|
|
/* Catch all multicast addresses, so set the
|
|
|
|
* filter to all 1's.
|
|
|
|
*/
|
|
|
|
out_be32(&p_82xx_addr_filt->gaddr_h, 0xffffffff);
|
|
|
|
out_be32(&p_82xx_addr_filt->gaddr_l, 0xffffffff);
|
|
|
|
} else {
|
|
|
|
/* Clear filter and add the addresses in the list.
|
|
|
|
*/
|
|
|
|
out_be32(&p_82xx_addr_filt->gaddr_h, 0x0);
|
|
|
|
out_be32(&p_82xx_addr_filt->gaddr_l, 0x0);
|
|
|
|
|
|
|
|
dmi = dev->mc_list;
|
|
|
|
|
|
|
|
for (i = 0; i < dev->mc_count; i++, dmi = dmi->next) {
|
|
|
|
|
|
|
|
/* Only support group multicast for now.
|
|
|
|
*/
|
|
|
|
if (!(dmi->dmi_addr[0] & 1))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Ask CPM to run CRC and set bit in
|
|
|
|
* filter mask.
|
|
|
|
*/
|
2007-10-17 05:05:41 -04:00
|
|
|
hw_add_addr_in_hash(ugeth, dmi->dmi_addr);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static void ucc_geth_stop(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth *ug_regs = ugeth->ug_regs;
|
2007-04-13 02:26:03 -04:00
|
|
|
struct phy_device *phydev = ugeth->phydev;
|
2006-08-15 02:00:11 -04:00
|
|
|
u32 tempval;
|
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
|
|
|
/* Disable the controller */
|
|
|
|
ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
|
|
|
|
|
|
|
|
/* Tell the kernel the link is down */
|
2007-04-13 02:26:03 -04:00
|
|
|
phy_stop(phydev);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Mask all interrupts */
|
2007-07-10 08:51:11 -04:00
|
|
|
out_be32(ugeth->uccf->p_uccm, 0x00000000);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Clear all interrupts */
|
|
|
|
out_be32(ugeth->uccf->p_ucce, 0xffffffff);
|
|
|
|
|
|
|
|
/* Disable Rx and Tx */
|
|
|
|
tempval = in_be32(&ug_regs->maccfg1);
|
|
|
|
tempval &= ~(MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
|
|
|
|
out_be32(&ug_regs->maccfg1, tempval);
|
|
|
|
|
|
|
|
free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev);
|
|
|
|
|
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
static int ucc_struct_init(struct ucc_geth_private *ugeth)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_info *ug_info;
|
|
|
|
struct ucc_fast_info *uf_info;
|
2007-04-13 02:26:03 -04:00
|
|
|
int i;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ug_info = ugeth->ug_info;
|
|
|
|
uf_info = &ug_info->uf_info;
|
|
|
|
|
2007-04-13 02:26:29 -04:00
|
|
|
/* Create CQs for hash tables */
|
|
|
|
INIT_LIST_HEAD(&ugeth->group_hash_q);
|
|
|
|
INIT_LIST_HEAD(&ugeth->ind_hash_q);
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) ||
|
|
|
|
(uf_info->bd_mem_part == MEM_PART_MURAM))) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: Bad memory partition value.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Rx BD lengths */
|
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++) {
|
|
|
|
if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) ||
|
|
|
|
(ug_info->bdRingLenRx[i] %
|
|
|
|
UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Rx BD ring length must be multiple of 4, no smaller than 8.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Tx BD lengths */
|
|
|
|
for (i = 0; i < ug_info->numQueuesTx; i++) {
|
|
|
|
if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Tx BD ring length must be no smaller than 2.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mrblr */
|
|
|
|
if ((uf_info->max_rx_buf_length == 0) ||
|
|
|
|
(uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: max_rx_buf_length must be non-zero multiple of 128.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* num Tx queues */
|
|
|
|
if (ug_info->numQueuesTx > NUM_TX_QUEUES) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: number of tx queues too large.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* num Rx queues */
|
|
|
|
if (ug_info->numQueuesRx > NUM_RX_QUEUES) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: number of rx queues too large.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* l2qt */
|
|
|
|
for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) {
|
|
|
|
if (ug_info->l2qt[i] >= ug_info->numQueuesRx) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: VLAN priority table entry must not be"
|
|
|
|
" larger than number of Rx queues.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* l3qt */
|
|
|
|
for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) {
|
|
|
|
if (ug_info->l3qt[i] >= ug_info->numQueuesRx) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: IP priority table entry must not be"
|
|
|
|
" larger than number of Rx queues.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ug_info->cam && !ug_info->ecamptr) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: If cam mode is chosen, must supply cam ptr.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ug_info->numStationAddresses !=
|
|
|
|
UCC_GETH_NUM_OF_STATION_ADDRESSES_1)
|
|
|
|
&& ug_info->rxExtendedFiltering) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: Number of station addresses greater than 1 "
|
|
|
|
"not allowed in extended parsing mode.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Generate uccm_mask for receive */
|
|
|
|
uf_info->uccm_mask = ug_info->eventRegMask & UCCE_OTHER;/* Errors */
|
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++)
|
|
|
|
uf_info->uccm_mask |= (UCCE_RXBF_SINGLE_MASK << i);
|
|
|
|
|
|
|
|
for (i = 0; i < ug_info->numQueuesTx; i++)
|
|
|
|
uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i);
|
|
|
|
/* Initialize the general fast UCC block. */
|
2007-04-13 02:26:03 -04:00
|
|
|
if (ucc_fast_init(uf_info, &ugeth->uccf)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: Failed to init uccf.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2007-04-13 02:26:03 -04:00
|
|
|
|
|
|
|
ugeth->ug_regs = (struct ucc_geth *) ioremap(uf_info->regs, sizeof(struct ucc_geth));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ucc_geth_startup(struct ucc_geth_private *ugeth)
|
|
|
|
{
|
|
|
|
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
|
|
|
|
struct ucc_geth_init_pram *p_init_enet_pram;
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
struct ucc_geth_info *ug_info;
|
|
|
|
struct ucc_fast_info *uf_info;
|
|
|
|
struct ucc_fast *uf_regs;
|
|
|
|
struct ucc_geth *ug_regs;
|
|
|
|
int ret_val = -EINVAL;
|
|
|
|
u32 remoder = UCC_GETH_REMODER_INIT;
|
|
|
|
u32 init_enet_pram_offset, cecr_subblock, command, maccfg1;
|
|
|
|
u32 ifstat, i, j, size, l2qt, l3qt, length;
|
|
|
|
u16 temoder = UCC_GETH_TEMODER_INIT;
|
|
|
|
u16 test;
|
|
|
|
u8 function_code = 0;
|
|
|
|
u8 *bd, *endOfRing;
|
|
|
|
u8 numThreadsRxNumerical, numThreadsTxNumerical;
|
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
ug_info = ugeth->ug_info;
|
|
|
|
uf_info = &ug_info->uf_info;
|
|
|
|
uf_regs = uccf->uf_regs;
|
|
|
|
ug_regs = ugeth->ug_regs;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
switch (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:
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Bad number of Rx threads value.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (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:
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Bad number of Tx threads value.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate rx_extended_features */
|
|
|
|
ugeth->rx_non_dynamic_extended_features = ug_info->ipCheckSumCheck ||
|
|
|
|
ug_info->ipAddressAlignment ||
|
|
|
|
(ug_info->numStationAddresses !=
|
|
|
|
UCC_GETH_NUM_OF_STATION_ADDRESSES_1);
|
|
|
|
|
|
|
|
ugeth->rx_extended_features = ugeth->rx_non_dynamic_extended_features ||
|
|
|
|
(ug_info->vlanOperationTagged != UCC_GETH_VLAN_OPERATION_TAGGED_NOP)
|
|
|
|
|| (ug_info->vlanOperationNonTagged !=
|
|
|
|
UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP);
|
|
|
|
|
|
|
|
init_default_reg_vals(&uf_regs->upsmr,
|
|
|
|
&ug_regs->maccfg1, &ug_regs->maccfg2);
|
|
|
|
|
|
|
|
/* Set UPSMR */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
init_rx_parameters(ug_info->bro,
|
|
|
|
ug_info->rsh, ug_info->pro, &uf_regs->upsmr);
|
|
|
|
|
|
|
|
/* We're going to ignore other registers for now, */
|
|
|
|
/* except as needed to get up and running */
|
|
|
|
|
|
|
|
/* Set MACCFG1 */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
init_flow_control_params(ug_info->aufc,
|
|
|
|
ug_info->receiveFlowControl,
|
2007-07-18 23:47:47 -04:00
|
|
|
ug_info->transmitFlowControl,
|
2006-08-15 02:00:11 -04:00
|
|
|
ug_info->pausePeriod,
|
|
|
|
ug_info->extensionField,
|
|
|
|
&uf_regs->upsmr,
|
|
|
|
&ug_regs->uempr, &ug_regs->maccfg1);
|
|
|
|
|
|
|
|
maccfg1 = in_be32(&ug_regs->maccfg1);
|
|
|
|
maccfg1 |= MACCFG1_ENABLE_RX;
|
|
|
|
maccfg1 |= MACCFG1_ENABLE_TX;
|
|
|
|
out_be32(&ug_regs->maccfg1, maccfg1);
|
|
|
|
|
|
|
|
/* Set IPGIFG */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
ret_val = init_inter_frame_gap_params(ug_info->nonBackToBackIfgPart1,
|
|
|
|
ug_info->nonBackToBackIfgPart2,
|
|
|
|
ug_info->
|
|
|
|
miminumInterFrameGapEnforcement,
|
|
|
|
ug_info->backToBackInterFrameGap,
|
|
|
|
&ug_regs->ipgifg);
|
|
|
|
if (ret_val != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: IPGIFG initialization parameter too large.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set HAFDUP */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
ret_val = init_half_duplex_params(ug_info->altBeb,
|
|
|
|
ug_info->backPressureNoBackoff,
|
|
|
|
ug_info->noBackoff,
|
|
|
|
ug_info->excessDefer,
|
|
|
|
ug_info->altBebTruncation,
|
|
|
|
ug_info->maxRetransmission,
|
|
|
|
ug_info->collisionWindow,
|
|
|
|
&ug_regs->hafdup);
|
|
|
|
if (ret_val != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Half Duplex initialization parameter too large.",
|
2006-08-15 02:00:11 -04:00
|
|
|
__FUNCTION__);
|
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set IFSTAT */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
/* Read only - resets upon read */
|
|
|
|
ifstat = in_be32(&ug_regs->ifstat);
|
|
|
|
|
|
|
|
/* Clear UEMPR */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
out_be32(&ug_regs->uempr, 0);
|
|
|
|
|
|
|
|
/* Set UESCR */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
init_hw_statistics_gathering_mode((ug_info->statisticsMode &
|
|
|
|
UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE),
|
|
|
|
0, &uf_regs->upsmr, &ug_regs->uescr);
|
|
|
|
|
|
|
|
/* Allocate Tx bds */
|
|
|
|
for (j = 0; j < ug_info->numQueuesTx; j++) {
|
|
|
|
/* Allocate in multiple of
|
|
|
|
UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT,
|
|
|
|
according to spec */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
length = ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd))
|
2006-08-15 02:00:11 -04:00
|
|
|
/ UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT)
|
|
|
|
* UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
if ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) %
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT)
|
|
|
|
length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT;
|
|
|
|
if (uf_info->bd_mem_part == MEM_PART_SYSTEM) {
|
|
|
|
u32 align = 4;
|
|
|
|
if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4)
|
|
|
|
align = UCC_GETH_TX_BD_RING_ALIGNMENT;
|
|
|
|
ugeth->tx_bd_ring_offset[j] =
|
2007-01-27 03:00:02 -05:00
|
|
|
kmalloc((u32) (length + align), GFP_KERNEL);
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ugeth->tx_bd_ring_offset[j] != 0)
|
|
|
|
ugeth->p_tx_bd_ring[j] =
|
|
|
|
(void*)((ugeth->tx_bd_ring_offset[j] +
|
|
|
|
align) & ~(align - 1));
|
|
|
|
} else if (uf_info->bd_mem_part == MEM_PART_MURAM) {
|
|
|
|
ugeth->tx_bd_ring_offset[j] =
|
|
|
|
qe_muram_alloc(length,
|
|
|
|
UCC_GETH_TX_BD_RING_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j]))
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->p_tx_bd_ring[j] =
|
|
|
|
(u8 *) qe_muram_addr(ugeth->
|
|
|
|
tx_bd_ring_offset[j]);
|
|
|
|
}
|
|
|
|
if (!ugeth->p_tx_bd_ring[j]) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate memory for Tx bd rings.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
/* Zero unused end of bd ring, according to spec */
|
|
|
|
memset(ugeth->p_tx_bd_ring[j] +
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->bdRingLenTx[j] * sizeof(struct qe_bd), 0,
|
|
|
|
length - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate Rx bds */
|
|
|
|
for (j = 0; j < ug_info->numQueuesRx; j++) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (uf_info->bd_mem_part == MEM_PART_SYSTEM) {
|
|
|
|
u32 align = 4;
|
|
|
|
if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4)
|
|
|
|
align = UCC_GETH_RX_BD_RING_ALIGNMENT;
|
|
|
|
ugeth->rx_bd_ring_offset[j] =
|
2007-01-27 03:00:02 -05:00
|
|
|
kmalloc((u32) (length + align), GFP_KERNEL);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ugeth->rx_bd_ring_offset[j] != 0)
|
|
|
|
ugeth->p_rx_bd_ring[j] =
|
|
|
|
(void*)((ugeth->rx_bd_ring_offset[j] +
|
|
|
|
align) & ~(align - 1));
|
|
|
|
} else if (uf_info->bd_mem_part == MEM_PART_MURAM) {
|
|
|
|
ugeth->rx_bd_ring_offset[j] =
|
|
|
|
qe_muram_alloc(length,
|
|
|
|
UCC_GETH_RX_BD_RING_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j]))
|
2006-08-15 02:00:11 -04:00
|
|
|
ugeth->p_rx_bd_ring[j] =
|
|
|
|
(u8 *) qe_muram_addr(ugeth->
|
|
|
|
rx_bd_ring_offset[j]);
|
|
|
|
}
|
|
|
|
if (!ugeth->p_rx_bd_ring[j]) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate memory for Rx bd rings.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Init Tx bds */
|
|
|
|
for (j = 0; j < ug_info->numQueuesTx; j++) {
|
|
|
|
/* Setup the skbuff rings */
|
2007-01-27 03:00:02 -05:00
|
|
|
ugeth->tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
|
|
|
|
ugeth->ug_info->bdRingLenTx[j],
|
|
|
|
GFP_KERNEL);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
if (ugeth->tx_skbuff[j] == NULL) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Could not allocate tx_skbuff",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ugeth->ug_info->bdRingLenTx[j]; i++)
|
|
|
|
ugeth->tx_skbuff[j][i] = NULL;
|
|
|
|
|
|
|
|
ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0;
|
|
|
|
bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j];
|
|
|
|
for (i = 0; i < ug_info->bdRingLenTx[j]; i++) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
/* clear bd buffer */
|
|
|
|
out_be32(&((struct qe_bd *)bd)->buf, 0);
|
|
|
|
/* set bd status and length */
|
|
|
|
out_be32((u32 *)bd, 0);
|
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd -= sizeof(struct qe_bd);
|
|
|
|
/* set bd status and length */
|
|
|
|
out_be32((u32 *)bd, T_W); /* for last BD set Wrap bit */
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Init Rx bds */
|
|
|
|
for (j = 0; j < ug_info->numQueuesRx; j++) {
|
|
|
|
/* Setup the skbuff rings */
|
2007-01-27 03:00:02 -05:00
|
|
|
ugeth->rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
|
|
|
|
ugeth->ug_info->bdRingLenRx[j],
|
|
|
|
GFP_KERNEL);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
if (ugeth->rx_skbuff[j] == NULL) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Could not allocate rx_skbuff",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ugeth->ug_info->bdRingLenRx[j]; i++)
|
|
|
|
ugeth->rx_skbuff[j][i] = NULL;
|
|
|
|
|
|
|
|
ugeth->skb_currx[j] = 0;
|
|
|
|
bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j];
|
|
|
|
for (i = 0; i < ug_info->bdRingLenRx[j]; i++) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
/* set bd status and length */
|
|
|
|
out_be32((u32 *)bd, R_I);
|
|
|
|
/* clear bd buffer */
|
|
|
|
out_be32(&((struct qe_bd *)bd)->buf, 0);
|
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd -= sizeof(struct qe_bd);
|
|
|
|
/* set bd status and length */
|
|
|
|
out_be32((u32 *)bd, R_W); /* for last BD set Wrap bit */
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global PRAM
|
|
|
|
*/
|
|
|
|
/* Tx global PRAM */
|
|
|
|
/* Allocate global tx parameter RAM page */
|
|
|
|
ugeth->tx_glbl_pram_offset =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
ugeth->p_tx_glbl_pram =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_tx_global_pram *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
tx_glbl_pram_offset);
|
|
|
|
/* Zero out p_tx_glbl_pram */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
memset(ugeth->p_tx_glbl_pram, 0, sizeof(struct ucc_geth_tx_global_pram));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Fill global PRAM */
|
|
|
|
|
|
|
|
/* TQPTR */
|
|
|
|
/* Size varies with number of Tx threads */
|
|
|
|
ugeth->thread_dat_tx_offset =
|
|
|
|
qe_muram_alloc(numThreadsTxNumerical *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_data_tx) +
|
2006-08-15 02:00:11 -04:00
|
|
|
32 * (numThreadsTxNumerical == 1),
|
|
|
|
UCC_GETH_THREAD_DATA_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_thread_data_tx =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_thread_data_tx *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
thread_dat_tx_offset);
|
|
|
|
out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset);
|
|
|
|
|
|
|
|
/* vtagtable */
|
|
|
|
for (i = 0; i < UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX; i++)
|
|
|
|
out_be32(&ugeth->p_tx_glbl_pram->vtagtable[i],
|
|
|
|
ug_info->vtagtable[i]);
|
|
|
|
|
|
|
|
/* iphoffset */
|
|
|
|
for (i = 0; i < TX_IP_OFFSET_ENTRY_MAX; i++)
|
|
|
|
ugeth->p_tx_glbl_pram->iphoffset[i] = ug_info->iphoffset[i];
|
|
|
|
|
|
|
|
/* SQPTR */
|
|
|
|
/* Size varies with number of Tx queues */
|
|
|
|
ugeth->send_q_mem_reg_offset =
|
|
|
|
qe_muram_alloc(ug_info->numQueuesTx *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_send_queue_qd),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_send_q_mem_reg =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_send_queue_mem_region *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
send_q_mem_reg_offset);
|
|
|
|
out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset);
|
|
|
|
|
|
|
|
/* Setup the table */
|
|
|
|
/* Assume BD rings are already established */
|
|
|
|
for (i = 0; i < ug_info->numQueuesTx; i++) {
|
|
|
|
endOfRing =
|
|
|
|
ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] -
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
1) * sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) {
|
|
|
|
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
|
|
|
|
(u32) virt_to_phys(ugeth->p_tx_bd_ring[i]));
|
|
|
|
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
|
|
|
|
last_bd_completed_address,
|
|
|
|
(u32) virt_to_phys(endOfRing));
|
|
|
|
} else if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_MURAM) {
|
|
|
|
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
|
|
|
|
(u32) immrbar_virt_to_phys(ugeth->
|
|
|
|
p_tx_bd_ring[i]));
|
|
|
|
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
|
|
|
|
last_bd_completed_address,
|
|
|
|
(u32) immrbar_virt_to_phys(endOfRing));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* schedulerbasepointer */
|
|
|
|
|
|
|
|
if (ug_info->numQueuesTx > 1) {
|
|
|
|
/* scheduler exists only if more than 1 tx queue */
|
|
|
|
ugeth->scheduler_offset =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_muram_alloc(sizeof(struct ucc_geth_scheduler),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_SCHEDULER_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->scheduler_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_scheduler.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_scheduler =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_scheduler *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
scheduler_offset);
|
|
|
|
out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer,
|
|
|
|
ugeth->scheduler_offset);
|
|
|
|
/* Zero out p_scheduler */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
memset(ugeth->p_scheduler, 0, sizeof(struct ucc_geth_scheduler));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Set values in scheduler */
|
|
|
|
out_be32(&ugeth->p_scheduler->mblinterval,
|
|
|
|
ug_info->mblinterval);
|
|
|
|
out_be16(&ugeth->p_scheduler->nortsrbytetime,
|
|
|
|
ug_info->nortsrbytetime);
|
|
|
|
ugeth->p_scheduler->fracsiz = ug_info->fracsiz;
|
|
|
|
ugeth->p_scheduler->strictpriorityq = ug_info->strictpriorityq;
|
|
|
|
ugeth->p_scheduler->txasap = ug_info->txasap;
|
|
|
|
ugeth->p_scheduler->extrabw = ug_info->extrabw;
|
|
|
|
for (i = 0; i < NUM_TX_QUEUES; i++)
|
|
|
|
ugeth->p_scheduler->weightfactor[i] =
|
|
|
|
ug_info->weightfactor[i];
|
|
|
|
|
|
|
|
/* Set pointers to cpucount registers in scheduler */
|
|
|
|
ugeth->p_cpucount[0] = &(ugeth->p_scheduler->cpucount0);
|
|
|
|
ugeth->p_cpucount[1] = &(ugeth->p_scheduler->cpucount1);
|
|
|
|
ugeth->p_cpucount[2] = &(ugeth->p_scheduler->cpucount2);
|
|
|
|
ugeth->p_cpucount[3] = &(ugeth->p_scheduler->cpucount3);
|
|
|
|
ugeth->p_cpucount[4] = &(ugeth->p_scheduler->cpucount4);
|
|
|
|
ugeth->p_cpucount[5] = &(ugeth->p_scheduler->cpucount5);
|
|
|
|
ugeth->p_cpucount[6] = &(ugeth->p_scheduler->cpucount6);
|
|
|
|
ugeth->p_cpucount[7] = &(ugeth->p_scheduler->cpucount7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* schedulerbasepointer */
|
|
|
|
/* TxRMON_PTR (statistics) */
|
|
|
|
if (ug_info->
|
|
|
|
statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
|
|
|
|
ugeth->tx_fw_statistics_pram_offset =
|
|
|
|
qe_muram_alloc(sizeof
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_tx_firmware_statistics_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_TX_STATISTICS_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for"
|
|
|
|
" p_tx_fw_statistics_pram.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
ugeth->p_tx_fw_statistics_pram =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_tx_firmware_statistics_pram *)
|
2006-08-15 02:00:11 -04:00
|
|
|
qe_muram_addr(ugeth->tx_fw_statistics_pram_offset);
|
|
|
|
/* Zero out p_tx_fw_statistics_pram */
|
|
|
|
memset(ugeth->p_tx_fw_statistics_pram,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
0, sizeof(struct ucc_geth_tx_firmware_statistics_pram));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* temoder */
|
|
|
|
/* Already has speed set */
|
|
|
|
|
|
|
|
if (ug_info->numQueuesTx > 1)
|
|
|
|
temoder |= TEMODER_SCHEDULER_ENABLE;
|
|
|
|
if (ug_info->ipCheckSumGenerate)
|
|
|
|
temoder |= TEMODER_IP_CHECKSUM_GENERATE;
|
|
|
|
temoder |= ((ug_info->numQueuesTx - 1) << TEMODER_NUM_OF_QUEUES_SHIFT);
|
|
|
|
out_be16(&ugeth->p_tx_glbl_pram->temoder, temoder);
|
|
|
|
|
|
|
|
test = in_be16(&ugeth->p_tx_glbl_pram->temoder);
|
|
|
|
|
|
|
|
/* Function code register value to be used later */
|
2007-10-03 12:34:59 -04:00
|
|
|
function_code = UCC_BMR_BO_BE | UCC_BMR_GBL;
|
2006-08-15 02:00:11 -04:00
|
|
|
/* Required for QE */
|
|
|
|
|
|
|
|
/* function code register */
|
|
|
|
out_be32(&ugeth->p_tx_glbl_pram->tstate, ((u32) function_code) << 24);
|
|
|
|
|
|
|
|
/* Rx global PRAM */
|
|
|
|
/* Allocate global rx parameter RAM page */
|
|
|
|
ugeth->rx_glbl_pram_offset =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
ugeth->p_rx_glbl_pram =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_rx_global_pram *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
rx_glbl_pram_offset);
|
|
|
|
/* Zero out p_rx_glbl_pram */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
memset(ugeth->p_rx_glbl_pram, 0, sizeof(struct ucc_geth_rx_global_pram));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Fill global PRAM */
|
|
|
|
|
|
|
|
/* RQPTR */
|
|
|
|
/* Size varies with number of Rx threads */
|
|
|
|
ugeth->thread_dat_rx_offset =
|
|
|
|
qe_muram_alloc(numThreadsRxNumerical *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_data_rx),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_THREAD_DATA_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_thread_data_rx =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_thread_data_rx *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
thread_dat_rx_offset);
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset);
|
|
|
|
|
|
|
|
/* typeorlen */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->typeorlen, ug_info->typeorlen);
|
|
|
|
|
|
|
|
/* rxrmonbaseptr (statistics) */
|
|
|
|
if (ug_info->
|
|
|
|
statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) {
|
|
|
|
ugeth->rx_fw_statistics_pram_offset =
|
|
|
|
qe_muram_alloc(sizeof
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_rx_firmware_statistics_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_RX_STATISTICS_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for"
|
|
|
|
" p_rx_fw_statistics_pram.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
ugeth->p_rx_fw_statistics_pram =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_rx_firmware_statistics_pram *)
|
2006-08-15 02:00:11 -04:00
|
|
|
qe_muram_addr(ugeth->rx_fw_statistics_pram_offset);
|
|
|
|
/* Zero out p_rx_fw_statistics_pram */
|
|
|
|
memset(ugeth->p_rx_fw_statistics_pram, 0,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_rx_firmware_statistics_pram));
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* intCoalescingPtr */
|
|
|
|
|
|
|
|
/* Size varies with number of Rx queues */
|
|
|
|
ugeth->rx_irq_coalescing_tbl_offset =
|
|
|
|
qe_muram_alloc(ug_info->numQueuesRx *
|
2007-04-13 02:26:15 -04:00
|
|
|
sizeof(struct ucc_geth_rx_interrupt_coalescing_entry)
|
|
|
|
+ 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for"
|
|
|
|
" p_rx_irq_coalescing_tbl.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_rx_irq_coalescing_tbl =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_rx_interrupt_coalescing_table *)
|
2006-08-15 02:00:11 -04:00
|
|
|
qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset);
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr,
|
|
|
|
ugeth->rx_irq_coalescing_tbl_offset);
|
|
|
|
|
|
|
|
/* Fill interrupt coalescing table */
|
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++) {
|
|
|
|
out_be32(&ugeth->p_rx_irq_coalescing_tbl->coalescingentry[i].
|
|
|
|
interruptcoalescingmaxvalue,
|
|
|
|
ug_info->interruptcoalescingmaxvalue[i]);
|
|
|
|
out_be32(&ugeth->p_rx_irq_coalescing_tbl->coalescingentry[i].
|
|
|
|
interruptcoalescingcounter,
|
|
|
|
ug_info->interruptcoalescingmaxvalue[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MRBLR */
|
|
|
|
init_max_rx_buff_len(uf_info->max_rx_buf_length,
|
|
|
|
&ugeth->p_rx_glbl_pram->mrblr);
|
|
|
|
/* MFLR */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->mflr, ug_info->maxFrameLength);
|
|
|
|
/* MINFLR */
|
|
|
|
init_min_frame_len(ug_info->minFrameLength,
|
|
|
|
&ugeth->p_rx_glbl_pram->minflr,
|
|
|
|
&ugeth->p_rx_glbl_pram->mrblr);
|
|
|
|
/* MAXD1 */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->maxd1, ug_info->maxD1Length);
|
|
|
|
/* MAXD2 */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->maxd2, ug_info->maxD2Length);
|
|
|
|
|
|
|
|
/* l2qt */
|
|
|
|
l2qt = 0;
|
|
|
|
for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++)
|
|
|
|
l2qt |= (ug_info->l2qt[i] << (28 - 4 * i));
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->l2qt, l2qt);
|
|
|
|
|
|
|
|
/* l3qt */
|
|
|
|
for (j = 0; j < UCC_GETH_IP_PRIORITY_MAX; j += 8) {
|
|
|
|
l3qt = 0;
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
l3qt |= (ug_info->l3qt[j + i] << (28 - 4 * i));
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->l3qt[j/8], l3qt);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* vlantype */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->vlantype, ug_info->vlantype);
|
|
|
|
|
|
|
|
/* vlantci */
|
|
|
|
out_be16(&ugeth->p_rx_glbl_pram->vlantci, ug_info->vlantci);
|
|
|
|
|
|
|
|
/* ecamptr */
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->ecamptr, ug_info->ecamptr);
|
|
|
|
|
|
|
|
/* RBDQPTR */
|
|
|
|
/* Size varies with number of Rx queues */
|
|
|
|
ugeth->rx_bd_qs_tbl_offset =
|
|
|
|
qe_muram_alloc(ug_info->numQueuesRx *
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(sizeof(struct ucc_geth_rx_bd_queues_entry) +
|
|
|
|
sizeof(struct ucc_geth_rx_prefetched_bds)),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_RX_BD_QUEUES_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_rx_bd_qs_tbl =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_rx_bd_queues_entry *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
rx_bd_qs_tbl_offset);
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset);
|
|
|
|
/* Zero out p_rx_bd_qs_tbl */
|
|
|
|
memset(ugeth->p_rx_bd_qs_tbl,
|
|
|
|
0,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->numQueuesRx * (sizeof(struct ucc_geth_rx_bd_queues_entry) +
|
|
|
|
sizeof(struct ucc_geth_rx_prefetched_bds)));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Setup the table */
|
|
|
|
/* Assume BD rings are already established */
|
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++) {
|
|
|
|
if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) {
|
|
|
|
out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
|
|
|
|
(u32) virt_to_phys(ugeth->p_rx_bd_ring[i]));
|
|
|
|
} else if (ugeth->ug_info->uf_info.bd_mem_part ==
|
|
|
|
MEM_PART_MURAM) {
|
|
|
|
out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
|
|
|
|
(u32) immrbar_virt_to_phys(ugeth->
|
|
|
|
p_rx_bd_ring[i]));
|
|
|
|
}
|
|
|
|
/* rest of fields handled by QE */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remoder */
|
|
|
|
/* Already has speed set */
|
|
|
|
|
|
|
|
if (ugeth->rx_extended_features)
|
|
|
|
remoder |= REMODER_RX_EXTENDED_FEATURES;
|
|
|
|
if (ug_info->rxExtendedFiltering)
|
|
|
|
remoder |= REMODER_RX_EXTENDED_FILTERING;
|
|
|
|
if (ug_info->dynamicMaxFrameLength)
|
|
|
|
remoder |= REMODER_DYNAMIC_MAX_FRAME_LENGTH;
|
|
|
|
if (ug_info->dynamicMinFrameLength)
|
|
|
|
remoder |= REMODER_DYNAMIC_MIN_FRAME_LENGTH;
|
|
|
|
remoder |=
|
|
|
|
ug_info->vlanOperationTagged << REMODER_VLAN_OPERATION_TAGGED_SHIFT;
|
|
|
|
remoder |=
|
|
|
|
ug_info->
|
|
|
|
vlanOperationNonTagged << REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT;
|
|
|
|
remoder |= ug_info->rxQoSMode << REMODER_RX_QOS_MODE_SHIFT;
|
|
|
|
remoder |= ((ug_info->numQueuesRx - 1) << REMODER_NUM_OF_QUEUES_SHIFT);
|
|
|
|
if (ug_info->ipCheckSumCheck)
|
|
|
|
remoder |= REMODER_IP_CHECKSUM_CHECK;
|
|
|
|
if (ug_info->ipAddressAlignment)
|
|
|
|
remoder |= REMODER_IP_ADDRESS_ALIGNMENT;
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->remoder, remoder);
|
|
|
|
|
|
|
|
/* Note that this function must be called */
|
|
|
|
/* ONLY AFTER p_tx_fw_statistics_pram */
|
|
|
|
/* andp_UccGethRxFirmwareStatisticsPram are allocated ! */
|
|
|
|
init_firmware_statistics_gathering_mode((ug_info->
|
|
|
|
statisticsMode &
|
|
|
|
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX),
|
|
|
|
(ug_info->statisticsMode &
|
|
|
|
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX),
|
|
|
|
&ugeth->p_tx_glbl_pram->txrmonbaseptr,
|
|
|
|
ugeth->tx_fw_statistics_pram_offset,
|
|
|
|
&ugeth->p_rx_glbl_pram->rxrmonbaseptr,
|
|
|
|
ugeth->rx_fw_statistics_pram_offset,
|
|
|
|
&ugeth->p_tx_glbl_pram->temoder,
|
|
|
|
&ugeth->p_rx_glbl_pram->remoder);
|
|
|
|
|
|
|
|
/* function code register */
|
|
|
|
ugeth->p_rx_glbl_pram->rstate = function_code;
|
|
|
|
|
|
|
|
/* initialize extended filtering */
|
|
|
|
if (ug_info->rxExtendedFiltering) {
|
|
|
|
if (!ug_info->extendedFilteringChainPointer) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Null Extended Filtering Chain Pointer.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate memory for extended filtering Mode Global
|
|
|
|
Parameters */
|
|
|
|
ugeth->exf_glbl_param_offset =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for"
|
|
|
|
" p_exf_glbl_param.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_exf_glbl_param =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_exf_global_pram *) qe_muram_addr(ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
exf_glbl_param_offset);
|
|
|
|
out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam,
|
|
|
|
ugeth->exf_glbl_param_offset);
|
|
|
|
out_be32(&ugeth->p_exf_glbl_param->l2pcdptr,
|
|
|
|
(u32) ug_info->extendedFilteringChainPointer);
|
|
|
|
|
|
|
|
} else { /* initialize 82xx style address filtering */
|
|
|
|
|
|
|
|
/* Init individual address recognition registers to disabled */
|
|
|
|
|
|
|
|
for (j = 0; j < NUM_OF_PADDRS; j++)
|
|
|
|
ugeth_82xx_filtering_clear_addr_in_paddr(ugeth, (u8) j);
|
|
|
|
|
|
|
|
p_82xx_addr_filt =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_82xx_address_filtering_pram *) ugeth->
|
2006-08-15 02:00:11 -04:00
|
|
|
p_rx_glbl_pram->addressfiltering;
|
|
|
|
|
|
|
|
ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth,
|
|
|
|
ENET_ADDR_TYPE_GROUP);
|
|
|
|
ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth,
|
|
|
|
ENET_ADDR_TYPE_INDIVIDUAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize UCC at QE level
|
|
|
|
*/
|
|
|
|
|
|
|
|
command = QE_INIT_TX_RX;
|
|
|
|
|
|
|
|
/* Allocate shadow InitEnet command parameter structure.
|
|
|
|
* This is needed because after the InitEnet command is executed,
|
|
|
|
* the structure in DPRAM is released, because DPRAM is a premium
|
|
|
|
* resource.
|
|
|
|
* This shadow structure keeps a copy of what was done so that the
|
|
|
|
* allocated resources can be released when the channel is freed.
|
|
|
|
*/
|
|
|
|
if (!(ugeth->p_init_enet_param_shadow =
|
2007-01-27 03:00:02 -05:00
|
|
|
kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate memory for"
|
|
|
|
" p_UccInitEnetParamShadows.", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
/* Zero out *p_init_enet_param_shadow */
|
|
|
|
memset((char *)ugeth->p_init_enet_param_shadow,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
0, sizeof(struct ucc_geth_init_pram));
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Fill shadow InitEnet command parameter structure */
|
|
|
|
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit1 =
|
|
|
|
ENET_INIT_PARAM_MAGIC_RES_INIT1;
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit2 =
|
|
|
|
ENET_INIT_PARAM_MAGIC_RES_INIT2;
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit3 =
|
|
|
|
ENET_INIT_PARAM_MAGIC_RES_INIT3;
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit4 =
|
|
|
|
ENET_INIT_PARAM_MAGIC_RES_INIT4;
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit5 =
|
|
|
|
ENET_INIT_PARAM_MAGIC_RES_INIT5;
|
|
|
|
ugeth->p_init_enet_param_shadow->rgftgfrxglobal |=
|
|
|
|
((u32) ug_info->numThreadsRx) << ENET_INIT_PARAM_RGF_SHIFT;
|
|
|
|
ugeth->p_init_enet_param_shadow->rgftgfrxglobal |=
|
|
|
|
((u32) ug_info->numThreadsTx) << ENET_INIT_PARAM_TGF_SHIFT;
|
|
|
|
|
|
|
|
ugeth->p_init_enet_param_shadow->rgftgfrxglobal |=
|
|
|
|
ugeth->rx_glbl_pram_offset | ug_info->riscRx;
|
|
|
|
if ((ug_info->largestexternallookupkeysize !=
|
|
|
|
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE)
|
|
|
|
&& (ug_info->largestexternallookupkeysize !=
|
|
|
|
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
|
|
|
|
&& (ug_info->largestexternallookupkeysize !=
|
|
|
|
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Invalid largest External Lookup Key Size.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
ugeth->p_init_enet_param_shadow->largestexternallookupkeysize =
|
|
|
|
ug_info->largestexternallookupkeysize;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
size = sizeof(struct ucc_geth_thread_rx_pram);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ug_info->rxExtendedFiltering) {
|
|
|
|
size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING;
|
|
|
|
if (ug_info->largestexternallookupkeysize ==
|
|
|
|
QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
|
|
|
|
size +=
|
|
|
|
THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8;
|
|
|
|
if (ug_info->largestexternallookupkeysize ==
|
|
|
|
QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES)
|
|
|
|
size +=
|
|
|
|
THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ret_val = fill_init_enet_entries(ugeth, &(ugeth->
|
|
|
|
p_init_enet_param_shadow->rxthread[0]),
|
|
|
|
(u8) (numThreadsRxNumerical + 1)
|
|
|
|
/* Rx needs one extra for terminator */
|
|
|
|
, size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT,
|
|
|
|
ug_info->riscRx, 1)) != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->p_init_enet_param_shadow->txglobal =
|
|
|
|
ugeth->tx_glbl_pram_offset | ug_info->riscTx;
|
|
|
|
if ((ret_val =
|
|
|
|
fill_init_enet_entries(ugeth,
|
|
|
|
&(ugeth->p_init_enet_param_shadow->
|
|
|
|
txthread[0]), numThreadsTxNumerical,
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
sizeof(struct ucc_geth_thread_tx_pram),
|
2006-08-15 02:00:11 -04:00
|
|
|
UCC_GETH_THREAD_TX_PRAM_ALIGNMENT,
|
|
|
|
ug_info->riscTx, 0)) != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load Rx bds with buffers */
|
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++) {
|
|
|
|
if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Can not fill Rx bds with buffers.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate InitEnet command parameter structure */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4);
|
2007-05-08 15:46:36 -04:00
|
|
|
if (IS_ERR_VALUE(init_enet_pram_offset)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err
|
|
|
|
("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
|
|
|
|
__FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
p_init_enet_pram =
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
(struct ucc_geth_init_pram *) qe_muram_addr(init_enet_pram_offset);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Copy shadow InitEnet command parameter structure into PRAM */
|
|
|
|
p_init_enet_pram->resinit1 = ugeth->p_init_enet_param_shadow->resinit1;
|
|
|
|
p_init_enet_pram->resinit2 = ugeth->p_init_enet_param_shadow->resinit2;
|
|
|
|
p_init_enet_pram->resinit3 = ugeth->p_init_enet_param_shadow->resinit3;
|
|
|
|
p_init_enet_pram->resinit4 = ugeth->p_init_enet_param_shadow->resinit4;
|
|
|
|
out_be16(&p_init_enet_pram->resinit5,
|
|
|
|
ugeth->p_init_enet_param_shadow->resinit5);
|
|
|
|
p_init_enet_pram->largestexternallookupkeysize =
|
|
|
|
ugeth->p_init_enet_param_shadow->largestexternallookupkeysize;
|
|
|
|
out_be32(&p_init_enet_pram->rgftgfrxglobal,
|
|
|
|
ugeth->p_init_enet_param_shadow->rgftgfrxglobal);
|
|
|
|
for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_RX; i++)
|
|
|
|
out_be32(&p_init_enet_pram->rxthread[i],
|
|
|
|
ugeth->p_init_enet_param_shadow->rxthread[i]);
|
|
|
|
out_be32(&p_init_enet_pram->txglobal,
|
|
|
|
ugeth->p_init_enet_param_shadow->txglobal);
|
|
|
|
for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_TX; i++)
|
|
|
|
out_be32(&p_init_enet_pram->txthread[i],
|
|
|
|
ugeth->p_init_enet_param_shadow->txthread[i]);
|
|
|
|
|
|
|
|
/* Issue QE command */
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
qe_issue_cmd(command, cecr_subblock, QE_CR_PROTOCOL_ETHERNET,
|
2006-08-15 02:00:11 -04:00
|
|
|
init_enet_pram_offset);
|
|
|
|
|
|
|
|
/* Free InitEnet command parameter */
|
|
|
|
qe_muram_free(init_enet_pram_offset);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ucc_geth_timeout gets called when a packet has not been
|
|
|
|
* transmitted after a set amount of time.
|
|
|
|
* For now, assume that clearing out all the structures, and
|
|
|
|
* starting over will fix the problem. */
|
|
|
|
static void ucc_geth_timeout(struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.tx_errors++;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_dump_regs(ugeth);
|
|
|
|
|
|
|
|
if (dev->flags & IFF_UP) {
|
|
|
|
ucc_geth_stop(ugeth);
|
|
|
|
ucc_geth_startup(ugeth);
|
|
|
|
}
|
|
|
|
|
|
|
|
netif_schedule(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called by the kernel when a frame is ready for transmission. */
|
|
|
|
/* It is pointed to by the dev->hard_start_xmit function pointer */
|
|
|
|
static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
2007-04-13 02:26:19 -04:00
|
|
|
#ifdef CONFIG_UGETH_TX_ON_DEMAND
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
#endif
|
2006-08-15 02:00:11 -04:00
|
|
|
u8 *bd; /* BD pointer */
|
|
|
|
u32 bd_status;
|
|
|
|
u8 txQ = 0;
|
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
|
|
|
spin_lock_irq(&ugeth->lock);
|
|
|
|
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.tx_bytes += skb->len;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Start from the next BD that should be filled */
|
|
|
|
bd = ugeth->txBd[txQ];
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd_status = in_be32((u32 *)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
/* Save the skb pointer so we can free it later */
|
|
|
|
ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb;
|
|
|
|
|
|
|
|
/* Update the current skb pointer (wrapping if this was the last) */
|
|
|
|
ugeth->skb_curtx[txQ] =
|
|
|
|
(ugeth->skb_curtx[txQ] +
|
|
|
|
1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
|
|
|
|
|
|
|
|
/* set up the buffer descriptor */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
out_be32(&((struct qe_bd *)bd)->buf,
|
2006-08-15 02:00:11 -04:00
|
|
|
dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE));
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
/* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len;
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
/* set bd status and length */
|
|
|
|
out_be32((u32 *)bd, bd_status);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
dev->trans_start = jiffies;
|
|
|
|
|
|
|
|
/* Move to next BD in the ring */
|
|
|
|
if (!(bd_status & T_W))
|
2007-03-06 03:53:46 -05:00
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
else
|
2007-03-06 03:53:46 -05:00
|
|
|
bd = ugeth->p_tx_bd_ring[txQ];
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* If the next BD still needs to be cleaned up, then the bds
|
|
|
|
are full. We need to tell the kernel to stop sending us stuff. */
|
|
|
|
if (bd == ugeth->confBd[txQ]) {
|
|
|
|
if (!netif_queue_stopped(dev))
|
|
|
|
netif_stop_queue(dev);
|
|
|
|
}
|
|
|
|
|
2007-03-06 03:53:46 -05:00
|
|
|
ugeth->txBd[txQ] = bd;
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ugeth->p_scheduler) {
|
|
|
|
ugeth->cpucount[txQ]++;
|
|
|
|
/* Indicate to QE that there are more Tx bds ready for
|
|
|
|
transmission */
|
|
|
|
/* This is done by writing a running counter of the bd
|
|
|
|
count to the scheduler PRAM. */
|
|
|
|
out_be16(ugeth->p_cpucount[txQ], ugeth->cpucount[txQ]);
|
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:19 -04:00
|
|
|
#ifdef CONFIG_UGETH_TX_ON_DEMAND
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
out_be16(uccf->p_utodr, UCC_FAST_TOD);
|
|
|
|
#endif
|
2006-08-15 02:00:11 -04:00
|
|
|
spin_unlock_irq(&ugeth->lock);
|
|
|
|
|
2007-03-18 23:58:02 -04:00
|
|
|
return 0;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
u8 *bd;
|
|
|
|
u16 length, howmany = 0;
|
|
|
|
u32 bd_status;
|
|
|
|
u8 *bdBuffer;
|
2007-12-13 19:02:55 -05:00
|
|
|
struct net_device *dev;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
2007-10-15 09:43:50 -04:00
|
|
|
dev = ugeth->dev;
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
/* collect received buffers */
|
|
|
|
bd = ugeth->rxBd[rxQ];
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd_status = in_be32((u32 *)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* while there are received buffers and BD is full (~R_E) */
|
|
|
|
while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) {
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bdBuffer = (u8 *) in_be32(&((struct qe_bd *)bd)->buf);
|
2006-08-15 02:00:11 -04:00
|
|
|
length = (u16) ((bd_status & BD_LENGTH_MASK) - 4);
|
|
|
|
skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]];
|
|
|
|
|
|
|
|
/* determine whether buffer is first, last, first and last
|
|
|
|
(single buffer frame) or middle (not first and not last) */
|
|
|
|
if (!skb ||
|
|
|
|
(!(bd_status & (R_F | R_L))) ||
|
|
|
|
(bd_status & R_ERRORS_FATAL)) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_rx_err(ugeth))
|
|
|
|
ugeth_err("%s, %d: ERROR!!! skb - 0x%08x",
|
|
|
|
__FUNCTION__, __LINE__, (u32) skb);
|
2006-08-15 02:00:11 -04:00
|
|
|
if (skb)
|
|
|
|
dev_kfree_skb_any(skb);
|
|
|
|
|
|
|
|
ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL;
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.rx_dropped++;
|
2006-08-15 02:00:11 -04:00
|
|
|
} else {
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.rx_packets++;
|
2006-08-15 02:00:11 -04:00
|
|
|
howmany++;
|
|
|
|
|
|
|
|
/* Prep the skb for the packet */
|
|
|
|
skb_put(skb, length);
|
|
|
|
|
|
|
|
/* Tell the skb what kind of packet this is */
|
|
|
|
skb->protocol = eth_type_trans(skb, ugeth->dev);
|
|
|
|
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.rx_bytes += length;
|
2006-08-15 02:00:11 -04:00
|
|
|
/* Send the packet up the stack */
|
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
|
|
|
netif_receive_skb(skb);
|
|
|
|
#else
|
|
|
|
netif_rx(skb);
|
|
|
|
#endif /* CONFIG_UGETH_NAPI */
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->dev->last_rx = jiffies;
|
|
|
|
|
|
|
|
skb = get_new_skb(ugeth, bd);
|
|
|
|
if (!skb) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_rx_err(ugeth))
|
|
|
|
ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__);
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.rx_dropped++;
|
2006-08-15 02:00:11 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = skb;
|
|
|
|
|
|
|
|
/* update to point at the next skb */
|
|
|
|
ugeth->skb_currx[rxQ] =
|
|
|
|
(ugeth->skb_currx[rxQ] +
|
|
|
|
1) & RX_RING_MOD_MASK(ugeth->ug_info->bdRingLenRx[rxQ]);
|
|
|
|
|
|
|
|
if (bd_status & R_W)
|
|
|
|
bd = ugeth->p_rx_bd_ring[rxQ];
|
|
|
|
else
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd_status = in_be32((u32 *)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ugeth->rxBd[rxQ] = bd;
|
|
|
|
return howmany;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ucc_geth_tx(struct net_device *dev, u8 txQ)
|
|
|
|
{
|
|
|
|
/* Start from the next BD that should be filled */
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
2006-08-15 02:00:11 -04:00
|
|
|
u8 *bd; /* BD pointer */
|
|
|
|
u32 bd_status;
|
|
|
|
|
|
|
|
bd = ugeth->confBd[txQ];
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
bd_status = in_be32((u32 *)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Normal processing. */
|
|
|
|
while ((bd_status & T_R) == 0) {
|
|
|
|
/* BD contains already transmitted buffer. */
|
|
|
|
/* Handle the transmitted buffer and release */
|
|
|
|
/* the BD to be used with the current frame */
|
|
|
|
|
2007-03-06 03:53:46 -05:00
|
|
|
if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
|
2006-08-15 02:00:11 -04:00
|
|
|
break;
|
|
|
|
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.tx_packets++;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Free the sk buffer associated with this TxBD */
|
|
|
|
dev_kfree_skb_irq(ugeth->
|
|
|
|
tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
|
|
|
|
ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
|
|
|
|
ugeth->skb_dirtytx[txQ] =
|
|
|
|
(ugeth->skb_dirtytx[txQ] +
|
|
|
|
1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
|
|
|
|
|
|
|
|
/* We freed a buffer, so now we can restart transmission */
|
|
|
|
if (netif_queue_stopped(dev))
|
|
|
|
netif_wake_queue(dev);
|
|
|
|
|
|
|
|
/* Advance the confirmation BD pointer */
|
|
|
|
if (!(bd_status & T_W))
|
2007-03-06 03:53:46 -05:00
|
|
|
bd += sizeof(struct qe_bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
else
|
2007-03-06 03:53:46 -05:00
|
|
|
bd = ugeth->p_tx_bd_ring[txQ];
|
|
|
|
bd_status = in_be32((u32 *)bd);
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
2007-03-06 03:53:46 -05:00
|
|
|
ugeth->confBd[txQ] = bd;
|
2006-08-15 02:00:11 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
static int ucc_geth_poll(struct napi_struct *napi, int budget)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
struct ucc_geth_private *ugeth = container_of(napi, struct ucc_geth_private, napi);
|
|
|
|
struct net_device *dev = ugeth->dev;
|
2007-04-13 02:26:11 -04:00
|
|
|
struct ucc_geth_info *ug_info;
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
int howmany, i;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:11 -04:00
|
|
|
ug_info = ugeth->ug_info;
|
|
|
|
|
|
|
|
howmany = 0;
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++)
|
|
|
|
howmany += ucc_geth_rx(ugeth, i, budget - howmany);
|
2007-04-13 02:26:11 -04:00
|
|
|
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
if (howmany < budget) {
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
u32 uccm;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
netif_rx_complete(dev, napi);
|
2007-04-13 02:26:11 -04:00
|
|
|
uccf = ugeth->uccf;
|
|
|
|
uccm = in_be32(uccf->p_uccm);
|
|
|
|
uccm |= UCCE_RX_EVENTS;
|
|
|
|
out_be32(uccf->p_uccm, uccm);
|
|
|
|
}
|
2006-08-15 02:00:11 -04:00
|
|
|
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
return howmany;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_UGETH_NAPI */
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 09:55:46 -04:00
|
|
|
static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
2007-10-19 03:10:11 -04:00
|
|
|
struct net_device *dev = info;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
struct ucc_geth_info *ug_info;
|
2007-04-13 02:26:11 -04:00
|
|
|
register u32 ucce;
|
|
|
|
register u32 uccm;
|
|
|
|
#ifndef CONFIG_UGETH_NAPI
|
|
|
|
register u32 rx_mask;
|
|
|
|
#endif
|
|
|
|
register u32 tx_mask;
|
|
|
|
u8 i;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ugeth)
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
uccf = ugeth->uccf;
|
|
|
|
ug_info = ugeth->ug_info;
|
|
|
|
|
2007-04-13 02:26:11 -04:00
|
|
|
/* read and clear events */
|
|
|
|
ucce = (u32) in_be32(uccf->p_ucce);
|
|
|
|
uccm = (u32) in_be32(uccf->p_uccm);
|
|
|
|
ucce &= uccm;
|
|
|
|
out_be32(uccf->p_ucce, ucce);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:11 -04:00
|
|
|
/* check for receive events that require processing */
|
|
|
|
if (ucce & UCCE_RX_EVENTS) {
|
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
if (netif_rx_schedule_prep(dev, &ugeth->napi)) {
|
|
|
|
uccm &= ~UCCE_RX_EVENTS;
|
2007-04-13 02:26:11 -04:00
|
|
|
out_be32(uccf->p_uccm, uccm);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
__netif_rx_schedule(dev, &ugeth->napi);
|
2007-04-13 02:26:11 -04:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
rx_mask = UCCE_RXBF_SINGLE_MASK;
|
2006-08-15 02:00:11 -04:00
|
|
|
for (i = 0; i < ug_info->numQueuesRx; i++) {
|
2007-04-13 02:26:11 -04:00
|
|
|
if (ucce & rx_mask)
|
|
|
|
ucc_geth_rx(ugeth, i, (int)ugeth->ug_info->bdRingLenRx[i]);
|
|
|
|
ucce &= ~rx_mask;
|
|
|
|
rx_mask <<= 1;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
2007-04-13 02:26:11 -04:00
|
|
|
#endif /* CONFIG_UGETH_NAPI */
|
|
|
|
}
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:11 -04:00
|
|
|
/* Tx event processing */
|
|
|
|
if (ucce & UCCE_TX_EVENTS) {
|
|
|
|
spin_lock(&ugeth->lock);
|
|
|
|
tx_mask = UCCE_TXBF_SINGLE_MASK;
|
2006-08-15 02:00:11 -04:00
|
|
|
for (i = 0; i < ug_info->numQueuesTx; i++) {
|
|
|
|
if (ucce & tx_mask)
|
|
|
|
ucc_geth_tx(dev, i);
|
|
|
|
ucce &= ~tx_mask;
|
|
|
|
tx_mask <<= 1;
|
|
|
|
}
|
2007-04-13 02:26:11 -04:00
|
|
|
spin_unlock(&ugeth->lock);
|
|
|
|
}
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:11 -04:00
|
|
|
/* Errors and other events */
|
|
|
|
if (ucce & UCCE_OTHER) {
|
2006-08-15 02:00:11 -04:00
|
|
|
if (ucce & UCCE_BSY) {
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.rx_errors++;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
2007-04-13 02:26:11 -04:00
|
|
|
if (ucce & UCCE_TXE) {
|
2007-10-03 20:41:50 -04:00
|
|
|
dev->stats.tx_errors++;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called when something needs to use the ethernet device */
|
|
|
|
/* Returns 0 for success. */
|
|
|
|
static int ucc_geth_open(struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
2006-08-15 02:00:11 -04:00
|
|
|
int err;
|
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
|
|
|
/* Test station address */
|
|
|
|
if (dev->dev_addr[0] & ENET_GROUP_ADDR) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Multicast address used for station address"
|
|
|
|
" - is this what you wanted?", __FUNCTION__);
|
2006-08-15 02:00:11 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
err = ucc_struct_init(ugeth);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name);
|
2007-04-13 02:26:03 -04:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
|
|
|
napi_enable(&ugeth->napi);
|
|
|
|
#endif
|
2006-08-15 02:00:11 -04:00
|
|
|
err = ucc_geth_startup(ugeth);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot configure net device, aborting.",
|
|
|
|
dev->name);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
goto out_err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
err = adjust_enet_interface(ugeth);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot configure net device, aborting.",
|
|
|
|
dev->name);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
goto out_err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set MACSTNADDR1, MACSTNADDR2 */
|
|
|
|
/* For more details see the hardware spec. */
|
|
|
|
init_mac_station_addr_regs(dev->dev_addr[0],
|
|
|
|
dev->dev_addr[1],
|
|
|
|
dev->dev_addr[2],
|
|
|
|
dev->dev_addr[3],
|
|
|
|
dev->dev_addr[4],
|
|
|
|
dev->dev_addr[5],
|
|
|
|
&ugeth->ug_regs->macstnaddr1,
|
|
|
|
&ugeth->ug_regs->macstnaddr2);
|
|
|
|
|
|
|
|
err = init_phy(dev);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
goto out_err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
2007-04-13 02:26:03 -04:00
|
|
|
|
|
|
|
phy_start(ugeth->phydev);
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
err =
|
|
|
|
request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0,
|
|
|
|
"UCC Geth", dev);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot get IRQ for net device, aborting.",
|
|
|
|
dev->name);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_stop(ugeth);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
goto out_err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_ifup(ugeth))
|
|
|
|
ugeth_err("%s: Cannot enable net device, aborting.", dev->name);
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_stop(ugeth);
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
goto out_err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
netif_start_queue(dev);
|
|
|
|
|
|
|
|
return err;
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
|
|
|
|
out_err:
|
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
|
|
|
napi_disable(&ugeth->napi);
|
|
|
|
#endif
|
|
|
|
return err;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Stops the kernel queue, and halts the controller */
|
|
|
|
static int ucc_geth_close(struct net_device *dev)
|
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
|
|
|
napi_disable(&ugeth->napi);
|
|
|
|
#endif
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
ucc_geth_stop(ugeth);
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
phy_disconnect(ugeth->phydev);
|
|
|
|
ugeth->phydev = NULL;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
netif_stop_queue(dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-05-11 19:25:07 -04:00
|
|
|
static phy_interface_t to_phy_interface(const char *phy_connection_type)
|
2007-04-13 02:26:03 -04:00
|
|
|
{
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "mii") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_MII;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "gmii") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_GMII;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "tbi") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_TBI;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "rmii") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_RMII;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "rgmii") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_RGMII;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_RGMII_ID;
|
2007-11-26 17:17:58 -05:00
|
|
|
if (strcasecmp(phy_connection_type, "rgmii-txid") == 0)
|
|
|
|
return PHY_INTERFACE_MODE_RGMII_TXID;
|
|
|
|
if (strcasecmp(phy_connection_type, "rgmii-rxid") == 0)
|
|
|
|
return PHY_INTERFACE_MODE_RGMII_RXID;
|
2007-05-11 19:25:07 -04:00
|
|
|
if (strcasecmp(phy_connection_type, "rtbi") == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
return PHY_INTERFACE_MODE_RTBI;
|
|
|
|
|
|
|
|
return PHY_INTERFACE_MODE_MII;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct device *device = &ofdev->dev;
|
|
|
|
struct device_node *np = ofdev->node;
|
2007-04-13 02:26:03 -04:00
|
|
|
struct device_node *mdio;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct net_device *dev = NULL;
|
|
|
|
struct ucc_geth_private *ugeth = NULL;
|
|
|
|
struct ucc_geth_info *ug_info;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct resource res;
|
|
|
|
struct device_node *phy;
|
2007-04-13 02:26:03 -04:00
|
|
|
int err, ucc_num, max_speed = 0;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
const phandle *ph;
|
|
|
|
const unsigned int *prop;
|
2007-02-08 04:35:54 -05:00
|
|
|
const void *mac_addr;
|
2007-04-13 02:26:03 -04:00
|
|
|
phy_interface_t phy_interface;
|
|
|
|
static const int enet_to_speed[] = {
|
|
|
|
SPEED_10, SPEED_10, SPEED_10,
|
|
|
|
SPEED_100, SPEED_100, SPEED_100,
|
|
|
|
SPEED_1000, SPEED_1000, SPEED_1000, SPEED_1000,
|
|
|
|
};
|
|
|
|
static const phy_interface_t enet_to_phy_interface[] = {
|
|
|
|
PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_RMII,
|
|
|
|
PHY_INTERFACE_MODE_RGMII, PHY_INTERFACE_MODE_MII,
|
|
|
|
PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII,
|
|
|
|
PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_RGMII,
|
|
|
|
PHY_INTERFACE_MODE_TBI, PHY_INTERFACE_MODE_RTBI,
|
|
|
|
};
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
ugeth_vdbg("%s: IN", __FUNCTION__);
|
|
|
|
|
2007-04-30 23:54:02 -04:00
|
|
|
prop = of_get_property(np, "device-id", NULL);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ucc_num = *prop - 1;
|
|
|
|
if ((ucc_num < 0) || (ucc_num > 7))
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
ug_info = &ugeth_info[ucc_num];
|
2007-07-18 23:48:29 -04:00
|
|
|
if (ug_info == NULL) {
|
|
|
|
if (netif_msg_probe(&debug))
|
|
|
|
ugeth_err("%s: [%d] Missing additional data!",
|
|
|
|
__FUNCTION__, ucc_num);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->uf_info.ucc_num = ucc_num;
|
2007-04-13 02:26:03 -04:00
|
|
|
|
2007-04-30 23:54:02 -04:00
|
|
|
prop = of_get_property(np, "rx-clock", NULL);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->uf_info.rx_clock = *prop;
|
2007-04-30 23:54:02 -04:00
|
|
|
prop = of_get_property(np, "tx-clock", NULL);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->uf_info.tx_clock = *prop;
|
|
|
|
err = of_address_to_resource(np, 0, &res);
|
|
|
|
if (err)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ug_info->uf_info.regs = res.start;
|
|
|
|
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
|
|
|
|
|
2007-04-30 23:54:02 -04:00
|
|
|
ph = of_get_property(np, "phy-handle", NULL);
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
phy = of_find_node_by_phandle(*ph);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
if (phy == NULL)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
/* set the PHY address */
|
2007-04-30 23:54:02 -04:00
|
|
|
prop = of_get_property(phy, "reg", NULL);
|
2007-04-13 02:26:03 -04:00
|
|
|
if (prop == NULL)
|
|
|
|
return -1;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
ug_info->phy_address = *prop;
|
2007-04-13 02:26:03 -04:00
|
|
|
|
|
|
|
/* get the phy interface type, or default to MII */
|
2007-05-11 19:25:07 -04:00
|
|
|
prop = of_get_property(np, "phy-connection-type", NULL);
|
2007-04-13 02:26:03 -04:00
|
|
|
if (!prop) {
|
|
|
|
/* handle interface property present in old trees */
|
2007-04-30 23:54:02 -04:00
|
|
|
prop = of_get_property(phy, "interface", NULL);
|
2007-05-11 19:25:07 -04:00
|
|
|
if (prop != NULL) {
|
2007-04-13 02:26:03 -04:00
|
|
|
phy_interface = enet_to_phy_interface[*prop];
|
2007-05-11 19:25:07 -04:00
|
|
|
max_speed = enet_to_speed[*prop];
|
|
|
|
} else
|
2007-04-13 02:26:03 -04:00
|
|
|
phy_interface = PHY_INTERFACE_MODE_MII;
|
|
|
|
} else {
|
|
|
|
phy_interface = to_phy_interface((const char *)prop);
|
|
|
|
}
|
|
|
|
|
2007-05-11 19:25:07 -04:00
|
|
|
/* get speed, or derive from PHY interface */
|
|
|
|
if (max_speed == 0)
|
2007-04-13 02:26:03 -04:00
|
|
|
switch (phy_interface) {
|
|
|
|
case PHY_INTERFACE_MODE_GMII:
|
|
|
|
case PHY_INTERFACE_MODE_RGMII:
|
|
|
|
case PHY_INTERFACE_MODE_RGMII_ID:
|
2007-11-26 17:17:58 -05:00
|
|
|
case PHY_INTERFACE_MODE_RGMII_RXID:
|
|
|
|
case PHY_INTERFACE_MODE_RGMII_TXID:
|
2007-04-13 02:26:03 -04:00
|
|
|
case PHY_INTERFACE_MODE_TBI:
|
|
|
|
case PHY_INTERFACE_MODE_RTBI:
|
|
|
|
max_speed = SPEED_1000;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
max_speed = SPEED_100;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (max_speed == SPEED_1000) {
|
2007-05-11 19:25:07 -04:00
|
|
|
/* configure muram FIFOs for gigabit operation */
|
2007-04-13 02:26:03 -04:00
|
|
|
ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
|
|
|
|
ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
|
|
|
|
ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT;
|
|
|
|
ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT;
|
|
|
|
ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT;
|
|
|
|
ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the bus id */
|
|
|
|
mdio = of_get_parent(phy);
|
|
|
|
|
|
|
|
if (mdio == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
err = of_address_to_resource(mdio, 0, &res);
|
|
|
|
of_node_put(mdio);
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
ug_info->mdio_bus = res.start;
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(&debug))
|
|
|
|
printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
|
|
|
|
ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
|
|
|
|
ug_info->uf_info.irq);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
|
|
|
/* Create an ethernet device instance */
|
|
|
|
dev = alloc_etherdev(sizeof(*ugeth));
|
|
|
|
|
|
|
|
if (dev == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
ugeth = netdev_priv(dev);
|
|
|
|
spin_lock_init(&ugeth->lock);
|
|
|
|
|
|
|
|
dev_set_drvdata(device, dev);
|
|
|
|
|
|
|
|
/* Set the dev->base_addr to the gfar reg region */
|
|
|
|
dev->base_addr = (unsigned long)(ug_info->uf_info.regs);
|
|
|
|
|
|
|
|
SET_NETDEV_DEV(dev, device);
|
|
|
|
|
|
|
|
/* Fill in the dev structure */
|
2007-07-18 23:47:47 -04:00
|
|
|
uec_set_ethtool_ops(dev);
|
2006-08-15 02:00:11 -04:00
|
|
|
dev->open = ucc_geth_open;
|
|
|
|
dev->hard_start_xmit = ucc_geth_start_xmit;
|
|
|
|
dev->tx_timeout = ucc_geth_timeout;
|
|
|
|
dev->watchdog_timeo = TX_TIMEOUT;
|
|
|
|
#ifdef CONFIG_UGETH_NAPI
|
[NET]: Make NAPI polling independent of struct net_device objects.
Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.
In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.
The signature of the ->poll() call back goes from:
int foo_poll(struct net_device *dev, int *budget)
to
int foo_poll(struct napi_struct *napi, int budget)
The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract). The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.
The napi_struct is to be embedded in the device driver private data
structures.
Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler. Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.
With lots of help and suggestions from Rusty Russell, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
[ Ported to current tree and all drivers converted. Integrated
Stephen's follow-on kerneldoc additions, and restored poll_list
handling to the old style to fix mutual exclusion issues. -DaveM ]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-03 19:41:36 -04:00
|
|
|
netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
|
2006-08-15 02:00:11 -04:00
|
|
|
#endif /* CONFIG_UGETH_NAPI */
|
|
|
|
dev->stop = ucc_geth_close;
|
|
|
|
// dev->change_mtu = ucc_geth_change_mtu;
|
|
|
|
dev->mtu = 1500;
|
|
|
|
dev->set_multicast_list = ucc_geth_set_multi;
|
|
|
|
|
2007-07-18 23:48:29 -04:00
|
|
|
ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
|
2007-04-13 02:26:03 -04:00
|
|
|
ugeth->phy_interface = phy_interface;
|
|
|
|
ugeth->max_speed = max_speed;
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
err = register_netdev(dev);
|
|
|
|
if (err) {
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_probe(ugeth))
|
|
|
|
ugeth_err("%s: Cannot register net device, aborting.",
|
|
|
|
dev->name);
|
2006-08-15 02:00:11 -04:00
|
|
|
free_netdev(dev);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2007-02-21 15:40:12 -05:00
|
|
|
mac_addr = of_get_mac_address(np);
|
2007-02-08 04:35:54 -05:00
|
|
|
if (mac_addr)
|
|
|
|
memcpy(dev->dev_addr, mac_addr, 6);
|
2006-08-15 02:00:11 -04:00
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
ugeth->ug_info = ug_info;
|
|
|
|
ugeth->dev = dev;
|
|
|
|
|
2006-08-15 02:00:11 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static int ucc_geth_remove(struct of_device* ofdev)
|
2006-08-15 02:00:11 -04:00
|
|
|
{
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
struct device *device = &ofdev->dev;
|
2006-08-15 02:00:11 -04:00
|
|
|
struct net_device *dev = dev_get_drvdata(device);
|
|
|
|
struct ucc_geth_private *ugeth = netdev_priv(dev);
|
|
|
|
|
|
|
|
dev_set_drvdata(device, NULL);
|
|
|
|
ucc_geth_memclean(ugeth);
|
|
|
|
free_netdev(dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
static struct of_device_id ucc_geth_match[] = {
|
|
|
|
{
|
|
|
|
.type = "network",
|
|
|
|
.compatible = "ucc_geth",
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(of, ucc_geth_match);
|
|
|
|
|
|
|
|
static struct of_platform_driver ucc_geth_driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.match_table = ucc_geth_match,
|
|
|
|
.probe = ucc_geth_probe,
|
|
|
|
.remove = ucc_geth_remove,
|
2006-08-15 02:00:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init ucc_geth_init(void)
|
|
|
|
{
|
2007-04-13 02:26:03 -04:00
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
ret = uec_mdio_init();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include:
o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments
bugfixes, courtesy of Scott Wood, include:
- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
device_is_compatible() will only compare up to the length of the
test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-19 22:07:34 -04:00
|
|
|
|
2007-07-18 23:48:29 -04:00
|
|
|
if (netif_msg_drv(&debug))
|
|
|
|
printk(KERN_INFO "ucc_geth: " DRV_DESC "\n");
|
2006-08-15 02:00:11 -04:00
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
memcpy(&(ugeth_info[i]), &ugeth_primary_info,
|
|
|
|
sizeof(ugeth_primary_info));
|
|
|
|
|
2007-04-13 02:26:03 -04:00
|
|
|
ret = of_register_platform_driver(&ucc_geth_driver);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
uec_mdio_exit();
|
|
|
|
|
|
|
|
return ret;
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit ucc_geth_exit(void)
|
|
|
|
{
|
2006-11-15 13:29:35 -05:00
|
|
|
of_unregister_platform_driver(&ucc_geth_driver);
|
2007-04-13 02:26:03 -04:00
|
|
|
uec_mdio_exit();
|
2006-08-15 02:00:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(ucc_geth_init);
|
|
|
|
module_exit(ucc_geth_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Freescale Semiconductor, Inc");
|
|
|
|
MODULE_DESCRIPTION(DRV_DESC);
|
2007-04-13 02:26:36 -04:00
|
|
|
MODULE_VERSION(DRV_VERSION);
|
2006-08-15 02:00:11 -04:00
|
|
|
MODULE_LICENSE("GPL");
|