From patchwork Mon Nov 16 17:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 1401053 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=i/5n5NoW; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CZb3n3y4Qz9sPB for ; Tue, 17 Nov 2020 04:02:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9297582304; Mon, 16 Nov 2020 18:02:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1605546159; bh=6m1xChdyR0jrET6KIQRVyAzhILREhXFRuchgpYd8azI=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=i/5n5NoW1zghE1GevBwcOl+c3YgkBv3FjNk2th0OFeCAUB2HU4eWO7WyjafF/X5sU OxySzL1L7ViY3+RmIF/ASV5HYQY7+/ejTyMDFRDSBz/BBs6U3HjOUNCnpyMxzp3GLw RtKS+q6fNOlhIj2WUCt6MCf0c+ki9AYOBVjBQuK5vc23Fd0GBh4ifyHR+v7g3Xsnfc IVNgVPsrrtyLSLo3IyhWbFRfSWPnIWdP+tsN3hDlqyDxk3rcq5kJ0+no/NFWl0kZbO Sbb+TWqEKd5lCR3BXN3nUrOED13CmgY36eLjcHdfoK9ibtUvPi2i6poc9GRA97og6h 3nBpdm4yqXScQ== Received: by phobos.denx.de (Postfix, from userid 109) id 31269823A9; Mon, 16 Nov 2020 18:02:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mx2.mailbox.org (mx2a.mailbox.org [IPv6:2001:67c:2050:104:0:2:25:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7AE43821F7 for ; Mon, 16 Nov 2020 18:02:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id F2B64A0B4B; Mon, 16 Nov 2020 18:02:34 +0100 (CET) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id hDcDSN21Fod6; Mon, 16 Nov 2020 18:02:31 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Cc: Joe Hershberger , Aaron Williams , Chandrakala Chavva Subject: [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Date: Mon, 16 Nov 2020 18:02:28 +0100 Message-Id: <20201116170230.1148457-1-sr@denx.de> MIME-Version: 1.0 X-MBO-SPAM-Probability: X-Rspamd-Score: -0.87 / 15.00 / 15.00 X-Rspamd-Queue-Id: A5B81184D X-Rspamd-UID: 6094a1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean bus_to_phys() is defined but not referenced at all. This patch removes it completely. Signed-off-by: Stefan Roese Cc: Joe Hershberger Cc: Aaron Williams Cc: Chandrakala Chavva --- drivers/net/e1000.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 8e6c755f64..2c57786ec9 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -47,10 +47,8 @@ tested on both gig copper and gig fiber boards #ifdef CONFIG_DM_ETH #define virt_to_bus(devno, v) dm_pci_virt_to_mem(devno, (void *) (v)) -#define bus_to_phys(devno, a) dm_pci_mem_to_phys(devno, a) #else #define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v)) -#define bus_to_phys(devno, a) pci_mem_to_phys(devno, a) #endif #define E1000_DEFAULT_PCI_PBA 0x00000030 From patchwork Mon Nov 16 17:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 1401055 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=Ygcw4VvK; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CZb4C5jhJz9sTc for ; Tue, 17 Nov 2020 04:03:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 85CAF8254E; Mon, 16 Nov 2020 18:02:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1605546164; bh=KsWX3HtO7U9g0YhKPG3NmoRL+PdZszeI2j6ZKj7s5bY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ygcw4VvKpUNnzBGQbEcrRVHt7hGOH01kiBZ5E67JNJRlBn1K+NRCp0gcvAeiAhleB h5ww8YYo4gWAPonoOIu16HPz/jZIH00BQij8eodOQcUr8p5ICMzMcng5+02Pt42nNr 275NYj+uWwfS7pVU42k11SL47tzI0MFsDAFFA98gMXkGQuNH0UGohepTWLYRBcdNoq OQ3DJubnRN3b7gsb9NDE/Sl0PzhVjIuL2rvwDj3Rsz9I9xkDtgJeZA+COmQiV0ugV8 pXrMAUhh1I3CnJfDeeoUdeq9f/+WPRLLbYvIgligWcLyaIobke1h9Ejjmhy2/ZNpqf Qfcvww0/dCyJg== Received: by phobos.denx.de (Postfix, from userid 109) id 45DF182543; Mon, 16 Nov 2020 18:02:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A4334823E1 for ; Mon, 16 Nov 2020 18:02:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 3CE20A0BC9; Mon, 16 Nov 2020 18:02:35 +0100 (CET) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id U9_6runzm2gc; Mon, 16 Nov 2020 18:02:31 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Cc: Joe Hershberger , Aaron Williams , Chandrakala Chavva Subject: [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Date: Mon, 16 Nov 2020 18:02:29 +0100 Message-Id: <20201116170230.1148457-2-sr@denx.de> In-Reply-To: <20201116170230.1148457-1-sr@denx.de> References: <20201116170230.1148457-1-sr@denx.de> MIME-Version: 1.0 X-MBO-SPAM-Probability: X-Rspamd-Score: -0.87 / 15.00 / 15.00 X-Rspamd-Queue-Id: DE6831837 X-Rspamd-UID: a80ad8 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Using (dm_)pci_virt_to_mem() is incorrect to translate the virtual address in local DRAM to a physical address. The correct macro here is virt_to_phys() so switch to using this macro. As virt_to_bus() is now not used any more, this patch also removes both definitions (DM and non-DM). This issue was detected while testing the e1000 driver on the MIPS Octeon III platform, which needs address translation. Signed-off-by: Stefan Roese Cc: Joe Hershberger Cc: Aaron Williams Cc: Chandrakala Chavva --- drivers/net/e1000.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 2c57786ec9..bf6cd7d602 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -45,12 +45,6 @@ tested on both gig copper and gig fiber boards #define TOUT_LOOP 100000 -#ifdef CONFIG_DM_ETH -#define virt_to_bus(devno, v) dm_pci_virt_to_mem(devno, (void *) (v)) -#else -#define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v)) -#endif - #define E1000_DEFAULT_PCI_PBA 0x00000030 #define E1000_DEFAULT_PCIE_PBA 0x000a0026 @@ -5387,7 +5381,7 @@ static int _e1000_transmit(struct e1000_hw *hw, void *txpacket, int length) txp = tx_base + tx_tail; tx_tail = (tx_tail + 1) % 8; - txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet)); + txp->buffer_addr = cpu_to_le64(virt_to_phys(nv_packet)); txp->lower.data = cpu_to_le32(hw->txd_cmd | length); txp->upper.data = 0; From patchwork Mon Nov 16 17:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 1401054 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=F0o3XV86; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CZb402DkGz9sPB for ; Tue, 17 Nov 2020 04:02:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8803B823E1; Mon, 16 Nov 2020 18:02:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1605546161; bh=ldPxqKr3rJflifhFWlBIPFY9YLCggZRoIKFXvsTMHgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=F0o3XV86SyYn3bJCR457C1y3/kSKttCYUIx6TQBQD0hg6+67IjAKR4eUoosW9jQvI uN7iZkrrBcd9Hvk6Ttrv9RkbhN90T4FGftaey+VlRQyMBTSHZmUOi7FIGgfG70YyQu 9i7YZ1/VTHoFt3IDnIGTJotD4QuaCD7hPHSCZI45WFynox/gPa7fZ0x0+mLHnm/Hc5 O14+OnKdiyppP9L6oE2QsQbDchwnR3WwLC2FbIwgpf2GePxUOtYYNTV4tF22s5QwBl dyAQ3ViDhxdaMNUFJKYmbu5rWZ+TSG+yU2kVQ2S+uzS/abYOzmWlvck+TAUza+giKd ZFfRInKsaPJCg== Received: by phobos.denx.de (Postfix, from userid 109) id 564FA82309; Mon, 16 Nov 2020 18:02:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 97AE882304 for ; Mon, 16 Nov 2020 18:02:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 17402A0BBF; Mon, 16 Nov 2020 18:02:35 +0100 (CET) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id 5M9OMQ_TK5ym; Mon, 16 Nov 2020 18:02:31 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Cc: Joe Hershberger , Aaron Williams , Chandrakala Chavva Subject: [PATCH 3/3] net: e1000: Add missing address translations Date: Mon, 16 Nov 2020 18:02:30 +0100 Message-Id: <20201116170230.1148457-3-sr@denx.de> In-Reply-To: <20201116170230.1148457-1-sr@denx.de> References: <20201116170230.1148457-1-sr@denx.de> MIME-Version: 1.0 X-MBO-SPAM-Probability: X-Rspamd-Score: -0.77 / 15.00 / 15.00 X-Rspamd-Queue-Id: EC59D1854 X-Rspamd-UID: 77eb52 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add some missing address translations from virtual address in local DRAM to physical address, which is needed for the DMA transactions to work correctly. This issue was detected while testing the e1000 driver on the MIPS Octeon III platform, which needs address translation. Signed-off-by: Stefan Roese Cc: Joe Hershberger Cc: Aaron Williams Cc: Chandrakala Chavva --- drivers/net/e1000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index bf6cd7d602..cf57ff067b 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -5143,7 +5143,7 @@ fill_rx(struct e1000_hw *hw) rd = rx_base + rx_tail; rx_tail = (rx_tail + 1) % 8; memset(rd, 0, 16); - rd->buffer_addr = cpu_to_le64((unsigned long)packet); + rd->buffer_addr = cpu_to_le64(virt_to_phys(packet)); /* * Make sure there are no stale data in WB over this area, which @@ -5174,8 +5174,8 @@ e1000_configure_tx(struct e1000_hw *hw) unsigned long tipg, tarc; uint32_t ipgr1, ipgr2; - E1000_WRITE_REG(hw, TDBAL, lower_32_bits((unsigned long)tx_base)); - E1000_WRITE_REG(hw, TDBAH, upper_32_bits((unsigned long)tx_base)); + E1000_WRITE_REG(hw, TDBAL, lower_32_bits(virt_to_phys(tx_base))); + E1000_WRITE_REG(hw, TDBAH, upper_32_bits(virt_to_phys(tx_base))); E1000_WRITE_REG(hw, TDLEN, 128); @@ -5319,8 +5319,8 @@ e1000_configure_rx(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } /* Setup the Base and Length of the Rx Descriptor Ring */ - E1000_WRITE_REG(hw, RDBAL, lower_32_bits((unsigned long)rx_base)); - E1000_WRITE_REG(hw, RDBAH, upper_32_bits((unsigned long)rx_base)); + E1000_WRITE_REG(hw, RDBAL, lower_32_bits(virt_to_phys(rx_base))); + E1000_WRITE_REG(hw, RDBAH, upper_32_bits(virt_to_phys(rx_base))); E1000_WRITE_REG(hw, RDLEN, 128);