Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77338C4332F for ; Fri, 9 Dec 2022 12:50:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0E6C84C4B; Fri, 9 Dec 2022 13:50:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 79A7A8452B; Fri, 9 Dec 2022 07:33:37 +0100 (CET) Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by phobos.denx.de (Postfix) with ESMTP id 74BE382AE2 for ; Fri, 9 Dec 2022 07:33:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=leyfoon.tan@starfivetech.com Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id D548924E2B2; Fri, 9 Dec 2022 14:33:25 +0800 (CST) Received: from EXMBX161.cuchost.com (172.16.6.71) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 9 Dec 2022 14:33:25 +0800 Received: from localhost.localdomain (202.188.176.82) by EXMBX161.cuchost.com (172.16.6.71) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 9 Dec 2022 14:33:23 +0800 From: Ley Foon Tan To: Joe Hershberger , Ramon Fried CC: , Ley Foon Tan Subject: [PATCH] net: dw_eth_qos: Add 64-bit addressing Date: Fri, 9 Dec 2022 14:33:14 +0800 Message-ID: <20221209063314.597218-1-leyfoon.tan@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX161.cuchost.com (172.16.6.71) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Fri, 09 Dec 2022 13:50:24 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Set upper 32bit address for DMA descriptors and buffer address to support 64-bit addressing. Signed-off-by: Ley Foon Tan --- drivers/net/dwc_eth_qos.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index afc47b56ff..a21dbbda72 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -745,6 +745,7 @@ static int eqos_start(struct udevice *dev) u32 val, tx_fifo_sz, rx_fifo_sz, tqs, rqs, pbl; ulong last_rx_desc; ulong desc_pad; + ulong addr64; =20 debug("%s(dev=3D%p):\n", __func__, dev); =20 @@ -1008,25 +1009,25 @@ static int eqos_start(struct udevice *dev) =20 for (i =3D 0; i < EQOS_DESCRIPTORS_RX; i++) { struct eqos_desc *rx_desc =3D eqos_get_desc(eqos, i, true); - rx_desc->des0 =3D (u32)(ulong)(eqos->rx_dma_buf + - (i * EQOS_MAX_PACKET_SIZE)); + + addr64 =3D (ulong)(eqos->rx_dma_buf + (i * EQOS_MAX_PACKET_SIZE)); + rx_desc->des0 =3D lower_32_bits(addr64); + rx_desc->des1 =3D upper_32_bits(addr64); rx_desc->des3 =3D EQOS_DESC3_OWN | EQOS_DESC3_BUF1V; mb(); eqos->config->ops->eqos_flush_desc(rx_desc); - eqos->config->ops->eqos_inval_buffer(eqos->rx_dma_buf + - (i * EQOS_MAX_PACKET_SIZE), - EQOS_MAX_PACKET_SIZE); + eqos->config->ops->eqos_inval_buffer((void *)addr64, EQOS_MAX_PACKET_S= IZE); } =20 - writel(0, &eqos->dma_regs->ch0_txdesc_list_haddress); - writel((ulong)eqos_get_desc(eqos, 0, false), - &eqos->dma_regs->ch0_txdesc_list_address); + addr64 =3D (ulong)eqos_get_desc(eqos, 0, false); + writel(upper_32_bits(addr64), &eqos->dma_regs->ch0_txdesc_list_haddress= ); + writel(lower_32_bits(addr64), &eqos->dma_regs->ch0_txdesc_list_address)= ; writel(EQOS_DESCRIPTORS_TX - 1, &eqos->dma_regs->ch0_txdesc_ring_length); =20 - writel(0, &eqos->dma_regs->ch0_rxdesc_list_haddress); - writel((ulong)eqos_get_desc(eqos, 0, true), - &eqos->dma_regs->ch0_rxdesc_list_address); + addr64 =3D (ulong)eqos_get_desc(eqos, 0, true); + writel(upper_32_bits(addr64), &eqos->dma_regs->ch0_rxdesc_list_haddress= ); + writel(lower_32_bits(addr64), &eqos->dma_regs->ch0_rxdesc_list_address)= ; writel(EQOS_DESCRIPTORS_RX - 1, &eqos->dma_regs->ch0_rxdesc_ring_length); =20 @@ -1131,8 +1132,8 @@ static int eqos_send(struct udevice *dev, void *pac= ket, int length) eqos->tx_desc_idx++; eqos->tx_desc_idx %=3D EQOS_DESCRIPTORS_TX; =20 - tx_desc->des0 =3D (ulong)eqos->tx_dma_buf; - tx_desc->des1 =3D 0; + tx_desc->des0 =3D lower_32_bits((ulong)eqos->tx_dma_buf); + tx_desc->des1 =3D upper_32_bits((ulong)eqos->tx_dma_buf); tx_desc->des2 =3D length; /* * Make sure that if HW sees the _OWN write below, it will see all the @@ -1205,14 +1206,17 @@ static int eqos_free_pkt(struct udevice *dev, uch= ar *packet, int length) for (idx =3D eqos->rx_desc_idx - idx_mask; idx <=3D eqos->rx_desc_idx; idx++) { + ulong addr64; + rx_desc =3D eqos_get_desc(eqos, idx, true); rx_desc->des0 =3D 0; + rx_desc->des1 =3D 0; mb(); eqos->config->ops->eqos_flush_desc(rx_desc); eqos->config->ops->eqos_inval_buffer(packet, length); - rx_desc->des0 =3D (u32)(ulong)(eqos->rx_dma_buf + - (idx * EQOS_MAX_PACKET_SIZE)); - rx_desc->des1 =3D 0; + addr64 =3D (ulong)(eqos->rx_dma_buf + (idx * EQOS_MAX_PACKET_SIZE)); + rx_desc->des0 =3D lower_32_bits(addr64); + rx_desc->des1 =3D upper_32_bits(addr64); rx_desc->des2 =3D 0; /* * Make sure that if HW sees the _OWN write below, --=20 2.25.1