From patchwork Sun Jul 14 00:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131675 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=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c9SebeAj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS8l0VZGz9sDQ for ; Sun, 14 Jul 2019 10:24:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AAF53C21E08; Sun, 14 Jul 2019 00:21:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 58821C21DA1; Sun, 14 Jul 2019 00:20:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 376EFC21DD4; Sun, 14 Jul 2019 00:19:58 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 23901C21C50 for ; Sun, 14 Jul 2019 00:19:55 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id v15so11893723wml.0 for ; Sat, 13 Jul 2019 17:19:55 -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; bh=xHl0j8ZwNq2/zTXkp/K2agS8DKyWZiD0m43JDav64DY=; b=c9SebeAj1H6ks25SKgIbxQFfS92mX2SF1Tp0rT0LMyAC5uaLBSrH/h69RpKtuPFO7p VGQ/QjEpEITm92hJhkdKS7BqOtK+SV0vzcA50pXO5OnNnd/6aXPuVWs81fo8y8/q0ugH T902diigUlGMjJ8s2AyUOMLZLAZYRZTGFo9/mCbIPhIPSa92fR1Bmin2C/h/2DLAnnkL +/XQPAVdJPMq+ngLD9P+FTdaxpeaJGL5tZAr9UPS6gYMCVeRGfXqfmrEHLpdJAHIsc38 sSIoeYUJinrxWoxwGhGHnLzNdi/clErkXDip/XpJoYX8KMKIVxD66v6lxqIUwpeekfnI MuHg== 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; bh=xHl0j8ZwNq2/zTXkp/K2agS8DKyWZiD0m43JDav64DY=; b=ksh1gFuy/TbaeNVuVvoodrSEMTluj0zph69ZSAzwTAMgIEHTRUvMwN4gdWamMhaQdj wOnflIamPRmeFRV7W4PTXhO9+voiVgTy2y3cYVB1U2IZNcrp21/U6aAdJ/MjMs0VkSLf FmEQnQfsuRCyY8n0mHXRISEGVVONppPLYgUREfK/poUf/0vNq4hmH5y0wkbhT37SPd0F FiJlDpcneK13TFMKAnQ4X0Bu2KGSvOpKqbT5bg2V/m/YRB0lv8QYwfTTXCAEdiosw7WJ R+Kdb3z7pmUr6twowBIQGnykOpiPhdAzh9QSBugYDJ+ugaQC9E3jASwqoRh61XbM7+4p CvVw== X-Gm-Message-State: APjAAAWMsT+2VkcEBz6Ts22N8yL6AE3xUyyfDlAOSIEbcXSajI/azdLO CQUu0WTK1m7AX7GWub4Z85M= X-Google-Smtp-Source: APXvYqxnZ5AYaxe/DtZGPrEyf0CXOvRmPhFXC3smoVR7DnnvpT4Kz9qYCyvnsQ4OXK0CgniI3BMiig== X-Received: by 2002:a1c:c706:: with SMTP id x6mr15732562wmf.162.1563063594778; Sat, 13 Jul 2019 17:19:54 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:54 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:57 +0300 Message-Id: <20190714001701.2781-6-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 5/9] net: tsec: Common handling of MAC station address for DM_ETH X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In tsec_init, the MAC address is retrieved from 2 different structures depending on whether DM_ETH is enabled or not. But since the field name is the same inside both structures, we can conditionally define the structure of the correct type and simplify the assignments. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 1e20fe4cd246..f6278817330d 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -560,6 +560,8 @@ static int tsec_init(struct udevice *dev) struct tsec_private *priv = (struct tsec_private *)dev->priv; #ifdef CONFIG_DM_ETH struct eth_pdata *pdata = dev_get_platdata(dev); +#else + struct eth_device *pdata = dev; #endif struct tsec __iomem *regs = priv->regs; u32 tempval; @@ -580,21 +582,12 @@ static int tsec_init(struct udevice *dev) * order (BE), MACnADDR1 is set to 0xCDAB7856 and * MACnADDR2 is set to 0x34120000. */ -#ifndef CONFIG_DM_ETH - tempval = (dev->enetaddr[5] << 24) | (dev->enetaddr[4] << 16) | - (dev->enetaddr[3] << 8) | dev->enetaddr[2]; -#else tempval = (pdata->enetaddr[5] << 24) | (pdata->enetaddr[4] << 16) | (pdata->enetaddr[3] << 8) | pdata->enetaddr[2]; -#endif out_be32(®s->macstnaddr1, tempval); -#ifndef CONFIG_DM_ETH - tempval = (dev->enetaddr[1] << 24) | (dev->enetaddr[0] << 16); -#else tempval = (pdata->enetaddr[1] << 24) | (pdata->enetaddr[0] << 16); -#endif out_be32(®s->macstnaddr2, tempval);