mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
net: ftgmac100: align RX/TX descriptors on ARCH_DMA_MINALIGN
Fixes: e766849713
("net: ftgmac100: convert the RX/TX descriptor arrays")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
committed by
Joe Hershberger
parent
1e354cb393
commit
08b3e90a01
@@ -72,8 +72,8 @@ enum ftgmac100_model {
|
|||||||
struct ftgmac100_data {
|
struct ftgmac100_data {
|
||||||
struct ftgmac100 *iobase;
|
struct ftgmac100 *iobase;
|
||||||
|
|
||||||
struct ftgmac100_txdes txdes[PKTBUFSTX];
|
struct ftgmac100_txdes txdes[PKTBUFSTX] __aligned(ARCH_DMA_MINALIGN);
|
||||||
struct ftgmac100_rxdes rxdes[PKTBUFSRX];
|
struct ftgmac100_rxdes rxdes[PKTBUFSRX] __aligned(ARCH_DMA_MINALIGN);
|
||||||
int tx_index;
|
int tx_index;
|
||||||
int rx_index;
|
int rx_index;
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ static int ftgmac100_start(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
priv->txdes[PKTBUFSTX - 1].txdes0 = priv->txdes0_edotr_mask;
|
priv->txdes[PKTBUFSTX - 1].txdes0 = priv->txdes0_edotr_mask;
|
||||||
|
|
||||||
start = (ulong)&priv->txdes[0];
|
start = ((ulong)&priv->txdes[0]) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
end = start + roundup(sizeof(priv->txdes), ARCH_DMA_MINALIGN);
|
end = start + roundup(sizeof(priv->txdes), ARCH_DMA_MINALIGN);
|
||||||
flush_dcache_range(start, end);
|
flush_dcache_range(start, end);
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ static int ftgmac100_start(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
priv->rxdes[PKTBUFSRX - 1].rxdes0 = priv->rxdes0_edorr_mask;
|
priv->rxdes[PKTBUFSRX - 1].rxdes0 = priv->rxdes0_edorr_mask;
|
||||||
|
|
||||||
start = (ulong)&priv->rxdes[0];
|
start = ((ulong)&priv->rxdes[0]) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
end = start + roundup(sizeof(priv->rxdes), ARCH_DMA_MINALIGN);
|
end = start + roundup(sizeof(priv->rxdes), ARCH_DMA_MINALIGN);
|
||||||
flush_dcache_range(start, end);
|
flush_dcache_range(start, end);
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ static int ftgmac100_free_pkt(struct udevice *dev, uchar *packet, int length)
|
|||||||
{
|
{
|
||||||
struct ftgmac100_data *priv = dev_get_priv(dev);
|
struct ftgmac100_data *priv = dev_get_priv(dev);
|
||||||
struct ftgmac100_rxdes *curr_des = &priv->rxdes[priv->rx_index];
|
struct ftgmac100_rxdes *curr_des = &priv->rxdes[priv->rx_index];
|
||||||
ulong des_start = (ulong)curr_des;
|
ulong des_start = ((ulong)curr_des) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
ulong des_end = des_start +
|
ulong des_end = des_start +
|
||||||
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ static int ftgmac100_recv(struct udevice *dev, int flags, uchar **packetp)
|
|||||||
struct ftgmac100_data *priv = dev_get_priv(dev);
|
struct ftgmac100_data *priv = dev_get_priv(dev);
|
||||||
struct ftgmac100_rxdes *curr_des = &priv->rxdes[priv->rx_index];
|
struct ftgmac100_rxdes *curr_des = &priv->rxdes[priv->rx_index];
|
||||||
unsigned short rxlen;
|
unsigned short rxlen;
|
||||||
ulong des_start = (ulong)curr_des;
|
ulong des_start = ((ulong)curr_des) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
ulong des_end = des_start +
|
ulong des_end = des_start +
|
||||||
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
||||||
ulong data_start = curr_des->rxdes3;
|
ulong data_start = curr_des->rxdes3;
|
||||||
@@ -427,7 +427,7 @@ static int ftgmac100_recv(struct udevice *dev, int flags, uchar **packetp)
|
|||||||
static u32 ftgmac100_read_txdesc(const void *desc)
|
static u32 ftgmac100_read_txdesc(const void *desc)
|
||||||
{
|
{
|
||||||
const struct ftgmac100_txdes *txdes = desc;
|
const struct ftgmac100_txdes *txdes = desc;
|
||||||
ulong des_start = (ulong)txdes;
|
ulong des_start = ((ulong)txdes) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
ulong des_end = des_start + roundup(sizeof(*txdes), ARCH_DMA_MINALIGN);
|
ulong des_end = des_start + roundup(sizeof(*txdes), ARCH_DMA_MINALIGN);
|
||||||
|
|
||||||
invalidate_dcache_range(des_start, des_end);
|
invalidate_dcache_range(des_start, des_end);
|
||||||
@@ -445,7 +445,7 @@ static int ftgmac100_send(struct udevice *dev, void *packet, int length)
|
|||||||
struct ftgmac100_data *priv = dev_get_priv(dev);
|
struct ftgmac100_data *priv = dev_get_priv(dev);
|
||||||
struct ftgmac100 *ftgmac100 = priv->iobase;
|
struct ftgmac100 *ftgmac100 = priv->iobase;
|
||||||
struct ftgmac100_txdes *curr_des = &priv->txdes[priv->tx_index];
|
struct ftgmac100_txdes *curr_des = &priv->txdes[priv->tx_index];
|
||||||
ulong des_start = (ulong)curr_des;
|
ulong des_start = ((ulong)curr_des) & ~(ARCH_DMA_MINALIGN - 1);
|
||||||
ulong des_end = des_start +
|
ulong des_end = des_start +
|
||||||
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
roundup(sizeof(*curr_des), ARCH_DMA_MINALIGN);
|
||||||
ulong data_start;
|
ulong data_start;
|
||||||
|
Reference in New Issue
Block a user