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 D3DBDC77B7E for ; Thu, 1 Jun 2023 10:02:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 871CF862F7; Thu, 1 Jun 2023 12:01:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1685613664; bh=sVS2Wvy6sEZW0g0V/sgWZr2NvHeNmP3scCVfffFUmH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=snTw6hqc5SoQFd1RgP2oR3xDhAsexgZp6aQfgTds7dQXUjfrIhFarU3X8wUQ9lnkC VVl6yVUtbMkwpzgMJgMqDzR6RP5+jwrxQF2m52u2bxttVs4CtUxv5xHnARFFmB3S+0 dQWawBRMEqAjnr8oUGhlcFUXmKSLj34Zcvj7aj83oy2qTn7tiHRFjM4e7kB6SsME6y aD4ESbx88IgVviILIKjpefiQgSoEwC4uzaQF1RYJW2tQQQaaaJmNZmrzVLT9Zkf82u 550ZXNjsrOZSpuOHNuSHWeBOxoesxGwlCZPBb1sPGoOeZ8tviwK6hKtgRjpQKWmSgY CMZlqCiOrNUQA== Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 4DF21862D7; Thu, 1 Jun 2023 12:00:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1685613631; bh=sVS2Wvy6sEZW0g0V/sgWZr2NvHeNmP3scCVfffFUmH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=opEdY5ops8BuTVME9FJnUawU9uWynkkYPZPj9PyWcMRgltd9yhhzzZ20PgRDlQk4G Ztf+67968gnlizterrvYz+7Whv9Ufq+zRvmwwpGa/LydRB3qnUJHvlGS7I07wD4/FW kZ66CEPz1DQtROgo5ewWrb2IDqys77vD7CZHVu43WpBV/sevJgoMd9itDxMx5enJI4 rCla/AexmK9UdYsX+bX41GTaKqbeNaHk+jIHlAd9h4em7lgpQ3r/V2fsGiBPKJGFBj EEvo6JeTFLrXans+xg/WWLRo3REF4n8JY8yw+DcslEUrkCTqh6xhEC/J70nLqh5q72 TQo4FI2QatF4Q== From: Lukasz Majewski To: u-boot@lists.denx.de, Tom Rini Cc: Anatolij Gustschin , Lukasz Majewski , Ramon Fried , Joe Hershberger , Marek Vasut , Michal Simek Subject: [PATCH v1 4/6] net: mv88e61xx: Directly access the switch chip Date: Thu, 1 Jun 2023 12:00:03 +0200 Message-Id: <20230601100005.2216345-5-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230601100005.2216345-1-lukma@denx.de> References: <20230601100005.2216345-1-lukma@denx.de> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean The mv88e6020 is accessed in a direct way (i.e. with direct read and write to mdio bus). The only necessary indirection is required when accessing its PHY registers. Signed-off-by: Lukasz Majewski Reviewed-by: Ramon Fried --- drivers/net/phy/mv88e61xx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c index c19c3dfa8b6d..c9917953f3d7 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -261,8 +261,11 @@ static int mv88e61xx_reg_read(struct phy_device *phydev, int dev, int reg) int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) + /* + * In single-chip or dual-chip (like mv88e6020) mode, the device can + * be addressed directly. + */ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->read(mdio_bus, dev, MDIO_DEVAD_NONE, reg); /* Wait for the bus to become free */ @@ -298,11 +301,13 @@ static int mv88e61xx_reg_write(struct phy_device *phydev, int dev, int reg, int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) { + /* + * In single-chip or dual-chip (like mv88e6020) mode, the device can + * be addressed directly. + */ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->write(mdio_bus, dev, MDIO_DEVAD_NONE, reg, val); - } /* Wait for the bus to become free */ res = mv88e61xx_smi_wait(mdio_bus, smi_addr); -- 2.30.2