From patchwork Sat May 23 16:38:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296719 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GbnTCC3A; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Tpwf71F4z9sRf for ; Sun, 24 May 2020 02:39:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F219381688; Sat, 23 May 2020 18:39:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GbnTCC3A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A069081589; Sat, 23 May 2020 18:39:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 46B5F8067C for ; Sat, 23 May 2020 18:39:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id se13so16367463ejb.9 for ; Sat, 23 May 2020 09:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YQ9TyB/Dcb8uUYr95iHXKPwN66T7J7C4l2lB/KZI4iY=; b=GbnTCC3AHS8K94bdilMcG65i9dLmz9a7MKFn20+TTUFQG3VL9/GJ/lDOZe3Ex1onPV 97dwIKGPkNZb/5JqHJmEu3q9upLwXazzrpfjys3W8sZZsnOt1x1wjAN6Wx9diT2DrXW1 wA9rDYMlQfivRJXOonUzIcHm3ek1CmRI/roJi2EPoII5RFBMy2a9NSo++qOJkzDznQNH jCv380fJ4YPqe8uf4En4rowmhIPp4MLoaB3kWOR3xfYCNG+qFGOFrr78uXnEGmqWqHoc yXlNyRryuec/t4nHqjeqDMiBl/SedIH3MhVLvYl1hwy9lWa6mCLGA1AsuLCrIuoP5lJa S9Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YQ9TyB/Dcb8uUYr95iHXKPwN66T7J7C4l2lB/KZI4iY=; b=Xlm870rPmkZqDJTxsroPteMqGGWpazhEfXO0IcDgwbQFhtUD7vdb+jbQiG9JZb27Dk t9ijFy2EdPH4iB2yiVKznPLvYNE8dp4ECU6fE1vR3GaVj0s1jPMJ7JFSt+np5swIoLfE ZEWuW8SnvUZh5C5bdNIFFgqp4LdQ/8keVyXrq9nnLdM/qfsq+nssdmQKZ2e219hyY9DC ReCKP7gyRNPfK1G0snY5rmbOmF8pVF7rULPl2dc0n9MCmIt0LpYqEMiEw5oQ/ZIx5Z89 XtQo9mP0aelTiugI4R8euZVbAIicYw27B8g1L6eLRwD13aGN8UPgQChs5BptLtBrVACR 0KPg== X-Gm-Message-State: AOAM532byCarG8I15eoWEhsOIWR7Q8rW2oQbT8UnnKODvdiAGmidRiOw YYjoL6ernLYricg+Ghnov+KRWxs7 X-Google-Smtp-Source: ABdhPJy97DrZ+qb8CGc+QhjJgHsRb7Mb92+KFQaEPYDjVvG8iCDAeC4AKciTiNaAvjWcRBaXm2aYCA== X-Received: by 2002:a17:906:b099:: with SMTP id x25mr13012603ejy.290.1590251941216; Sat, 23 May 2020 09:39:01 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:00 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 01/30] net: eepro100: Remove EEPRO100_SROM_WRITE Date: Sat, 23 May 2020 18:38:08 +0200 Message-Id: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This code is never enabled, last board that used it was ELPPC which was removed some 5 years ago, so just remove this code altogether. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried = 0; i--) - { - dataval = (enable_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(dev, EE_ENB | dataval, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); - udelay(1); - } - - OUTW(dev, EE_ENB, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB, SCBeeprom); - - - /* Shift the write command bits out. */ - for (i = (addr_len+EE_CMD_BITS-1); i >= 0; i--) - { - dataval = (write_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(dev, EE_ENB | dataval, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); - udelay(1); - } - - /* Write the data */ - datalong= (unsigned long) ((((data) & 0x00ff) << 8) | ( (data) >> 8)); - - for (i = 0; i< EE_DATA_BITS; i++) - { - /* Extract and move data bit to bit DI */ - dataval = ((datalong & 0x8000)>>13) ? EE_DATA_WRITE : 0; - - OUTW(dev, EE_ENB | dataval, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); - udelay(1); - OUTW(dev, EE_ENB | dataval, SCBeeprom); - udelay(1); - - datalong = datalong << 1; /* Adjust significant data bit*/ - } - - /* Finish up command (toggle CS) */ - OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); - udelay(1); /* delay for more than 250 ns */ - OUTW(dev, EE_ENB, SCBeeprom); - - /* Wait for programming ready (D0 = 1) */ - tmplong = 10; - do - { - dataval = INW(dev, SCBeeprom); - if (dataval & EE_DATA_READ) - break; - udelay(10000); - } - while (-- tmplong); - - if (tmplong == 0) - { - printf ("Write i82559 eeprom timed out (100 ms waiting for data ready.\n"); - return -1; - } - - /* Terminate the EEPROM access. */ - OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); - - return 0; -} -#endif - static void init_rx_ring (struct eth_device *dev) { int i; diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 3f5e6504e1..2dee446dde 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -401,7 +401,6 @@ CONFIG_EDB93XX_SDCS1 CONFIG_EDB93XX_SDCS2 CONFIG_EDB93XX_SDCS3 CONFIG_EEPRO100 -CONFIG_EEPRO100_SROM_WRITE CONFIG_EFLASH_PROTSECTORS CONFIG_EHCI_DESC_BIG_ENDIAN CONFIG_EHCI_HCD_INIT_AFTER_RESET From patchwork Sat May 23 16:38:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296720 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=YQaYY6+L; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Tpx21mNzz9sPK for ; Sun, 24 May 2020 02:39:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19DD681589; Sat, 23 May 2020 18:39:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YQaYY6+L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 591C2815FB; Sat, 23 May 2020 18:39:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 79D28812EE for ; Sat, 23 May 2020 18:39:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id j21so16429545ejy.1 for ; Sat, 23 May 2020 09:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s2/ScMRb2iGeemxy1tvzEho4iSq+xf7fcyrz0lBy8JU=; b=YQaYY6+LC25T871KuRJ6muhjAmEUc27KndTeWSndrStCTNfmAnbgb8VtHcFeJp4ZA/ kNO0k966Y4jNB/8SnX+ZyDFV7TfEkh0yV1JZroFcv986cY0CKLYWzVkG0gh81a8+C2M/ nC95BCjErMw9T6Kklz0UYWgvyk/JOah9jKp8r2K42rzTAwl16IK4PJ2mihiacGJORVHj twFAO4iOzhS3yqKSZ+0nCG0ii3sW26lxAz9/+jgDC185YxHd4HatlatRVdQ6tga15heY 0LP4mfs0V+L5T+J2wg8f6p+2vTWGEDuukeWT3b5r9njb0GuNbIOQP0xtkuGCck7eBXTx QCyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s2/ScMRb2iGeemxy1tvzEho4iSq+xf7fcyrz0lBy8JU=; b=hPixgD3TZtSn6bhTAntnuQg+X5LbOxHGR0V3jHRn2SY+tW0TLvLLQVbFAOl2zKelAt /dPtD2yppNrpTfB1eDYeAnpMdhmZCxAJtEdTGp2n+/7PLbxeoweIdVOUGqOAKs+lDxs/ /YWLEOOI8crYyfvcQi8WHvXyPF3UznEd6v3kEzhLLz9F8ibY1aYK+DWOU6c1coUxYqRo gdMoevAYOY0oPTjnHH083WEbNsS0SpAO1yKanzXVOqY9A53cJxAuRJlNXwlTyMqvF7lT z+rNSyPDE9j4GZuJsk1AdL9xPFtd88t2hFrRd+t8xCkktJu7Lyr5ldXuO7cjbTAw/Qft yzQg== X-Gm-Message-State: AOAM530T/VRxDpw6ZGCmH5NXKnwOKXTceQ2vRaeyGN2mnC92/qE1cFfS hJG6QHjpmF14H0m48AXlpQK3G/Fb X-Google-Smtp-Source: ABdhPJxkT5KHX8q9vKZubwqd8+5lR877sU8Frle0lNwMKMKOsZdvSu48QFbBnvPeAmTcNEjo6QgR5w== X-Received: by 2002:a17:906:64c:: with SMTP id t12mr12329131ejb.524.1590251942459; Sat, 23 May 2020 09:39:02 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:01 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 02/30] net: eepro100: Clean up comments Date: Sat, 23 May 2020 18:38:09 +0200 Message-Id: <20200523163837.407592-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Clean the comments up to they trigger fewer checkpatch warnings, no functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried params, dev->enetaddr, 6); - /* Tell the adapter where the TX ring is located. - */ + /* Tell the adapter where the TX ring is located. */ if (!wait_for_eepro100 (dev)) { printf ("Error: Can not reset ethernet controller.\n"); goto Done; @@ -626,8 +608,7 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) goto Done; } - /* Send the packet. - */ + /* Send the packet. */ OUTL (dev, phys_to_bus ((u32) & tx_ring[tx_cur]), SCBPointer); OUTW (dev, SCB_M | CU_START, SCBCmd); @@ -666,21 +647,16 @@ static int eepro100_recv (struct eth_device *dev) break; } - /* Valid frame status. - */ + /* Valid frame status. */ if ((status & RFD_STATUS_OK)) { - /* A valid frame received. - */ + /* A valid frame received. */ length = le32_to_cpu (rx_ring[rx_next].count) & 0x3fff; - /* Pass the packet up to the protocol - * layers. - */ + /* Pass the packet up to the protocol layers. */ net_process_received_packet((u8 *)rx_ring[rx_next].data, length); } else { - /* There was an error. - */ + /* There was an error. */ printf ("RX error status = 0x%08X\n", status); } @@ -691,8 +667,7 @@ static int eepro100_recv (struct eth_device *dev) rx_prev = (rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; rx_ring[rx_prev].control = 0; - /* Update entry information. - */ + /* Update entry information. */ rx_next = (rx_next + 1) % NUM_RX_DESC; } @@ -700,8 +675,7 @@ static int eepro100_recv (struct eth_device *dev) printf ("%s: Receiver is not ready, restart it !\n", dev->name); - /* Reinitialize Rx ring. - */ + /* Reinitialize Rx ring. */ init_rx_ring (dev); if (!wait_for_eepro100 (dev)) { @@ -719,8 +693,7 @@ static int eepro100_recv (struct eth_device *dev) static void eepro100_halt (struct eth_device *dev) { - /* Reset the ethernet controller - */ + /* Reset the ethernet controller */ OUTL (dev, I82559_SELECTIVE_RESET, SCBPort); udelay(20); @@ -745,8 +718,7 @@ static void eepro100_halt (struct eth_device *dev) return; } - /* SROM Read. - */ +/* SROM Read. */ static int read_eeprom (struct eth_device *dev, int location, int addr_len) { unsigned short retval = 0; From patchwork Sat May 23 16:38:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296722 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=EETQiNVJ; 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 49TpxR1NFLz9sPK for ; Sun, 24 May 2020 02:40:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 00F4D81799; Sat, 23 May 2020 18:39:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EETQiNVJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5363A8172F; Sat, 23 May 2020 18:39:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 26B10812FB for ; Sat, 23 May 2020 18:39:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id se13so16367521ejb.9 for ; Sat, 23 May 2020 09:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MkNYvpEnybhaVXPcfX9U9xeYzCNrhZEDrYcSkXjoZww=; b=EETQiNVJdbTKT/I4Cc2cSMqPpMo/U7xuXBBHXrBYSeKAcXXPbtAot4eFaP8RgKmRw7 hsMzBLRKfobNsh+uVlRQZvl/zizn8m8WEJBOS+o6Ph3nM6BcMUZwub/4s/tVHaUQL5bD Um66E6Qu4H6vObT816mVVHn6kx/T/SnrYAlhHs8mb9D/iWei8y+HzItyR1llPtp9rsWP e9gxYKt5H4wT8KZVPWfvPuVwMadDb0F2IrPhRC+C1XD6dXI2dMP7JOjUsXc1D/IcXJht EG/TOqRrby/LAxJFFSie6TJYHPFkqwOaN9ehv6kwp9WPGH8cvJxB3d3tQPmZMRFPaldt E2EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MkNYvpEnybhaVXPcfX9U9xeYzCNrhZEDrYcSkXjoZww=; b=gYFQ8GDaf7NNyRJMkNplLqwuvq8p/3qNNDR5pnL4AK5VTC9aXg5p3CRGuEeQBy1xA2 M559VB4LgLIfj7eUeL0RGzFvlUWRC+qVrTjIgWE3UDm3ozZMY4ex7Fv+0sacK9FSyshd 5qhbY4DQjkRPbmaIkOTYHvePyCqHSplu4EInWtDwhafj/0rJxaJc9eOuHzKkOsPmcl+5 KhsvDQsDaoMQnLAbZpWy1l1I9IiC8iqBM2WK+8UUpR7j2+JfT2srY/wnnPqPWyhZFP0h BrIGuwiu9k0NdhqwrK4OFE6E4CR/4pLg0FW+j6szxfPAbrLYiAHDpbaGZZ1Xy/4Ph5fP 8imQ== X-Gm-Message-State: AOAM533KDy+sD5uKXERnjejvshfBbJUIuxv78+iS6G+AQ+brHUtOrlkf IoffsGh77DNeaJSicDeEw/rnnJ7p X-Google-Smtp-Source: ABdhPJxn8jr4dhcxPqtJmptwrrS7mQemqxm9p72NALShdoahPd/0bZQ8pTK8l6lB6lrZ5jXFiStz0A== X-Received: by 2002:a17:907:41dd:: with SMTP id og21mr13166027ejb.368.1590251943466; Sat, 23 May 2020 09:39:03 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:02 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 03/30] net: eepro100: Use plain debug() Date: Sat, 23 May 2020 18:38:10 +0200 Message-Id: <20200523163837.407592-3-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Convert all the ifdef DEBUG to plain debug(), no functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried #include -#undef DEBUG - /* Ethernet chip registers. */ #define SCBStatus 0 /* Rx/Command Unit Status *Word* */ #define SCBIntAckByte 1 /* Rx/Command Unit STAT/ACK byte */ @@ -392,10 +390,8 @@ int eepro100_initialize (bd_t * bis) pci_read_config_dword (devno, PCI_BASE_ADDRESS_0, &iobase); iobase &= ~0xf; -#ifdef DEBUG - printf ("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", - iobase); -#endif + debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", + iobase); pci_write_config_dword (devno, PCI_COMMAND, @@ -810,10 +806,7 @@ static void read_hw_addr (struct eth_device *dev, bd_t * bis) if (sum != 0xBABA) { memset (dev->enetaddr, 0, ETH_ALEN); -#ifdef DEBUG - printf ("%s: Invalid EEPROM checksum %#4.4x, " - "check settings before activating this device!\n", - dev->name, sum); -#endif + debug("%s: Invalid EEPROM checksum %#4.4x, check settings before activating this device!\n", + dev->name, sum); } } From patchwork Sat May 23 16:38:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296725 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=H3zwYCeg; 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 49Tpy63nzqz9sPK for ; Sun, 24 May 2020 02:40:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF94D817EA; Sat, 23 May 2020 18:39:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="H3zwYCeg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CBD381734; Sat, 23 May 2020 18:39:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A7236813A5 for ; Sat, 23 May 2020 18:39:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x644.google.com with SMTP id z5so16442877ejb.3 for ; Sat, 23 May 2020 09:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1BH+ZSJLe+Ct6ARhXazuGnstr5c8YuYZ1Kt8MZrCPb4=; b=H3zwYCeg04bCKIG6Q/CizAtF4nBkzq0IAwagpvi2BvbSGSRNKaaeLaEhwxlWxnsriI iBvyAVOaC49ny6zUbsyBP8A1g3WF8UrhSDrs25CDvFd2K89sy/o+ySm3hYShCbz8F/Zc t3uBoJ/gLL2EuImTdV+D9fwZHFvXMWztc4N+OapUgW/vPhWXWrZd7+mf4Bd1hVSMRhJa n94/Mt30t3atCeLh/RJvo/tDig+W9OLZdOfgL3i+qLmCwm7P5C+VLSruZtrPRzs43XuD Pxi2Vf5De5CzlMeV49KxfwwY1STfgqoYRugw4EYNvj1CEWYDKm2/lvLWgsunEPLWsLpf qN/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1BH+ZSJLe+Ct6ARhXazuGnstr5c8YuYZ1Kt8MZrCPb4=; b=DLXxN436lyh8FsL0RnOasFowDCQ092ATFWhwjlvwJXzLMvIyk+aRAYIN9IZJypY1HH T/lgMIBJAIPBagUEBdGUbNhglPtXhzjsYFdmWqmw0M/mk0VZe1e5cNWbn+BXY4iZpgQY 5Fp+H2FzIljCZNkOkaor0S/w9uuHtsUvfUAQiD4JWhqGtFMGpTvQsaImX/uqCwxkDUon S3Wzpdha8eNoeuXdDvOy+r0T63MHZFlQfNGCZXvRAWwYW2TcEm06jtze6M7u3ImDkw0H ji6e9UjnnAqcmX3Z3XSSVBtXTg75lXPNOAieGEV/llrvPtRH/7EnsogS3Fc8S3zZJjrR miuA== X-Gm-Message-State: AOAM531AX4xVw/9NaTfzjlH4ItWaNtVhEs6GGpPagpmZadFjFZYIKu4E iZQd9qHjbJSDztHAXnWYQxOMCW+N X-Google-Smtp-Source: ABdhPJwBesJd9rOCpOqTF1p/J37HiGFUHcf6KsQviMqiXtjIrTC57/XS37vI01XndNIW3EB/k6fz1Q== X-Received: by 2002:a17:906:1313:: with SMTP id w19mr13538371ejb.79.1590251944606; Sat, 23 May 2020 09:39:04 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:03 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 04/30] net: eepro100: Fix spacing Date: Sat, 23 May 2020 18:38:11 +0200 Message-Id: <20200523163837.407592-4-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types SPACING -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 278 ++++++++++++++++++++--------------------- 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index dd902386b1..1b6d5375f8 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -68,13 +68,13 @@ #define CU_STATUS_MASK 0x00C0 #define RU_STATUS_MASK 0x003C -#define RU_STATUS_IDLE (0<<2) -#define RU_STATUS_SUS (1<<2) -#define RU_STATUS_NORES (2<<2) -#define RU_STATUS_READY (4<<2) -#define RU_STATUS_NO_RBDS_SUS ((1<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_NORES ((2<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_READY ((4<<2)|(8<<2)) +#define RU_STATUS_IDLE (0 << 2) +#define RU_STATUS_SUS (1 << 2) +#define RU_STATUS_NORES (2 << 2) +#define RU_STATUS_READY (4 << 2) +#define RU_STATUS_NO_RBDS_SUS ((1 << 2) | (8 << 2)) +#define RU_STATUS_NO_RBDS_NORES ((2 << 2) | (8 << 2)) +#define RU_STATUS_NO_RBDS_READY ((4 << 2) | (8 << 2)) /* 82559 Port interface commands. */ #define I82559_RESET 0x00000000 /* Software reset */ @@ -200,15 +200,15 @@ static const char i82558_config_cmd[] = { 0x31, 0x05, }; -static void init_rx_ring (struct eth_device *dev); -static void purge_tx_ring (struct eth_device *dev); +static void init_rx_ring(struct eth_device *dev); +static void purge_tx_ring(struct eth_device *dev); -static void read_hw_addr (struct eth_device *dev, bd_t * bis); +static void read_hw_addr(struct eth_device *dev, bd_t * bis); -static int eepro100_init (struct eth_device *dev, bd_t * bis); +static int eepro100_init(struct eth_device *dev, bd_t * bis); static int eepro100_send(struct eth_device *dev, void *packet, int length); -static int eepro100_recv (struct eth_device *dev); -static void eepro100_halt (struct eth_device *dev); +static int eepro100_recv(struct eth_device *dev); +static void eepro100_halt(struct eth_device *dev); #if defined(CONFIG_E500) #define bus_to_phys(a) (a) @@ -218,28 +218,28 @@ static void eepro100_halt (struct eth_device *dev); #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a) #endif -static inline int INW (struct eth_device *dev, u_long addr) +static inline int INW(struct eth_device *dev, u_long addr) { return le16_to_cpu(*(volatile u16 *)(addr + (u_long)dev->iobase)); } -static inline void OUTW (struct eth_device *dev, int command, u_long addr) +static inline void OUTW(struct eth_device *dev, int command, u_long addr) { *(volatile u16 *)((addr + (u_long)dev->iobase)) = cpu_to_le16(command); } -static inline void OUTL (struct eth_device *dev, int command, u_long addr) +static inline void OUTL(struct eth_device *dev, int command, u_long addr) { *(volatile u32 *)((addr + (u_long)dev->iobase)) = cpu_to_le32(command); } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static inline int INL (struct eth_device *dev, u_long addr) +static inline int INL(struct eth_device *dev, u_long addr) { return le32_to_cpu(*(volatile u32 *)(addr + (u_long)dev->iobase)); } -static int get_phyreg (struct eth_device *dev, unsigned char addr, +static int get_phyreg(struct eth_device *dev, unsigned char addr, unsigned char reg, unsigned short *value) { int cmd; @@ -247,22 +247,22 @@ static int get_phyreg (struct eth_device *dev, unsigned char addr, /* read requested data */ cmd = (2 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL (dev, cmd, SCBCtrlMDI); + OUTL(dev, cmd, SCBCtrlMDI); do { udelay(1000); - cmd = INL (dev, SCBCtrlMDI); + cmd = INL(dev, SCBCtrlMDI); } while (!(cmd & (1 << 28)) && (--timeout)); if (timeout == 0) return -1; - *value = (unsigned short) (cmd & 0xffff); + *value = (unsigned short)(cmd & 0xffff); return 0; } -static int set_phyreg (struct eth_device *dev, unsigned char addr, +static int set_phyreg(struct eth_device *dev, unsigned char addr, unsigned char reg, unsigned short value) { int cmd; @@ -270,9 +270,9 @@ static int set_phyreg (struct eth_device *dev, unsigned char addr, /* write requested data */ cmd = (1 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL (dev, cmd | value, SCBCtrlMDI); + OUTL(dev, cmd | value, SCBCtrlMDI); - while (!(INL (dev, SCBCtrlMDI) & (1 << 28)) && (--timeout)) + while (!(INL(dev, SCBCtrlMDI) & (1 << 28)) && (--timeout)) udelay(1000); if (timeout == 0) @@ -285,7 +285,7 @@ static int set_phyreg (struct eth_device *dev, unsigned char addr, * Check if given phyaddr is valid, i.e. there is a PHY connected. * Do this by checking model value field from ID2 register. */ -static struct eth_device* verify_phyaddr (const char *devname, +static struct eth_device* verify_phyaddr(const char *devname, unsigned char addr) { struct eth_device *dev; @@ -353,11 +353,11 @@ static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, #endif /* Wait for the chip get the command. */ -static int wait_for_eepro100 (struct eth_device *dev) +static int wait_for_eepro100(struct eth_device *dev) { int i; - for (i = 0; INW (dev, SCBCmd) & (CU_CMD_MASK | RU_CMD_MASK); i++) { + for (i = 0; INW(dev, SCBCmd) & (CU_CMD_MASK | RU_CMD_MASK); i++) { if (i >= TOUT_LOOP) { return 0; } @@ -373,7 +373,7 @@ static struct pci_device_id supported[] = { {} }; -int eepro100_initialize (bd_t * bis) +int eepro100_initialize(bd_t * bis) { pci_dev_t devno; int card_number = 0; @@ -383,50 +383,50 @@ int eepro100_initialize (bd_t * bis) while (1) { /* Find PCI device */ - if ((devno = pci_find_devices (supported, idx++)) < 0) { + if ((devno = pci_find_devices(supported, idx++)) < 0) { break; } - pci_read_config_dword (devno, PCI_BASE_ADDRESS_0, &iobase); + pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &iobase); iobase &= ~0xf; debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", iobase); - pci_write_config_dword (devno, + pci_write_config_dword(devno, PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); /* Check if I/O accesses and Bus Mastering are enabled. */ - pci_read_config_dword (devno, PCI_COMMAND, &status); + pci_read_config_dword(devno, PCI_COMMAND, &status); if (!(status & PCI_COMMAND_MEMORY)) { - printf ("Error: Can not enable MEM access.\n"); + printf("Error: Can not enable MEM access.\n"); continue; } if (!(status & PCI_COMMAND_MASTER)) { - printf ("Error: Can not enable Bus Mastering.\n"); + printf("Error: Can not enable Bus Mastering.\n"); continue; } - dev = (struct eth_device *) malloc (sizeof *dev); + dev = (struct eth_device *)malloc(sizeof *dev); if (!dev) { printf("eepro100: Can not allocate memory\n"); break; } memset(dev, 0, sizeof(*dev)); - sprintf (dev->name, "i82559#%d", card_number); - dev->priv = (void *) devno; /* this have to come before bus_to_phys() */ - dev->iobase = bus_to_phys (iobase); + sprintf(dev->name, "i82559#%d", card_number); + dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ + dev->iobase = bus_to_phys(iobase); dev->init = eepro100_init; dev->halt = eepro100_halt; dev->send = eepro100_send; dev->recv = eepro100_recv; - eth_register (dev); + eth_register(dev); -#if defined (CONFIG_MII) || defined(CONFIG_CMD_MII) +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) /* register mii command access routines */ int retval; struct mii_dev *mdiodev = mdio_alloc(); @@ -444,89 +444,89 @@ int eepro100_initialize (bd_t * bis) card_number++; /* Set the latency timer for value. */ - pci_write_config_byte (devno, PCI_LATENCY_TIMER, 0x20); + pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x20); udelay(10 * 1000); - read_hw_addr (dev, bis); + read_hw_addr(dev, bis); } return card_number; } -static int eepro100_init (struct eth_device *dev, bd_t * bis) +static int eepro100_init(struct eth_device *dev, bd_t * bis) { int i, status = -1; int tx_cur; struct descriptor *ias_cmd, *cfg_cmd; /* Reset the ethernet controller */ - OUTL (dev, I82559_SELECTIVE_RESET, SCBPort); + OUTL(dev, I82559_SELECTIVE_RESET, SCBPort); udelay(20); - OUTL (dev, I82559_RESET, SCBPort); + OUTL(dev, I82559_RESET, SCBPort); udelay(20); - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, 0, SCBPointer); - OUTW (dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCBPointer); + OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, 0, SCBPointer); - OUTW (dev, SCB_M | CU_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCBPointer); + OUTW(dev, SCB_M | CU_ADDR_LOAD, SCBCmd); /* Initialize Rx and Tx rings. */ - init_rx_ring (dev); - purge_tx_ring (dev); + init_rx_ring(dev); + purge_tx_ring(dev); /* Tell the adapter where the RX ring is located. */ - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, phys_to_bus ((u32) & rx_ring[rx_next]), SCBPointer); - OUTW (dev, SCB_M | RUC_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCBPointer); + OUTW(dev, SCB_M | RUC_START, SCBCmd); /* Send the Configure frame */ tx_cur = tx_next; tx_next = ((tx_next + 1) % NUM_TX_DESC); - cfg_cmd = (struct descriptor *) &tx_ring[tx_cur]; + cfg_cmd = (struct descriptor *)&tx_ring[tx_cur]; cfg_cmd->command = cpu_to_le16 ((CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE)); cfg_cmd->status = 0; - cfg_cmd->link = cpu_to_le32 (phys_to_bus ((u32) & tx_ring[tx_next])); + cfg_cmd->link = cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); - memcpy (cfg_cmd->params, i82558_config_cmd, - sizeof (i82558_config_cmd)); + memcpy(cfg_cmd->params, i82558_config_cmd, + sizeof(i82558_config_cmd)); - if (!wait_for_eepro100 (dev)) { - printf ("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, phys_to_bus ((u32) & tx_ring[tx_cur]), SCBPointer); - OUTW (dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); + OUTW(dev, SCB_M | CU_START, SCBCmd); for (i = 0; - !(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); + !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); i++) { if (i >= TOUT_LOOP) { - printf ("%s: Tx error buffer not ready\n", dev->name); + printf("%s: Tx error buffer not ready\n", dev->name); goto Done; } } - if (!(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf ("TX error status = 0x%08X\n", - le16_to_cpu (tx_ring[tx_cur].status)); + if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { + printf("TX error status = 0x%08X\n", + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } @@ -534,34 +534,34 @@ static int eepro100_init (struct eth_device *dev, bd_t * bis) tx_cur = tx_next; tx_next = ((tx_next + 1) % NUM_TX_DESC); - ias_cmd = (struct descriptor *) &tx_ring[tx_cur]; + ias_cmd = (struct descriptor *)&tx_ring[tx_cur]; ias_cmd->command = cpu_to_le16 ((CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS)); ias_cmd->status = 0; - ias_cmd->link = cpu_to_le32 (phys_to_bus ((u32) & tx_ring[tx_next])); + ias_cmd->link = cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); - memcpy (ias_cmd->params, dev->enetaddr, 6); + memcpy(ias_cmd->params, dev->enetaddr, 6); /* Tell the adapter where the TX ring is located. */ - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, phys_to_bus ((u32) & tx_ring[tx_cur]), SCBPointer); - OUTW (dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); + OUTW(dev, SCB_M | CU_START, SCBCmd); - for (i = 0; !(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); + for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); i++) { if (i >= TOUT_LOOP) { - printf ("%s: Tx error buffer not ready\n", + printf("%s: Tx error buffer not ready\n", dev->name); goto Done; } } - if (!(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf ("TX error status = 0x%08X\n", - le16_to_cpu (tx_ring[tx_cur].status)); + if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { + printf("TX error status = 0x%08X\n", + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } @@ -577,48 +577,48 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) int tx_cur; if (length <= 0) { - printf ("%s: bad packet size: %d\n", dev->name, length); + printf("%s: bad packet size: %d\n", dev->name, length); goto Done; } tx_cur = tx_next; tx_next = (tx_next + 1) % NUM_TX_DESC; - tx_ring[tx_cur].command = cpu_to_le16 ( TxCB_CMD_TRANSMIT | + tx_ring[tx_cur].command = cpu_to_le16 (TxCB_CMD_TRANSMIT | TxCB_CMD_SF | TxCB_CMD_S | - TxCB_CMD_EL ); + TxCB_CMD_EL); tx_ring[tx_cur].status = 0; tx_ring[tx_cur].count = cpu_to_le32 (tx_threshold); tx_ring[tx_cur].link = - cpu_to_le32 (phys_to_bus ((u32) & tx_ring[tx_next])); + cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); tx_ring[tx_cur].tx_desc_addr = - cpu_to_le32 (phys_to_bus ((u32) & tx_ring[tx_cur].tx_buf_addr0)); + cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_cur].tx_buf_addr0)); tx_ring[tx_cur].tx_buf_addr0 = - cpu_to_le32 (phys_to_bus ((u_long) packet)); + cpu_to_le32 (phys_to_bus((u_long)packet)); tx_ring[tx_cur].tx_buf_size0 = cpu_to_le32 (length); - if (!wait_for_eepro100 (dev)) { - printf ("%s: Tx error ethernet controller not ready.\n", + if (!wait_for_eepro100(dev)) { + printf("%s: Tx error ethernet controller not ready.\n", dev->name); goto Done; } /* Send the packet. */ - OUTL (dev, phys_to_bus ((u32) & tx_ring[tx_cur]), SCBPointer); - OUTW (dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); + OUTW(dev, SCB_M | CU_START, SCBCmd); - for (i = 0; !(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); + for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); i++) { if (i >= TOUT_LOOP) { - printf ("%s: Tx error buffer not ready\n", dev->name); + printf("%s: Tx error buffer not ready\n", dev->name); goto Done; } } - if (!(le16_to_cpu (tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf ("TX error status = 0x%08X\n", - le16_to_cpu (tx_ring[tx_cur].status)); + if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { + printf("TX error status = 0x%08X\n", + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } @@ -628,16 +628,16 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) return status; } -static int eepro100_recv (struct eth_device *dev) +static int eepro100_recv(struct eth_device *dev) { u16 status, stat; int rx_prev, length = 0; - stat = INW (dev, SCBStatus); - OUTW (dev, stat & SCB_STATUS_RNR, SCBStatus); + stat = INW(dev, SCBStatus); + OUTW(dev, stat & SCB_STATUS_RNR, SCBStatus); for (;;) { - status = le16_to_cpu (rx_ring[rx_next].status); + status = le16_to_cpu(rx_ring[rx_next].status); if (!(status & RFD_STATUS_C)) { break; @@ -646,14 +646,14 @@ static int eepro100_recv (struct eth_device *dev) /* Valid frame status. */ if ((status & RFD_STATUS_OK)) { /* A valid frame received. */ - length = le32_to_cpu (rx_ring[rx_next].count) & 0x3fff; + length = le32_to_cpu(rx_ring[rx_next].count) & 0x3fff; /* Pass the packet up to the protocol layers. */ net_process_received_packet((u8 *)rx_ring[rx_next].data, length); } else { /* There was an error. */ - printf ("RX error status = 0x%08X\n", status); + printf("RX error status = 0x%08X\n", status); } rx_ring[rx_next].control = cpu_to_le16 (RFD_CONTROL_S); @@ -669,87 +669,87 @@ static int eepro100_recv (struct eth_device *dev) if (stat & SCB_STATUS_RNR) { - printf ("%s: Receiver is not ready, restart it !\n", dev->name); + printf("%s: Receiver is not ready, restart it !\n", dev->name); /* Reinitialize Rx ring. */ - init_rx_ring (dev); + init_rx_ring(dev); - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not restart ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not restart ethernet controller.\n"); goto Done; } - OUTL (dev, phys_to_bus ((u32) & rx_ring[rx_next]), SCBPointer); - OUTW (dev, SCB_M | RUC_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCBPointer); + OUTW(dev, SCB_M | RUC_START, SCBCmd); } Done: return length; } -static void eepro100_halt (struct eth_device *dev) +static void eepro100_halt(struct eth_device *dev) { /* Reset the ethernet controller */ - OUTL (dev, I82559_SELECTIVE_RESET, SCBPort); + OUTL(dev, I82559_SELECTIVE_RESET, SCBPort); udelay(20); - OUTL (dev, I82559_RESET, SCBPort); + OUTL(dev, I82559_RESET, SCBPort); udelay(20); - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, 0, SCBPointer); - OUTW (dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCBPointer); + OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); - if (!wait_for_eepro100 (dev)) { - printf ("Error: Can not reset ethernet controller.\n"); + if (!wait_for_eepro100(dev)) { + printf("Error: Can not reset ethernet controller.\n"); goto Done; } - OUTL (dev, 0, SCBPointer); - OUTW (dev, SCB_M | CU_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCBPointer); + OUTW(dev, SCB_M | CU_ADDR_LOAD, SCBCmd); Done: return; } /* SROM Read. */ -static int read_eeprom (struct eth_device *dev, int location, int addr_len) +static int read_eeprom(struct eth_device *dev, int location, int addr_len) { unsigned short retval = 0; int read_cmd = location | EE_READ_CMD; int i; - OUTW (dev, EE_ENB & ~EE_CS, SCBeeprom); - OUTW (dev, EE_ENB, SCBeeprom); + OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); + OUTW(dev, EE_ENB, SCBeeprom); /* Shift the read command bits out. */ for (i = 12; i >= 0; i--) { short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW (dev, EE_ENB | dataval, SCBeeprom); + OUTW(dev, EE_ENB | dataval, SCBeeprom); udelay(1); - OUTW (dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); + OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); udelay(1); } - OUTW (dev, EE_ENB, SCBeeprom); + OUTW(dev, EE_ENB, SCBeeprom); for (i = 15; i >= 0; i--) { - OUTW (dev, EE_ENB | EE_SHIFT_CLK, SCBeeprom); + OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCBeeprom); udelay(1); retval = (retval << 1) | - ((INW (dev, SCBeeprom) & EE_DATA_READ) ? 1 : 0); - OUTW (dev, EE_ENB, SCBeeprom); + ((INW(dev, SCBeeprom) & EE_DATA_READ) ? 1 : 0); + OUTW(dev, EE_ENB, SCBeeprom); udelay(1); } /* Terminate the EEPROM access. */ - OUTW (dev, EE_ENB & ~EE_CS, SCBeeprom); + OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); return retval; } -static void init_rx_ring (struct eth_device *dev) +static void init_rx_ring(struct eth_device *dev) { int i; @@ -759,7 +759,7 @@ static void init_rx_ring (struct eth_device *dev) (i == NUM_RX_DESC - 1) ? cpu_to_le16 (RFD_CONTROL_S) : 0; rx_ring[i].link = cpu_to_le32 (phys_to_bus - ((u32) & rx_ring[(i + 1) % NUM_RX_DESC])); + ((u32)&rx_ring[(i + 1) % NUM_RX_DESC])); rx_ring[i].rx_buf_addr = 0xffffffff; rx_ring[i].count = cpu_to_le32 (PKTSIZE_ALIGN << 16); } @@ -767,7 +767,7 @@ static void init_rx_ring (struct eth_device *dev) rx_next = 0; } -static void purge_tx_ring (struct eth_device *dev) +static void purge_tx_ring(struct eth_device *dev) { int i; @@ -788,14 +788,14 @@ static void purge_tx_ring (struct eth_device *dev) } } -static void read_hw_addr (struct eth_device *dev, bd_t * bis) +static void read_hw_addr(struct eth_device *dev, bd_t * bis) { u16 sum = 0; int i, j; - int addr_len = read_eeprom (dev, 0, 6) == 0xffff ? 8 : 6; + int addr_len = read_eeprom(dev, 0, 6) == 0xffff ? 8 : 6; for (j = 0, i = 0; i < 0x40; i++) { - u16 value = read_eeprom (dev, i, addr_len); + u16 value = read_eeprom(dev, i, addr_len); sum += value; if (i < 3) { @@ -805,7 +805,7 @@ static void read_hw_addr (struct eth_device *dev, bd_t * bis) } if (sum != 0xBABA) { - memset (dev->enetaddr, 0, ETH_ALEN); + memset(dev->enetaddr, 0, ETH_ALEN); debug("%s: Invalid EEPROM checksum %#4.4x, check settings before activating this device!\n", dev->name, sum); } From patchwork Sat May 23 16:38:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296721 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=H1yoe/KV; 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 49TpxB1YKYz9sPK for ; Sun, 24 May 2020 02:39:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BFDD28172F; Sat, 23 May 2020 18:39:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="H1yoe/KV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB2AD813A6; Sat, 23 May 2020 18:39:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4AEDE813A6 for ; Sat, 23 May 2020 18:39:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x543.google.com with SMTP id k19so11727990edv.9 for ; Sat, 23 May 2020 09:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=edavD9wQCJjBE7IhudDcqcgSjNhV0lIxn/Am082lahc=; b=H1yoe/KVAiBZPCKohwIODtc5laesUUkXkPmiEqRTsM0TWT/v8R8ZeVympIWAcke2vh sjICm6+4KyVksnjhkcDJiJcSPC/lde0zNkYjZzqyMFcgQq1J7Yl/h1JlZlhttFYkYRb6 FpucXXEvVbNF0h5m1/4jeVY5tsMQcBjaQDghTN1j5f8kztzpfSAxuo8+Pl+66vlSRi2/ Oen0i+h42deMwg47QmhmBI+NviKyOhVW/3xv6hnBsfUcGQap0yHTJgFIOToMeJGohW/h zJ5JUiN0pEwCchc9tHsSncJx//v+uaI+z6CbxbDDCGwcw5pHfbV0HTi+PD6mwP/MzWHj hOyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=edavD9wQCJjBE7IhudDcqcgSjNhV0lIxn/Am082lahc=; b=HQ36ou8ssauDsifqHl1YZwExK5kaPSyB7vOgtj9BK14GKf/f+rj6Nt1gIHoXb3+0gu QCw2VPCOk756AVdXnqRzQRzp+bR9DDwATCXFOtHwsHpVcDS0XXTsS76i0K0+xGsM52QV 2duiw8cEaxnyc/ttcNmzAwoD+wkqKAOPeIGNGb3Z7KcXnedJPDH7ycbIiLXZJbDgKupu fGgkm+KiwWYroop13SskUW3V/LamAq91jFhI4eWpAHXyZfSH3hiPtCb9q7KhFkaSjAsS br0gG2QVmQfW1/8WGs6PJhcEPvp4JiC8JHCHd6+6p1vMfhB2TxIzRmOpLYhGuDTLVyEF sakw== X-Gm-Message-State: AOAM533ZZmeGX56DHurFn2s8Lp+31wzgWHvSXSqg24ydBTaoK9iVMA8T mouDBEjXeIvNPfVozMd7old2yto3 X-Google-Smtp-Source: ABdhPJy4SigWdF1mlwaTe2/uFXnNn74/oYji2dmZmGMRJ/R1NaE4XUjZ6OB/cQZ8lGIzmqaVgelzRA== X-Received: by 2002:a50:88c6:: with SMTP id d64mr7885474edd.324.1590251945612; Sat, 23 May 2020 09:39:05 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:04 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 05/30] net: eepro100: Fix braces Date: Sat, 23 May 2020 18:38:12 +0200 Message-Id: <20200523163837.407592-5-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types BRACES -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried = TOUT_LOOP) { + if (i >= TOUT_LOOP) return 0; - } } return 1; @@ -383,9 +382,9 @@ int eepro100_initialize(bd_t * bis) while (1) { /* Find PCI device */ - if ((devno = pci_find_devices(supported, idx++)) < 0) { + devno = pci_find_devices(supported, idx++); + if (devno < 0) break; - } pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &iobase); iobase &= ~0xf; @@ -639,9 +638,8 @@ static int eepro100_recv(struct eth_device *dev) for (;;) { status = le16_to_cpu(rx_ring[rx_next].status); - if (!(status & RFD_STATUS_C)) { + if (!(status & RFD_STATUS_C)) break; - } /* Valid frame status. */ if ((status & RFD_STATUS_OK)) { @@ -668,7 +666,6 @@ static int eepro100_recv(struct eth_device *dev) } if (stat & SCB_STATUS_RNR) { - printf("%s: Receiver is not ready, restart it !\n", dev->name); /* Reinitialize Rx ring. */ From patchwork Sat May 23 16:38:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296723 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=e0LkOi8/; 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 49Tpxg0q1Wz9sPK for ; Sun, 24 May 2020 02:40:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C0B0781817; Sat, 23 May 2020 18:39:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e0LkOi8/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 16D0481734; Sat, 23 May 2020 18:39:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 63ECB813C5 for ; Sat, 23 May 2020 18:39:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x542.google.com with SMTP id l25so11731347edj.4 for ; Sat, 23 May 2020 09:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TBkBwV6kob9g8pV70myW5lCNkrRfJA7GNG66u9OabYc=; b=e0LkOi8/Z3n/un6e6SGwAx485UmGREB0workO47EPcKlhky6ckxSldsGiW1YnOmY3+ KvPr/Ozvx+JUq9gJHYOhlH5NrBGo22CssaB/8/2ZIKCvW8QhLUQFZ6YbZwkwdqdp2yIa oyiY0suBWZTVPJmBYrFCkUyLR9e7i8wxdG2vnh+l4R7f7iHwIO5nHg8aLfKPxeAPCEJn ezcjRPqzvbexZDh3QlzjEpK0c145pHv8/qDN/vvz5rR4BXcJq7hm+SFGU/HivmuTLQCm fCA8inHMRtXh3HOLuDzvjLkfFHmfkc4lpEPGdickBEMAD0ue2Yx3kKSTFUTiT0NZk9QQ 1R6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TBkBwV6kob9g8pV70myW5lCNkrRfJA7GNG66u9OabYc=; b=cbvxOTq15ipbZ1XNEcPnJmJvKfaicvY9SO/X5nU4cu0sLKTmW4M71Rmv6/e9xlfcez 0IDtBhVrXMzCSQTYShSRpvi58b9GH58mRWYkpyv4V83kv8eeip1vL/QxT6YmgvY6Jrqx YIKCtk3ZRcq+2k0036v8PWRn+qbkySM0zNrfRhmH8deXQDmjuC1TlkGyJG2m/Y4iMr77 tfryrcgtYztq54TqBvNXksHXoP92+2YdUntsXnumPDhorjBiDgoKc3VSOex9J/9VWr6A MO5JqdD0uLduVCGEFxzZpKJZjpaApzFNVN+AKKms26ypG4Mtj0Iqp4xeUOAvcTk4+y6V TfcQ== X-Gm-Message-State: AOAM533h62bJ/axFU34OooEwa6974KO/GG5nsr4JuAglPTRvS+VPbuHb oYi4K/9WoMcBjlUwJdrjnZNDaCrz X-Google-Smtp-Source: ABdhPJy368GIWFcknx52gW9qV9Rbi4phW4tlrg0CSkhnITWgZkapc9uFRooZMqBFJcSpZ6jS2Bl0Ig== X-Received: by 2002:aa7:d312:: with SMTP id p18mr7814529edq.88.1590251946605; Sat, 23 May 2020 09:39:06 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:05 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 06/30] net: eepro100: Fix parenthesis alignment Date: Sat, 23 May 2020 18:38:13 +0200 Message-Id: <20200523163837.407592-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types PARENTHESIS_ALIGNMENT -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 6dccd59bda..d367052cd2 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -240,7 +240,7 @@ static inline int INL(struct eth_device *dev, u_long addr) } static int get_phyreg(struct eth_device *dev, unsigned char addr, - unsigned char reg, unsigned short *value) + unsigned char reg, unsigned short *value) { int cmd; int timeout = 50; @@ -263,7 +263,7 @@ static int get_phyreg(struct eth_device *dev, unsigned char addr, } static int set_phyreg(struct eth_device *dev, unsigned char addr, - unsigned char reg, unsigned short value) + unsigned char reg, unsigned short value) { int cmd; int timeout = 50; @@ -286,7 +286,7 @@ static int set_phyreg(struct eth_device *dev, unsigned char addr, * Do this by checking model value field from ID2 register. */ static struct eth_device* verify_phyaddr(const char *devname, - unsigned char addr) + unsigned char addr) { struct eth_device *dev; unsigned short value; @@ -393,7 +393,7 @@ int eepro100_initialize(bd_t * bis) iobase); pci_write_config_dword(devno, - PCI_COMMAND, + PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); /* Check if I/O accesses and Bus Mastering are enabled. */ @@ -504,7 +504,7 @@ static int eepro100_init(struct eth_device *dev, bd_t * bis) cfg_cmd->link = cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); memcpy(cfg_cmd->params, i82558_config_cmd, - sizeof(i82558_config_cmd)); + sizeof(i82558_config_cmd)); if (!wait_for_eepro100(dev)) { printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); @@ -525,7 +525,7 @@ static int eepro100_init(struct eth_device *dev, bd_t * bis) if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } @@ -553,14 +553,14 @@ static int eepro100_init(struct eth_device *dev, bd_t * bis) i++) { if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", - dev->name); + dev->name); goto Done; } } if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } @@ -599,7 +599,7 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) if (!wait_for_eepro100(dev)) { printf("%s: Tx error ethernet controller not ready.\n", - dev->name); + dev->name); goto Done; } @@ -617,7 +617,7 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + le16_to_cpu(tx_ring[tx_cur].status)); goto Done; } From patchwork Sat May 23 16:38:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296724 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=krxsv4T7; 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 49Tpxv42P5z9sPK for ; Sun, 24 May 2020 02:40:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8B5218180B; Sat, 23 May 2020 18:39:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="krxsv4T7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E2E6B8174A; Sat, 23 May 2020 18:39:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5910B815F1 for ; Sat, 23 May 2020 18:39:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x641.google.com with SMTP id j21so16429656ejy.1 for ; Sat, 23 May 2020 09:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ym9RF2Al7LRrOBUaLmrLEj5yW3kTs6Yu0j3Kugoqjl0=; b=krxsv4T7hXYv43CGpwEvpM7gZtV2ou9INDbZiEu/LyeWd8HrWJW7kQRN+7cNuADFWD xB/1F4lxVJZP+koUmvaH5JjFrkrazwLgglT17rjk+JxLfg5TZXPABbWdVr3RBPr7bZ85 v7vds0X2nQ7yX+G1ATGmC2gPLkpgziQycEYnZiL8/c6xR1YxC/AKwG6mgk4dteT7IScm V6HtajnoG2jK6Hqti5pKnB7ovyd4PlUzL3OH5dKQGUMIAcOPzlL6PO9vtmw1GMhzqRSF 8kMy3Tl/4kIteclW/YhxDUkbBRhSUAvshK9bUMqTs/VNgt4IhvNcjiW/k7oy2HyVyUwI 7lmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ym9RF2Al7LRrOBUaLmrLEj5yW3kTs6Yu0j3Kugoqjl0=; b=PPGJ4s0sIq33aqpB+4U4x2xfTfBc2AvG8bJsi9BHNnoc4K2ff7nR97hO31GRSLT9Mh v7GPZl3RIgmjO9LxDWSmO+yEgcSIIqGhUuW9aM9kZy6xdLNA03uqQFPUWgBJX7af6wf3 mZni0Iz4A+ki3eMAlofdVQQDxghLqZrb8nFu6QPBKZi/3Y5LoFw9266ibgtwShz2REwV OyIUXwqzM2PiDKxS0szID6GO86iCl1GAap4/hlzKOUaOpN3deZA91ykdB4wblpUV9pNA qOxmYolIL3X6OVvdWINN9riX8Zx7S2MWQ2j1lGIUAIEzK2vrA0xGCfXsOSZ8vzHwls1c tGDw== X-Gm-Message-State: AOAM5318Jrz35fmf/Nr6RrtG4xRtTlCbhw3s8PdZSQVvYeIa/JVHLqMY WrNn45tK+4McUVZCpFQkL1DALS3g X-Google-Smtp-Source: ABdhPJwGfqVry6GwQvOV3R/i3aVAvwyvBXwEznabtqgxKfBaWvnq1+e5sbLikCLn75ENMPIBTfOahQ== X-Received: by 2002:a17:906:e0c7:: with SMTP id gl7mr12359142ejb.306.1590251947675; Sat, 23 May 2020 09:39:07 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:07 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 07/30] net: eepro100: Fix pointer location Date: Sat, 23 May 2020 18:38:14 +0200 Message-Id: <20200523163837.407592-7-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types POINTER_LOCATION -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index d367052cd2..2aad124ae5 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -203,9 +203,9 @@ static const char i82558_config_cmd[] = { static void init_rx_ring(struct eth_device *dev); static void purge_tx_ring(struct eth_device *dev); -static void read_hw_addr(struct eth_device *dev, bd_t * bis); +static void read_hw_addr(struct eth_device *dev, bd_t *bis); -static int eepro100_init(struct eth_device *dev, bd_t * bis); +static int eepro100_init(struct eth_device *dev, bd_t *bis); static int eepro100_send(struct eth_device *dev, void *packet, int length); static int eepro100_recv(struct eth_device *dev); static void eepro100_halt(struct eth_device *dev); @@ -285,7 +285,7 @@ static int set_phyreg(struct eth_device *dev, unsigned char addr, * Check if given phyaddr is valid, i.e. there is a PHY connected. * Do this by checking model value field from ID2 register. */ -static struct eth_device* verify_phyaddr(const char *devname, +static struct eth_device *verify_phyaddr(const char *devname, unsigned char addr) { struct eth_device *dev; @@ -372,7 +372,7 @@ static struct pci_device_id supported[] = { {} }; -int eepro100_initialize(bd_t * bis) +int eepro100_initialize(bd_t *bis) { pci_dev_t devno; int card_number = 0; @@ -454,7 +454,7 @@ int eepro100_initialize(bd_t * bis) } -static int eepro100_init(struct eth_device *dev, bd_t * bis) +static int eepro100_init(struct eth_device *dev, bd_t *bis) { int i, status = -1; int tx_cur; @@ -785,7 +785,7 @@ static void purge_tx_ring(struct eth_device *dev) } } -static void read_hw_addr(struct eth_device *dev, bd_t * bis) +static void read_hw_addr(struct eth_device *dev, bd_t *bis) { u16 sum = 0; int i, j; From patchwork Sat May 23 16:38:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296726 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OCx8mNRV; 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 49TpyM4Mvgz9sPK for ; Sun, 24 May 2020 02:40:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4ED8B81767; Sat, 23 May 2020 18:39:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OCx8mNRV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6598F8067C; Sat, 23 May 2020 18:39:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5FFFF8067C for ; Sat, 23 May 2020 18:39:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id d7so16409448eja.7 for ; Sat, 23 May 2020 09:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HaTq0J1tpyfn+wYPtDcrTvp0+zRT0t+jOriVEj2BN58=; b=OCx8mNRVeRocf15pqGZhu19n2svbSpo2Y5GFWbIv0nYabkyyblL+uvAJAd8I/wPeGT eBg9c9Lr3xb2/xwIv5vC/t0Rf2VA8GGxhgtp3RImW9zDYSSXgfWRBRD7i4Icv6swt65r tMr9BtveOQGjp+Pf4rSTzjRN4/FgdvPaBdvURMI1En+1d+ehiLT+U3p/Qu6ShjIA0oqM kBBHGfV2Pgr2J16vtHp2bdyG9XVWgyZjGoU9SoWOb5kA6JERyewfY3cblYDIv5Uys5nj OpMRiKRlbzmdJFXipLnKQ0HQvote6yqb9i3vQPb0dBS7YO6SJIx3jH16q0GFAyqns71y TsGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HaTq0J1tpyfn+wYPtDcrTvp0+zRT0t+jOriVEj2BN58=; b=t/uyv2uAHlTF2b3SnqVD0EYh0StTE35D/zkV2k84mQTqIcGGWigjxKQI4xNHEGU77g /1cPNBVtF3SOLKbxZfpnKTbrIhD0GRNdC0SoUz19n1GBgbTDXKQWX2yRRnjY6uhCyBcE QH4eW/QL04X/j3DZWq4R4PatiFXHa7tq2X3IgGf64U8Hq7gJXndURbc+XSBR9zWij4dW otJ9QfPJV7SUVi6brU6D2wttHFOvKioPWP+unqKsslcO+Fc7g3JUGz3segp3etXbRpso rofFrksB0P/d5BKDKud01Xf/GTwzVmpEq62Ow0HSgUfxBtXaDjvxp2YS3F2KUSaBjQif aJuw== X-Gm-Message-State: AOAM5305HkEImsyPRe2UXSEkeCmAy3Ll2wF4YA2p2Qc/mob2WO94cT0S Jj4V/KRMGNYJ1HUOwcEqJuRn3/TN X-Google-Smtp-Source: ABdhPJxUG3hytHINlwydd6s2qZIdUHqU1bnGiQc8dWK02FwrDxHs3n1nG1dDwIPLpGgQkBlhXuxPlA== X-Received: by 2002:a17:906:5210:: with SMTP id g16mr12874509ejm.197.1590251948727; Sat, 23 May 2020 09:39:08 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:08 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 08/30] net: eepro100: Fix indented label Date: Sat, 23 May 2020 18:38:15 +0200 Message-Id: <20200523163837.407592-8-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types INDENTED_LABEL -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 2aad124ae5..e5bc90f52c 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -566,7 +566,7 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) status = 0; - Done: +Done: return status; } @@ -623,7 +623,7 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) status = length; - Done: +Done: return status; } @@ -680,7 +680,7 @@ static int eepro100_recv(struct eth_device *dev) OUTW(dev, SCB_M | RUC_START, SCBCmd); } - Done: +Done: return length; } @@ -707,7 +707,7 @@ static void eepro100_halt(struct eth_device *dev) OUTL(dev, 0, SCBPointer); OUTW(dev, SCB_M | CU_ADDR_LOAD, SCBCmd); - Done: +Done: return; } From patchwork Sat May 23 16:38:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296727 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=uA6gOro9; 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 49Tpyc4wPQz9sPK for ; Sun, 24 May 2020 02:41:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7AC7C81696; Sat, 23 May 2020 18:39:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uA6gOro9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 410C5813C6; Sat, 23 May 2020 18:39:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BA626813C6 for ; Sat, 23 May 2020 18:39:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id j21so16429734ejy.1 for ; Sat, 23 May 2020 09:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hFAt3r4WDR2hRaDH6/V+N6duxfRL3LT4O8CQVFE0ml8=; b=uA6gOro9EcQAZF7CRfpFfurwgVrUQtIYpaUXZ++ioxqqG+qWieweR99HtF4HFdFj6K TdymYMV4FjvV7eVpJeFOYP7ncooZsv+EwHL7tWd96CWtKSvz6DFQ26DvI8DnXU7aYm3R uKTFmsZ60BvpT6niV8bQmQgSbHkAIUQqpS8dJ/kGxdwTOd99XeQn9kJkS6drZFeCsWkP sXoS8bv/VcCF25WNXtLN9ExWXQW7PZIDn8i02ajXgG74liAsOmufWINEqu62eg9dWmAd U+DlhW9lBvdZuqt1LlyrKB+pBKZN31Y0Z9iO2MMf6LfoL3VsqMdQP9Yt/YscmTxbBgar 9T4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hFAt3r4WDR2hRaDH6/V+N6duxfRL3LT4O8CQVFE0ml8=; b=ELIbUd0uvhtrVQBYlcDlGBcjr7cZ9coXEQO5LsTz6qSSE0LCEMLIBGdFTgYm3wOM7Z VYTQ34Hv2z6UOXop/qaeuWvv2c6a40FrWtWWPaKsuwYzo3b6KvnOCpKq8ci3PXYrcYwp BZgxqr2JYLtuoB0iZtFV4IpMEc5uLX/h3koERmSj4uftVxuWwdZz5ZfuqDFsL60ik8Ji buMacaqf3MjBt4GWPtxEDu5i/PiVnTLlY0FihY0LEU4zcmJx34ZuqEhDW563WHyGKEtx TomJFwEqogtpP8kXSiF9Bu9AznP3ocgPbChU5ErNDdYQ9zab9mfeOYi072J66hHJ+xA+ AiEQ== X-Gm-Message-State: AOAM533P8mC3LWGQv8vJYfCpkiHXGK4YXaVxABhUq1/vzDntPVYBS3Ko kByo0PfXdgh1ZoueCEMOXNH3iRHP X-Google-Smtp-Source: ABdhPJzBZ9FoXX+61XQXC9o8/kmg0/UcJCs5girgWyqBtcQcDC+9m4pcuncZNDDVgbWG1V8tUn/0Bw== X-Received: by 2002:a17:906:da1e:: with SMTP id fi30mr13196368ejb.80.1590251949811; Sat, 23 May 2020 09:39:09 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:09 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 09/30] net: eepro100: Fix remaining checkpatch issues Date: Sat, 23 May 2020 18:38:16 +0200 Message-Id: <20200523163837.407592-9-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl -f --fix --fix-inplace drivers/net/eepro100.c This fixes all the remaining errors except a couple of comments which are longer than 80 characters, all the volatile misuse and all the camelcase, that needs a separate patch. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 45 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index e5bc90f52c..45c013607e 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -293,7 +293,7 @@ static struct eth_device *verify_phyaddr(const char *devname, unsigned char model; dev = eth_get_dev_by_name(devname); - if (dev == NULL) { + if (!dev) { printf("%s: no such device\n", devname); return NULL; } @@ -322,7 +322,7 @@ static int eepro100_miiphy_read(struct mii_dev *bus, int addr, int devad, struct eth_device *dev; dev = verify_phyaddr(bus->name, addr); - if (dev == NULL) + if (!dev) return -1; if (get_phyreg(dev, addr, reg, &value) != 0) { @@ -339,7 +339,7 @@ static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, struct eth_device *dev; dev = verify_phyaddr(bus->name, addr); - if (dev == NULL) + if (!dev) return -1; if (set_phyreg(dev, addr, reg, value) != 0) { @@ -392,9 +392,8 @@ int eepro100_initialize(bd_t *bis) debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", iobase); - pci_write_config_dword(devno, - PCI_COMMAND, - PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); + pci_write_config_dword(devno, PCI_COMMAND, + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); /* Check if I/O accesses and Bus Mastering are enabled. */ pci_read_config_dword(devno, PCI_COMMAND, &status); @@ -408,7 +407,7 @@ int eepro100_initialize(bd_t *bis) continue; } - dev = (struct eth_device *)malloc(sizeof *dev); + dev = (struct eth_device *)malloc(sizeof(*dev)); if (!dev) { printf("eepro100: Can not allocate memory\n"); break; @@ -429,6 +428,7 @@ int eepro100_initialize(bd_t *bis) /* register mii command access routines */ int retval; struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); @@ -453,7 +453,6 @@ int eepro100_initialize(bd_t *bis) return card_number; } - static int eepro100_init(struct eth_device *dev, bd_t *bis) { int i, status = -1; @@ -499,9 +498,10 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) tx_next = ((tx_next + 1) % NUM_TX_DESC); cfg_cmd = (struct descriptor *)&tx_ring[tx_cur]; - cfg_cmd->command = cpu_to_le16 ((CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE)); + cfg_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | + CONFIG_SYS_CMD_CONFIGURE); cfg_cmd->status = 0; - cfg_cmd->link = cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); + cfg_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); memcpy(cfg_cmd->params, i82558_config_cmd, sizeof(i82558_config_cmd)); @@ -534,9 +534,10 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) tx_next = ((tx_next + 1) % NUM_TX_DESC); ias_cmd = (struct descriptor *)&tx_ring[tx_cur]; - ias_cmd->command = cpu_to_le16 ((CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS)); + ias_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | + CONFIG_SYS_CMD_IAS); ias_cmd->status = 0; - ias_cmd->link = cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); + ias_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); memcpy(ias_cmd->params, dev->enetaddr, 6); @@ -549,8 +550,9 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); OUTW(dev, SCB_M | CU_START, SCBCmd); - for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); - i++) { + for (i = 0; + !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); + i++) { if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", dev->name); @@ -607,8 +609,9 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); OUTW(dev, SCB_M | CU_START, SCBCmd); - for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); - i++) { + for (i = 0; + !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); + i++) { if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", dev->name); goto Done; @@ -752,13 +755,13 @@ static void init_rx_ring(struct eth_device *dev) for (i = 0; i < NUM_RX_DESC; i++) { rx_ring[i].status = 0; - rx_ring[i].control = - (i == NUM_RX_DESC - 1) ? cpu_to_le16 (RFD_CONTROL_S) : 0; + rx_ring[i].control = (i == NUM_RX_DESC - 1) ? + cpu_to_le16 (RFD_CONTROL_S) : 0; rx_ring[i].link = - cpu_to_le32 (phys_to_bus - ((u32)&rx_ring[(i + 1) % NUM_RX_DESC])); + cpu_to_le32(phys_to_bus((u32)&rx_ring[(i + 1) % + NUM_RX_DESC])); rx_ring[i].rx_buf_addr = 0xffffffff; - rx_ring[i].count = cpu_to_le32 (PKTSIZE_ALIGN << 16); + rx_ring[i].count = cpu_to_le32(PKTSIZE_ALIGN << 16); } rx_next = 0; From patchwork Sat May 23 16:38:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296728 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Q4pbf6jJ; 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 49Tpyv0jhXz9sRf for ; Sun, 24 May 2020 02:41:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DFE578185E; Sat, 23 May 2020 18:40:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Q4pbf6jJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 85F6281734; Sat, 23 May 2020 18:39:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BB648167F for ; Sat, 23 May 2020 18:39:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x543.google.com with SMTP id l5so11727262edn.7 for ; Sat, 23 May 2020 09:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sxH6mqTWenajv/xSVmi8Np8Gcn5D5tuVCvRAOusQrQA=; b=Q4pbf6jJCbQo7znNjkVM1dlewzSvdwPJ/EXZ52I+/zRdNTNeM8DewsaHLCwd13l4f1 1k93oVIWEzMAkn8EU6jvutOUjtLDIkzT+yP7IkZsG1/fzqIFnhwfYrBOsgvVeuxi3KL3 2UmBu9a1lLQFKCBtiXm/9fxYmGXypriYUN4YamNPzOI3jykbxUDA2WpTHOSdbm65hfCc mFEhibsaXr72j7b8KF09DzN7IHmQe+HopKxRlVUAM5UuT30laXcEMcMLX2+9qqbNMHZ9 Ffbxk6/9qgClc2BjY8pHx1EOp9ZXRrn6krKOahzhZcz4rrP9s98/uW8/OMI+10qnImkB /voA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sxH6mqTWenajv/xSVmi8Np8Gcn5D5tuVCvRAOusQrQA=; b=DQ3AuclhcvER6HlVOIgrPZf3GT7yx8d72CGZfiB13Qjpfc/1X8MNNYNoc3viARIhFM 3uhvpQnwvyxBEb3mpYMW8EVB+OMp1iSWZS/CeiPNyiXlpuvmF9eP6XxhvFAHcGYJXqIo jC+SR8SOD/opqlX6VM0g2AgC1bCIUvFbezLaK0TYtVidp84RDbnv4ucDlW8POCjvfYE1 S1IEMLWcC5/aPZFhNZ3BdMS6Sq4wKGKhOjmmJmoQIQimWIJwm7NFVgiO62XgUeKf7Nsr JNswKGfxl7cSeN8AFr7tqyJd8y9lrTlzpEirym62UPUGh+wnoLjyXxmV8r0flE3OY80Q ahqg== X-Gm-Message-State: AOAM531eUGqYr2ppatH779q/L01HIgJER7/IZBZxr0pHjV4Ovg4dB+wU K3ExilCTHn3TlaCcEXkKFTSnktJU X-Google-Smtp-Source: ABdhPJxZpyHM8btRqESATH+tTawXr7P7ojHPorMBs9OOUEUxjwTCmCMmTWGq7kd9s8huIUCiYa465w== X-Received: by 2002:a50:fa8d:: with SMTP id w13mr7393774edr.280.1590251951020; Sat, 23 May 2020 09:39:11 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:10 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 10/30] net: eepro100: Fix camelcase Date: Sat, 23 May 2020 18:38:17 +0200 Message-Id: <20200523163837.407592-10-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is automated cleanup via checkpatch, no functional change. ./scripts/checkpatch.pl --show-types -f drivers/net/eepro100.c ./scripts/checkpatch.pl --types INDENTED_LABEL -f --fix --fix-inplace drivers/net/eepro100.c Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 172 ++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 87 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 45c013607e..d3ced08761 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -14,18 +14,18 @@ #include /* Ethernet chip registers. */ -#define SCBStatus 0 /* Rx/Command Unit Status *Word* */ -#define SCBIntAckByte 1 /* Rx/Command Unit STAT/ACK byte */ -#define SCBCmd 2 /* Rx/Command Unit Command *Word* */ -#define SCBIntrCtlByte 3 /* Rx/Command Unit Intr.Control Byte */ -#define SCBPointer 4 /* General purpose pointer. */ -#define SCBPort 8 /* Misc. commands and operands. */ -#define SCBflash 12 /* Flash memory control. */ -#define SCBeeprom 14 /* EEPROM memory control. */ -#define SCBCtrlMDI 16 /* MDI interface control. */ -#define SCBEarlyRx 20 /* Early receive byte count. */ -#define SCBGenControl 28 /* 82559 General Control Register */ -#define SCBGenStatus 29 /* 82559 General Status register */ +#define SCB_STATUS 0 /* Rx/Command Unit Status *Word* */ +#define SCB_INT_ACK_BYTE 1 /* Rx/Command Unit STAT/ACK byte */ +#define SCB_CMD 2 /* Rx/Command Unit Command *Word* */ +#define SCB_INTR_CTL_BYTE 3 /* Rx/Command Unit Intr.Control Byte */ +#define SCB_POINTER 4 /* General purpose pointer. */ +#define SCB_PORT 8 /* Misc. commands and operands. */ +#define SCB_FLASH 12 /* Flash memory control. */ +#define SCB_EEPROM 14 /* EEPROM memory control. */ +#define SCB_CTRL_MDI 16 /* MDI interface control. */ +#define SCB_EARLY_RX 20 /* Early receive byte count. */ +#define SCB_GEN_CONTROL 28 /* 82559 General Control Register */ +#define SCB_GEN_STATUS 29 /* 82559 General Status register */ /* 82559 SCB status word defnitions */ #define SCB_STATUS_CX 0x8000 /* CU finished command (transmit) */ @@ -101,10 +101,10 @@ #define EE_ERASE_CMD (7 << addr_len) /* Receive frame descriptors. */ -struct RxFD { +struct eepro100_rxfd { volatile u16 status; volatile u16 control; - volatile u32 link; /* struct RxFD * */ + volatile u32 link; /* struct eepro100_rxfd * */ volatile u32 rx_buf_addr; /* void * */ volatile u32 count; @@ -135,7 +135,7 @@ struct RxFD { #define RFD_RX_TCO 0x0001 /* TCO indication */ /* Transmit frame descriptors */ -struct TxFD { /* Transmit frame descriptor set. */ +struct eepro100_txfd { /* Transmit frame descriptor set. */ volatile u16 status; volatile u16 command; volatile u32 link; /* void * */ @@ -148,15 +148,15 @@ struct TxFD { /* Transmit frame descriptor set. */ volatile s32 tx_buf_size1; /* Length of Tx frame. */ }; -#define TxCB_CMD_TRANSMIT 0x0004 /* transmit command */ -#define TxCB_CMD_SF 0x0008 /* 0=simplified, 1=flexible mode */ -#define TxCB_CMD_NC 0x0010 /* 0=CRC insert by controller */ -#define TxCB_CMD_I 0x2000 /* generate interrupt on completion */ -#define TxCB_CMD_S 0x4000 /* suspend on completion */ -#define TxCB_CMD_EL 0x8000 /* last command block in CBL */ +#define TXCB_CMD_TRANSMIT 0x0004 /* transmit command */ +#define TXCB_CMD_SF 0x0008 /* 0=simplified, 1=flexible mode */ +#define TXCB_CMD_NC 0x0010 /* 0=CRC insert by controller */ +#define TXCB_CMD_I 0x2000 /* generate interrupt on completion */ +#define TXCB_CMD_S 0x4000 /* suspend on completion */ +#define TXCB_CMD_EL 0x8000 /* last command block in CBL */ -#define TxCB_COUNT_MASK 0x3fff -#define TxCB_COUNT_EOF 0x8000 +#define TXCB_COUNT_MASK 0x3fff +#define TXCB_COUNT_EOF 0x8000 /* The Speedo3 Rx and Tx frame/buffer descriptors. */ struct descriptor { /* A generic descriptor. */ @@ -182,8 +182,8 @@ struct descriptor { /* A generic descriptor. */ #define TOUT_LOOP 1000000 -static struct RxFD rx_ring[NUM_RX_DESC]; /* RX descriptor ring */ -static struct TxFD tx_ring[NUM_TX_DESC]; /* TX descriptor ring */ +static struct eepro100_rxfd rx_ring[NUM_RX_DESC]; /* RX descriptor ring */ +static struct eepro100_txfd tx_ring[NUM_TX_DESC]; /* TX descriptor ring */ static int rx_next; /* RX descriptor ring pointer */ static int tx_next; /* TX descriptor ring pointer */ static int tx_threshold; @@ -247,11 +247,11 @@ static int get_phyreg(struct eth_device *dev, unsigned char addr, /* read requested data */ cmd = (2 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL(dev, cmd, SCBCtrlMDI); + OUTL(dev, cmd, SCB_CTRL_MDI); do { udelay(1000); - cmd = INL(dev, SCBCtrlMDI); + cmd = INL(dev, SCB_CTRL_MDI); } while (!(cmd & (1 << 28)) && (--timeout)); if (timeout == 0) @@ -270,9 +270,9 @@ static int set_phyreg(struct eth_device *dev, unsigned char addr, /* write requested data */ cmd = (1 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL(dev, cmd | value, SCBCtrlMDI); + OUTL(dev, cmd | value, SCB_CTRL_MDI); - while (!(INL(dev, SCBCtrlMDI) & (1 << 28)) && (--timeout)) + while (!(INL(dev, SCB_CTRL_MDI) & (1 << 28)) && (--timeout)) udelay(1000); if (timeout == 0) @@ -357,7 +357,7 @@ static int wait_for_eepro100(struct eth_device *dev) { int i; - for (i = 0; INW(dev, SCBCmd) & (CU_CMD_MASK | RU_CMD_MASK); i++) { + for (i = 0; INW(dev, SCB_CMD) & (CU_CMD_MASK | RU_CMD_MASK); i++) { if (i >= TOUT_LOOP) return 0; } @@ -460,25 +460,25 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) struct descriptor *ias_cmd, *cfg_cmd; /* Reset the ethernet controller */ - OUTL(dev, I82559_SELECTIVE_RESET, SCBPort); + OUTL(dev, I82559_SELECTIVE_RESET, SCB_PORT); udelay(20); - OUTL(dev, I82559_RESET, SCBPort); + OUTL(dev, I82559_RESET, SCB_PORT); udelay(20); if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, 0, SCBPointer); - OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCB_POINTER); + OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCB_CMD); if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, 0, SCBPointer); - OUTW(dev, SCB_M | CU_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCB_POINTER); + OUTW(dev, SCB_M | CU_ADDR_LOAD, SCB_CMD); /* Initialize Rx and Tx rings. */ init_rx_ring(dev); @@ -487,11 +487,11 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) /* Tell the adapter where the RX ring is located. */ if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCBPointer); - OUTW(dev, SCB_M | RUC_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); + OUTW(dev, SCB_M | RUC_START, SCB_CMD); /* Send the Configure frame */ tx_cur = tx_next; @@ -508,25 +508,25 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) if (!wait_for_eepro100(dev)) { printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); - OUTW(dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); + OUTW(dev, SCB_M | CU_START, SCB_CMD); for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); i++) { if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", dev->name); - goto Done; + goto done; } } if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", le16_to_cpu(tx_ring[tx_cur].status)); - goto Done; + goto done; } /* Send the Individual Address Setup frame */ @@ -544,11 +544,11 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) /* Tell the adapter where the TX ring is located. */ if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); - OUTW(dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); + OUTW(dev, SCB_M | CU_START, SCB_CMD); for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); @@ -556,19 +556,19 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", dev->name); - goto Done; + goto done; } } if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", le16_to_cpu(tx_ring[tx_cur].status)); - goto Done; + goto done; } status = 0; -Done: +done: return status; } @@ -579,16 +579,14 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) if (length <= 0) { printf("%s: bad packet size: %d\n", dev->name, length); - goto Done; + goto done; } tx_cur = tx_next; tx_next = (tx_next + 1) % NUM_TX_DESC; - tx_ring[tx_cur].command = cpu_to_le16 (TxCB_CMD_TRANSMIT | - TxCB_CMD_SF | - TxCB_CMD_S | - TxCB_CMD_EL); + tx_ring[tx_cur].command = cpu_to_le16(TXCB_CMD_TRANSMIT | TXCB_CMD_SF | + TXCB_CMD_S | TXCB_CMD_EL); tx_ring[tx_cur].status = 0; tx_ring[tx_cur].count = cpu_to_le32 (tx_threshold); tx_ring[tx_cur].link = @@ -602,31 +600,31 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) if (!wait_for_eepro100(dev)) { printf("%s: Tx error ethernet controller not ready.\n", dev->name); - goto Done; + goto done; } /* Send the packet. */ - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCBPointer); - OUTW(dev, SCB_M | CU_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); + OUTW(dev, SCB_M | CU_START, SCB_CMD); for (i = 0; !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); i++) { if (i >= TOUT_LOOP) { printf("%s: Tx error buffer not ready\n", dev->name); - goto Done; + goto done; } } if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { printf("TX error status = 0x%08X\n", le16_to_cpu(tx_ring[tx_cur].status)); - goto Done; + goto done; } status = length; -Done: +done: return status; } @@ -635,8 +633,8 @@ static int eepro100_recv(struct eth_device *dev) u16 status, stat; int rx_prev, length = 0; - stat = INW(dev, SCBStatus); - OUTW(dev, stat & SCB_STATUS_RNR, SCBStatus); + stat = INW(dev, SCB_STATUS); + OUTW(dev, stat & SCB_STATUS_RNR, SCB_STATUS); for (;;) { status = le16_to_cpu(rx_ring[rx_next].status); @@ -676,41 +674,41 @@ static int eepro100_recv(struct eth_device *dev) if (!wait_for_eepro100(dev)) { printf("Error: Can not restart ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCBPointer); - OUTW(dev, SCB_M | RUC_START, SCBCmd); + OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); + OUTW(dev, SCB_M | RUC_START, SCB_CMD); } -Done: +done: return length; } static void eepro100_halt(struct eth_device *dev) { /* Reset the ethernet controller */ - OUTL(dev, I82559_SELECTIVE_RESET, SCBPort); + OUTL(dev, I82559_SELECTIVE_RESET, SCB_PORT); udelay(20); - OUTL(dev, I82559_RESET, SCBPort); + OUTL(dev, I82559_RESET, SCB_PORT); udelay(20); if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, 0, SCBPointer); - OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCB_POINTER); + OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCB_CMD); if (!wait_for_eepro100(dev)) { printf("Error: Can not reset ethernet controller.\n"); - goto Done; + goto done; } - OUTL(dev, 0, SCBPointer); - OUTW(dev, SCB_M | CU_ADDR_LOAD, SCBCmd); + OUTL(dev, 0, SCB_POINTER); + OUTW(dev, SCB_M | CU_ADDR_LOAD, SCB_CMD); -Done: +done: return; } @@ -721,31 +719,31 @@ static int read_eeprom(struct eth_device *dev, int location, int addr_len) int read_cmd = location | EE_READ_CMD; int i; - OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); - OUTW(dev, EE_ENB, SCBeeprom); + OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); + OUTW(dev, EE_ENB, SCB_EEPROM); /* Shift the read command bits out. */ for (i = 12; i >= 0; i--) { short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(dev, EE_ENB | dataval, SCBeeprom); + OUTW(dev, EE_ENB | dataval, SCB_EEPROM); udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom); + OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCB_EEPROM); udelay(1); } - OUTW(dev, EE_ENB, SCBeeprom); + OUTW(dev, EE_ENB, SCB_EEPROM); for (i = 15; i >= 0; i--) { - OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCBeeprom); + OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCB_EEPROM); udelay(1); retval = (retval << 1) | - ((INW(dev, SCBeeprom) & EE_DATA_READ) ? 1 : 0); - OUTW(dev, EE_ENB, SCBeeprom); + ((INW(dev, SCB_EEPROM) & EE_DATA_READ) ? 1 : 0); + OUTW(dev, EE_ENB, SCB_EEPROM); udelay(1); } /* Terminate the EEPROM access. */ - OUTW(dev, EE_ENB & ~EE_CS, SCBeeprom); + OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); return retval; } From patchwork Sat May 23 16:38:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296730 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qytmnKrX; 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 49TpzS2RlNz9sPK for ; Sun, 24 May 2020 02:41:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 309F381734; Sat, 23 May 2020 18:40:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qytmnKrX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31F7D81781; Sat, 23 May 2020 18:39:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B0A3081689 for ; Sat, 23 May 2020 18:39:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id yc10so16340305ejb.12 for ; Sat, 23 May 2020 09:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LOpa3YpCt5uJ3+meiWo0muu0FoNkZ3GI2w4lcAEG45o=; b=qytmnKrXfFrLWRDGuElYEfU3XLnk+TwcaXLn0eb31ZvzV5smdH6fIAZoM6MUl+qysd 3dRdqM/2dbJy5wwkZvgLp3mLUQzPyvmSoB52gaIEKv9fn/9l4UEwA1S4QDNKWK9zZ6fM w9q+4RF/1XksNVgkIPU0VC4OEj6la4uaTzzL5O3vqzL0+xL+ivG2DfSFW9/I51zBJKxy mnSaJ+hZApAtfh89+2ZSFjIOJx0NVwJFGJZ30Au0MqLbVe3uUU+ylxCxHAwHWU3HmTaP gF+pJOTCSEk50+a7dYURprv2TBD8G3w75aNOznbLQhpIeXXNBPANeHabP6ig6UdoFxGU KHBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LOpa3YpCt5uJ3+meiWo0muu0FoNkZ3GI2w4lcAEG45o=; b=pxV+kmzPaRDTBErYUWXuI83te5R7n9Mi5dGsQ97/FSAjUedCdhPEvsxNodIm12dtpF 7uClhdEB4m02Kb1tKOQQYjDszlVXxy0g32oWWXMLtWsdTUsp99x67CscCbskUychvQMs LUuFOqMKD26AuliryPXmgy7lOXWpXTuICbZPyphWqK9o0Lb39jAcd1YTtiZwE39BzIIM I8NwwomtLL75cmImActNdhL4notg6RLFEyP1PBJGg8CEM7TNleC0q5Qe7MAOWyzGATif cuPN203t7SJxajC/gHFiOvVoTfqKwtetM2U2Q+cuML1hoP57lYUnSZVTKC+FHYUk8YPJ cAjA== X-Gm-Message-State: AOAM533z9fByEkI+Cd1qf1sQAu9EwfbHHSXWO1PKaAIkw/arE9WcRg1K adN0aKRsylUB8Zk2sEfj5VGS621b X-Google-Smtp-Source: ABdhPJzb03s8AdKVWpj+UAi9/4P+I+r/8YG/UkuMpZMaNuaYPedQv3FNWcpRrzIGr7Hf+HQmGbFTxQ== X-Received: by 2002:a17:906:d86:: with SMTP id m6mr12961179eji.470.1590251952034; Sat, 23 May 2020 09:39:12 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:11 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 11/30] net: eepro100: Use standard I/O accessors Date: Sat, 23 May 2020 18:38:18 +0200 Message-Id: <20200523163837.407592-11-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The current eepro100 driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on some systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index d3ced08761..5d11665fdc 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -220,23 +220,23 @@ static void eepro100_halt(struct eth_device *dev); static inline int INW(struct eth_device *dev, u_long addr) { - return le16_to_cpu(*(volatile u16 *)(addr + (u_long)dev->iobase)); + return le16_to_cpu(readw(addr + (void *)dev->iobase)); } static inline void OUTW(struct eth_device *dev, int command, u_long addr) { - *(volatile u16 *)((addr + (u_long)dev->iobase)) = cpu_to_le16(command); + writew(cpu_to_le16(command), addr + (void *)dev->iobase); } static inline void OUTL(struct eth_device *dev, int command, u_long addr) { - *(volatile u32 *)((addr + (u_long)dev->iobase)) = cpu_to_le32(command); + writel(cpu_to_le32(command), addr + (void *)dev->iobase); } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) static inline int INL(struct eth_device *dev, u_long addr) { - return le32_to_cpu(*(volatile u32 *)(addr + (u_long)dev->iobase)); + return le32_to_cpu(readl(addr + (void *)dev->iobase)); } static int get_phyreg(struct eth_device *dev, unsigned char addr, From patchwork Sat May 23 16:38:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296729 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VDd19nYJ; 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 49TpzB0s9wz9sPK for ; Sun, 24 May 2020 02:41:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C2FD815FB; Sat, 23 May 2020 18:40:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VDd19nYJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09EB88167F; Sat, 23 May 2020 18:39:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CE96F81589 for ; Sat, 23 May 2020 18:39:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id n24so16410138ejd.0 for ; Sat, 23 May 2020 09:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rCPCCGaZKx4co1rTHB4MLGT6P3uDJk2TJjNShbwStSE=; b=VDd19nYJVvh7ACGq4QM5QfCM7jS6DYCvb1JTOrlaREdn17QV1gT4PJVxkb0x730tKw DWtckL+O2CJGY0q35oi3sgMnPWSbN3oOqS4lZMZQ3eZbAeDfYGPELuN880At5euAliBq 9Mh2Oe3ju9dj5dpiiKFf1WZUviGnU8ttG8SWmwnFymIpySLx2zw44bIqBjcuABqfUKPY EUbq2Yl3/UA9aA4E8im2vojJc95NraQXaduhh6Cr/5t2040ysCnTyFccimfg8nLBFVZ+ +r8+ddM7vmKbYWzB5uQ2a/2ouHd2fYWG2UrS6SMewcrh4BwJIJTWFNSzwUtDntAv6CmZ MhCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rCPCCGaZKx4co1rTHB4MLGT6P3uDJk2TJjNShbwStSE=; b=k0P4BLsImrzF6R9WJ7B8WNNYfPnzAA/iHDFsDcEacddhVoPXJ8Dj5zAXYtaybbfzB0 M34G0TOxAEtcYUDuHe3mHy1rBbbcXLib1fTQbWKvURVruHOlu6hFE4Pfp5ctxxiEitln osZClQz6j+dWZgRbppnHEvSEgH7KhXVUbTNlXy4N/GHpD4xYs++86BusdPRUee2zKtMW njZjtxYbuXoEM6sPYJT7Esl8F/F377uGnOYq2VAVntoLzrHyxUOnf9lcWo+3y8f6650x Kx+YwzQhikfFAdVizdYlUamcRGsxD2MWaWPEZTyCiH2uQhq6+ge5XguHdTGt+wiktdRj s9BA== X-Gm-Message-State: AOAM5309zb3OYxqa4+blcZE9xkUllaksNAufn0qawunAggG9FETfH+Wg mvqlaYz2lpSLf2NcEaBOLiHnAMfv X-Google-Smtp-Source: ABdhPJzxqQIOhL41Z2StgK7akD2WCYh87DN011FAwGHFPInMjpcvs2hDjd2nl/bmGEEg8MQe5B9cUQ== X-Received: by 2002:a17:906:b348:: with SMTP id cd8mr12413268ejb.139.1590251953126; Sat, 23 May 2020 09:39:13 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:12 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 12/30] net: eepro100: Replace purge_tx_ring() with memset() Date: Sat, 23 May 2020 18:38:19 +0200 Message-Id: <20200523163837.407592-12-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This function zeroes-out all the descriptors in the TX ring, use memset() instead. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 5d11665fdc..6fb9192e81 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -767,23 +767,9 @@ static void init_rx_ring(struct eth_device *dev) static void purge_tx_ring(struct eth_device *dev) { - int i; - tx_next = 0; tx_threshold = 0x01208000; - - for (i = 0; i < NUM_TX_DESC; i++) { - tx_ring[i].status = 0; - tx_ring[i].command = 0; - tx_ring[i].link = 0; - tx_ring[i].tx_desc_addr = 0; - tx_ring[i].count = 0; - - tx_ring[i].tx_buf_addr0 = 0; - tx_ring[i].tx_buf_size0 = 0; - tx_ring[i].tx_buf_addr1 = 0; - tx_ring[i].tx_buf_size1 = 0; - } + memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC); } static void read_hw_addr(struct eth_device *dev, bd_t *bis) From patchwork Sat May 23 16:38:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296731 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=MGy1/0W+; 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 49Tpzj1yshz9sPK for ; Sun, 24 May 2020 02:42:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02DDB81799; Sat, 23 May 2020 18:40:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MGy1/0W+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 35F5A81777; Sat, 23 May 2020 18:39:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 366B18168F for ; Sat, 23 May 2020 18:39:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x641.google.com with SMTP id l21so16404040eji.4 for ; Sat, 23 May 2020 09:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MmjqQKm3K/eI10VKF7iYXAM0wCKqOkEOwiy9SHwpR8E=; b=MGy1/0W+L/mxfMD5+YV0lzVp6aS/7TCLip7vwdrIyFnhNrCrIfaKHv6Uj5uW/SllJp YQCZaEuIQGuNCCXtOmov2pQVTtpRv4yXz697X2LtbskWbi8l/Eg/WsmmtacrGvC1bB7h opr9Dl8ThXtNmcvV6yRB9u2l7dx5piNfakRX6Jpdv02FW/vtuvNQoM5mlQZ+2M7Psi0d pGm7n5TejKiEKH3DzQzrBgQVqln6IS8nOoGtdvMhop872S+X+KFNmdzHfg2GSgDNZvxS tfRn5uFbisAA5yAuqjNqUTa7Sb9trYbnLUtWSEK43EeXGcOOGysOMXq+/6dm/iOkOA23 aWuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MmjqQKm3K/eI10VKF7iYXAM0wCKqOkEOwiy9SHwpR8E=; b=t84Es5BAB5zUPbuh0nMEoJ/icBFb2/2zuxl5rRFHR9uuakcuTH86ZKlgVqR3zgc0vE KyqrTvgjXrpvTeFdmCTiY2ZodD9OJQsu4+L4YJdRmczhxOFE40qIlDz2auimmWbXgZF6 T8LaxCDj6XnLJw2OhBW6jAkDq4wHd11o7ezdcKNLQYlAiminjqDbuONw3OKLgIbeBKPc Qa4X9gI2IaE4TYScCBK5Yw/xcODC1VPtaIaV2wgUiAC5CoiE6Jed8z4VxepDxkkeXW8t HK1dh7TM+yPyp/2s71jw6QzWklSKJo4ajIANiI5mbBviz1yujJG10WwuEdNVrpvfPeq5 /tqg== X-Gm-Message-State: AOAM531eVrQ+PF0IPF0dcNagbzQlfrSV6I9lwGH3JtNtiwN7Zhe7TZPl TMKw4FQJe46bQ8HZchB7sQP6jegK X-Google-Smtp-Source: ABdhPJygTklQumaD+gQsX7e+c7GM9QwxBjUawwTjCX3Zu/qyVYL+WOrR5FbJTIpvAVBJDe5pMQV65A== X-Received: by 2002:a17:906:1f09:: with SMTP id w9mr12315878ejj.486.1590251954364; Sat, 23 May 2020 09:39:14 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:13 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 13/30] net: eepro100: Factor out tx_ring command issuing Date: Sat, 23 May 2020 18:38:20 +0200 Message-Id: <20200523163837.407592-13-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This code is replicated in the driver thrice almost verbatim, factor it out into a separate function and clean it up. No functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 124 ++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 71 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 6fb9192e81..03ba9a41a5 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -453,11 +453,44 @@ int eepro100_initialize(bd_t *bis) return card_number; } +static int eepro100_txcmd_send(struct eth_device *dev, + struct eepro100_txfd *desc) +{ + u16 rstat; + int i = 0; + + if (!wait_for_eepro100(dev)) + return -ETIMEDOUT; + + OUTL(dev, phys_to_bus((u32)desc), SCB_POINTER); + OUTW(dev, SCB_M | CU_START, SCB_CMD); + + while (true) { + rstat = le16_to_cpu(desc->status); + if (rstat & CONFIG_SYS_STATUS_C) + break; + + if (i++ >= TOUT_LOOP) { + printf("%s: Tx error buffer not ready\n", dev->name); + return -EINVAL; + } + } + + rstat = le16_to_cpu(desc->status); + + if (!(rstat & CONFIG_SYS_STATUS_OK)) { + printf("TX error status = 0x%08X\n", rstat); + return -EIO; + } + + return 0; +} + static int eepro100_init(struct eth_device *dev, bd_t *bis) { - int i, status = -1; + struct eepro100_txfd *ias_cmd, *cfg_cmd; + int ret, status = -1; int tx_cur; - struct descriptor *ias_cmd, *cfg_cmd; /* Reset the ethernet controller */ OUTL(dev, I82559_SELECTIVE_RESET, SCB_PORT); @@ -497,35 +530,19 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) tx_cur = tx_next; tx_next = ((tx_next + 1) % NUM_TX_DESC); - cfg_cmd = (struct descriptor *)&tx_ring[tx_cur]; + cfg_cmd = &tx_ring[tx_cur]; cfg_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE); cfg_cmd->status = 0; cfg_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); - memcpy(cfg_cmd->params, i82558_config_cmd, + memcpy(((struct descriptor *)cfg_cmd)->params, i82558_config_cmd, sizeof(i82558_config_cmd)); - if (!wait_for_eepro100(dev)) { - printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); - goto done; - } - - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); - OUTW(dev, SCB_M | CU_START, SCB_CMD); - - for (i = 0; - !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); - i++) { - if (i >= TOUT_LOOP) { - printf("%s: Tx error buffer not ready\n", dev->name); - goto done; - } - } - - if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + ret = eepro100_txcmd_send(dev, cfg_cmd); + if (ret) { + if (ret == -ETIMEDOUT) + printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); goto done; } @@ -533,36 +550,18 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) tx_cur = tx_next; tx_next = ((tx_next + 1) % NUM_TX_DESC); - ias_cmd = (struct descriptor *)&tx_ring[tx_cur]; + ias_cmd = &tx_ring[tx_cur]; ias_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS); ias_cmd->status = 0; ias_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); - memcpy(ias_cmd->params, dev->enetaddr, 6); - - /* Tell the adapter where the TX ring is located. */ - if (!wait_for_eepro100(dev)) { - printf("Error: Can not reset ethernet controller.\n"); - goto done; - } - - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); - OUTW(dev, SCB_M | CU_START, SCB_CMD); - - for (i = 0; - !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); - i++) { - if (i >= TOUT_LOOP) { - printf("%s: Tx error buffer not ready\n", - dev->name); - goto done; - } - } + memcpy(((struct descriptor *)ias_cmd)->params, dev->enetaddr, 6); - if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + ret = eepro100_txcmd_send(dev, ias_cmd); + if (ret) { + if (ret == -ETIMEDOUT) + printf("Error: Can not reset ethernet controller.\n"); goto done; } @@ -574,7 +573,7 @@ done: static int eepro100_send(struct eth_device *dev, void *packet, int length) { - int i, status = -1; + int ret, status = -1; int tx_cur; if (length <= 0) { @@ -597,28 +596,11 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) cpu_to_le32 (phys_to_bus((u_long)packet)); tx_ring[tx_cur].tx_buf_size0 = cpu_to_le32 (length); - if (!wait_for_eepro100(dev)) { - printf("%s: Tx error ethernet controller not ready.\n", - dev->name); - goto done; - } - - /* Send the packet. */ - OUTL(dev, phys_to_bus((u32)&tx_ring[tx_cur]), SCB_POINTER); - OUTW(dev, SCB_M | CU_START, SCB_CMD); - - for (i = 0; - !(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_C); - i++) { - if (i >= TOUT_LOOP) { - printf("%s: Tx error buffer not ready\n", dev->name); - goto done; - } - } - - if (!(le16_to_cpu(tx_ring[tx_cur].status) & CONFIG_SYS_STATUS_OK)) { - printf("TX error status = 0x%08X\n", - le16_to_cpu(tx_ring[tx_cur].status)); + ret = eepro100_txcmd_send(dev, &tx_ring[tx_cur]); + if (ret) { + if (ret == -ETIMEDOUT) + printf("%s: Tx error ethernet controller not ready.\n", + dev->name); goto done; } From patchwork Sat May 23 16:38:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296735 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qYyY5ZCY; 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 49Tq0d29hMz9sPK for ; Sun, 24 May 2020 02:42:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2D37D8195D; Sat, 23 May 2020 18:41:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qYyY5ZCY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7164481767; Sat, 23 May 2020 18:39:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6EF64812EE for ; Sat, 23 May 2020 18:39:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x644.google.com with SMTP id s21so16438537ejd.2 for ; Sat, 23 May 2020 09:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n0KalfF+LQkzHuuja87Rf91UTqgBQ/TvRqm+tFNg0Mo=; b=qYyY5ZCYbh+1DOUyLYpBBiswZLgH1jsIe9btWwNq/HgnEPLV+r1lfwHjVnyOCWd+M/ HDMAN5ji0aSqVpuzNBcEkjHBvDaHRmTvoH93ZL4umuQ5+4qM2KDJ2vWzNSiRYxVpEL/u mVWbQ2DhBlZoldhyX+ej5KaQ7FEQ3xikaiT964y7ofzbHnkJqrz8ClTKBoLbi6OacriO VLXzyTL3xl6wemAAME51Y/V+Y0FwNMF09QG4BWC/B+x8/cfJARra8IKfMwB31uOfFCqR PBmPW7sjg4D/4Y3YHo8kbfjk7iwFue7m4waw/25JiKWSJYddoj48yfKpPuZHq0smUe22 YNmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n0KalfF+LQkzHuuja87Rf91UTqgBQ/TvRqm+tFNg0Mo=; b=qk06VBXlKg/b2Y+jlvPbfXgynwNGa0m5a4udCYJa6XmCqSfmKRAtDG0GwianrCICbk NAWAyRtjZVlb+UpDO7ayZMwGQx89EsrIPkCE9gnXVFMHKRftjsBzZUIzyNSlTdls3Zo+ 7GWs9tV5MVN0veLbh2BKJWvrCNLtdVaV41+nuBQC7VqMx83OGvZia8rJ906B2WENo51s bpIY+wZXRhLgBdtQ9cHxeMSv9tMWyeduCf1hwzwoc0WjFNTHeY0zJVkPuVPiHTxU6IIr qBurP4UvIfF5/3K6hl+VPpzHT7BFvzwjDBmZUu0x4aY0ExS3IqPkvKpXEMAQTm63Oz/u /LgQ== X-Gm-Message-State: AOAM53086qG5ft3JC/qEhh8afYALjmRLMtTCWcXiW0DdJTGKv48+wbp9 4MtWURVkEk7gNIzfWvgLFVe4TwEG X-Google-Smtp-Source: ABdhPJxvQqczp9hc6KCus8bCxm5hWycSdmliSCqICMATaH3gPQ0VeAadeUxaJxm6bZijDTUIEe2xGw== X-Received: by 2002:a17:906:1f87:: with SMTP id t7mr12989265ejr.50.1590251955678; Sat, 23 May 2020 09:39:15 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:14 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 14/30] net: eepro100: Add cache management Date: Sat, 23 May 2020 18:38:21 +0200 Message-Id: <20200523163837.407592-14-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add cache invalidation and flushes wherever the DMA descriptors are written or read, otherwise this driver cannot work reliably on any systems where caches are enabled. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 65 +++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 03ba9a41a5..89bfcfba0a 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -459,6 +460,9 @@ static int eepro100_txcmd_send(struct eth_device *dev, u16 rstat; int i = 0; + flush_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); + if (!wait_for_eepro100(dev)) return -ETIMEDOUT; @@ -466,6 +470,8 @@ static int eepro100_txcmd_send(struct eth_device *dev, OUTW(dev, SCB_M | CU_START, SCB_CMD); while (true) { + invalidate_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); rstat = le16_to_cpu(desc->status); if (rstat & CONFIG_SYS_STATUS_C) break; @@ -476,6 +482,8 @@ static int eepro100_txcmd_send(struct eth_device *dev, } } + invalidate_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); rstat = le16_to_cpu(desc->status); if (!(rstat & CONFIG_SYS_STATUS_OK)) { @@ -523,6 +531,7 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) goto done; } + /* RX ring cache was already flushed in init_rx_ring() */ OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); OUTW(dev, SCB_M | RUC_START, SCB_CMD); @@ -573,6 +582,7 @@ done: static int eepro100_send(struct eth_device *dev, void *packet, int length) { + struct eepro100_txfd *desc; int ret, status = -1; int tx_cur; @@ -584,17 +594,15 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) tx_cur = tx_next; tx_next = (tx_next + 1) % NUM_TX_DESC; - tx_ring[tx_cur].command = cpu_to_le16(TXCB_CMD_TRANSMIT | TXCB_CMD_SF | - TXCB_CMD_S | TXCB_CMD_EL); - tx_ring[tx_cur].status = 0; - tx_ring[tx_cur].count = cpu_to_le32 (tx_threshold); - tx_ring[tx_cur].link = - cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_next])); - tx_ring[tx_cur].tx_desc_addr = - cpu_to_le32 (phys_to_bus((u32)&tx_ring[tx_cur].tx_buf_addr0)); - tx_ring[tx_cur].tx_buf_addr0 = - cpu_to_le32 (phys_to_bus((u_long)packet)); - tx_ring[tx_cur].tx_buf_size0 = cpu_to_le32 (length); + desc = &tx_ring[tx_cur]; + desc->command = cpu_to_le16(TXCB_CMD_TRANSMIT | TXCB_CMD_SF | + TXCB_CMD_S | TXCB_CMD_EL); + desc->status = 0; + desc->count = cpu_to_le32(tx_threshold); + desc->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); + desc->tx_desc_addr = cpu_to_le32(phys_to_bus((u32)&desc->tx_buf_addr0)); + desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus((u_long)packet)); + desc->tx_buf_size0 = cpu_to_le32(length); ret = eepro100_txcmd_send(dev, &tx_ring[tx_cur]); if (ret) { @@ -612,14 +620,18 @@ done: static int eepro100_recv(struct eth_device *dev) { - u16 status, stat; + struct eepro100_rxfd *desc; int rx_prev, length = 0; + u16 status, stat; stat = INW(dev, SCB_STATUS); OUTW(dev, stat & SCB_STATUS_RNR, SCB_STATUS); for (;;) { - status = le16_to_cpu(rx_ring[rx_next].status); + desc = &rx_ring[rx_next]; + invalidate_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); + status = le16_to_cpu(desc->status); if (!(status & RFD_STATUS_C)) break; @@ -627,22 +639,26 @@ static int eepro100_recv(struct eth_device *dev) /* Valid frame status. */ if ((status & RFD_STATUS_OK)) { /* A valid frame received. */ - length = le32_to_cpu(rx_ring[rx_next].count) & 0x3fff; + length = le32_to_cpu(desc->count) & 0x3fff; /* Pass the packet up to the protocol layers. */ - net_process_received_packet((u8 *)rx_ring[rx_next].data, - length); + net_process_received_packet((u8 *)desc->data, length); } else { /* There was an error. */ printf("RX error status = 0x%08X\n", status); } - rx_ring[rx_next].control = cpu_to_le16 (RFD_CONTROL_S); - rx_ring[rx_next].status = 0; - rx_ring[rx_next].count = cpu_to_le32 (PKTSIZE_ALIGN << 16); + desc->control = cpu_to_le16(RFD_CONTROL_S); + desc->status = 0; + desc->count = cpu_to_le32(PKTSIZE_ALIGN << 16); + flush_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); rx_prev = (rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; - rx_ring[rx_prev].control = 0; + desc = &rx_ring[rx_prev]; + desc->control = 0; + flush_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); /* Update entry information. */ rx_next = (rx_next + 1) % NUM_RX_DESC; @@ -659,6 +675,7 @@ static int eepro100_recv(struct eth_device *dev) goto done; } + /* RX ring cache was already flushed in init_rx_ring() */ OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); OUTW(dev, SCB_M | RUC_START, SCB_CMD); } @@ -744,6 +761,10 @@ static void init_rx_ring(struct eth_device *dev) rx_ring[i].count = cpu_to_le32(PKTSIZE_ALIGN << 16); } + flush_dcache_range((unsigned long)rx_ring, + (unsigned long)rx_ring + + (sizeof(*rx_ring) * NUM_RX_DESC)); + rx_next = 0; } @@ -752,6 +773,10 @@ static void purge_tx_ring(struct eth_device *dev) tx_next = 0; tx_threshold = 0x01208000; memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC); + + flush_dcache_range((unsigned long)tx_ring, + (unsigned long)tx_ring + + (sizeof(*tx_ring) * NUM_TX_DESC)); } static void read_hw_addr(struct eth_device *dev, bd_t *bis) From patchwork Sat May 23 16:38:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296734 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=TYyNy7Sy; 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 49Tq0P25Ncz9sPK for ; Sun, 24 May 2020 02:42:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BBA478190C; Sat, 23 May 2020 18:41:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TYyNy7Sy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FE8981799; Sat, 23 May 2020 18:39:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 96048812FB for ; Sat, 23 May 2020 18:39:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x544.google.com with SMTP id i16so11737703edv.1 for ; Sat, 23 May 2020 09:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9MVIm5LXMPzwvQrIRTmwk89+jqEgKGnAhG4UgroEbXU=; b=TYyNy7SyYiduj8VWcjQm46dzy7YtXHPacxtApIHg+eA7Z4fxoaC5FMKeXLJ4FdKCeB VB18szi6o5AMl3nZRXHQuZPhRm8brIw9haPHTPxKA8kSlRMPfgjkzdOqQwpfpvz271OY Fbd53a3Td59/qqvJ0izigWOBNnTluiDYgenuPdAXhQDrKe2jwFcQbvOJWEVzOA5Yqqym aMUK85eFvE6NNFez196+jpEYlq1ScqQYcRfGrGAqnnWTe9Sc3vws1BtXqzgdaWzXpx7D aPq6y7m7x2U6+l4hX5fkJ/vqoGK3aOVsIp3PuBV9JaLkJKyXiBy+fPB4YSUaKt4JC6Xd Lh0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9MVIm5LXMPzwvQrIRTmwk89+jqEgKGnAhG4UgroEbXU=; b=g+h677RWWgTCa2dlQQZyg4VPC6aLQbXeCi0tgl0lyMGkjWsBUszt/6OjvIKhN++TC0 Lad0Ng0IhNFFKHKitfKXEjgTN2GmILObRwmCpA+9LvztU1J4zkHJP9HU4KUFL8uQ+5Cm f7gCBWmmb0CIM2lcD/+uWk5BYQn1jfs+M8nUtoC7PXEXuy6vGMOeNwk6LgjrSx5bbeIJ kg5fTrihNfeSZNkXeTRV6dNrrv/LuEGhBvUtYVuEZki5WQP1XGfw5jj16quAkWvOJpU6 kOkJPpPtetbsJZ+/9aoGWE6FH+rdWDlYX4i5UZfOcpmFgU4bz3vkTm0t+HR6ywwqfvtX LL2g== X-Gm-Message-State: AOAM530vT9xuH7If2wshumBtxoKLaaL4FM7nn5e5/wydbNx6V/s1Gmwa /14DA+MShYriPIe/QjWmY0E65FuZ X-Google-Smtp-Source: ABdhPJwLhBf8f6wBdkdLfby7RSV+4AMQpgrnz3mgd/9OINIL4pk6f/5LV2AnELTf2rUNl8brGJvARQ== X-Received: by 2002:a50:fc04:: with SMTP id i4mr8050325edr.236.1590251956823; Sat, 23 May 2020 09:39:16 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:16 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 15/30] net: eepro100: Remove volatile misuse Date: Sat, 23 May 2020 18:38:22 +0200 Message-Id: <20200523163837.407592-15-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Remove all the remaining use of the 'volatile' keyword, as this is no longer required. All the accesses which might have needed this use of 'volatile' have been repaired properly. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 89bfcfba0a..f3bcb0dfe4 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -103,13 +103,13 @@ /* Receive frame descriptors. */ struct eepro100_rxfd { - volatile u16 status; - volatile u16 control; - volatile u32 link; /* struct eepro100_rxfd * */ - volatile u32 rx_buf_addr; /* void * */ - volatile u32 count; + u16 status; + u16 control; + u32 link; /* struct eepro100_rxfd * */ + u32 rx_buf_addr; /* void * */ + u32 count; - volatile u8 data[PKTSIZE_ALIGN]; + u8 data[PKTSIZE_ALIGN]; }; #define RFD_STATUS_C 0x8000 /* completion of received frame */ @@ -136,17 +136,17 @@ struct eepro100_rxfd { #define RFD_RX_TCO 0x0001 /* TCO indication */ /* Transmit frame descriptors */ -struct eepro100_txfd { /* Transmit frame descriptor set. */ - volatile u16 status; - volatile u16 command; - volatile u32 link; /* void * */ - volatile u32 tx_desc_addr; /* Always points to the tx_buf_addr element. */ - volatile s32 count; - - volatile u32 tx_buf_addr0; /* void *, frame to be transmitted. */ - volatile s32 tx_buf_size0; /* Length of Tx frame. */ - volatile u32 tx_buf_addr1; /* void *, frame to be transmitted. */ - volatile s32 tx_buf_size1; /* Length of Tx frame. */ +struct eepro100_txfd { /* Transmit frame descriptor set. */ + u16 status; + u16 command; + u32 link; /* void * */ + u32 tx_desc_addr; /* Always points to the tx_buf_addr element. */ + s32 count; + + u32 tx_buf_addr0; /* void *, frame to be transmitted. */ + s32 tx_buf_size0; /* Length of Tx frame. */ + u32 tx_buf_addr1; /* void *, frame to be transmitted. */ + s32 tx_buf_size1; /* Length of Tx frame. */ }; #define TXCB_CMD_TRANSMIT 0x0004 /* transmit command */ @@ -160,10 +160,10 @@ struct eepro100_txfd { /* Transmit frame descriptor set. */ #define TXCB_COUNT_EOF 0x8000 /* The Speedo3 Rx and Tx frame/buffer descriptors. */ -struct descriptor { /* A generic descriptor. */ - volatile u16 status; - volatile u16 command; - volatile u32 link; /* struct descriptor * */ +struct descriptor { /* A generic descriptor. */ + u16 status; + u16 command; + u32 link; /* struct descriptor * */ unsigned char params[0]; }; From patchwork Sat May 23 16:38:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296733 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GvCyFG1X; 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 49Tq092mhvz9sPK for ; Sun, 24 May 2020 02:42:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E3487818F8; Sat, 23 May 2020 18:41:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GvCyFG1X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F32381767; Sat, 23 May 2020 18:39:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D08208168A for ; Sat, 23 May 2020 18:39:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x641.google.com with SMTP id x20so16356659ejb.11 for ; Sat, 23 May 2020 09:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QtYjRMHa2azOimy8BCLRzpPeu+KYaiC6ESL5ErIZvv8=; b=GvCyFG1XFVWg2zurYsW03OPuLk+PoHSgTmZN0vw1eqtjNSOHTpTXvWt5Q0H7KrJ6ef iZZe7SZzTESqVcZv3Y4dKdOplGPO+wC5mf4+8Fh/oYDFxvk+pZ1LdG8pDa2L/Lxrz8HV Cp1sCYH/kQR7v2O06BTgzzjWBnUdA/r1DEzGFVL5Idjgy46orIuYBVpmM4o+T9MtMGOb VC/avvwqIecHzp31NWI8I2ARD2i0BvVQPipZkDBnZawj6TBR7BAzihFhkulQooFcgF5g 6L2nSkHo3zB3K/RBfjBJqyZ1WNpbHoFnmst5dgCVu7o+mcMzTnhYVzAD88FeyRV5Qvlo kYoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QtYjRMHa2azOimy8BCLRzpPeu+KYaiC6ESL5ErIZvv8=; b=mrkBvq5XNV8FWg38mRMeGPlJ8yrgHLFBYU54QLRn5MS6z0trf9lopqgzNwWjNBv8nr eFFdx7VsXi1nn6GWdqiSDcrt1RJBdWEinw+P8RFfi3i/O3pGPMAwBBbxpQvWi7bHPJRW LQqZbUSYA2JjOBaFQMmIfPdFhGEPsPPaoqNtbTHK9x2sM2+Lq6ziFVYBEg5UqM+9I8iS 1wyVHdTWSt/UA5FQI3Kr7xopj9VjpmAS9NwdJx4i3xV5ZfeTsORGz9R88ou9EFVYj0Zv ZUUAnHOiCEOdPwtMmPn0aCEaU5kdtPt38HALzEbQmFeG6nElgh+4UxgOS6q+0DoBsEc7 FyLg== X-Gm-Message-State: AOAM532JGyACx0O7ERgpYzUxtumpFXAXr9qRa8EyC1gzxrRvmfrLX8KS 28j0W68/nFVwbw9Ms2UeAd19YlpZ X-Google-Smtp-Source: ABdhPJwTkOD3a/zmNu5OOVeNaYTJjN0O3fo/MMbTKOk9buVMQ0rMQZTGqcb3ykr8BUhCWFmAP5QMmg== X-Received: by 2002:a17:906:4815:: with SMTP id w21mr13328394ejq.533.1590251957914; Sat, 23 May 2020 09:39:17 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:17 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 16/30] net: eepro100: Reorder functions in the driver Date: Sat, 23 May 2020 18:38:23 +0200 Message-Id: <20200523163837.407592-16-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Move the functions around in the driver to prepare it for DM conversion. Drop forward declarations which are not necessary anymore. No functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 330 ++++++++++++++++++++--------------------- 1 file changed, 160 insertions(+), 170 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index f3bcb0dfe4..9db9367e95 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -5,13 +5,13 @@ */ #include +#include #include #include +#include #include #include -#include #include -#include #include /* Ethernet chip registers. */ @@ -201,16 +201,6 @@ static const char i82558_config_cmd[] = { 0x31, 0x05, }; -static void init_rx_ring(struct eth_device *dev); -static void purge_tx_ring(struct eth_device *dev); - -static void read_hw_addr(struct eth_device *dev, bd_t *bis); - -static int eepro100_init(struct eth_device *dev, bd_t *bis); -static int eepro100_send(struct eth_device *dev, void *packet, int length); -static int eepro100_recv(struct eth_device *dev); -static void eepro100_halt(struct eth_device *dev); - #if defined(CONFIG_E500) #define bus_to_phys(a) (a) #define phys_to_bus(a) (a) @@ -353,105 +343,50 @@ static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, #endif -/* Wait for the chip get the command. */ -static int wait_for_eepro100(struct eth_device *dev) +static void init_rx_ring(struct eth_device *dev) { int i; - for (i = 0; INW(dev, SCB_CMD) & (CU_CMD_MASK | RU_CMD_MASK); i++) { - if (i >= TOUT_LOOP) - return 0; + for (i = 0; i < NUM_RX_DESC; i++) { + rx_ring[i].status = 0; + rx_ring[i].control = (i == NUM_RX_DESC - 1) ? + cpu_to_le16 (RFD_CONTROL_S) : 0; + rx_ring[i].link = + cpu_to_le32(phys_to_bus((u32)&rx_ring[(i + 1) % + NUM_RX_DESC])); + rx_ring[i].rx_buf_addr = 0xffffffff; + rx_ring[i].count = cpu_to_le32(PKTSIZE_ALIGN << 16); } - return 1; -} + flush_dcache_range((unsigned long)rx_ring, + (unsigned long)rx_ring + + (sizeof(*rx_ring) * NUM_RX_DESC)); -static struct pci_device_id supported[] = { - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER}, - {} -}; + rx_next = 0; +} -int eepro100_initialize(bd_t *bis) +static void purge_tx_ring(struct eth_device *dev) { - pci_dev_t devno; - int card_number = 0; - struct eth_device *dev; - u32 iobase, status; - int idx = 0; - - while (1) { - /* Find PCI device */ - devno = pci_find_devices(supported, idx++); - if (devno < 0) - break; - - pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &iobase); - iobase &= ~0xf; - - debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", - iobase); - - pci_write_config_dword(devno, PCI_COMMAND, - PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); - - /* Check if I/O accesses and Bus Mastering are enabled. */ - pci_read_config_dword(devno, PCI_COMMAND, &status); - if (!(status & PCI_COMMAND_MEMORY)) { - printf("Error: Can not enable MEM access.\n"); - continue; - } - - if (!(status & PCI_COMMAND_MASTER)) { - printf("Error: Can not enable Bus Mastering.\n"); - continue; - } - - dev = (struct eth_device *)malloc(sizeof(*dev)); - if (!dev) { - printf("eepro100: Can not allocate memory\n"); - break; - } - memset(dev, 0, sizeof(*dev)); - - sprintf(dev->name, "i82559#%d", card_number); - dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ - dev->iobase = bus_to_phys(iobase); - dev->init = eepro100_init; - dev->halt = eepro100_halt; - dev->send = eepro100_send; - dev->recv = eepro100_recv; - - eth_register(dev); - -#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - /* register mii command access routines */ - int retval; - struct mii_dev *mdiodev = mdio_alloc(); - - if (!mdiodev) - return -ENOMEM; - strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); - mdiodev->read = eepro100_miiphy_read; - mdiodev->write = eepro100_miiphy_write; - - retval = mdio_register(mdiodev); - if (retval < 0) - return retval; -#endif - - card_number++; + tx_next = 0; + tx_threshold = 0x01208000; + memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC); - /* Set the latency timer for value. */ - pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x20); + flush_dcache_range((unsigned long)tx_ring, + (unsigned long)tx_ring + + (sizeof(*tx_ring) * NUM_TX_DESC)); +} - udelay(10 * 1000); +/* Wait for the chip get the command. */ +static int wait_for_eepro100(struct eth_device *dev) +{ + int i; - read_hw_addr(dev, bis); + for (i = 0; INW(dev, SCB_CMD) & (CU_CMD_MASK | RU_CMD_MASK); i++) { + if (i >= TOUT_LOOP) + return 0; } - return card_number; + return 1; } static int eepro100_txcmd_send(struct eth_device *dev, @@ -494,6 +429,71 @@ static int eepro100_txcmd_send(struct eth_device *dev, return 0; } +/* SROM Read. */ +static int read_eeprom(struct eth_device *dev, int location, int addr_len) +{ + unsigned short retval = 0; + int read_cmd = location | EE_READ_CMD; + int i; + + OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); + OUTW(dev, EE_ENB, SCB_EEPROM); + + /* Shift the read command bits out. */ + for (i = 12; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + + OUTW(dev, EE_ENB | dataval, SCB_EEPROM); + udelay(1); + OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCB_EEPROM); + udelay(1); + } + OUTW(dev, EE_ENB, SCB_EEPROM); + + for (i = 15; i >= 0; i--) { + OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCB_EEPROM); + udelay(1); + retval = (retval << 1) | + ((INW(dev, SCB_EEPROM) & EE_DATA_READ) ? 1 : 0); + OUTW(dev, EE_ENB, SCB_EEPROM); + udelay(1); + } + + /* Terminate the EEPROM access. */ + OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); + return retval; +} + +static struct pci_device_id supported[] = { + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557}, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559}, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER}, + {} +}; + +static void read_hw_addr(struct eth_device *dev, bd_t *bis) +{ + u16 sum = 0; + int i, j; + int addr_len = read_eeprom(dev, 0, 6) == 0xffff ? 8 : 6; + + for (j = 0, i = 0; i < 0x40; i++) { + u16 value = read_eeprom(dev, i, addr_len); + + sum += value; + if (i < 3) { + dev->enetaddr[j++] = value; + dev->enetaddr[j++] = value >> 8; + } + } + + if (sum != 0xBABA) { + memset(dev->enetaddr, 0, ETH_ALEN); + debug("%s: Invalid EEPROM checksum %#4.4x, check settings before activating this device!\n", + dev->name, sum); + } +} + static int eepro100_init(struct eth_device *dev, bd_t *bis) { struct eepro100_txfd *ias_cmd, *cfg_cmd; @@ -711,93 +711,83 @@ done: return; } -/* SROM Read. */ -static int read_eeprom(struct eth_device *dev, int location, int addr_len) +int eepro100_initialize(bd_t *bis) { - unsigned short retval = 0; - int read_cmd = location | EE_READ_CMD; - int i; + pci_dev_t devno; + int card_number = 0; + struct eth_device *dev; + u32 iobase, status; + int idx = 0; - OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); - OUTW(dev, EE_ENB, SCB_EEPROM); + while (1) { + /* Find PCI device */ + devno = pci_find_devices(supported, idx++); + if (devno < 0) + break; - /* Shift the read command bits out. */ - for (i = 12; i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; + pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &iobase); + iobase &= ~0xf; - OUTW(dev, EE_ENB | dataval, SCB_EEPROM); - udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCB_EEPROM); - udelay(1); - } - OUTW(dev, EE_ENB, SCB_EEPROM); + debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", + iobase); - for (i = 15; i >= 0; i--) { - OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCB_EEPROM); - udelay(1); - retval = (retval << 1) | - ((INW(dev, SCB_EEPROM) & EE_DATA_READ) ? 1 : 0); - OUTW(dev, EE_ENB, SCB_EEPROM); - udelay(1); - } + pci_write_config_dword(devno, PCI_COMMAND, + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); - /* Terminate the EEPROM access. */ - OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); - return retval; -} + /* Check if I/O accesses and Bus Mastering are enabled. */ + pci_read_config_dword(devno, PCI_COMMAND, &status); + if (!(status & PCI_COMMAND_MEMORY)) { + printf("Error: Can not enable MEM access.\n"); + continue; + } -static void init_rx_ring(struct eth_device *dev) -{ - int i; + if (!(status & PCI_COMMAND_MASTER)) { + printf("Error: Can not enable Bus Mastering.\n"); + continue; + } - for (i = 0; i < NUM_RX_DESC; i++) { - rx_ring[i].status = 0; - rx_ring[i].control = (i == NUM_RX_DESC - 1) ? - cpu_to_le16 (RFD_CONTROL_S) : 0; - rx_ring[i].link = - cpu_to_le32(phys_to_bus((u32)&rx_ring[(i + 1) % - NUM_RX_DESC])); - rx_ring[i].rx_buf_addr = 0xffffffff; - rx_ring[i].count = cpu_to_le32(PKTSIZE_ALIGN << 16); - } + dev = (struct eth_device *)malloc(sizeof(*dev)); + if (!dev) { + printf("eepro100: Can not allocate memory\n"); + break; + } + memset(dev, 0, sizeof(*dev)); - flush_dcache_range((unsigned long)rx_ring, - (unsigned long)rx_ring + - (sizeof(*rx_ring) * NUM_RX_DESC)); + sprintf(dev->name, "i82559#%d", card_number); + dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ + dev->iobase = bus_to_phys(iobase); + dev->init = eepro100_init; + dev->halt = eepro100_halt; + dev->send = eepro100_send; + dev->recv = eepro100_recv; - rx_next = 0; -} + eth_register(dev); -static void purge_tx_ring(struct eth_device *dev) -{ - tx_next = 0; - tx_threshold = 0x01208000; - memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC); +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) + /* register mii command access routines */ + int retval; + struct mii_dev *mdiodev = mdio_alloc(); - flush_dcache_range((unsigned long)tx_ring, - (unsigned long)tx_ring + - (sizeof(*tx_ring) * NUM_TX_DESC)); -} + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = eepro100_miiphy_read; + mdiodev->write = eepro100_miiphy_write; -static void read_hw_addr(struct eth_device *dev, bd_t *bis) -{ - u16 sum = 0; - int i, j; - int addr_len = read_eeprom(dev, 0, 6) == 0xffff ? 8 : 6; + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; +#endif - for (j = 0, i = 0; i < 0x40; i++) { - u16 value = read_eeprom(dev, i, addr_len); + card_number++; - sum += value; - if (i < 3) { - dev->enetaddr[j++] = value; - dev->enetaddr[j++] = value >> 8; - } - } + /* Set the latency timer for value. */ + pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x20); - if (sum != 0xBABA) { - memset(dev->enetaddr, 0, ETH_ALEN); - debug("%s: Invalid EEPROM checksum %#4.4x, check settings before activating this device!\n", - dev->name, sum); + udelay(10 * 1000); + + read_hw_addr(dev, bis); } + + return card_number; } From patchwork Sat May 23 16:38:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296736 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Cq4gsQr+; 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 49Tq0s4nM1z9sPK for ; Sun, 24 May 2020 02:43:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 89B0381986; Sat, 23 May 2020 18:41:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Cq4gsQr+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1140481810; Sat, 23 May 2020 18:39:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EB1D88172F for ; Sat, 23 May 2020 18:39:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x644.google.com with SMTP id a2so16364643ejb.10 for ; Sat, 23 May 2020 09:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lEqtfIht5ezZpCCpt3uFhZje0RMCDnnNJWWR5/uWZ1Y=; b=Cq4gsQr+nxEiNgwi1ZdYJX3aIuT7soJmJ28TCHhYtMYYfFKKi3iXycJrhcb+JPWzuC vjIda1wIidBuTbtRZ+f37xVb/GpPvpATBtJVHnY8re4VCdGq/gZYF7k5KSC5Zph1mNvX UyEtZeZdGyyQFfQ2+9lBl72zJcnyfFEUcliVT92vCayoGd22S5kysO8tMaUnUXET7r10 EPt4sS2r97YHCaJjJJPZ/5HRbQCpQTi9S4ca6ntbQsDOcwjUWnSXJHPHlfYht1Ad9zj9 FCPsTJhONHg4jjF8Z8hID2n0TZoTtESsDu+lwjToA/vvJRCAmiLEI/hiT19igjxzaR/H jvsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lEqtfIht5ezZpCCpt3uFhZje0RMCDnnNJWWR5/uWZ1Y=; b=oKyRQJA+xhQ71mGi/AMWiOKZRr49dDLEMesR9FEWvpXECxTqtiwH5lACBrSwlX9v2s Sby0A/hZAXviZEz2yagKgll/mU82KCbfUwZNKweLl3mxVzbgMm2ZUUkI+RfYcRQxVvC+ Tg9c7UoiWrdAFW4WBO7d2GLwBPVd8lNhzZkNZLZQCKic+nlWx3AoO5CGZrES+jfxc7KY RGsXG6bjwJv7llDz+QHtTarFLbM2a5xwwVp7jesbPBj4kDhfF1LHrp1GTsMEUTilG1zk s4q3zIpF4RSr2U1rf99G+YaECSQI3tOdtk8NOuxZA2nGuSnezrK3TVyNow98Br2Xdr1Z mSjQ== X-Gm-Message-State: AOAM530v4eUsnx1qxgs27uuCNoHqrC2e7SiV1v/cXB/HT+URF9WdVx2n TvwgIxDKGhm9TxoYKk/mq5qjZjfZ X-Google-Smtp-Source: ABdhPJwZeSyE4hAjedUCcuUUayy8HUbm8o8ykQpv/fV/NF0mg4ery08PtSJJKJ3u0E3A7GHJDupJiA== X-Received: by 2002:a17:907:2095:: with SMTP id pv21mr12296611ejb.247.1590251959238; Sat, 23 May 2020 09:39:19 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:18 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 17/30] net: eepro100: Use PCI_DEVICE() to define PCI device compat list Date: Sat, 23 May 2020 18:38:24 +0200 Message-Id: <20200523163837.407592-17-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Use this macro to fully fill the PCI device ID table. This is mandatory for the DM PCI support, which checks all the fields. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 9db9367e95..74b09e9afd 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -465,10 +465,10 @@ static int read_eeprom(struct eth_device *dev, int location, int addr_len) } static struct pci_device_id supported[] = { - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER}, - {} + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER) }, + { } }; static void read_hw_addr(struct eth_device *dev, bd_t *bis) From patchwork Sat May 23 16:38:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296732 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AB7nSp0n; 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 49Tpzy01fhz9sPK for ; Sun, 24 May 2020 02:42:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DDB3781868; Sat, 23 May 2020 18:40:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AB7nSp0n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 183AF81783; Sat, 23 May 2020 18:39:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5502681743 for ; Sat, 23 May 2020 18:39:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id yc10so16340563ejb.12 for ; Sat, 23 May 2020 09:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5UEE88nyD9BIUhzVxiK2fOHTrk0Sf0je9Bf3+GrTpjY=; b=AB7nSp0nKIG48gyKBdavGx4/oGF8qVDjTIKF/ACEI94APYt+zduSLHtb0SxnZ+QmAL lRwCzC80TTiSlJ6MTHmuhq/izfZtkOHuKgi8z7UWKWJQ80zr/ZJdBLAaX2DqZFKLrsXY aoFrCwQ6qG3Glam5G5ebd7tKjKXOCXcdRUlQSb4NBs3WdAp5vS9nPhA4cN2+ruaEYH2c C7m5ZVuXZ7T4wItkPE22l/GUssyhtAM0Kb5uwvViYc3w6vmxppsBp8CzndQ/CDbZIP5X gqAXi6qtCcGq7TB7BwZ5LMovO1lSm99UHEb1nqr3K/2vC8uJ+n1BYPcnQ67QkfWvkVee ScHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5UEE88nyD9BIUhzVxiK2fOHTrk0Sf0je9Bf3+GrTpjY=; b=r9edk4ezmBGniAGTLwpLJOPIFLUy0rYC1gOBGrF7qrNLCL/r7kgwgcMNew/DiU7qSW CJhKZyt409ICaXiCTe6m73LBeWZfsVClo92t4apC9SM5hePIUumpQULCquSCoi6ANC6a +F2VhMMnaFmwGFDpiUrnCQmD4OrMqCQrYQwk8n3jynwtFCkVzxJe9XFOt7iy9A1L6F/Z xJHlhgJHfTpTu0XFi2rva37+HSaGakq311h2WW+Qke7VJn9FUOskaxxKFaEqYse0h009 8k0fUsg7TSwTnPLhsjcH9x0qAsYVIhZJUKJPyTfBWy+a3Z8whxl92YqH21swo191sP9w iq2A== X-Gm-Message-State: AOAM532e/IxSlyKo1EpGX0kSCY1HH93jDS1ra0srHDkFQUyu16QY/9ST fM1n2iWa3rBRFfgGJSsYvd/D2+T9 X-Google-Smtp-Source: ABdhPJz2X5KCflyl2AsUvQEiYhSKgySAAwRru+KoUN2Y1YKRnuTDfT6uxvY9FoiibiTF6fb3ip8lkQ== X-Received: by 2002:a17:907:262a:: with SMTP id aq10mr12176964ejc.418.1590251960276; Sat, 23 May 2020 09:39:20 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:19 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 18/30] net: eepro100: Switch from malloc()+memset() to calloc() Date: Sat, 23 May 2020 18:38:25 +0200 Message-Id: <20200523163837.407592-18-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Replace malloc()+memset() combination with calloc(), no functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 74b09e9afd..8fa665743a 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -746,12 +746,11 @@ int eepro100_initialize(bd_t *bis) continue; } - dev = (struct eth_device *)malloc(sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); if (!dev) { printf("eepro100: Can not allocate memory\n"); break; } - memset(dev, 0, sizeof(*dev)); sprintf(dev->name, "i82559#%d", card_number); dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ From patchwork Sat May 23 16:38:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296739 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=uVOdJgsm; 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 49Tq1X274Tz9sPK for ; Sun, 24 May 2020 02:43:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E2F8819D5; Sat, 23 May 2020 18:41:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uVOdJgsm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A655B8180B; Sat, 23 May 2020 18:39:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 830EA813A6 for ; Sat, 23 May 2020 18:39:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x644.google.com with SMTP id x20so16356794ejb.11 for ; Sat, 23 May 2020 09:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oeYJvrCJdaxzB5xbYlVWs12XqAX+Uzy+36u/ClbeTxc=; b=uVOdJgsmfIcaX3KccDim7+2dRXpzqlpQcSNJ9bZJtUxfNfxLyaG5hKoMRoojjvptUc BqvmeQrlsNDkGAn+1w7VnpNsZhKCpHFmUYY5NJ6GI+SDilbgGJvxGGPNII7a9DNY/NGX SC8ASRWW+K4C/UlY4IYkGkHmFik8qKVcLJfV/OEnzjv5dCEdcb3aFXWYHRj5vHR1/VK/ bRMp8auTnolPVNaKHWGUnKfZfuzcs/l2JpX8xVb+ayO05KWVNnnGTBViLEhbm4WYiCRH h74DgPBTYHHvFL3yMxv1iXOcEmhEBMjU98qvmGP8tZXL5NnxVSrTy0zzMoHxHTC2VPea /z5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oeYJvrCJdaxzB5xbYlVWs12XqAX+Uzy+36u/ClbeTxc=; b=PdrBOLHgV3lFgVKW/4UJMePWQvEkq5JxAk5T2u9m3vP1qTx0Hd9oOWga/Gs3C3BLHf XnliuHPA43jhbzegDU6ng7g7XlUMxPBIfMtM9cXUbz0ZvWud9tgFtR6VIc7G1GH+KmVo ZCYgfO2dsDOYwVu+hj5xlPMOS6+ACVu+1Uq0u0PTZIU+EXKQJlot+F+z+e6rYBq7cCK7 UmjqJO6Gn16OjFJmX1GXZXJuteztfDhkswSgE5Mssci49vHp1jpbuvHTScmFhV/kZOsZ KQGCk/Je1fGmtacff0d8mtAMzgy+QLU0v6REgGIVE0ypjhGOy58hw43y6FIHQ2U1lcKh IXFg== X-Gm-Message-State: AOAM531FXBq4oEnrEj+yYt+Yb3tDNbfH9u064hTIlFshEDOZF9/TPq0S hPTuKt7PnjjAfQOO8rGr/NulNyto X-Google-Smtp-Source: ABdhPJzWXVQWaH3kXCT7Y7jcXguNthxgugl6Hl3egwhHNawZIlJvtXCAbqlyTmX0+auKo3N+h+a+3Q== X-Received: by 2002:a17:906:9404:: with SMTP id q4mr12359289ejx.138.1590251961717; Sat, 23 May 2020 09:39:21 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:20 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 19/30] net: eepro100: Factor out MII registration Date: Sat, 23 May 2020 18:38:26 +0200 Message-Id: <20200523163837.407592-19-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Pull the MII registration code into a separate function. Moreover, properly free memory in case any of the registration or allocation functions fail, so this fixes an existing memleak. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 56 +++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 8fa665743a..861d39cf9f 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -464,6 +464,36 @@ static int read_eeprom(struct eth_device *dev, int location, int addr_len) return retval; } +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) +static int eepro100_initialize_mii(struct eth_device *dev) +{ + /* register mii command access routines */ + struct mii_dev *mdiodev; + int ret; + + mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = eepro100_miiphy_read; + mdiodev->write = eepro100_miiphy_write; + + ret = mdio_register(mdiodev); + if (ret < 0) { + mdio_free(mdiodev); + return ret; + } + + return 0; +} +#else +static int eepro100_initialize_mii(struct eth_device *dev) +{ + return 0; +} +#endif + static struct pci_device_id supported[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559) }, @@ -713,11 +743,12 @@ done: int eepro100_initialize(bd_t *bis) { - pci_dev_t devno; - int card_number = 0; struct eth_device *dev; + int card_number = 0; u32 iobase, status; + pci_dev_t devno; int idx = 0; + int ret; while (1) { /* Find PCI device */ @@ -762,21 +793,12 @@ int eepro100_initialize(bd_t *bis) eth_register(dev); -#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - /* register mii command access routines */ - int retval; - struct mii_dev *mdiodev = mdio_alloc(); - - if (!mdiodev) - return -ENOMEM; - strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); - mdiodev->read = eepro100_miiphy_read; - mdiodev->write = eepro100_miiphy_write; - - retval = mdio_register(mdiodev); - if (retval < 0) - return retval; -#endif + ret = eepro100_initialize_mii(dev); + if (ret) { + eth_unregister(dev); + free(dev); + return ret; + } card_number++; From patchwork Sat May 23 16:38:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296741 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Bho4mirc; 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 49Tq201kGRz9sPK for ; Sun, 24 May 2020 02:44:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02C6281A66; Sat, 23 May 2020 18:41:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bho4mirc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE1BF81767; Sat, 23 May 2020 18:39:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C0908813A5 for ; Sat, 23 May 2020 18:39:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x541.google.com with SMTP id l25so11731688edj.4 for ; Sat, 23 May 2020 09:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2wdmGnBdgD3iAPP8TeN3LtV5NTQh8XtDx/ul2E5KtUY=; b=Bho4mirc6ERewmHzlI58daF/pfHw7zcJBlACKQuGSW8fykJKRUcHc68vEeubrOeLWs VHfF9dRkW07rEviPx23ow7Gb6AOFqYYi3cspzpxjJCV9v76P6+/2J5QnSiOQ4bidU1NS sIrYhU0jaOdA0Hlp/zmivWNbKv9fIreHZmKwFDUCHQSq0v46oOMJGxu5L+9VY4clPZeb 1KkGX3LiNZMOxuvH3aS4uiqaQD4ORbQYaJiB5UOTexoKbxPFSAA2v6Ku42Wzm+uCrMMs A/cUx8dbZ+EQzCpN1oJPYnb98BAaIt1Z4561taFweBqq0lJAjxypn0sbrb+HckBQYk4P LurQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2wdmGnBdgD3iAPP8TeN3LtV5NTQh8XtDx/ul2E5KtUY=; b=eixQnvp1mLmxVo2XCr9epXj1M9BFCxHmVKN6XyYEVDjnpNhN3Gfs+EJLzfXUD34esa ROVLkktdW529vcv79QhrzTTMORC4YoiNAQPcHHgRYtt9bD2zfMenIA+yHdtO0Uc/dhE+ bvFG+4CIx/ADvv9zMTq9xx8ZZFtGgNZ6/VrL9Oybv4Ui2CnQcesCCB68F3DXzaOOcBAz dSb3r59/w6YxRQQK6lCqXNNgXcxK4tYFbnTCTlMXZyTEwxd+lEFUsDde4KccQUIWajm8 xXlFryYjthdu04K1eeiv5HjNESizK33Ly/xW4bOeNeqwd94J0WnPCQ3iwu/ySAoPH4+a hKew== X-Gm-Message-State: AOAM530IzCbZNwFEm3YporXgjHI72n2xDWfDNN0vRmF4u/xb6dV4ETO+ BzqZsvk5XGn/B3mLF+vEzgJBAiuw X-Google-Smtp-Source: ABdhPJwqtLMBItazNxraFyQN9JXCKAAFWpZMBdHMn/5u5XHiTzBGW7DOEj/PaRAvj+kUrlvsSBTH2Q== X-Received: by 2002:a05:6402:8c1:: with SMTP id d1mr7824007edz.265.1590251963015; Sat, 23 May 2020 09:39:23 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:22 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 20/30] net: eepro100: Fix EE_*_CMD macros Date: Sat, 23 May 2020 18:38:27 +0200 Message-Id: <20200523163837.407592-20-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Those macros depended on specific variable names to be declared at their usage sites, fix this by adding an argument to those macros and also protect the argument with braces. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 861d39cf9f..a8d617c7e8 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -96,10 +96,10 @@ #define EE_DATA_BITS 16 /* The EEPROM commands include the alway-set leading bit. */ -#define EE_EWENB_CMD (4 << addr_len) -#define EE_WRITE_CMD (5 << addr_len) -#define EE_READ_CMD (6 << addr_len) -#define EE_ERASE_CMD (7 << addr_len) +#define EE_EWENB_CMD(addr_len) (4 << (addr_len)) +#define EE_WRITE_CMD(addr_len) (5 << (addr_len)) +#define EE_READ_CMD(addr_len) (6 << (addr_len)) +#define EE_ERASE_CMD(addr_len) (7 << (addr_len)) /* Receive frame descriptors. */ struct eepro100_rxfd { @@ -433,7 +433,7 @@ static int eepro100_txcmd_send(struct eth_device *dev, static int read_eeprom(struct eth_device *dev, int location, int addr_len) { unsigned short retval = 0; - int read_cmd = location | EE_READ_CMD; + int read_cmd = location | EE_READ_CMD(addr_len); int i; OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); From patchwork Sat May 23 16:38:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296737 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=IP0NSg5b; 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 49Tq1459Nfz9sPK for ; Sun, 24 May 2020 02:43:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C840819A0; Sat, 23 May 2020 18:41:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IP0NSg5b"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A1EAD81767; Sat, 23 May 2020 18:39:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C3704815FB for ; Sat, 23 May 2020 18:39:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x641.google.com with SMTP id d7so16409899eja.7 for ; Sat, 23 May 2020 09:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kNT3Klq6XhOMGPIR+iVNZPpW2aXBmwpvBaX2EaSDKXQ=; b=IP0NSg5bCWyho+N1xRYJx5eqVtdJP4MXW09v73OY1HvkWrATUkbR3CLuAHdMv6GRAz K5wDt/9JIcUe1n9gfsvGxTqo5Wc9fGK7M9Q+IYmR8poC5AV5ZXOdLoN1h4+tSGucUS+e FbCUXnFgf/nXct0tnTxgkykWak70pCQg9FSYiOK4I5Blt2MDcLl0DnY82UXLRQYQBz5C n/Phr44rfKiBy3pGNm6IvJ1l6Tn7x+5SlMYToRnsaCXCMYv45xn6lAMVVT/rNdLe5+8Y wEtGvg7D7cBuOMl/4pxeq1dA8DjzSpJHqBgXfNCkujwuLzyO488rZ63DLxDsMIAjRl5m vynw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kNT3Klq6XhOMGPIR+iVNZPpW2aXBmwpvBaX2EaSDKXQ=; b=c4FlQPsR9MLIFxSEA4J+GMoX9ZeJBD0lQAfmAe0MI+9/uxUFX+Ac70yAj5zJrpajDO 1QM3vZuCIDjGOkMvV5J53ZYiTPlEjMBXJtGwIAyRk0DMxtNq+2w4tnONN556a2Z8kB5L p4NfkvecBo43pJmS6xMZSpFiS8HHEoLrbHG+wfl0YiMxtekSLu9aLuLjLySrMtqDXx8G k+hMVKXH4M0F9gbEsgjY4GF7Mjk0L2tQPF1mIWhH377Rwu1vmazrDVL3IxEexfQkp3yo lb13Jia3BqvI8IR7DKg3eOUiYuTTxqsPaoVqsMbrh0gKQcaYwHV6iCTlCNEKBZnvsL5Y i5UQ== X-Gm-Message-State: AOAM532xgUJ581ulmF+cSWONgrbJPCioi4lsEP34++q834439XAl+Z9Y c3URMHUOtdIAvXtj7VhRV3+GHnRB X-Google-Smtp-Source: ABdhPJxiNsY7fz4akJTYLG0EvLJXj+50tzmqGrtpaFz2xxO3wIjP40Yq1xlIPMDoWgvYWoqIfe3/UA== X-Received: by 2002:a17:906:660f:: with SMTP id b15mr12094560ejp.113.1590251964203; Sat, 23 May 2020 09:39:24 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:23 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 21/30] net: eepro100: Drop inline keyword Date: Sat, 23 May 2020 18:38:28 +0200 Message-Id: <20200523163837.407592-21-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Drop the inline keyword from the static functions, the compiler has a much better overview and can decide how to inline those functions much better. Signed-off-by: Marek Vasut --- drivers/net/eepro100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index a8d617c7e8..4446251e11 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -209,23 +209,23 @@ static const char i82558_config_cmd[] = { #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a) #endif -static inline int INW(struct eth_device *dev, u_long addr) +static int INW(struct eth_device *dev, u_long addr) { return le16_to_cpu(readw(addr + (void *)dev->iobase)); } -static inline void OUTW(struct eth_device *dev, int command, u_long addr) +static void OUTW(struct eth_device *dev, int command, u_long addr) { writew(cpu_to_le16(command), addr + (void *)dev->iobase); } -static inline void OUTL(struct eth_device *dev, int command, u_long addr) +static void OUTL(struct eth_device *dev, int command, u_long addr) { writel(cpu_to_le32(command), addr + (void *)dev->iobase); } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static inline int INL(struct eth_device *dev, u_long addr) +static int INL(struct eth_device *dev, u_long addr) { return le32_to_cpu(readl(addr + (void *)dev->iobase)); } From patchwork Sat May 23 16:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296738 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=RTQWytyn; 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 49Tq1J4L74z9sPK for ; Sun, 24 May 2020 02:43:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A995D819B5; Sat, 23 May 2020 18:41:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RTQWytyn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FA3C81810; Sat, 23 May 2020 18:39:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 24AA1815F1 for ; Sat, 23 May 2020 18:39:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x541.google.com with SMTP id g9so11711988edr.8 for ; Sat, 23 May 2020 09:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OCsI4ezcP5Cv+0ZydU967RZewOXHETaifc+kzsCHUXA=; b=RTQWytyn384Ll/ygOi44wpK3Ec14WxqQXa7A5SDZPPi4cutIVLd6+dAb3f9Un5rxXE 00xfP6KfKpBzY/hmr0ODy9R6jIzmEa416V86ummohH44M1jfIwyhbxGUK9Yg3cbSdOgU LY4YYVknelqSZicfU0MImqj7MZTeovXzWBBYRp8umygfdCay4eisiLQ2AfYasPltw2UW /sDUM3KnB6i0nlb2uHJhAo3/wxTgCeFiLf8JY4ZvTSeI4Cgx/eyIboJjvyWz3vKCE+53 7VfANIelN0bM2vkXp6P+39krZ5Q83WkM8sIofKn+LFICUWi0Il9Yk4+rW8gcP+eIPLsB z9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OCsI4ezcP5Cv+0ZydU967RZewOXHETaifc+kzsCHUXA=; b=KCuWspyv+GQyg6zvlIWXfNL5YFkMieT++2q6ztyRrXgjnlngmpnR5F+uyELP/sv4Ip ECNFhsy5+x1WcsrAbX2T+bpYsZW+i4tYUkyaqAqaDLooDtVy96mOteBZFJ1PxM2eFngf ncIQ6N0zl3cBERRnt72knDG4dHGnUrKWCfYHDaKtg6FxnIqA5FiQ6CDh0I0soB+OuLsU 9RIV0/nlybC0dlBWfQDv/VJIGOME5G50JdIsWUvOeC6o/ULzSjuCAUxYuTBJppgPYXKU u9x552XzURadZedYsaa8XHFmaTv2VEXELWMWP5oV/DXUNK7FtYKCeMwjF/Upz0OOGGcb zj3Q== X-Gm-Message-State: AOAM531yZ20JwHEF3kfgvnsRllhDKsZAxc/5B90syZm5aMUg/MwdyUFx /VaMuHJOaG5VroLp3haSnx4lTK0J X-Google-Smtp-Source: ABdhPJzF/9HczxbCuG7OljMGiQuyaXS6Kruov6q9KzEai6ImaNC5/w0cFBAYOrXYnpZLl6gJwhDusA== X-Received: by 2002:a50:9d46:: with SMTP id j6mr8071029edk.362.1590251965377; Sat, 23 May 2020 09:39:25 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:24 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 22/30] net: eepro100: Pass PCI BDF into bus_to_phys()/phys_to_bus() Date: Sat, 23 May 2020 18:38:29 +0200 Message-Id: <20200523163837.407592-22-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This is a trick in preparation for adding DM support. By passing in the PCI BDF into the bus_to_phys()/phys_to_bus() macros and calling that dev, we can substitute dev with udevice when DM support lands and do minor adjustment to the macros to support both DM and non-DM operation. No functional change. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 4446251e11..532d7aa649 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -202,11 +202,11 @@ static const char i82558_config_cmd[] = { }; #if defined(CONFIG_E500) -#define bus_to_phys(a) (a) -#define phys_to_bus(a) (a) +#define bus_to_phys(dev, a) (a) +#define phys_to_bus(dev, a) (a) #else -#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a) -#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a) +#define bus_to_phys(dev, a) pci_mem_to_phys((dev), (a)) +#define phys_to_bus(dev, a) pci_phys_to_mem((dev), (a)) #endif static int INW(struct eth_device *dev, u_long addr) @@ -352,7 +352,8 @@ static void init_rx_ring(struct eth_device *dev) rx_ring[i].control = (i == NUM_RX_DESC - 1) ? cpu_to_le16 (RFD_CONTROL_S) : 0; rx_ring[i].link = - cpu_to_le32(phys_to_bus((u32)&rx_ring[(i + 1) % + cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u32)&rx_ring[(i + 1) % NUM_RX_DESC])); rx_ring[i].rx_buf_addr = 0xffffffff; rx_ring[i].count = cpu_to_le32(PKTSIZE_ALIGN << 16); @@ -401,7 +402,7 @@ static int eepro100_txcmd_send(struct eth_device *dev, if (!wait_for_eepro100(dev)) return -ETIMEDOUT; - OUTL(dev, phys_to_bus((u32)desc), SCB_POINTER); + OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, (u32)desc), SCB_POINTER); OUTW(dev, SCB_M | CU_START, SCB_CMD); while (true) { @@ -562,7 +563,8 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) } /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); + OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, (u32)&rx_ring[rx_next]), + SCB_POINTER); OUTW(dev, SCB_M | RUC_START, SCB_CMD); /* Send the Configure frame */ @@ -573,7 +575,8 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) cfg_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE); cfg_cmd->status = 0; - cfg_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); + cfg_cmd->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u32)&tx_ring[tx_next])); memcpy(((struct descriptor *)cfg_cmd)->params, i82558_config_cmd, sizeof(i82558_config_cmd)); @@ -593,7 +596,8 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) ias_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS); ias_cmd->status = 0; - ias_cmd->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); + ias_cmd->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u32)&tx_ring[tx_next])); memcpy(((struct descriptor *)ias_cmd)->params, dev->enetaddr, 6); @@ -629,9 +633,12 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) TXCB_CMD_S | TXCB_CMD_EL); desc->status = 0; desc->count = cpu_to_le32(tx_threshold); - desc->link = cpu_to_le32(phys_to_bus((u32)&tx_ring[tx_next])); - desc->tx_desc_addr = cpu_to_le32(phys_to_bus((u32)&desc->tx_buf_addr0)); - desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus((u_long)packet)); + desc->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u32)&tx_ring[tx_next])); + desc->tx_desc_addr = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u32)&desc->tx_buf_addr0)); + desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + (u_long)packet)); desc->tx_buf_size0 = cpu_to_le32(length); ret = eepro100_txcmd_send(dev, &tx_ring[tx_cur]); @@ -706,7 +713,8 @@ static int eepro100_recv(struct eth_device *dev) } /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(dev, phys_to_bus((u32)&rx_ring[rx_next]), SCB_POINTER); + OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, + (u32)&rx_ring[rx_next]), SCB_POINTER); OUTW(dev, SCB_M | RUC_START, SCB_CMD); } @@ -785,7 +793,7 @@ int eepro100_initialize(bd_t *bis) sprintf(dev->name, "i82559#%d", card_number); dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ - dev->iobase = bus_to_phys(iobase); + dev->iobase = bus_to_phys(devno, iobase); dev->init = eepro100_init; dev->halt = eepro100_halt; dev->send = eepro100_send; From patchwork Sat May 23 16:38:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296740 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XHcqkmrl; 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 49Tq1l63B5z9sPK for ; Sun, 24 May 2020 02:43:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 46FE9819DC; Sat, 23 May 2020 18:41:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XHcqkmrl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09892815F1; Sat, 23 May 2020 18:39:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 243098067C for ; Sat, 23 May 2020 18:39:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id h21so16407777ejq.5 for ; Sat, 23 May 2020 09:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y1szhH321DoqhbOYDRD1wKqQPyGEhlfvB4l9QG15ao4=; b=XHcqkmrlx2Jzy+4UHgIbuqRjAHNiAr1mSgfz5RI+wuizaq0bS16lnTrxcebb6WZ669 qrsqqFoqXW74WX5NzGvQ5zuZ3es7g2FQ4inl35VMX6BrlahkKGo7j0CE54c7BnIdtvZ9 Rx8XPk8bEbPuGpyI1m5oShNhvZA4Yx8aZQ8K78VPMez1oeQeQT2/GyK8FSnjSS3kO5EC VpsnVPMhppSpvG38dYK61LtBVBG6INnGlK2r/A8l7nD5KyaGEBJyEcNz71eNpAtresEA QPfsS4VxxrdSvjUPGo4m4u+1RsNt2GIiOhJlWq7dR2nJhqGyjkKePlvVFhgdK21rCRFX hRoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y1szhH321DoqhbOYDRD1wKqQPyGEhlfvB4l9QG15ao4=; b=qEWD+82cwbPxeWLRNArlbMgpeS1bwdmkg/OJrdF75W++UZ23gMjkZ6BEUNpsCiuJb/ tKvwRCXwpQrQFbODJrHcX12QJ3FIq5OLf4fJ1Sd0iWsiNmpgNG0Ts/l1UwKF5Wzo36v9 a32jqVOwTVCuWq7uAs+uWEaZgaW1+aRj41idK7gF/qCwm0ri9NY2CWk+RTFWxsCLMAzT r6O2GYAkCdmwUKeouVBUR21UNICWlChKqo8lUkB5EApm0qelpr3voAkiJtFPnzdXeA1g 6pgNcZPBekahNjusUgPKLECU3h2Ndns0juD5FAPUXex8A3MQgstA/1FFKTnN/4q4rZN/ jV0Q== X-Gm-Message-State: AOAM533YJIBlSEXumGiXd4UYLCNDiqneQU8fNGPc1ZcGXp4r7OhFHB/a fu6SXU8ufHqStxXKSKSBkFJ+6EY2 X-Google-Smtp-Source: ABdhPJwacPuecTaGBoYe/rgBofJyt9d7PF9RnENNoeCoT5BhgF2Ql9g8/cy/pIfCrqzG/yphEmB7Ow== X-Received: by 2002:a17:906:770b:: with SMTP id q11mr12078047ejm.224.1590251966363; Sat, 23 May 2020 09:39:26 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:25 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 23/30] net: eepro100: Introduce device private data Date: Sat, 23 May 2020 18:38:30 +0200 Message-Id: <20200523163837.407592-23-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 532d7aa649..2c25307002 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -201,6 +201,10 @@ static const char i82558_config_cmd[] = { 0x31, 0x05, }; +struct eepro100_priv { + struct eth_device dev; +}; + #if defined(CONFIG_E500) #define bus_to_phys(dev, a) (a) #define phys_to_bus(dev, a) (a) @@ -751,6 +755,7 @@ done: int eepro100_initialize(bd_t *bis) { + struct eepro100_priv *priv; struct eth_device *dev; int card_number = 0; u32 iobase, status; @@ -785,11 +790,12 @@ int eepro100_initialize(bd_t *bis) continue; } - dev = calloc(1, sizeof(*dev)); - if (!dev) { + priv = calloc(1, sizeof(*priv)); + if (!priv) { printf("eepro100: Can not allocate memory\n"); break; } + dev = &priv->dev; sprintf(dev->name, "i82559#%d", card_number); dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ @@ -804,7 +810,7 @@ int eepro100_initialize(bd_t *bis) ret = eepro100_initialize_mii(dev); if (ret) { eth_unregister(dev); - free(dev); + free(priv); return ret; } From patchwork Sat May 23 16:38:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296745 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ggt++0jA; 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 49Tq2v4Pcsz9sPK for ; Sun, 24 May 2020 02:44:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7398E81C80; Sat, 23 May 2020 18:41:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ggt++0jA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8349481734; Sat, 23 May 2020 18:39:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C7AFC812EE for ; Sat, 23 May 2020 18:39:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x544.google.com with SMTP id b91so11739274edf.3 for ; Sat, 23 May 2020 09:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LJDLcZ5NVvjzvQfMwd5TSwFNeniQa0XXafelOFS2f6U=; b=ggt++0jA4sPiVkBhOQy/yc4WVO9yL4lWxClOrZfiz4uKX+9SGVav1f3gc4Z6+rdLq7 nJGEsikGMx3ecdeLHIF2Au+rsDyD6Mg70JKQTaFIX3F2U1A4s16NsZ2MBIIKZTnXgErF FW0Pz+6L+V4X50XpAbUoAVX4pNmYBtFkK9KFhFPhY4LkuwXpuoBVuTgFbDAIjAxG9s+B NWlWIcJw2hi/TAQjKNWEiP0ZV35YompT3BGjG5lhE4w5ziqigVG04qsqzzzc8JXUJGWr kIJNYjkAmmZ3Fxf6p7rHJg7H01l8IqV+C3SnY1cW1oU34vi/yaC+Q0L23O4dd9oFoiCp dRTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LJDLcZ5NVvjzvQfMwd5TSwFNeniQa0XXafelOFS2f6U=; b=e1gBJEWr1wq5rXWv82KAklEZ2cXff5Av5xoxOoykMJvwEPc8ToZmsRTEoX48dJMJ3u 1hIZwNYNIb3oARbjmPU/4DwTQHI6kZGsB6oDLpxv6zoQPf9O+VqQknvQobx13VQUJzk8 MIYfGuYOIAz3jUdNaxfqFuwq7OPsHFStGp2ROS8cFhyJQdGthYPX1y0mET+4qiOARWKn CJlhW9lovdw4/Y7OIiaK+s7k7Qpr03KnIT8MiqF62SRIq+LZ1+bu2CeZOHgGaZPhgEc2 qYqYWfW9F3Wc1ftlv9pdoVhtG7iPMzrzciKPpR4644Q1pV1R/Xmda21vJiiyM34X8cTx r1eg== X-Gm-Message-State: AOAM533kXSL18JU/22EDF72aWGB64vlgp/5GEOxZxLTKlazxZYgnnssE pQfb2MPei37NYwhYuLyRpRQivePP X-Google-Smtp-Source: ABdhPJwMTbVeuFCgIgvj/vvsvd1pipoFoJo24Ty7dQQCgyHNYQeV79SxyradutUwADIoqFouQuFbig== X-Received: by 2002:aa7:db4c:: with SMTP id n12mr7508508edt.99.1590251967608; Sat, 23 May 2020 09:39:27 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:26 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 24/30] net: eepro100: Pass device private data around Date: Sat, 23 May 2020 18:38:31 +0200 Message-Id: <20200523163837.407592-24-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean This patch replaces the various uses of struct eth_device for accessing device private data with struct eepro100_priv, which is compatible both with DM and non-DM operation. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 264 ++++++++++++++++++++++------------------- 1 file changed, 140 insertions(+), 124 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 2c25307002..1c33ec3da2 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -203,6 +203,10 @@ static const char i82558_config_cmd[] = { struct eepro100_priv { struct eth_device dev; + pci_dev_t devno; + char *name; + void __iomem *iobase; + u8 *enetaddr; }; #if defined(CONFIG_E500) @@ -213,40 +217,40 @@ struct eepro100_priv { #define phys_to_bus(dev, a) pci_phys_to_mem((dev), (a)) #endif -static int INW(struct eth_device *dev, u_long addr) +static int INW(struct eepro100_priv *priv, u_long addr) { - return le16_to_cpu(readw(addr + (void *)dev->iobase)); + return le16_to_cpu(readw(addr + priv->iobase)); } -static void OUTW(struct eth_device *dev, int command, u_long addr) +static void OUTW(struct eepro100_priv *priv, int command, u_long addr) { - writew(cpu_to_le16(command), addr + (void *)dev->iobase); + writew(cpu_to_le16(command), addr + priv->iobase); } -static void OUTL(struct eth_device *dev, int command, u_long addr) +static void OUTL(struct eepro100_priv *priv, int command, u_long addr) { - writel(cpu_to_le32(command), addr + (void *)dev->iobase); + writel(cpu_to_le32(command), addr + priv->iobase); } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static int INL(struct eth_device *dev, u_long addr) +static int INL(struct eepro100_priv *priv, u_long addr) { - return le32_to_cpu(readl(addr + (void *)dev->iobase)); + return le32_to_cpu(readl(addr + priv->iobase)); } -static int get_phyreg(struct eth_device *dev, unsigned char addr, +static int get_phyreg(struct eepro100_priv *priv, unsigned char addr, unsigned char reg, unsigned short *value) { - int cmd; int timeout = 50; + int cmd; /* read requested data */ cmd = (2 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL(dev, cmd, SCB_CTRL_MDI); + OUTL(priv, cmd, SCB_CTRL_MDI); do { udelay(1000); - cmd = INL(dev, SCB_CTRL_MDI); + cmd = INL(priv, SCB_CTRL_MDI); } while (!(cmd & (1 << 28)) && (--timeout)); if (timeout == 0) @@ -257,17 +261,17 @@ static int get_phyreg(struct eth_device *dev, unsigned char addr, return 0; } -static int set_phyreg(struct eth_device *dev, unsigned char addr, +static int set_phyreg(struct eepro100_priv *priv, unsigned char addr, unsigned char reg, unsigned short value) { - int cmd; int timeout = 50; + int cmd; /* write requested data */ cmd = (1 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16); - OUTL(dev, cmd | value, SCB_CTRL_MDI); + OUTL(priv, cmd | value, SCB_CTRL_MDI); - while (!(INL(dev, SCB_CTRL_MDI) & (1 << 28)) && (--timeout)) + while (!(INL(priv, SCB_CTRL_MDI) & (1 << 28)) && (--timeout)) udelay(1000); if (timeout == 0) @@ -280,49 +284,45 @@ static int set_phyreg(struct eth_device *dev, unsigned char addr, * Check if given phyaddr is valid, i.e. there is a PHY connected. * Do this by checking model value field from ID2 register. */ -static struct eth_device *verify_phyaddr(const char *devname, - unsigned char addr) +static int verify_phyaddr(struct eepro100_priv *priv, unsigned char addr) { - struct eth_device *dev; - unsigned short value; - unsigned char model; - - dev = eth_get_dev_by_name(devname); - if (!dev) { - printf("%s: no such device\n", devname); - return NULL; - } + unsigned short value, model; + int ret; /* read id2 register */ - if (get_phyreg(dev, addr, MII_PHYSID2, &value) != 0) { - printf("%s: mii read timeout!\n", devname); - return NULL; + ret = get_phyreg(priv, addr, MII_PHYSID2, &value); + if (ret) { + printf("%s: mii read timeout!\n", priv->name); + return ret; } /* get model */ - model = (unsigned char)((value >> 4) & 0x003f); - - if (model == 0) { - printf("%s: no PHY at address %d\n", devname, addr); - return NULL; + model = (value >> 4) & 0x003f; + if (!model) { + printf("%s: no PHY at address %d\n", priv->name, addr); + return -EINVAL; } - return dev; + return 0; } static int eepro100_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { + struct eth_device *dev = eth_get_dev_by_name(bus->name); + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); unsigned short value = 0; - struct eth_device *dev; + int ret; - dev = verify_phyaddr(bus->name, addr); - if (!dev) - return -1; + ret = verify_phyaddr(priv, addr); + if (ret) + return ret; - if (get_phyreg(dev, addr, reg, &value) != 0) { + ret = get_phyreg(priv, addr, reg, &value); + if (ret) { printf("%s: mii read timeout!\n", bus->name); - return -1; + return ret; } return value; @@ -331,23 +331,26 @@ static int eepro100_miiphy_read(struct mii_dev *bus, int addr, int devad, static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, u16 value) { - struct eth_device *dev; + struct eth_device *dev = eth_get_dev_by_name(bus->name); + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + int ret; - dev = verify_phyaddr(bus->name, addr); - if (!dev) - return -1; + ret = verify_phyaddr(priv, addr); + if (ret) + return ret; - if (set_phyreg(dev, addr, reg, value) != 0) { + ret = set_phyreg(priv, addr, reg, value); + if (ret) { printf("%s: mii write timeout!\n", bus->name); - return -1; + return ret; } return 0; } - #endif -static void init_rx_ring(struct eth_device *dev) +static void init_rx_ring(struct eepro100_priv *priv) { int i; @@ -356,7 +359,7 @@ static void init_rx_ring(struct eth_device *dev) rx_ring[i].control = (i == NUM_RX_DESC - 1) ? cpu_to_le16 (RFD_CONTROL_S) : 0; rx_ring[i].link = - cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + cpu_to_le32(phys_to_bus(priv->devno, (u32)&rx_ring[(i + 1) % NUM_RX_DESC])); rx_ring[i].rx_buf_addr = 0xffffffff; @@ -370,7 +373,7 @@ static void init_rx_ring(struct eth_device *dev) rx_next = 0; } -static void purge_tx_ring(struct eth_device *dev) +static void purge_tx_ring(struct eepro100_priv *priv) { tx_next = 0; tx_threshold = 0x01208000; @@ -382,11 +385,11 @@ static void purge_tx_ring(struct eth_device *dev) } /* Wait for the chip get the command. */ -static int wait_for_eepro100(struct eth_device *dev) +static int wait_for_eepro100(struct eepro100_priv *priv) { int i; - for (i = 0; INW(dev, SCB_CMD) & (CU_CMD_MASK | RU_CMD_MASK); i++) { + for (i = 0; INW(priv, SCB_CMD) & (CU_CMD_MASK | RU_CMD_MASK); i++) { if (i >= TOUT_LOOP) return 0; } @@ -394,7 +397,7 @@ static int wait_for_eepro100(struct eth_device *dev) return 1; } -static int eepro100_txcmd_send(struct eth_device *dev, +static int eepro100_txcmd_send(struct eepro100_priv *priv, struct eepro100_txfd *desc) { u16 rstat; @@ -403,11 +406,11 @@ static int eepro100_txcmd_send(struct eth_device *dev, flush_dcache_range((unsigned long)desc, (unsigned long)desc + sizeof(*desc)); - if (!wait_for_eepro100(dev)) + if (!wait_for_eepro100(priv)) return -ETIMEDOUT; - OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, (u32)desc), SCB_POINTER); - OUTW(dev, SCB_M | CU_START, SCB_CMD); + OUTL(priv, phys_to_bus(priv->devno, (u32)desc), SCB_POINTER); + OUTW(priv, SCB_M | CU_START, SCB_CMD); while (true) { invalidate_dcache_range((unsigned long)desc, @@ -417,7 +420,7 @@ static int eepro100_txcmd_send(struct eth_device *dev, break; if (i++ >= TOUT_LOOP) { - printf("%s: Tx error buffer not ready\n", dev->name); + printf("%s: Tx error buffer not ready\n", priv->name); return -EINVAL; } } @@ -435,42 +438,42 @@ static int eepro100_txcmd_send(struct eth_device *dev, } /* SROM Read. */ -static int read_eeprom(struct eth_device *dev, int location, int addr_len) +static int read_eeprom(struct eepro100_priv *priv, int location, int addr_len) { unsigned short retval = 0; int read_cmd = location | EE_READ_CMD(addr_len); int i; - OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); - OUTW(dev, EE_ENB, SCB_EEPROM); + OUTW(priv, EE_ENB & ~EE_CS, SCB_EEPROM); + OUTW(priv, EE_ENB, SCB_EEPROM); /* Shift the read command bits out. */ for (i = 12; i >= 0; i--) { short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(dev, EE_ENB | dataval, SCB_EEPROM); + OUTW(priv, EE_ENB | dataval, SCB_EEPROM); udelay(1); - OUTW(dev, EE_ENB | dataval | EE_SHIFT_CLK, SCB_EEPROM); + OUTW(priv, EE_ENB | dataval | EE_SHIFT_CLK, SCB_EEPROM); udelay(1); } - OUTW(dev, EE_ENB, SCB_EEPROM); + OUTW(priv, EE_ENB, SCB_EEPROM); for (i = 15; i >= 0; i--) { - OUTW(dev, EE_ENB | EE_SHIFT_CLK, SCB_EEPROM); + OUTW(priv, EE_ENB | EE_SHIFT_CLK, SCB_EEPROM); udelay(1); retval = (retval << 1) | - ((INW(dev, SCB_EEPROM) & EE_DATA_READ) ? 1 : 0); - OUTW(dev, EE_ENB, SCB_EEPROM); + !!(INW(priv, SCB_EEPROM) & EE_DATA_READ); + OUTW(priv, EE_ENB, SCB_EEPROM); udelay(1); } /* Terminate the EEPROM access. */ - OUTW(dev, EE_ENB & ~EE_CS, SCB_EEPROM); + OUTW(priv, EE_ENB & ~EE_CS, SCB_EEPROM); return retval; } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static int eepro100_initialize_mii(struct eth_device *dev) +static int eepro100_initialize_mii(struct eepro100_priv *priv) { /* register mii command access routines */ struct mii_dev *mdiodev; @@ -480,7 +483,7 @@ static int eepro100_initialize_mii(struct eth_device *dev) if (!mdiodev) return -ENOMEM; - strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + strncpy(mdiodev->name, priv->name, MDIO_NAME_LEN); mdiodev->read = eepro100_miiphy_read; mdiodev->write = eepro100_miiphy_write; @@ -493,7 +496,7 @@ static int eepro100_initialize_mii(struct eth_device *dev) return 0; } #else -static int eepro100_initialize_mii(struct eth_device *dev) +static int eepro100_initialize_mii(struct eepro100_priv *priv) { return 0; } @@ -506,70 +509,72 @@ static struct pci_device_id supported[] = { { } }; -static void read_hw_addr(struct eth_device *dev, bd_t *bis) +static void read_hw_addr(struct eepro100_priv *priv, bd_t *bis) { u16 sum = 0; int i, j; - int addr_len = read_eeprom(dev, 0, 6) == 0xffff ? 8 : 6; + int addr_len = read_eeprom(priv, 0, 6) == 0xffff ? 8 : 6; for (j = 0, i = 0; i < 0x40; i++) { - u16 value = read_eeprom(dev, i, addr_len); + u16 value = read_eeprom(priv, i, addr_len); sum += value; if (i < 3) { - dev->enetaddr[j++] = value; - dev->enetaddr[j++] = value >> 8; + priv->enetaddr[j++] = value; + priv->enetaddr[j++] = value >> 8; } } if (sum != 0xBABA) { - memset(dev->enetaddr, 0, ETH_ALEN); + memset(priv->enetaddr, 0, ETH_ALEN); debug("%s: Invalid EEPROM checksum %#4.4x, check settings before activating this device!\n", - dev->name, sum); + priv->name, sum); } } static int eepro100_init(struct eth_device *dev, bd_t *bis) { + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); struct eepro100_txfd *ias_cmd, *cfg_cmd; int ret, status = -1; int tx_cur; /* Reset the ethernet controller */ - OUTL(dev, I82559_SELECTIVE_RESET, SCB_PORT); + OUTL(priv, I82559_SELECTIVE_RESET, SCB_PORT); udelay(20); - OUTL(dev, I82559_RESET, SCB_PORT); + OUTL(priv, I82559_RESET, SCB_PORT); udelay(20); - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not reset ethernet controller.\n"); goto done; } - OUTL(dev, 0, SCB_POINTER); - OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCB_CMD); + OUTL(priv, 0, SCB_POINTER); + OUTW(priv, SCB_M | RUC_ADDR_LOAD, SCB_CMD); - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not reset ethernet controller.\n"); goto done; } - OUTL(dev, 0, SCB_POINTER); - OUTW(dev, SCB_M | CU_ADDR_LOAD, SCB_CMD); + OUTL(priv, 0, SCB_POINTER); + OUTW(priv, SCB_M | CU_ADDR_LOAD, SCB_CMD); /* Initialize Rx and Tx rings. */ - init_rx_ring(dev); - purge_tx_ring(dev); + init_rx_ring(priv); + purge_tx_ring(priv); /* Tell the adapter where the RX ring is located. */ - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not reset ethernet controller.\n"); goto done; } /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, (u32)&rx_ring[rx_next]), + OUTL(priv, phys_to_bus(priv->devno, (u32)&rx_ring[rx_next]), SCB_POINTER); - OUTW(dev, SCB_M | RUC_START, SCB_CMD); + OUTW(priv, SCB_M | RUC_START, SCB_CMD); /* Send the Configure frame */ tx_cur = tx_next; @@ -579,13 +584,13 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) cfg_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE); cfg_cmd->status = 0; - cfg_cmd->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + cfg_cmd->link = cpu_to_le32(phys_to_bus(priv->devno, (u32)&tx_ring[tx_next])); memcpy(((struct descriptor *)cfg_cmd)->params, i82558_config_cmd, sizeof(i82558_config_cmd)); - ret = eepro100_txcmd_send(dev, cfg_cmd); + ret = eepro100_txcmd_send(priv, cfg_cmd); if (ret) { if (ret == -ETIMEDOUT) printf("Error---CONFIG_SYS_CMD_CONFIGURE: Can not reset ethernet controller.\n"); @@ -600,12 +605,12 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) ias_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS); ias_cmd->status = 0; - ias_cmd->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + ias_cmd->link = cpu_to_le32(phys_to_bus(priv->devno, (u32)&tx_ring[tx_next])); - memcpy(((struct descriptor *)ias_cmd)->params, dev->enetaddr, 6); + memcpy(((struct descriptor *)ias_cmd)->params, priv->enetaddr, 6); - ret = eepro100_txcmd_send(dev, ias_cmd); + ret = eepro100_txcmd_send(priv, ias_cmd); if (ret) { if (ret == -ETIMEDOUT) printf("Error: Can not reset ethernet controller.\n"); @@ -620,12 +625,14 @@ done: static int eepro100_send(struct eth_device *dev, void *packet, int length) { + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); struct eepro100_txfd *desc; int ret, status = -1; int tx_cur; if (length <= 0) { - printf("%s: bad packet size: %d\n", dev->name, length); + printf("%s: bad packet size: %d\n", priv->name, length); goto done; } @@ -637,19 +644,19 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) TXCB_CMD_S | TXCB_CMD_EL); desc->status = 0; desc->count = cpu_to_le32(tx_threshold); - desc->link = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, - (u32)&tx_ring[tx_next])); - desc->tx_desc_addr = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + desc->link = cpu_to_le32(phys_to_bus(priv->devno, + (u32)&tx_ring[tx_next])); + desc->tx_desc_addr = cpu_to_le32(phys_to_bus(priv->devno, (u32)&desc->tx_buf_addr0)); - desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus((pci_dev_t)dev->priv, + desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus(priv->devno, (u_long)packet)); desc->tx_buf_size0 = cpu_to_le32(length); - ret = eepro100_txcmd_send(dev, &tx_ring[tx_cur]); + ret = eepro100_txcmd_send(priv, &tx_ring[tx_cur]); if (ret) { if (ret == -ETIMEDOUT) printf("%s: Tx error ethernet controller not ready.\n", - dev->name); + priv->name); goto done; } @@ -661,12 +668,14 @@ done: static int eepro100_recv(struct eth_device *dev) { + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); struct eepro100_rxfd *desc; int rx_prev, length = 0; u16 status, stat; - stat = INW(dev, SCB_STATUS); - OUTW(dev, stat & SCB_STATUS_RNR, SCB_STATUS); + stat = INW(priv, SCB_STATUS); + OUTW(priv, stat & SCB_STATUS_RNR, SCB_STATUS); for (;;) { desc = &rx_ring[rx_next]; @@ -706,20 +715,20 @@ static int eepro100_recv(struct eth_device *dev) } if (stat & SCB_STATUS_RNR) { - printf("%s: Receiver is not ready, restart it !\n", dev->name); + printf("%s: Receiver is not ready, restart it !\n", priv->name); /* Reinitialize Rx ring. */ - init_rx_ring(dev); + init_rx_ring(priv); - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not restart ethernet controller.\n"); goto done; } /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(dev, phys_to_bus((pci_dev_t)dev->priv, - (u32)&rx_ring[rx_next]), SCB_POINTER); - OUTW(dev, SCB_M | RUC_START, SCB_CMD); + OUTL(priv, phys_to_bus(priv->devno, + (u32)&rx_ring[rx_next]), SCB_POINTER); + OUTW(priv, SCB_M | RUC_START, SCB_CMD); } done: @@ -728,26 +737,29 @@ done: static void eepro100_halt(struct eth_device *dev) { + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + /* Reset the ethernet controller */ - OUTL(dev, I82559_SELECTIVE_RESET, SCB_PORT); + OUTL(priv, I82559_SELECTIVE_RESET, SCB_PORT); udelay(20); - OUTL(dev, I82559_RESET, SCB_PORT); + OUTL(priv, I82559_RESET, SCB_PORT); udelay(20); - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not reset ethernet controller.\n"); goto done; } - OUTL(dev, 0, SCB_POINTER); - OUTW(dev, SCB_M | RUC_ADDR_LOAD, SCB_CMD); + OUTL(priv, 0, SCB_POINTER); + OUTW(priv, SCB_M | RUC_ADDR_LOAD, SCB_CMD); - if (!wait_for_eepro100(dev)) { + if (!wait_for_eepro100(priv)) { printf("Error: Can not reset ethernet controller.\n"); goto done; } - OUTL(dev, 0, SCB_POINTER); - OUTW(dev, SCB_M | CU_ADDR_LOAD, SCB_CMD); + OUTL(priv, 0, SCB_POINTER); + OUTW(priv, SCB_M | CU_ADDR_LOAD, SCB_CMD); done: return; @@ -798,8 +810,12 @@ int eepro100_initialize(bd_t *bis) dev = &priv->dev; sprintf(dev->name, "i82559#%d", card_number); - dev->priv = (void *)devno; /* this have to come before bus_to_phys() */ - dev->iobase = bus_to_phys(devno, iobase); + priv->name = dev->name; + /* this have to come before bus_to_phys() */ + priv->devno = devno; + priv->iobase = (void __iomem *)bus_to_phys(devno, iobase); + priv->enetaddr = dev->enetaddr; + dev->init = eepro100_init; dev->halt = eepro100_halt; dev->send = eepro100_send; @@ -807,7 +823,7 @@ int eepro100_initialize(bd_t *bis) eth_register(dev); - ret = eepro100_initialize_mii(dev); + ret = eepro100_initialize_mii(priv); if (ret) { eth_unregister(dev); free(priv); @@ -821,7 +837,7 @@ int eepro100_initialize(bd_t *bis) udelay(10 * 1000); - read_hw_addr(dev, bis); + read_hw_addr(priv, bis); } return card_number; From patchwork Sat May 23 16:38:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296742 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XHos2lPR; 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 49Tq2C6rH7z9sPK for ; Sun, 24 May 2020 02:44:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 060C68185E; Sat, 23 May 2020 18:41:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XHos2lPR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E50E7815F1; Sat, 23 May 2020 18:39:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 71D8881734 for ; Sat, 23 May 2020 18:39:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x642.google.com with SMTP id s21so16438921ejd.2 for ; Sat, 23 May 2020 09:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d/ckRT1ydk9v2zkIhdXis8NLX+5WE0jInQ5Kh9L/IoM=; b=XHos2lPRtPvh78V27ed8yUDVq4DQbEduO6haik58aNCuP6Tx5zIdjt7VTaMr9Dgi8M 9JRcA4oJdOO5NgW5YWugp2z/pqDdFIgXop07bDR4w2pL5KqY9rnn16/J34xObuYRCUJ9 VAZhwLkn+r9C392C9cBcfrs1bMhg2JXW5xjA65cIQXqdeOoN9aT3N2+qJeFSvq210e7u 0PZMDBC0+r6v72Hk08bIevJWXE+H1FobHi6OL19syXYR9uqE9+qfylEGKM0G+R8tjgcO uxI++kxBMFgaiGrda9qqKOLRWx8xKWDI5aoMPmDiVaEBiV/p20XW8qSu0gd/APL53HnS n7lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d/ckRT1ydk9v2zkIhdXis8NLX+5WE0jInQ5Kh9L/IoM=; b=Ki5qKA+erv01ZDwpdoNDb+/v3bc6CtjwU+sy5a69IZiuBys7WnR5EZ50SrtA435ZZ3 323AeRBOpGWg80tnE/WHU2Jmz49sYC5tyjUdFaJmSfTao5ujr/KBL4MNhDKzWHJzmD4u AG0mJUQPBIx2PyNIO1pCMw6TOIHBH/LnPG7/X9Jgtgl7T/MyAtd0r+BBk479pk6ihDd6 0Fv9oCSEPcRjCXQn03mWSIO7w7bufpYtX2c4Aja4Z4biEBTz3KV6RjTS4XtEjRPfOvg0 3SCdzYx0Qxg/0RhZHYseKUcYVY/69saPMB2jrQCLsKNvN+DDPztlpm9FfXeSoXuVWIzq /6Qw== X-Gm-Message-State: AOAM5337tEkxqjhsd1Zc82kUDKEN2GVU0sxeuRsT8pf/HzvP+5Y0/7Dr tChGr0zNGWuWzU2Xd5oMXGaXpKFi X-Google-Smtp-Source: ABdhPJxPHWFUTw3m59cc/KJ4RVWY6GzLxXsCPBPsAsxIlvqhA8E2qjGLo77pKQlKMycojyt9LAjdDw== X-Received: by 2002:a17:906:1f8b:: with SMTP id t11mr12721294ejr.201.1590251968838; Sat, 23 May 2020 09:39:28 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:28 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 25/30] net: eepro100: Pass device private data into mdiobus Date: Sat, 23 May 2020 18:38:32 +0200 Message-Id: <20200523163837.407592-25-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Instead of doing ethernet device lookup by name every time there is an MDIO access, pass the driver private data via mdiobus priv to the MDIO bus accessors. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 1c33ec3da2..78dedbdcc9 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -309,9 +309,7 @@ static int verify_phyaddr(struct eepro100_priv *priv, unsigned char addr) static int eepro100_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { - struct eth_device *dev = eth_get_dev_by_name(bus->name); - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); + struct eepro100_priv *priv = bus->priv; unsigned short value = 0; int ret; @@ -331,9 +329,7 @@ static int eepro100_miiphy_read(struct mii_dev *bus, int addr, int devad, static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, u16 value) { - struct eth_device *dev = eth_get_dev_by_name(bus->name); - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); + struct eepro100_priv *priv = bus->priv; int ret; ret = verify_phyaddr(priv, addr); @@ -486,6 +482,7 @@ static int eepro100_initialize_mii(struct eepro100_priv *priv) strncpy(mdiodev->name, priv->name, MDIO_NAME_LEN); mdiodev->read = eepro100_miiphy_read; mdiodev->write = eepro100_miiphy_write; + mdiodev->priv = priv; ret = mdio_register(mdiodev); if (ret < 0) { From patchwork Sat May 23 16:38:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296743 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PKpyJIbK; 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 49Tq2R54kxz9sRf for ; Sun, 24 May 2020 02:44:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D078981C62; Sat, 23 May 2020 18:41:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PKpyJIbK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD07A815F1; Sat, 23 May 2020 18:39:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 92D798168F for ; Sat, 23 May 2020 18:39:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x541.google.com with SMTP id be9so11735623edb.2 for ; Sat, 23 May 2020 09:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m1scvJgplDb8JkosIZxtwiN8EEPkWRRCavn0AoIZIBM=; b=PKpyJIbK1v297WZO21h2uBXeA7ELJNyOdutlLmvG+NC2ylT+Gai6DewsstqMXkIDaB t36eUw7Fx6nxieJUjL+sMDJb2lWX8X2+5s2BSFwHtfIFTuD8XnEQzGLkrJP0jZxhyrGs 0YmsOGV3gQbRij/fRBteS2JZFvicUS7os800Bku55rAGF8ac3SCMEwGK8Qcm6NfXT/2T nwt3He7psU7zifqLbRUAPshCwn/FRvspKrgQiwkL8A1rSF3V/sp3qYQVUeiDq/wvBB6R ut2vdsmKlA2C4m4pygcOQKhmgZWyJceP09h7abuJu93IxzDJhdzdkmdPOQ0nCdspQOXx 62BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m1scvJgplDb8JkosIZxtwiN8EEPkWRRCavn0AoIZIBM=; b=greb5OgwJfTE20Bi0EyKwqX8kagxx+qaeMqMYYsG98YrcwT0W5ZoR+gExdjNKyxve8 jQYVK8fCDNOh66me4EDTSNs12OyIzV2nJryUDwdAqp3jZ7NGR6bYgNWaGSN+ToK2WgkA t9nXBNTBc/DtRimakkkKLBl3VGbrCaANh0oUpwRp6ZegX6vg4HHSDusROBYd8tSdzwfd Vl52XyL1IG6x0HYkWsmfSVxmtD6tPbeIkoMrOEgbH8I80DrzQLliHsR5v4tIYDceC79b 603YdD4j+gVkvtgFsv4tbnsG/mLS7cF1YfLGb02hTsKF90uwqTRW8m3MP8cM7ehS/FxS wQig== X-Gm-Message-State: AOAM530XcKk4n1v4LT36OmNdPpthxw+YjoGRsX26lTAnFN7xD3IjLSSJ /+Jd+T2hFt0qlAnoguXJ/CRi5Wc5 X-Google-Smtp-Source: ABdhPJwFsV0TRXs//+5i1FcXWtMA4BPGK7p94LxbNNbkdx9C4pIW4/NClvzn63APQEOf9e4sAJ+tMQ== X-Received: by 2002:a50:ec0d:: with SMTP id g13mr7698264edr.296.1590251969860; Sat, 23 May 2020 09:39:29 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:29 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 26/30] net: eepro100: Add RX/TX rings into the private data Date: Sat, 23 May 2020 18:38:33 +0200 Message-Id: <20200523163837.407592-26-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The RX/TX DMA descriptor rings are per-device-instance private data, so move them into the private data. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 59 +++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 78dedbdcc9..ed6bbd5cf8 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -183,12 +183,6 @@ struct descriptor { /* A generic descriptor. */ #define TOUT_LOOP 1000000 -static struct eepro100_rxfd rx_ring[NUM_RX_DESC]; /* RX descriptor ring */ -static struct eepro100_txfd tx_ring[NUM_TX_DESC]; /* TX descriptor ring */ -static int rx_next; /* RX descriptor ring pointer */ -static int tx_next; /* TX descriptor ring pointer */ -static int tx_threshold; - /* * The parameters for a CmdConfigure operation. * There are so many options that it would be difficult to document @@ -202,6 +196,15 @@ static const char i82558_config_cmd[] = { }; struct eepro100_priv { + /* RX descriptor ring */ + struct eepro100_rxfd rx_ring[NUM_RX_DESC]; + /* TX descriptor ring */ + struct eepro100_txfd tx_ring[NUM_TX_DESC]; + /* RX descriptor ring pointer */ + int rx_next; + /* TX descriptor ring pointer */ + int tx_next; + int tx_threshold; struct eth_device dev; pci_dev_t devno; char *name; @@ -348,6 +351,7 @@ static int eepro100_miiphy_write(struct mii_dev *bus, int addr, int devad, static void init_rx_ring(struct eepro100_priv *priv) { + struct eepro100_rxfd *rx_ring = priv->rx_ring; int i; for (i = 0; i < NUM_RX_DESC; i++) { @@ -366,13 +370,15 @@ static void init_rx_ring(struct eepro100_priv *priv) (unsigned long)rx_ring + (sizeof(*rx_ring) * NUM_RX_DESC)); - rx_next = 0; + priv->rx_next = 0; } static void purge_tx_ring(struct eepro100_priv *priv) { - tx_next = 0; - tx_threshold = 0x01208000; + struct eepro100_txfd *tx_ring = priv->tx_ring; + + priv->tx_next = 0; + priv->tx_threshold = 0x01208000; memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC); flush_dcache_range((unsigned long)tx_ring, @@ -533,6 +539,8 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) { struct eepro100_priv *priv = container_of(dev, struct eepro100_priv, dev); + struct eepro100_rxfd *rx_ring = priv->rx_ring; + struct eepro100_txfd *tx_ring = priv->tx_ring; struct eepro100_txfd *ias_cmd, *cfg_cmd; int ret, status = -1; int tx_cur; @@ -569,20 +577,20 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) } /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(priv, phys_to_bus(priv->devno, (u32)&rx_ring[rx_next]), + OUTL(priv, phys_to_bus(priv->devno, (u32)&rx_ring[priv->rx_next]), SCB_POINTER); OUTW(priv, SCB_M | RUC_START, SCB_CMD); /* Send the Configure frame */ - tx_cur = tx_next; - tx_next = ((tx_next + 1) % NUM_TX_DESC); + tx_cur = priv->tx_next; + priv->tx_next = ((priv->tx_next + 1) % NUM_TX_DESC); cfg_cmd = &tx_ring[tx_cur]; cfg_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_CONFIGURE); cfg_cmd->status = 0; cfg_cmd->link = cpu_to_le32(phys_to_bus(priv->devno, - (u32)&tx_ring[tx_next])); + (u32)&tx_ring[priv->tx_next])); memcpy(((struct descriptor *)cfg_cmd)->params, i82558_config_cmd, sizeof(i82558_config_cmd)); @@ -595,15 +603,15 @@ static int eepro100_init(struct eth_device *dev, bd_t *bis) } /* Send the Individual Address Setup frame */ - tx_cur = tx_next; - tx_next = ((tx_next + 1) % NUM_TX_DESC); + tx_cur = priv->tx_next; + priv->tx_next = ((priv->tx_next + 1) % NUM_TX_DESC); ias_cmd = &tx_ring[tx_cur]; ias_cmd->command = cpu_to_le16(CONFIG_SYS_CMD_SUSPEND | CONFIG_SYS_CMD_IAS); ias_cmd->status = 0; ias_cmd->link = cpu_to_le32(phys_to_bus(priv->devno, - (u32)&tx_ring[tx_next])); + (u32)&tx_ring[priv->tx_next])); memcpy(((struct descriptor *)ias_cmd)->params, priv->enetaddr, 6); @@ -624,6 +632,7 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) { struct eepro100_priv *priv = container_of(dev, struct eepro100_priv, dev); + struct eepro100_txfd *tx_ring = priv->tx_ring; struct eepro100_txfd *desc; int ret, status = -1; int tx_cur; @@ -633,16 +642,16 @@ static int eepro100_send(struct eth_device *dev, void *packet, int length) goto done; } - tx_cur = tx_next; - tx_next = (tx_next + 1) % NUM_TX_DESC; + tx_cur = priv->tx_next; + priv->tx_next = (priv->tx_next + 1) % NUM_TX_DESC; desc = &tx_ring[tx_cur]; desc->command = cpu_to_le16(TXCB_CMD_TRANSMIT | TXCB_CMD_SF | TXCB_CMD_S | TXCB_CMD_EL); desc->status = 0; - desc->count = cpu_to_le32(tx_threshold); + desc->count = cpu_to_le32(priv->tx_threshold); desc->link = cpu_to_le32(phys_to_bus(priv->devno, - (u32)&tx_ring[tx_next])); + (u32)&tx_ring[priv->tx_next])); desc->tx_desc_addr = cpu_to_le32(phys_to_bus(priv->devno, (u32)&desc->tx_buf_addr0)); desc->tx_buf_addr0 = cpu_to_le32(phys_to_bus(priv->devno, @@ -667,6 +676,7 @@ static int eepro100_recv(struct eth_device *dev) { struct eepro100_priv *priv = container_of(dev, struct eepro100_priv, dev); + struct eepro100_rxfd *rx_ring = priv->rx_ring; struct eepro100_rxfd *desc; int rx_prev, length = 0; u16 status, stat; @@ -675,7 +685,7 @@ static int eepro100_recv(struct eth_device *dev) OUTW(priv, stat & SCB_STATUS_RNR, SCB_STATUS); for (;;) { - desc = &rx_ring[rx_next]; + desc = &rx_ring[priv->rx_next]; invalidate_dcache_range((unsigned long)desc, (unsigned long)desc + sizeof(*desc)); status = le16_to_cpu(desc->status); @@ -701,14 +711,14 @@ static int eepro100_recv(struct eth_device *dev) flush_dcache_range((unsigned long)desc, (unsigned long)desc + sizeof(*desc)); - rx_prev = (rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; + rx_prev = (priv->rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; desc = &rx_ring[rx_prev]; desc->control = 0; flush_dcache_range((unsigned long)desc, (unsigned long)desc + sizeof(*desc)); /* Update entry information. */ - rx_next = (rx_next + 1) % NUM_RX_DESC; + priv->rx_next = (priv->rx_next + 1) % NUM_RX_DESC; } if (stat & SCB_STATUS_RNR) { @@ -724,7 +734,8 @@ static int eepro100_recv(struct eth_device *dev) /* RX ring cache was already flushed in init_rx_ring() */ OUTL(priv, phys_to_bus(priv->devno, - (u32)&rx_ring[rx_next]), SCB_POINTER); + (u32)&rx_ring[priv->rx_next]), + SCB_POINTER); OUTW(priv, SCB_M | RUC_START, SCB_CMD); } From patchwork Sat May 23 16:38:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296744 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ctNAScyD; 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 49Tq2g3lPBz9sPK for ; Sun, 24 May 2020 02:44:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CDAC081C75; Sat, 23 May 2020 18:41:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ctNAScyD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 18C918185E; Sat, 23 May 2020 18:39:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C943681781 for ; Sat, 23 May 2020 18:39:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id j21so16430364ejy.1 for ; Sat, 23 May 2020 09:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=150qGJWg1GTJ/Bw4Mw6UbvSouVWjsEBl73FccJrLAb4=; b=ctNAScyDagwA8vqiYzu/l+eGsXj2QJLC3ctmYahWCWTihjA3712sE9OenqJuqkbbzx +eovfJ26GUrn318ikR0dztaxrlxh7qpryXrq2D057fvXYuOaFtByEs56z3Y/RFAc51+v yI/lK/9kt0L2Gm2nY4X13/P7uX7PqH8Joa0BCA/z/zrOiq5Paz1Z05yxyBpQvOEzSMR4 aMkfILpuAt10OVlsjkKyvfIf3e8Sv2gtjCB85A/mYPYGqo8HmvC4pVu4uB5vPeUHuVL6 t/c2XzgMjj/DNhGWuCQKgmsBGEpTSscRFaT5kXn7lRs0YYGkcMkgNH9CiGitCg0dK/Tn +CJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=150qGJWg1GTJ/Bw4Mw6UbvSouVWjsEBl73FccJrLAb4=; b=Qoo2jH1gLPBA/+pw5tsMG6xF+xCNnLOGe6WN/tJM9CVBfLcWfodZ+EPI8gOkNqZNBW tGymM98amy92ujxLGQXEv4fb/qA/wbkUcg9DFZpYcqwkEN/l/Or+gr8P/jnCSDYNurKY 6mYIgUbmlxPeysx9n7/6EuO68kw4HQVxv3+5PKesw6NxN9bcfJraqjKZ/1VP7y2/WBKT 7EzhWmZN6FIv/NlSt7irCZmYyqtk1JbX3jjrmQ+J1v7kBJvgLK5hgDa1iSx85LoPRFZP qV6nyM2yI7PBXIZK0vktEE/G6bOTUBNR6i3RY/ZnqvItUclHPBmU/4ZXyyk4CzI0Gkkv ZRCA== X-Gm-Message-State: AOAM5307a77ci/Kx7Kt1STqAsgD2F+sV1P6AGTL/FOSUOeE21ssOGbcl GOat0zob7P/wOfoCh25iaOwISvCJ X-Google-Smtp-Source: ABdhPJwK8JT2+TYJomcRT8+6SAY8xCqmIzNeKkgRW+KhBKOJDc1g9W/K40Nm17QWPLfsGpqfw55DvA== X-Received: by 2002:a17:906:7e43:: with SMTP id z3mr12272058ejr.221.1590251971081; Sat, 23 May 2020 09:39:31 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:30 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 27/30] net: eepro100: Drop bd_t pointer from read_hw_addr() Date: Sat, 23 May 2020 18:38:34 +0200 Message-Id: <20200523163837.407592-27-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The pointer is unused, so drop it. Rename the function to start with the eepro100_ prefix. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index ed6bbd5cf8..fb8a68f84c 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -512,7 +512,7 @@ static struct pci_device_id supported[] = { { } }; -static void read_hw_addr(struct eepro100_priv *priv, bd_t *bis) +static void eepro100_get_hwaddr(struct eepro100_priv *priv) { u16 sum = 0; int i, j; @@ -845,7 +845,7 @@ int eepro100_initialize(bd_t *bis) udelay(10 * 1000); - read_hw_addr(priv, bis); + eepro100_get_hwaddr(priv); } return card_number; From patchwork Sat May 23 16:38:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296746 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OuSOoZnu; 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 49Tq393mKWz9sSF for ; Sun, 24 May 2020 02:45:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD2EB81C95; Sat, 23 May 2020 18:41:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OuSOoZnu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E95781767; Sat, 23 May 2020 18:39:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E480981798 for ; Sat, 23 May 2020 18:39:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x543.google.com with SMTP id s19so11693359edt.12 for ; Sat, 23 May 2020 09:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SSjlXU3oicrdAHb0uotL10b5qaUQNNtN9DTjlLajwYg=; b=OuSOoZnuQyi151R5FCE8VnaFflaP/7nTKrxuYLX+NNXmB2da//a2RQBoHc7BAbLXvY UZMn1W97yOiElXnj1zoQ35ds4nWL+vIDhAM72XVY7hak9aqh/TS/j/SHWtUZe8OxciXS uTrvztdH93BXBk42GhzMZkgFDCWAaUouWWf/jWhG+8MEl88mtcNpip9fWPefD+gUg9xu 1D6geVTiuJcgAYL55Hze6tF9nTQGZRezJsSW4MGeMLsbzv2+vOIwfXaS7TW7WnWzC5G8 pPVofzU4sO9jk1OwmYidbMPzgbXiZWIxwuvf7hEgZvA45nY09VK6Ygmy2qIakMDDcXBE Tufg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SSjlXU3oicrdAHb0uotL10b5qaUQNNtN9DTjlLajwYg=; b=OJc1dlYfibI9lsHwIt1fa7lWUcBruZp5tHkpPLWSCudOpvKq5+apgRKXDfyjJFkBvx jSzQVRJbwh8xNcge1quFZW6qaeNNQjMCSvwKD3mde9kd2w/Vjx6oXHIdEs7Uj2FDuzXV LhkZfTNp1ZdvV7mzjBYVch/SScz7TiSDaBw0dlXXy8avg8aiCvfkDlbgKAeYOMNFYQk9 9tV0TxSn5MjKuxFnolFJ61U1tvudTnu1UMeh1bRVr7Aw4thq6D0qX/t2xtKfjvCJ8Ox1 PcEmjW2Ga2lD8wqEr9UA6Wc0RVxVOlrjw0aNFrc4CnAPjIHzmsden/yFC7AVhHhHx3Pw TrMA== X-Gm-Message-State: AOAM531IW69ij5CxxQdQNA47lnvYs/XIM6pLyAPz08s5EDOWBg0v4dzL 2NVVYvO5U7Hmcvxh+sARoSAXRUFC X-Google-Smtp-Source: ABdhPJy/yCodEtTor5wBLta4DY+cegwLkT2Z/JKjIRzNOcQHZJvkVaSSwazXGFJzFhOCIYFiJ9w/2w== X-Received: by 2002:a50:bb07:: with SMTP id y7mr7561276ede.176.1590251972145; Sat, 23 May 2020 09:39:32 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:31 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 28/30] net: eepro100: Split common parts of non-DM functions out Date: Sat, 23 May 2020 18:38:35 +0200 Message-Id: <20200523163837.407592-28-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Split the common code from the non-DM code, so it can be reused by the DM code later. As always, the recv() function had to be split into the actual receiving part and free_pkt part to fit with the DM. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 162 +++++++++++++++++++++++++---------------- 1 file changed, 100 insertions(+), 62 deletions(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index fb8a68f84c..f474832552 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -202,6 +202,7 @@ struct eepro100_priv { struct eepro100_txfd tx_ring[NUM_TX_DESC]; /* RX descriptor ring pointer */ int rx_next; + u16 rx_stat; /* TX descriptor ring pointer */ int tx_next; int tx_threshold; @@ -535,10 +536,8 @@ static void eepro100_get_hwaddr(struct eepro100_priv *priv) } } -static int eepro100_init(struct eth_device *dev, bd_t *bis) +static int eepro100_init_common(struct eepro100_priv *priv) { - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); struct eepro100_rxfd *rx_ring = priv->rx_ring; struct eepro100_txfd *tx_ring = priv->tx_ring; struct eepro100_txfd *ias_cmd, *cfg_cmd; @@ -628,10 +627,9 @@ done: return status; } -static int eepro100_send(struct eth_device *dev, void *packet, int length) +static int eepro100_send_common(struct eepro100_priv *priv, + void *packet, int length) { - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); struct eepro100_txfd *tx_ring = priv->tx_ring; struct eepro100_txfd *desc; int ret, status = -1; @@ -672,82 +670,82 @@ done: return status; } -static int eepro100_recv(struct eth_device *dev) +static int eepro100_recv_common(struct eepro100_priv *priv, uchar **packetp) { - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); struct eepro100_rxfd *rx_ring = priv->rx_ring; struct eepro100_rxfd *desc; - int rx_prev, length = 0; - u16 status, stat; + int length; + u16 status; - stat = INW(priv, SCB_STATUS); - OUTW(priv, stat & SCB_STATUS_RNR, SCB_STATUS); + priv->rx_stat = INW(priv, SCB_STATUS); + OUTW(priv, priv->rx_stat & SCB_STATUS_RNR, SCB_STATUS); - for (;;) { - desc = &rx_ring[priv->rx_next]; - invalidate_dcache_range((unsigned long)desc, - (unsigned long)desc + sizeof(*desc)); - status = le16_to_cpu(desc->status); + desc = &rx_ring[priv->rx_next]; + invalidate_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); + status = le16_to_cpu(desc->status); + + if (!(status & RFD_STATUS_C)) + return 0; + + /* Valid frame status. */ + if (status & RFD_STATUS_OK) { + /* A valid frame received. */ + length = le32_to_cpu(desc->count) & 0x3fff; + /* Pass the packet up to the protocol layers. */ + *packetp = desc->data; + return length; + } - if (!(status & RFD_STATUS_C)) - break; + /* There was an error. */ + printf("RX error status = 0x%08X\n", status); + return -EINVAL; +} - /* Valid frame status. */ - if ((status & RFD_STATUS_OK)) { - /* A valid frame received. */ - length = le32_to_cpu(desc->count) & 0x3fff; +static void eepro100_free_pkt_common(struct eepro100_priv *priv) +{ + struct eepro100_rxfd *rx_ring = priv->rx_ring; + struct eepro100_rxfd *desc; + int rx_prev; - /* Pass the packet up to the protocol layers. */ - net_process_received_packet((u8 *)desc->data, length); - } else { - /* There was an error. */ - printf("RX error status = 0x%08X\n", status); - } + desc = &rx_ring[priv->rx_next]; - desc->control = cpu_to_le16(RFD_CONTROL_S); - desc->status = 0; - desc->count = cpu_to_le32(PKTSIZE_ALIGN << 16); - flush_dcache_range((unsigned long)desc, - (unsigned long)desc + sizeof(*desc)); + desc->control = cpu_to_le16(RFD_CONTROL_S); + desc->status = 0; + desc->count = cpu_to_le32(PKTSIZE_ALIGN << 16); + flush_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); - rx_prev = (priv->rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; - desc = &rx_ring[rx_prev]; - desc->control = 0; - flush_dcache_range((unsigned long)desc, - (unsigned long)desc + sizeof(*desc)); + rx_prev = (priv->rx_next + NUM_RX_DESC - 1) % NUM_RX_DESC; + desc = &rx_ring[rx_prev]; + desc->control = 0; + flush_dcache_range((unsigned long)desc, + (unsigned long)desc + sizeof(*desc)); - /* Update entry information. */ - priv->rx_next = (priv->rx_next + 1) % NUM_RX_DESC; - } + /* Update entry information. */ + priv->rx_next = (priv->rx_next + 1) % NUM_RX_DESC; - if (stat & SCB_STATUS_RNR) { - printf("%s: Receiver is not ready, restart it !\n", priv->name); + if (!(priv->rx_stat & SCB_STATUS_RNR)) + return; - /* Reinitialize Rx ring. */ - init_rx_ring(priv); + printf("%s: Receiver is not ready, restart it !\n", priv->name); - if (!wait_for_eepro100(priv)) { - printf("Error: Can not restart ethernet controller.\n"); - goto done; - } + /* Reinitialize Rx ring. */ + init_rx_ring(priv); - /* RX ring cache was already flushed in init_rx_ring() */ - OUTL(priv, phys_to_bus(priv->devno, - (u32)&rx_ring[priv->rx_next]), - SCB_POINTER); - OUTW(priv, SCB_M | RUC_START, SCB_CMD); + if (!wait_for_eepro100(priv)) { + printf("Error: Can not restart ethernet controller.\n"); + return; } -done: - return length; + /* RX ring cache was already flushed in init_rx_ring() */ + OUTL(priv, phys_to_bus(priv->devno, (u32)&rx_ring[priv->rx_next]), + SCB_POINTER); + OUTW(priv, SCB_M | RUC_START, SCB_CMD); } -static void eepro100_halt(struct eth_device *dev) +static void eepro100_halt_common(struct eepro100_priv *priv) { - struct eepro100_priv *priv = - container_of(dev, struct eepro100_priv, dev); - /* Reset the ethernet controller */ OUTL(priv, I82559_SELECTIVE_RESET, SCB_PORT); udelay(20); @@ -773,6 +771,46 @@ done: return; } +static int eepro100_init(struct eth_device *dev, bd_t *bis) +{ + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + + return eepro100_init_common(priv); +} + +static void eepro100_halt(struct eth_device *dev) +{ + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + + eepro100_halt_common(priv); +} + +static int eepro100_send(struct eth_device *dev, void *packet, int length) +{ + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + + return eepro100_send_common(priv, packet, length); +} + +static int eepro100_recv(struct eth_device *dev) +{ + struct eepro100_priv *priv = + container_of(dev, struct eepro100_priv, dev); + uchar *packet; + int ret; + + ret = eepro100_recv_common(priv, &packet); + if (ret > 0) + net_process_received_packet(packet, ret); + if (ret) + eepro100_free_pkt_common(priv); + + return ret; +} + int eepro100_initialize(bd_t *bis) { struct eepro100_priv *priv; From patchwork Sat May 23 16:38:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296747 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GW7G5Tdv; 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 49Tq3Q1sRPz9sPK for ; Sun, 24 May 2020 02:45:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A10181817; Sat, 23 May 2020 18:41:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GW7G5Tdv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71A4581734; Sat, 23 May 2020 18:39:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EEFF3813C6 for ; Sat, 23 May 2020 18:39:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ej1-x643.google.com with SMTP id x20so16357126ejb.11 for ; Sat, 23 May 2020 09:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=twLoPce7meZyCw2kKaIzx/8ijg2mh/hY6aWLSAl6cCY=; b=GW7G5TdvZLDiXzrTnoxptPZyR2uMtE4mydntlLNZx6DRQroi46Xmrvd3MxOnurBztL IQmw14kTmsKqTwSJu3KrUAqMK3j761ziahd+JbVIFB8AszOtETy6pCGGUcgZ9ytjbprv Rt4JZANWc0SamJsPDAj1buS7zlu/XMJVuQPK4Lb6sN9c/76Q18H1KLr+Pm0DWaNYbI4F tcx8x7GMPJXzFE/c56TWEnpbfRNAg7QhCy0To2XHvevWHbysyueZlcIUSXzg2E+fm878 gIZf/KdtWFs2STgPAEAg8AUjdkAsRgk29IXg/Vcub+dxA5gHA4HCSwgeR1D73pPIa1gl E32g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=twLoPce7meZyCw2kKaIzx/8ijg2mh/hY6aWLSAl6cCY=; b=aKGwu1GN+ctn0+Obpeo9KKMlZMJkj+FBfQSBLFUWi1+3Be/YPXExylYGKOvjGx9eZe 8Pq1Xzwq+vGQqQ+dPrFouWMELhG7xZSh4tyEZcjuDTBBVRQ1z1hLDnTlOCFAIlBRptQz tdR9w1PKjG7F5LFbEFsNxGuCMTQu15IKtf3EM+AcM1txOKE7GX1JcTCYuUJLlLNCO/ZY mxNq7YvCJiW42P1ovAbYeXMVIjWwLYKtQ/FQ0CamjEM1giEOgvYtIVI50A39OF7rJrkw uIG9Nz43oDvdnVfZ+vLCQEVeJrQozWmXZHWcQnta4FnZT3MgR647Jmq6uimekyyrtjn2 1MAg== X-Gm-Message-State: AOAM530ZP8FPYxJfOTp2k1A2PCIAEpi6iZorWzZcHe8hsG7tGAzK7Bv6 uMWoY9QCeTZuKCltzzTNRhQtC97w X-Google-Smtp-Source: ABdhPJwvrhmQPpGBeQu6qVyGhB2YHdRoXcBIJMmc1mRRJmQa7CI/JLV649K/RV74OAV2bpbWrE755A== X-Received: by 2002:a17:906:2e4a:: with SMTP id r10mr13558486eji.116.1590251973183; Sat, 23 May 2020 09:39:33 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:32 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 29/30] net: eepro100: Add DM support Date: Sat, 23 May 2020 18:38:36 +0200 Message-Id: <20200523163837.407592-29-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add support for driver model to the driver. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- drivers/net/eepro100.c | 129 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index f474832552..45ea3b70fc 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -206,14 +206,21 @@ struct eepro100_priv { /* TX descriptor ring pointer */ int tx_next; int tx_threshold; +#ifdef CONFIG_DM_ETH + struct udevice *devno; +#else struct eth_device dev; pci_dev_t devno; +#endif char *name; void __iomem *iobase; u8 *enetaddr; }; -#if defined(CONFIG_E500) +#if defined(CONFIG_DM_ETH) +#define bus_to_phys(dev, a) dm_pci_mem_to_phys((dev), (a)) +#define phys_to_bus(dev, a) dm_pci_phys_to_mem((dev), (a)) +#elif defined(CONFIG_E500) #define bus_to_phys(dev, a) (a) #define phys_to_bus(dev, a) (a) #else @@ -771,6 +778,7 @@ done: return; } +#ifndef CONFIG_DM_ETH static int eepro100_init(struct eth_device *dev, bd_t *bis) { struct eepro100_priv *priv = @@ -888,3 +896,122 @@ int eepro100_initialize(bd_t *bis) return card_number; } + +#else /* DM_ETH */ +static int eepro100_start(struct udevice *dev) +{ + struct eth_pdata *plat = dev_get_platdata(dev); + struct eepro100_priv *priv = dev_get_priv(dev); + + memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); + + return eepro100_init_common(priv); +} + +static void eepro100_stop(struct udevice *dev) +{ + struct eepro100_priv *priv = dev_get_priv(dev); + + eepro100_halt_common(priv); +} + +static int eepro100_send(struct udevice *dev, void *packet, int length) +{ + struct eepro100_priv *priv = dev_get_priv(dev); + int ret; + + ret = eepro100_send_common(priv, packet, length); + + return ret ? 0 : -ETIMEDOUT; +} + +static int eepro100_recv(struct udevice *dev, int flags, uchar **packetp) +{ + struct eepro100_priv *priv = dev_get_priv(dev); + + return eepro100_recv_common(priv, packetp); +} + +static int eepro100_free_pkt(struct udevice *dev, uchar *packet, int length) +{ + struct eepro100_priv *priv = dev_get_priv(dev); + + eepro100_free_pkt_common(priv); + + return 0; +} + +static int eepro100_read_rom_hwaddr(struct udevice *dev) +{ + struct eepro100_priv *priv = dev_get_priv(dev); + + eepro100_get_hwaddr(priv); + + return 0; +} + +static int eepro100_bind(struct udevice *dev) +{ + static int card_number; + char name[16]; + + sprintf(name, "eepro100#%u", card_number++); + + return device_set_name(dev, name); +} + +static int eepro100_probe(struct udevice *dev) +{ + struct eth_pdata *plat = dev_get_platdata(dev); + struct eepro100_priv *priv = dev_get_priv(dev); + u16 command, status; + u32 iobase; + int ret; + + dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &iobase); + iobase &= ~0xf; + + debug("eepro100: Intel i82559 PCI EtherExpressPro @0x%x\n", iobase); + + priv->devno = dev; + priv->enetaddr = plat->enetaddr; + priv->iobase = (void __iomem *)bus_to_phys(dev, iobase); + + command = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; + dm_pci_write_config16(dev, PCI_COMMAND, command); + dm_pci_read_config16(dev, PCI_COMMAND, &status); + if ((status & command) != command) { + printf("eepro100: Couldn't enable IO access or Bus Mastering\n"); + return -EINVAL; + } + + ret = eepro100_initialize_mii(priv); + if (ret) + return ret; + + dm_pci_write_config8(dev, PCI_LATENCY_TIMER, 0x20); + + return 0; +} + +static const struct eth_ops eepro100_ops = { + .start = eepro100_start, + .send = eepro100_send, + .recv = eepro100_recv, + .stop = eepro100_stop, + .free_pkt = eepro100_free_pkt, + .read_rom_hwaddr = eepro100_read_rom_hwaddr, +}; + +U_BOOT_DRIVER(eth_eepro100) = { + .name = "eth_eepro100", + .id = UCLASS_ETH, + .bind = eepro100_bind, + .probe = eepro100_probe, + .ops = &eepro100_ops, + .priv_auto_alloc_size = sizeof(struct eepro100_priv), + .platdata_auto_alloc_size = sizeof(struct eth_pdata), +}; + +U_BOOT_PCI_DEVICE(eth_eepro100, supported); +#endif From patchwork Sat May 23 16:38:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1296748 X-Patchwork-Delegate: joe.hershberger@gmail.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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rVr++H95; 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 49Tq3d67P5z9sPK for ; Sun, 24 May 2020 02:45:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2BC1C81CA0; Sat, 23 May 2020 18:41:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rVr++H95"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01FF78185E; Sat, 23 May 2020 18:39:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7010881777 for ; Sat, 23 May 2020 18:39:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@gmail.com Received: by mail-ed1-x544.google.com with SMTP id g9so11715913edw.10 for ; Sat, 23 May 2020 09:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ztFb2s6/O7Kb6Cn1PFszv2lBb/3iiUDezFpN+MKT0aQ=; b=rVr++H95L106c+mnUGNhvr0PWI+AxScdBvI0EDkyeSs0A39iJ7tRHsIT0Jm9Rs9ty9 n0DqhkoOkYDyFi+QOdr58fPWRH19MQ71LEgFLHIuZ9fN4SajssrBF6Biq9ellXiEmUf1 jgYj9fuEpCvTyggrzSO5ZN1gkHsdJXLNTsU6pN2nUJREk9Lg6SNaTJ7akyAQ7lyYmqlV GG4+oDxUcPSL2H9zk7m/6osCkLYg+Wh55NHcFmg/vHdAJ9t8ILY4eH75JjS3rICd+2nq Asb3a11Q7yvzPNgS6sHKZQESwZxLfPiq2GTtjJUwVYZPPntVbs844QzSEkAzGAnCj6ue EI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ztFb2s6/O7Kb6Cn1PFszv2lBb/3iiUDezFpN+MKT0aQ=; b=OkjZAibRrcOLZ3fRqgKdB30GMtDS6ta/IxCLWyZJip8ZILIuH5aZTZIbPZw+Wyg31p Oa3H7/q2MhN5UqKcSDRdICOcVJrXj+LlFu6A8gOZS175sF2nmi0xoff7AfpgbpOpCUmu r2EYw/i1Z+UlTFj45SMi+QV8r8OjtA/qcLwh/vlyoBI6nfP9IyvrikTYlBMEFVx+2gy1 ubMyAKtkMLNWhT510TfvWuWmTBQpcIBVbhGzT/Bjd8SjvPjTzcIzTI5uFdjNwrG3pXYs mhRWKh4hQzyxg+1BH4Dr94JRpbZOwTCZLKxueTZKz4Xcp1CobBzGW+4AsoX3XQzqBiZX lH4Q== X-Gm-Message-State: AOAM531Li3aLTm8iRTHMYvG7xOljPUD4U2bo18PMkCAzQEBkAOHYxlp0 RFZRVwzkQJW0mD33pqwzWD6mm0zz X-Google-Smtp-Source: ABdhPJy1WFdqm2m+XiZA9U0omFfOK6YbX38K22kRTsEpRpT83JbFkCi42UKl3NURkWR58ykILoiUJw== X-Received: by 2002:a05:6402:617:: with SMTP id n23mr7824036edv.107.1590251974440; Sat, 23 May 2020 09:39:34 -0700 (PDT) Received: from desktop.lan (ip-86-49-35-8.net.upcbroadband.cz. [86.49.35.8]) by smtp.gmail.com with ESMTPSA id p25sm10456174eds.76.2020.05.23.09.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 09:39:33 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, Marek Vasut Subject: [PATCH 30/30] net: eepro100: Add Kconfig entries Date: Sat, 23 May 2020 18:38:37 +0200 Message-Id: <20200523163837.407592-30-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> References: <20200523163837.407592-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add Kconfig entries for the eepro100 driver and convert various boards. Signed-off-by: Marek Vasut Reviewed-By: Ramon Fried --- README | 3 --- configs/MPC8315ERDB_defconfig | 1 + configs/TQM834x_defconfig | 1 + configs/integratorap_cm720t_defconfig | 1 + configs/integratorap_cm920t_defconfig | 1 + configs/integratorap_cm926ejs_defconfig | 1 + configs/integratorap_cm946es_defconfig | 1 + drivers/net/Kconfig | 6 ++++++ include/configs/MPC8315ERDB.h | 1 - include/configs/MPC8323ERDB.h | 1 - include/configs/MPC832XEMDS.h | 1 - include/configs/MPC8349EMDS.h | 1 - include/configs/MPC8349EMDS_SDRAM.h | 1 - include/configs/MPC837XEMDS.h | 1 - include/configs/MPC8536DS.h | 1 - include/configs/MPC8540ADS.h | 1 - include/configs/MPC8541CDS.h | 1 - include/configs/MPC8544DS.h | 1 - include/configs/MPC8548CDS.h | 1 - include/configs/MPC8555CDS.h | 1 - include/configs/MPC8560ADS.h | 1 - include/configs/MPC8568MDS.h | 1 - include/configs/MPC8569MDS.h | 1 - include/configs/MPC8572DS.h | 1 - include/configs/MPC8641HPCN.h | 1 - include/configs/TQM834x.h | 2 -- include/configs/caddy2.h | 1 - include/configs/integratorap.h | 1 - include/configs/sbc8349.h | 1 - include/configs/sbc8548.h | 1 - include/configs/sbc8641d.h | 1 - include/configs/vme8349.h | 1 - scripts/config_whitelist.txt | 1 - 33 files changed, 12 insertions(+), 29 deletions(-) diff --git a/README b/README index c4bb6f3e7b..0e48c2aa7c 100644 --- a/README +++ b/README @@ -889,9 +889,6 @@ The following options need to be configured: Allow generic access to the SPI bus on the Intel 8257x, for example with the "sspi" command. - CONFIG_EEPRO100 - Support for Intel 82557/82559/82559ER chips. - CONFIG_TULIP Support for Digital 2114x chips. diff --git a/configs/MPC8315ERDB_defconfig b/configs/MPC8315ERDB_defconfig index bbb79dff2e..d7981e9855 100644 --- a/configs/MPC8315ERDB_defconfig +++ b/configs/MPC8315ERDB_defconfig @@ -147,6 +147,7 @@ CONFIG_PHY_NATSEMI=y CONFIG_PHY_REALTEK=y CONFIG_PHY_SMSC=y CONFIG_PHY_VITESSE=y +CONFIG_EEPRO100=y CONFIG_MII=y CONFIG_TSEC_ENET=y CONFIG_SYS_NS16550=y diff --git a/configs/TQM834x_defconfig b/configs/TQM834x_defconfig index 96ce4de0e6..c29d8a8be1 100644 --- a/configs/TQM834x_defconfig +++ b/configs/TQM834x_defconfig @@ -159,6 +159,7 @@ CONFIG_PHY_NATSEMI=y CONFIG_PHY_REALTEK=y CONFIG_PHY_SMSC=y CONFIG_PHY_VITESSE=y +CONFIG_EEPRO100=y CONFIG_MII=y CONFIG_TSEC_ENET=y CONFIG_SYS_NS16550=y diff --git a/configs/integratorap_cm720t_defconfig b/configs/integratorap_cm720t_defconfig index f5f9cb28b3..1b7d672bcb 100644 --- a/configs/integratorap_cm720t_defconfig +++ b/configs/integratorap_cm720t_defconfig @@ -24,6 +24,7 @@ CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_EEPRO100=y CONFIG_PCI=y CONFIG_BAUDRATE=38400 CONFIG_OF_LIBFDT=y diff --git a/configs/integratorap_cm920t_defconfig b/configs/integratorap_cm920t_defconfig index 8a0ad1f948..116ac015a0 100644 --- a/configs/integratorap_cm920t_defconfig +++ b/configs/integratorap_cm920t_defconfig @@ -24,6 +24,7 @@ CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_EEPRO100=y CONFIG_PCI=y CONFIG_BAUDRATE=38400 CONFIG_OF_LIBFDT=y diff --git a/configs/integratorap_cm926ejs_defconfig b/configs/integratorap_cm926ejs_defconfig index ab61bf2ef4..9c1a3fa2f5 100644 --- a/configs/integratorap_cm926ejs_defconfig +++ b/configs/integratorap_cm926ejs_defconfig @@ -24,6 +24,7 @@ CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_EEPRO100=y CONFIG_PCI=y CONFIG_BAUDRATE=38400 CONFIG_OF_LIBFDT=y diff --git a/configs/integratorap_cm946es_defconfig b/configs/integratorap_cm946es_defconfig index 7af5433161..ee9c69bce0 100644 --- a/configs/integratorap_cm946es_defconfig +++ b/configs/integratorap_cm946es_defconfig @@ -24,6 +24,7 @@ CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=y CONFIG_SYS_FLASH_CFI=y +CONFIG_EEPRO100=y CONFIG_PCI=y CONFIG_BAUDRATE=38400 CONFIG_OF_LIBFDT=y diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f7855c92d3..c3e4510fa1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -192,6 +192,12 @@ config CMD_E1000 used on devices with SPI support you can reprogram the EEPROM from U-Boot. +config EEPRO100 + bool "Intel PRO/100 82557/82559/82559ER Fast Ethernet support" + help + This driver supports Intel(R) PRO/100 82557/82559/82559ER fast + ethernet family of adapters. + config ETH_SANDBOX depends on DM_ETH && SANDBOX default y diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index 2c35223868..cb4e96e966 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -239,7 +239,6 @@ #define CONFIG_PCI_INDIRECT_BRIDGE #define CONFIG_PCIE -#define CONFIG_EEPRO100 #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */ diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h index ff18d10872..4119ff5861 100644 --- a/include/configs/MPC8323ERDB.h +++ b/include/configs/MPC8323ERDB.h @@ -172,7 +172,6 @@ #define CONFIG_PCI_INDIRECT_BRIDGE #define CONFIG_PCI_SKIP_HOST_BRIDGE -#undef CONFIG_EEPRO100 #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */ diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h index bfcff2e4f8..7508566710 100644 --- a/include/configs/MPC832XEMDS.h +++ b/include/configs/MPC832XEMDS.h @@ -196,7 +196,6 @@ #define CONFIG_83XX_PCI_STREAMING -#undef CONFIG_EEPRO100 #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */ diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h index 0a80a60d30..df02d9ee7a 100644 --- a/include/configs/MPC8349EMDS.h +++ b/include/configs/MPC8349EMDS.h @@ -220,7 +220,6 @@ #define CONFIG_83XX_PCI_STREAMING -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/MPC8349EMDS_SDRAM.h b/include/configs/MPC8349EMDS_SDRAM.h index 79dd956174..5f9d9e10b6 100644 --- a/include/configs/MPC8349EMDS_SDRAM.h +++ b/include/configs/MPC8349EMDS_SDRAM.h @@ -275,7 +275,6 @@ #define CONFIG_83XX_PCI_STREAMING -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index 1254b4fc10..962bc92c5e 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -238,7 +238,6 @@ extern int board_pci_host_broken(void); #define CONFIG_USB_EHCI_FSL #define CONFIG_EHCI_HCD_INIT_AFTER_RESET -#undef CONFIG_EEPRO100 #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */ #endif /* CONFIG_PCI */ diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index 340574a985..62da11e4a1 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -466,7 +466,6 @@ #define CONFIG_SYS_ISA_IO_BASE_ADDRESS CONFIG_SYS_PCIE3_IO_VIRT #endif -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #ifndef CONFIG_PCI_PNP diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h index 2ba7322021..c5c6e2d69b 100644 --- a/include/configs/MPC8540ADS.h +++ b/include/configs/MPC8540ADS.h @@ -236,7 +236,6 @@ #define CONFIG_SYS_PCI1_IO_SIZE 0x100000 /* 1M */ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index b2a3201072..013bd775dd 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -282,7 +282,6 @@ extern unsigned long get_clock_freq(void); #define CONFIG_MPC85XX_PCI2 -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index c9f193fc46..1dd030842a 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -258,7 +258,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET #endif -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #ifndef CONFIG_PCI_PNP diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index de2bfd8f2f..e3044f0ae6 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -380,7 +380,6 @@ extern unsigned long get_clock_freq(void); #endif #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_DM_PCI) diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index d964b4e121..70289f570a 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -280,7 +280,6 @@ extern unsigned long get_clock_freq(void); #define CONFIG_MPC85XX_PCI2 -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h index 97d8cc48ed..fc4040907a 100644 --- a/include/configs/MPC8560ADS.h +++ b/include/configs/MPC8560ADS.h @@ -233,7 +233,6 @@ #define CONFIG_SYS_PCI1_IO_SIZE 0x100000 /* 1M */ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index a0bd5f4d40..60caea4a4c 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -290,7 +290,6 @@ extern unsigned long get_clock_freq(void); #endif /* CONFIG_QE */ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index beba848214..4d6a3d0a7d 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -396,7 +396,6 @@ extern unsigned long get_clock_freq(void); #endif /* CONFIG_QE */ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index 3243f39df4..bad9142921 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -443,7 +443,6 @@ #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET #endif -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #ifndef CONFIG_PCI_PNP diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index edbeeefdd4..78d1dd2c37 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -334,7 +334,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP /************************************************************ diff --git a/include/configs/TQM834x.h b/include/configs/TQM834x.h index 40fe62fdf0..d43d217956 100644 --- a/include/configs/TQM834x.h +++ b/include/configs/TQM834x.h @@ -167,8 +167,6 @@ #define CONFIG_SYS_PCI1_IO_PHYS CONFIG_SYS_PCI1_IO_BASE #define CONFIG_SYS_PCI1_IO_SIZE 0x1000000 /* 16M */ -#undef CONFIG_EEPRO100 -#define CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/caddy2.h b/include/configs/caddy2.h index 459712190a..e0449aa848 100644 --- a/include/configs/caddy2.h +++ b/include/configs/caddy2.h @@ -155,7 +155,6 @@ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/integratorap.h b/include/configs/integratorap.h index f15e08f397..0a8e945fa3 100644 --- a/include/configs/integratorap.h +++ b/include/configs/integratorap.h @@ -38,7 +38,6 @@ */ #define CONFIG_TULIP -#define CONFIG_EEPRO100 #define CONFIG_SYS_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */ /*----------------------------------------------------------------------- diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h index 55b9a3c182..9063139a04 100644 --- a/include/configs/sbc8349.h +++ b/include/configs/sbc8349.h @@ -180,7 +180,6 @@ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h index 55c4bff28a..503b9b1cb5 100644 --- a/include/configs/sbc8548.h +++ b/include/configs/sbc8548.h @@ -434,7 +434,6 @@ #endif #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h index 4ab364ae9a..66c1f3595b 100644 --- a/include/configs/sbc8641d.h +++ b/include/configs/sbc8641d.h @@ -276,7 +276,6 @@ #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h index c11507e550..708b4bd8e1 100644 --- a/include/configs/vme8349.h +++ b/include/configs/vme8349.h @@ -155,7 +155,6 @@ #if defined(CONFIG_PCI) -#undef CONFIG_EEPRO100 #undef CONFIG_TULIP #if !defined(CONFIG_PCI_PNP) diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 2dee446dde..720bd92cb7 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -400,7 +400,6 @@ CONFIG_EDB93XX_SDCS0 CONFIG_EDB93XX_SDCS1 CONFIG_EDB93XX_SDCS2 CONFIG_EDB93XX_SDCS3 -CONFIG_EEPRO100 CONFIG_EFLASH_PROTSECTORS CONFIG_EHCI_DESC_BIG_ENDIAN CONFIG_EHCI_HCD_INIT_AFTER_RESET