From patchwork Fri Nov 17 10:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 166086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp422767vqn; Fri, 17 Nov 2023 02:11:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGV3CdaXpYtdJlehjlC8jza73DSGO9tIJu6EX882py61qR8vNgZs9ozkZGzj8IohCsz1BF4 X-Received: by 2002:a05:6e02:148f:b0:351:5322:b820 with SMTP id n15-20020a056e02148f00b003515322b820mr25511832ilk.11.1700215859781; Fri, 17 Nov 2023 02:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700215859; cv=none; d=google.com; s=arc-20160816; b=VC7x7CCg4+4F9EV57xUG34hJRIQe3WY4OX/pK3YO5rWc3N0V2+Ow2x1Cw3c1vQqNwn 9Mg6e+jVDAyOyw0OiiYAfe/NTF/J+QINvgZLaBPhAWYcXbf7WCcaghLP2PW1Z//vQt57 59VMVfHzXeHDhB41SCD8tiqUWfSrDn1oWO+P0rB7M6WaZKN3Sm2tlm5KnB6W7GLrT7W8 Klr8Ck2+ahlUjuTOEgEtf5M3XxHZpim690fibw4WmrAsQ7B60xXSVZNHtz6T3A4mEqdk SQvU4Ahr8NBL0ElrqtaO1pl/CRLYq7WV7leYxj2f85Xfgse6UzeQf10IOuYQ9k0NZ2bt y4nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EbmgR2wWjkRCjoHXAmGAF8yTKa5Bp0SAasTthhu3X1w=; fh=Pjsyd7NRaiCeIBGjME77yFlHk2byuPh+3fTNnOkAbUA=; b=PoPwKmLAdE5RoY3IR66zuJoQZ4qwYvq00UHGSYTRmLmh8xC6mu/zRXZuuG//HKKWls OhxQZGWcze2ULzbhWP2ynSUwiyfXtuJAHVj9myR1qcAx+fuOyH2E8V52HkptqC6fN1sC d8v7gMQTZGdl847VuVqyK5VZsW9Hb0eQJNvMWmaPSNB17bdM0Ivjp+rMDkZisy9FOmnX iDOW1+M2Fm+E9muMgsSt51iDrQpHn/NTBBWnhj5h7Y8Cs+riMrOFd3hwAlETKNy9oLlG n7BNkbFlEiDB9KACTTijcUrwOXzmWadN7tKNt4tJgU8Br2Q3qCNYE1XwNN6NdZZgQTbb k8gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bWXrr3m9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x10-20020a056a00188a00b006c31c0e909dsi1673818pfh.32.2023.11.17.02.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 02:10:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bWXrr3m9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 24B148068FC4; Fri, 17 Nov 2023 02:10:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345765AbjKQKKJ (ORCPT + 30 others); Fri, 17 Nov 2023 05:10:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345722AbjKQKKI (ORCPT ); Fri, 17 Nov 2023 05:10:08 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5D2C1; Fri, 17 Nov 2023 02:10:04 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-53dd752685fso2617591a12.3; Fri, 17 Nov 2023 02:10:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700215802; x=1700820602; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EbmgR2wWjkRCjoHXAmGAF8yTKa5Bp0SAasTthhu3X1w=; b=bWXrr3m9qWsYYNPIrD4Qy0lCRISA9hZF8/VR9jGw1uRLQbu89Iwa0f6Lf0reMCK0nv dESP82PsWqLfyLIOx8NYFXQ1RyzKD7SZQ/BdWQ7L/29BpFyVJ+SEYfMA/1w+vGSoJ2JZ HmntYV4Ku0JygIFNOuoIs6/kYn4W1NBG0DS5Xik7qi7poa+Qe+DYSAaL1BU49EuG6Gtb 0mKCOzavECCZPLRWUDTxyJLpwn5R2wA6SAQnyn1IzADCb+CxwhFZtrrNWuO3kmYSonS2 M9iVz0kcLhRARSWtrmDuCTa0581NAOMjEvyVktF9eAGSrYQC/HswjT+qhZTwffhNfwrb Mx/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700215802; x=1700820602; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EbmgR2wWjkRCjoHXAmGAF8yTKa5Bp0SAasTthhu3X1w=; b=wFiyVrXDWnxdsiuecHnIFz/WKeCw8xwd0P3pfnE1+o1rmIAo4LGJQUrUqFCFLPB3mE fecBUfWU+GlE97//Dhls7VHN0BeeG6NKxfDBZ0TDKmGFqSc0P/qA7X4qJMMih9qG1nQY 7WHPDQ65IK8+sbBoU4kETgaom3hgnu1Ju0nZuA8VKRI/FexLmo1ddNRADR15i8AQN6dk d9zC9D/R6b4IqWnaq2WrzkN0ImUqRzZx+kqEmux51D0r4PDr3R+nGlO5X8u33XH+Kk1s yTWwtZzIkD3BqfL87Cq/+6ZhUBSPliH4QRkJCfUU7URSRkG29hhWohRCptA6dg0HBUs9 Z/5Q== X-Gm-Message-State: AOJu0YzY2J6BuS54HgtQHyenfwqn5qU1Usp9scug34d8CaXwLGkvlbBy yW9Hxv4vev4Eg5zShdaZUfQ= X-Received: by 2002:a17:906:eb11:b0:9e3:f24d:5496 with SMTP id mb17-20020a170906eb1100b009e3f24d5496mr11799779ejb.28.1700215801929; Fri, 17 Nov 2023 02:10:01 -0800 (PST) Received: from fedora.. (dh207-97-146.xnet.hr. [88.207.97.146]) by smtp.googlemail.com with ESMTPSA id u22-20020a17090617d600b009e5e4ff01d4sm610599eje.129.2023.11.17.02.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 02:10:00 -0800 (PST) From: Robert Marko To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ansuelsmth@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Robert Marko Subject: [PATCH net-next 1/2] net: phy: aquantia: validate PHY mode on AQR107 Date: Fri, 17 Nov 2023 11:09:48 +0100 Message-ID: <20231117100958.425354-1-robimarko@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 02:10:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782805436431152839 X-GMAIL-MSGID: 1782805545720236820 The Aquantia driver is not setting the PHY mode itself, but it does however still check if the PHY mode set in DTS is one of the supported modes. However, the set PHY mode does not have to match the actual one, so lets add update the PHY mode during .config_init and warn if they differ. Signed-off-by: Robert Marko --- drivers/net/phy/aquantia/aquantia_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index cc4a97741c4a..7711e052e737 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -505,6 +505,21 @@ static void aqr107_chip_info(struct phy_device *phydev) fw_major, fw_minor, build_id, prov_id); } +static void aqr107_validate_mode(struct phy_device *phydev, + phy_interface_t dts_mode) +{ + int ret; + + /* Get the actual PHY mode */ + ret = aqr107_read_status(phydev); + if (ret) + return; + + if (dts_mode != phydev->interface) + phydev_info(phydev, "%s mode is set in DTS while %s mode is actual. Please update your devicetree.\n", + phy_modes(dts_mode), phy_modes(phydev->interface)); +} + static int aqr107_config_init(struct phy_device *phydev) { int ret; @@ -528,6 +543,8 @@ static int aqr107_config_init(struct phy_device *phydev) if (!ret) aqr107_chip_info(phydev); + aqr107_validate_mode(phydev, phydev->interface); + return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); }