From: jozsef imrek <mazsi@imrek.org>
To: linuxppc-embedded@ozlabs.org
Subject: Re: U-boot and Xilinx emaclite, TX_PING_PONG -> stops working
Date: Sat, 16 Aug 2008 23:33:54 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0808162240010.9518@mail.imrek.org> (raw)
In-Reply-To: <48A7302F.8030707@hachti.de>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1617 bytes --]
dear philipp,
On Sat, 16 Aug 2008, Philipp Hachtmann wrote:
> I am currently wondering if someone has experience with the emaclite
> driver. When I unset the "ping pong" (double buffering) parameters of
> ...
>
> I found a driver (xilinx_emaclite.c) in the U-boot git. That completely
> refuses to work correctly (of course with parameters corrected). The
> other driver I once found "somewhere" (in the Petalinux distribution).
i don't know what exact versions are you using. for me the following
combination works reasonably both with tx-ping-pong = rx-ping-pong = 0
and with tx-ping-pong = rx-ping-pong = 1, both under u-boot and
linux (i'm normally using ping-pong = 1, i've only made a quick test
with ping-pong = 0):
- edk 9.1, opb_ethernetlite v1.01.b, v4-fx12 (memec/avnet minimodule)
- u-boot: ftp://ftp.denx.de/pub/u-boot/u-boot-1.3.3.tar.bz2
- linux: xilinx's git://git.xilinx.com/linux-2.6-xlnx, 2.6.26-rc6
also, i think there is a bug in the linux driver: the XEmacLite_Config
structure used to set up the device is located on the stack. so
after the init returns, further references to this struct by the
os independent part of the driver are invalid. see the attached
patch. i don't know if it solves your prolem, though..
(the patch also replaces a few calls of dev_kfree_skb() from
interrupt context. thoose can generate lots of warnings on the
console, thus slowing down operation.)
--
mazsi
----------------------------------------------------------------
strawberry fields forever! mazsi@imrek.org
----------------------------------------------------------------
[-- Attachment #2: Type: TEXT/x-diff, Size: 3339 bytes --]
diff --git a/drivers/net/xilinx_emaclite/adapter.c b/drivers/net/xilinx_emaclite/adapter.c
index ed7a947..2a50e29 100644
--- a/drivers/net/xilinx_emaclite/adapter.c
+++ b/drivers/net/xilinx_emaclite/adapter.c
@@ -100,6 +100,7 @@ struct net_local {
* data as an opaque object in this file (meaning that we never
* reference any of the fields inside of the structure).
*/
+ XEmacLite_Config Config;
XEmacLite EmacLite;
void *desc_space;
@@ -168,7 +169,7 @@ static void reset(struct net_device *dev, DUPLEX duplex)
XEmacLite_EnableInterrupts(&lp->EmacLite);
if (lp->deferred_skb) {
- dev_kfree_skb(lp->deferred_skb);
+ dev_kfree_skb_any(lp->deferred_skb);
lp->deferred_skb = NULL;
lp->stats.tx_errors++;
}
@@ -279,7 +280,7 @@ static int xemaclite_Send(struct sk_buff *orig_skb, struct net_device *dev)
spin_unlock_irqrestore(&reset_lock, flags);
lp->stats.tx_bytes += len;
- dev_kfree_skb(new_skb);
+ dev_kfree_skb_any(new_skb);
dev->trans_start = jiffies;
return 0;
@@ -298,7 +299,7 @@ static void SendHandler(void *CallbackRef)
return;
}
else {
- dev_kfree_skb(lp->deferred_skb);
+ dev_kfree_skb_any(lp->deferred_skb);
lp->deferred_skb = NULL;
netif_wake_queue(dev);
}
@@ -354,7 +355,7 @@ static void RecvHandler(void *CallbackRef)
if (!len) {
lp->stats.rx_errors++;
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
//printk(KERN_ERR "%s: Could not receive buffer\n",dev->name);
spin_lock(&reset_lock);
//reset(dev, UNKNOWN_DUPLEX);
@@ -438,8 +439,6 @@ static int xemaclite_setup(
u32 virt_baddr; /* virtual base address of emac */
- XEmacLite_Config Config;
-
struct net_device *ndev = NULL;
struct net_local *lp = NULL;
@@ -471,9 +470,9 @@ static int xemaclite_setup(
lp->ndev = ndev;
/* Setup the Config structure for the XEmacLite_CfgInitialize() call. */
- Config.BaseAddress = r_mem->start; /* Physical address */
- Config.TxPingPong = pdata->tx_ping_pong;
- Config.RxPingPong = pdata->rx_ping_pong;
+ lp->Config.BaseAddress = r_mem->start; /* Physical address */
+ lp->Config.TxPingPong = pdata->tx_ping_pong;
+ lp->Config.RxPingPong = pdata->rx_ping_pong;
/* Get the virtual base address for the device */
@@ -485,7 +484,7 @@ static int xemaclite_setup(
}
- if (XEmacLite_CfgInitialize(&lp->EmacLite, &Config, virt_baddr) != XST_SUCCESS) {
+ if (XEmacLite_CfgInitialize(&lp->EmacLite, &lp->Config, virt_baddr) != XST_SUCCESS) {
dev_err(dev, "XEmacLite: Could not initialize device.\n");
rc = -ENODEV;
goto error;
@@ -498,12 +497,12 @@ static int xemaclite_setup(
XEmacLite_SetMacAddress(&lp->EmacLite, ndev->dev_addr);
dev_info(dev,
- "MAC address is now %2x:%2x:%2x:%2x:%2x:%2x\n",
+ "MAC address is now %02x:%02x:%02x:%02x:%02x:%02x\n",
pdata->mac_addr[0], pdata->mac_addr[1],
pdata->mac_addr[2], pdata->mac_addr[3],
pdata->mac_addr[4], pdata->mac_addr[5]);
- dev_err(dev, "using fifo mode.\n");
+ dev_err(dev, "using fifo mode, tx-ping-pong=%d, rx-ping-pong=%d.\n", lp->Config.TxPingPong, lp->Config.RxPingPong);
XEmacLite_SetRecvHandler(&lp->EmacLite, ndev, RecvHandler);
XEmacLite_SetSendHandler(&lp->EmacLite, ndev, SendHandler);
ndev->hard_start_xmit = xemaclite_Send;
next prev parent reply other threads:[~2008-08-16 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 11:34 How to use ttyUL0 as input and use VGA as display? yanlong wang
2008-08-16 12:56 ` Anatolij Gustschin
2008-08-16 16:38 ` wangyanlong
2008-08-18 6:18 ` wangyanlong
2008-08-16 19:53 ` U-boot and Xilinx emaclite, TX_PING_PONG -> stops working Philipp Hachtmann
2008-08-16 21:33 ` jozsef imrek [this message]
2008-08-20 12:13 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0808162240010.9518@mail.imrek.org \
--to=mazsi@imrek.org \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).