From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 20 Jul 2009 22:47:06 -0700 Subject: [U-Boot] [PATCH 4/4]: arm: Kirkwood: See to it that sent data is 8-byte aligned In-Reply-To: <20090708130542.321f7951@marrow.netinsight.se> References: <20090708130134.4b100399@marrow.netinsight.se> <20090708130542.321f7951@marrow.netinsight.se> Message-ID: <4A65565A.7010206@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Simon, Simon Kagstrom wrote: > U-boot might use non-8-byte-aligned addresses for sending data, which > the kwgbe_send doesn't accept (bootp does this for me). This patch > copies the data to be sent to a temporary buffer if it is non-aligned. > > Signed-off-by: Simon Kagstrom > --- > drivers/net/kirkwood_egiga.c | 26 ++++++++++++++++++++------ > 1 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c > index 537343f..24269c1 100644 > --- a/drivers/net/kirkwood_egiga.c > +++ b/drivers/net/kirkwood_egiga.c > @@ -481,7 +481,7 @@ static int kwgbe_halt(struct eth_device *dev) > return 0; > } > > -static int kwgbe_send(struct eth_device *dev, volatile void *dataptr, > +static int kwgbe_send_aligned(struct eth_device *dev, volatile void *dataptr, > int datasize) > { > struct kwgbe_device *dkwgbe = to_dkwgbe(dev); > @@ -489,11 +489,6 @@ static int kwgbe_send(struct eth_device *dev, volatile void *dataptr, > struct kwgbe_txdesc *p_txdesc = dkwgbe->p_txdesc; > u32 cmd_sts; > > - if ((u32) dataptr & 0x07) { > - printf("Err..(%s) xmit dataptr not 64bit aligned\n", > - __FUNCTION__); > - return -1; > - } > p_txdesc->cmd_sts = KWGBE_ZERO_PADDING | KWGBE_GEN_CRC; > p_txdesc->cmd_sts |= KWGBE_TX_FIRST_DESC | KWGBE_TX_LAST_DESC; > p_txdesc->cmd_sts |= KWGBE_BUFFER_OWNED_BY_DMA; > @@ -522,6 +517,25 @@ static int kwgbe_send(struct eth_device *dev, volatile void *dataptr, > return 0; > } > > +static int kwgbe_send(struct eth_device *dev, volatile void *dataptr, > + int datasize) > +{ > + static u8 __attribute__((aligned(8))) aligned_buf[9000]; > Why do you need to send a jumbo frame? U-boot is hard-coded in some ways to only handle frames with an MTU of 1518 bytes on Rx. regards, Ben