From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00442C43219 for ; Wed, 27 Apr 2022 10:43:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1529683ECC; Wed, 27 Apr 2022 12:42:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="k1xVU2ri"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B8B383E7F; Wed, 27 Apr 2022 12:42:28 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B4DA583E7F for ; Wed, 27 Apr 2022 12:42:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6BEF0B82530; Wed, 27 Apr 2022 10:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A2F8C385A7; Wed, 27 Apr 2022 10:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651056138; bh=L2PqYn0Ng/4p43A3+enT/XgLv5KqB0npQKRMHVCUR9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1xVU2ri+WZp5Z75lLuCy2zONx8KzbDgND6SSzpu+GUCMrHeQ1n3v681nfS+a21+E +7tYiLs/n4tZ4UBVVqXm27c7bKtPnj+LzBfn8UQA8YnH/BR2eTpcOtL0sb4uQL7bJy 26n53AysKS/I6eKJ/Y011z33It4ga4lSP/vVOqDNkqDqoyJvDsq287/YBnmNTnVZAW h3dkHpNfaryU3e0cz/rGCHslDSxWXYo86yz9KMtQsULUzku1ihSDeszqxcsjHc9pKP pMEdo2DTnesx5pVkSZ8hBne6Jd5o1VkdsLzix/Vn8uTigpqe1MUivzuk0PqY67Ptgb 7WfH4YKRa0ZCg== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Stefan Roese Cc: Robert Marko , =?UTF-8?q?Pali=20Roh=C3=A1r?= , U-Boot-Denx , Ramon Fried , Joe Hershberger , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 04/19] net: mvneta: Remember fixed link instead of PHY address in priv data Date: Wed, 27 Apr 2022 12:41:47 +0200 Message-Id: <20220427104202.1205-5-kabel@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427104202.1205-1-kabel@kernel.org> References: <20220427104202.1205-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn We don't need to remember PHY address anymore, because since using DM MDIO for connecting PHY, the address is parsed by mdio-uclass from the ofnode. But the driver uses a special value of the address to signal fixed link usage. Drop phyaddr add fixed_link in driver private structure. This simplifies code a little. Signed-off-by: Marek BehĂșn --- drivers/net/mvneta.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 24a491dcde..83e9629138 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -277,12 +277,12 @@ struct mvneta_port { u16 rx_ring_size; phy_interface_t phy_interface; + bool fixed_link; unsigned int link; unsigned int duplex; unsigned int speed; int init; - int phyaddr; struct phy_device *phydev; #if CONFIG_IS_ENABLED(DM_GPIO) struct gpio_desc phy_reset_gpio; @@ -576,13 +576,6 @@ static void mvneta_rxq_buf_size_set(struct mvneta_port *pp, mvreg_write(pp, MVNETA_RXQ_SIZE_REG(rxq->id), val); } -static int mvneta_port_is_fixed_link(struct mvneta_port *pp) -{ - /* phy_addr is set to invalid value for fixed link */ - return pp->phyaddr > PHY_MAX_ADDR; -} - - /* Start the Ethernet port RX and TX activity */ static void mvneta_port_up(struct mvneta_port *pp) { @@ -834,7 +827,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) mvreg_write(pp, MVNETA_SDMA_CONFIG, val); /* Enable PHY polling in hardware if not in fixed-link mode */ - if (!mvneta_port_is_fixed_link(pp)) { + if (!pp->fixed_link) { val = mvreg_read(pp, MVNETA_UNIT_CONTROL); val |= MVNETA_PHY_POLLING_ENABLE; mvreg_write(pp, MVNETA_UNIT_CONTROL, val); @@ -1173,7 +1166,7 @@ static void mvneta_adjust_link(struct udevice *dev) struct phy_device *phydev = pp->phydev; int status_change = 0; - if (mvneta_port_is_fixed_link(pp)) { + if (pp->fixed_link) { debug("Using fixed link, skip link adjust\n"); return; } @@ -1548,7 +1541,7 @@ static int mvneta_start(struct udevice *dev) mvneta_port_power_up(pp, pp->phy_interface); if (!pp->init || pp->link == 0) { - if (mvneta_port_is_fixed_link(pp)) { + if (pp->fixed_link) { u32 val; pp->init = 1; @@ -1698,7 +1691,6 @@ static int mvneta_probe(struct udevice *dev) void *blob = (void *)gd->fdt_blob; int node = dev_of_offset(dev); struct mii_dev *bus; - unsigned long addr; void *bd_space; int ret; int fl_node; @@ -1742,14 +1734,9 @@ static int mvneta_probe(struct udevice *dev) fl_node = fdt_subnode_offset(blob, node, "fixed-link"); if (fl_node != -FDT_ERR_NOTFOUND) { /* set phy_addr to invalid value for fixed link */ - pp->phyaddr = PHY_MAX_ADDR + 1; pp->duplex = fdtdec_get_bool(blob, fl_node, "full-duplex"); pp->speed = fdtdec_get_int(blob, fl_node, "speed", 0); - } else { - /* Now read phyaddr from DT */ - addr = fdtdec_get_int(blob, node, "phy", 0); - addr = fdt_node_offset_by_phandle(blob, addr); - pp->phyaddr = fdtdec_get_int(blob, addr, "reg", 0); + pp->fixed_link = true; } bus = mdio_alloc(); -- 2.35.1