diff options
author | Andy Duan <fugang.duan@nxp.com> | 2016-12-08 14:53:17 +0800 |
---|---|---|
committer | Andy Duan <fugang.duan@nxp.com> | 2016-12-08 16:28:27 +0800 |
commit | 8b1b6a8faf274bef47016d3edc682a5dc1845f65 (patch) | |
tree | b33d39d1f7bdfec312560ae77a903114cc602751 /drivers | |
parent | bf562a4035f53bc4265dc1b9b5708065e7fd1823 (diff) | |
download | u-boot-imx-8b1b6a8faf274bef47016d3edc682a5dc1845f65.zip u-boot-imx-8b1b6a8faf274bef47016d3edc682a5dc1845f65.tar.gz u-boot-imx-8b1b6a8faf274bef47016d3edc682a5dc1845f65.tar.bz2 |
MLK-13582 net: usb: r8152: allocate cache-aligned buffer for usb transfer buffers
Transfer the cache-aligned buffer for usb transfer buffer.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/eth/r8152.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c index 325b70c..5728716 100644 --- a/drivers/usb/eth/r8152.c +++ b/drivers/usb/eth/r8152.c @@ -8,6 +8,7 @@ #include <common.h> #include <errno.h> #include <malloc.h> +#include <memalign.h> #include <usb.h> #include <usb/lin_gadget_compat.h> #include <linux/mii.h> @@ -68,17 +69,25 @@ static const struct r8152_version const r8152_versions[] = { static int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) { - return usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), + int ret = 0; + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buf, size); + + ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, - value, index, data, size, 500); + value, index, buf, size, 500); + memcpy(data, buf, size); + return ret; } static int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) { + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buf, size); + memcpy(buf, data, size); + return usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, - value, index, data, size, 500); + value, index, buf, size, 500); } int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, @@ -1219,7 +1228,8 @@ static int r8152_send(struct eth_device *eth, void *packet, int length) int err; int actual_len; - unsigned char msg[PKTSIZE + sizeof(struct tx_desc)]; + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, msg, + PKTSIZE + sizeof(struct tx_desc)); struct tx_desc *tx_desc = (struct tx_desc *)msg; debug("** %s(), len %d\n", __func__, length); @@ -1247,7 +1257,7 @@ static int r8152_recv(struct eth_device *eth) { struct ueth_data *dev = (struct ueth_data *)eth->priv; - static unsigned char recv_buf[RTL8152_AGG_BUF_SZ]; + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, recv_buf, RTL8152_AGG_BUF_SZ); unsigned char *pkt_ptr; int err; int actual_len; |