From patchwork Tue Nov 8 08:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13036014 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 626CEC433FE for ; Tue, 8 Nov 2022 08:24:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232654AbiKHIX6 (ORCPT ); Tue, 8 Nov 2022 03:23:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233274AbiKHIXv (ORCPT ); Tue, 8 Nov 2022 03:23:51 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D29427B1C for ; Tue, 8 Nov 2022 00:23:50 -0800 (PST) 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 C045A84F34; Tue, 8 Nov 2022 09:23:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1667895829; bh=+9d0loleSBLQE3udcwHEbOBMYujfJ70ZJ0Qtzvonwjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0NUSEStZEFtCdG7zqwmp7rE4jSis1rGaN/VEMk5bwBoRjcgfAtH7XoAisYrwgDcp 0o6lt8fA/N77KvVQFalUHbh9gALISLyI2t9j7h+nYuXitCGJxMsIAxBaqBT1UdEIAL BnX4BkrZ5G+HeSqEbLMeDhHATUjPQS3fHrRK2ANOWp7/0pBur5nfSLdYsRQPbENGmm 9T29UM3+ORzhTrTmeaG/SozNdNtL0zRrQX6Bm02h2Ew0KL19iUtBaAfvLnzhNOipQn CHsXhGfrAgzPliS8n+HiUbWaN2gpjOI5iiUHgRcKOqTccH8kcGdvaHErvE6jgIoq2B Z8k9R7LK7c3IQ== From: Lukasz Majewski To: Andrew Lunn , Vivien Didelot Cc: Florian Fainelli , Vladimir Oltean , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Matthias Schiffer Subject: [PATCH 3/9] net: dsa: mv88e6xxx: implement get_phy_address Date: Tue, 8 Nov 2022 09:23:24 +0100 Message-Id: <20221108082330.2086671-4-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221108082330.2086671-1-lukma@denx.de> References: <20221108082330.2086671-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matthias Schiffer Avoid the need to specify a PHY for each physical port in the device tree when phy_base_addr is not 0 (6250 and 6341 families). This change should be backwards-compatible with existing device trees, as it only adds sensible defaults where explicit definitions were required before. Signed-off-by: Matthias Schiffer --- drivers/net/dsa/mv88e6xxx/chip.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 2479be3a1e35..d51fd1966be9 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -6362,6 +6362,13 @@ static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, return chip->tag_protocol; } +static int mv88e6xxx_get_phy_address(struct dsa_switch *ds, int port) +{ + struct mv88e6xxx_chip *chip = ds->priv; + + return chip->phy_base_addr + port; +} + static int mv88e6xxx_change_tag_protocol(struct dsa_switch *ds, enum dsa_tag_protocol proto) { @@ -6887,6 +6894,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { .phylink_mac_link_up = mv88e6xxx_mac_link_up, .get_strings = mv88e6xxx_get_strings, .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, + .get_phy_address = mv88e6xxx_get_phy_address, .get_sset_count = mv88e6xxx_get_sset_count, .port_enable = mv88e6xxx_port_enable, .port_disable = mv88e6xxx_port_disable,