From patchwork Tue Mar 2 15:34:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1446121 X-Patchwork-Delegate: priyanka.jain@nxp.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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=pWYnlRO8; 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 4Dqh9b0GMtz9sS8 for ; Wed, 3 Mar 2021 02:38:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F29C2827BE; Tue, 2 Mar 2021 16:36:37 +0100 (CET) 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="pWYnlRO8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 458D682834; Tue, 2 Mar 2021 16:36:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-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-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 6AAD082828 for ; Tue, 2 Mar 2021 16:36:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x430.google.com with SMTP id e3so10066411pfj.6 for ; Tue, 02 Mar 2021 07:36:27 -0800 (PST) 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=dYUrPIM7c44DLntKUmcUGcs2g5P2AQymaF7PKEIYsjY=; b=pWYnlRO8qPoK7oGExjtK/sX5k7DoqbdFAb0PMYukr0bAwG2a2pQISUbxAphTsYhsYE wcdr1kWbxeAo4pq2co2zWs9h/Y2ycl5faDIfsaa24eZLDALIFpAdVDGHHm0xen0zR3JR AiHWk9FdVin9vdSdZz2y5Y/OXPZ3Q3/k/aJqQ7TCqksW7JHPdmlsYW/Coa9zOJJPeIXm QnEyAhcItkJPp9mhqyH/2hGa/Jcme6BFJ7+LPEPLyHzIfcE4QO8fLSlld0EmODla3EK9 yQSBb3flg+KUZWTrfDAzDLScmgQUf9YhLJ50WTz7zBH57vMiHwcMIG1mheUEZShn33PS CkJA== 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=dYUrPIM7c44DLntKUmcUGcs2g5P2AQymaF7PKEIYsjY=; b=oGqN9LTUnrqCTIf0nX2aCsSOrpNffXfljgeuYgsEbm7Oepx73ZSbi7pbN6jVIRE1jK xN2k/0TtIhnNX3CJZJZ+dmSVs3LdR8l4uDGgUHWGNCm4kKvfPz4keGk10e/zh3UcUZJp U7YONnxjXLIZEzI1FqfhGRoZznb6jrY7WD55Ggk+jts9sUVBeRLDkv2xgL6AV9xwcaSL /HDA58fXMLuAStIrDd1WvTxVAA1y88l7gqBhkJX7YTQc+FrcIfDdA9yWI814WcAoZuNM dy0wDfwmW7Mjw5Nm52UItmkBHTk2WG3G2dQTmiGktuKM+lV2hzdrTZp5DBI378JZ4yjw oL7w== X-Gm-Message-State: AOAM533P2kXJyGhbaFAnRvj7D058IuAf6Mu18FUKwejsmn8KEr9USF1l gfgoWLHmGk+PtrmOT73mdW4= X-Google-Smtp-Source: ABdhPJwTD97xPeU2912tIE//9nF+YzeyYWjmGjt9OwhqEnM8dzynOdRSwGGOdGEETiY2fb6QphpfDg== X-Received: by 2002:a63:ee4e:: with SMTP id n14mr18493023pgk.422.1614699386018; Tue, 02 Mar 2021 07:36:26 -0800 (PST) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id mm12sm3541139pjb.49.2021.03.02.07.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 07:36:25 -0800 (PST) From: Bin Meng To: Priyanka Jain , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Alexander Graf , Bin Meng , Joe Hershberger , Ramon Fried Subject: [PATCH 15/20] net: tsec: Support property from the subnode "queue-group" Date: Tue, 2 Mar 2021 23:34:46 +0800 Message-Id: <20210302153451.19440-16-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210302153451.19440-1-bmeng.cn@gmail.com> References: <20210302153451.19440-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present the tsec driver uses a non-standard DT bindings to get its base / size. The upstream Linux kernel seems to require the base / size to be put under a subnode of the eTSEC node with a name prefix "queue-group". This is not documented in the kernel DT bindings, but it looks every dtsi file that contains the eTSEC node was written like this. This commit updates the tsec driver to handle this case. Signed-off-by: Bin Meng Reviewed-By: Ramon Fried --- drivers/net/tsec.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 24f9962b82..5012cd29f1 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -831,13 +831,35 @@ int tsec_probe(struct udevice *dev) struct tsec_data *data; const char *phy_mode; fdt_addr_t reg; - ofnode parent; + ofnode parent, child; int ret; data = (struct tsec_data *)dev_get_driver_data(dev); pdata->iobase = (phys_addr_t)dev_read_addr(dev); - priv->regs = dev_remap_addr(dev); + if (pdata->iobase != FDT_ADDR_T_NONE) { + priv->regs = dev_remap_addr(dev); + } else { + ofnode_for_each_subnode(child, dev_ofnode(dev)) { + if (!strncmp(ofnode_get_name(child), "queue-group", + strlen("queue-group"))) { + reg = ofnode_get_addr(child); + if (reg == FDT_ADDR_T_NONE) { + printf("No 'reg' property of \n"); + return -ENOENT; + } + pdata->iobase = reg; + priv->regs = map_physmem(pdata->iobase, 0, + MAP_NOCACHE); + break; + } + } + + if (!ofnode_valid(child)) { + printf("No child node for ?\n"); + return -ENOENT; + } + } ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, &phandle_args);