From patchwork Wed Jun 16 19:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325801 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 X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A8FC48BE5 for ; Wed, 16 Jun 2021 19:08:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72F5F61246 for ; Wed, 16 Jun 2021 19:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232395AbhFPTKe (ORCPT ); Wed, 16 Jun 2021 15:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbhFPTK3 (ORCPT ); Wed, 16 Jun 2021 15:10:29 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 007DAC06175F for ; Wed, 16 Jun 2021 12:08:22 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id q20so6066402lfo.2 for ; Wed, 16 Jun 2021 12:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TveMsDiAYx4LUYO2CwQNe1XuHAWA/htRnEHF57RNIUk=; b=GRsi4mjEdWOx+gMqyTrmBY/2Gv/cbZtMo8YR7hmlhMP3rs6fRBZW9ugznhpZ4OMTJW k7dDYwiKDz96MZXNrcZfJ+N2UwllLAZLSD9wHfog3GDFsCGRtB/a6DH/q2flC3SSelfx AKwV8qH/zbot4YVVtuuxZQW3OpTAY1y811nftEGil1NNVEB2gZPFY7ujBW4Wv62CqR1l 2ok8+Y/Z0rKhWRGqiPncLWGyG98wd07AxEcS3sBZ2AICzfJuE/+6d7jtvQBzfcU+3m7r 47pgvTd68nrb/bAD9wi02PDqfurlGV9NdKd8mBpR3HmFXpMiRFgXspWOEYqCq6FJgRvT VtHw== 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=TveMsDiAYx4LUYO2CwQNe1XuHAWA/htRnEHF57RNIUk=; b=GcoKFG1dvf0lh4vF5nu+DBVLEkKhfOi46H1GEx/cfi+lsHS2gclvpe+SdJw/t5+aux VC0YTkG0ba59l/WA/Hwvy1OlPE4Aw+9aIeQnlaJDwTvlGSR8wyijz0QEVCWSfGN2AT4j e8+WqAtgPatKaqJSVnrdLSWRa8SbvT6rK/eRzDzSk57LjYaJkDVv7VAPjQkE3LMbvB8e o9kOHD1baNflH5RTaR7jerHvf0FWVjS1Xl223x7tkbpxf9tuvuLi9ROxF6Tocdk6vgNm C/b/IAJ2NG0q95y+XQuJ3ySWBMwwQ64r0z8UvY5Tb2KjxoKBlraZH/8shCqzGqnMKn+B OnVA== X-Gm-Message-State: AOAM532e99MEAHAqKT3Eg4sfnSgfFpxPiIce9RIw9P7KL/G6BcOYtzIp tkeg1jAn0KaaCggP/t8v4bJ2tg== X-Google-Smtp-Source: ABdhPJxbTIBuB3iEoPlYr9f6hNq0NoROhaoCgimHWQJyrfe0VIVNfHnaNP74V5TZrbypNgG5vgnfzA== X-Received: by 2002:a05:6512:3a85:: with SMTP id q5mr887099lfu.404.1623870501251; Wed, 16 Jun 2021 12:08:21 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:20 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 1/7] Documentation: ACPI: DSD: describe additional MAC configuration Date: Wed, 16 Jun 2021 21:07:53 +0200 Message-Id: <20210616190759.2832033-2-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Document additional MAC configuration modes which can be processed by the existing fwnode_ phylink helpers: * "managed" standard ACPI _DSD property [1] * "fixed-link" data-only subnode linked in the _DSD package via generic mechanism of the hierarchical data extension [2] [1] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf [2] https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.pdf Signed-off-by: Marcin Wojtas --- Documentation/firmware-guide/acpi/dsd/phy.rst | 55 ++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Documentation/firmware-guide/acpi/dsd/phy.rst b/Documentation/firmware-guide/acpi/dsd/phy.rst index 7d01ae8b3cc6..839710b94a7f 100644 --- a/Documentation/firmware-guide/acpi/dsd/phy.rst +++ b/Documentation/firmware-guide/acpi/dsd/phy.rst @@ -49,6 +49,21 @@ phy-mode The "phy-mode" _DSD property is used to describe the connection to the PHY. The valid values for "phy-mode" are defined in [4]. +managed +------- +Optional property, which specifies the PHY management type. +The valid values for "managed" are defined in [4]. + +fixed-link +---------- +The "fixed-link" is described by a the data-only subnode of the +MAC port, which is linked in the _DSD package via +hierarchical data extension (UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b +in accordance with [5] "_DSD Implementation Guide" document). +The subnode should comprise a required property ("speed") and +possibly the optional ones - complete list of parameters and +their values are specified in [4]. + The following ASL example illustrates the usage of these properties. DSDT entry for MDIO node @@ -121,6 +136,44 @@ phy-mode and phy-handle are used as explained earlier. }) } +MAC node example where "managed" property is specified. +------------------------------------------------------- +:: + Scope(\_SB.PP21.ETH0) + { + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () {"phy-mode", "sgmii"}, + Package () {"managed", "in-band-status"} + } + }) + } + +MAC node example with a "fixed-link" subnode. +--------------------------------------------- +:: + Scope(\_SB.PP21.ETH1) + { + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () {"phy-mode", "sgmii"}, + }, + ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), + Package () { + Package () {"fixed-link", "LNK0"} + } + }) + Name (LNK0, Package(){ // Data-only subnode of port + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () {"speed", 1000}, + Package () {"full-duplex", 1} + } + }) + } + References ========== @@ -131,3 +184,5 @@ References [3] Documentation/firmware-guide/acpi/DSD-properties-rules.rst [4] Documentation/devicetree/bindings/net/ethernet-controller.yaml + +[5] https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.pdf From patchwork Wed Jun 16 19:07:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325803 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB4BBC48BE8 for ; Wed, 16 Jun 2021 19:08:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E2CA61246 for ; Wed, 16 Jun 2021 19:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232418AbhFPTKi (ORCPT ); Wed, 16 Jun 2021 15:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232351AbhFPTKb (ORCPT ); Wed, 16 Jun 2021 15:10:31 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2306BC061574 for ; Wed, 16 Jun 2021 12:08:25 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id r16so5303959ljk.9 for ; Wed, 16 Jun 2021 12:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XwPUFmwMt+6ig9pUm7xR69UTaqxBREF6Kd62jKc8yaI=; b=BQ/amQy84n8KucLrbcdyONyn+4G87+J4dUfVzAJ6jeeaJgjg4ZS+ZqfenzMUM30yyf UW0UHQ7kUanjquaLOkRatvcA80WtEgRgEUhyfDOq/i2mA9wtTNFn0ygei5CZFmrbIFZn jhbkXZ0npg6uSRCMVSGmKXla4WTOoFIH8UhKrirZ8O4zHGgmKE1ofJ731vCH3quovrQv 3zhV1MExunmSNNf+3jZVbNb7azAGfZqdd6epMgZkhsbLpAaOJP2g9UqB5REApYokuqJS CivELkyiZp+od2aVig+dWQG5DDdiunOcwLfPr4F2qpEdMLp7V+d7qvaodUC3+o8dbVIy LGaw== 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=XwPUFmwMt+6ig9pUm7xR69UTaqxBREF6Kd62jKc8yaI=; b=dZe/1uHLcXokI/1x9XOTbjqDiDXycqCjtaNF1YPPeOK5sPxLIEWcfKa6qVYHGyvVKj gCx7k43q6MF0x6BoyssBUmY4eOOYkADmkxLy0JjeXEfRxN3Hgea3u128hLMjZqeLAC/b CBxV1DGny9bAuWjb57NI+OhTFwCH7wCxIj1feKhV8DBZMoJhqCv9ybLGb9Ogf1ytpDUC vI5w36pdpfh9wsnksiqTom4TlTSZJ9iL+LyQeldrznjPicrYFfaKeuB1Gx+IX4ROpkTF rpq6zZiRJowVnjwmAQFnXvJom446jbUWmDVPRpD/24BTpFcUNm4SnYq3+JgYAYY/KTr8 ZYqA== X-Gm-Message-State: AOAM530ysGLcf4AiEklAmdaYjBWRsHC9INamMg1KTKaO4WJbnvcqGef6 zALOd4Bt/Lw8OI3EXl3GZtObQA== X-Google-Smtp-Source: ABdhPJwym4wWzJVyfPCnct1qQl1FU7ernZ+6b1Nh1rWn8VG2YsSMO14y5o9x58hC3nYas6XlXAUJVg== X-Received: by 2002:a2e:a583:: with SMTP id m3mr1161671ljp.305.1623870502441; Wed, 16 Jun 2021 12:08:22 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:21 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 2/7] net: mdiobus: Introduce fwnode_mdbiobus_register() Date: Wed, 16 Jun 2021 21:07:54 +0200 Message-Id: <20210616190759.2832033-3-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This patch introduces a new helper function that wraps acpi_/of_ mdiobus_register() and allows its usage via common fwnode_ interface. Fall back to raw mdiobus_register() in case CONFIG_FWNODE_MDIO is not enabled, in order to satisfy compatibility in all future user drivers. Signed-off-by: Marcin Wojtas --- include/linux/fwnode_mdio.h | 12 +++++++++++ drivers/net/mdio/fwnode_mdio.c | 22 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h index faf603c48c86..13d4ae8fee0a 100644 --- a/include/linux/fwnode_mdio.h +++ b/include/linux/fwnode_mdio.h @@ -16,6 +16,7 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, u32 addr); +int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode); #else /* CONFIG_FWNODE_MDIO */ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, @@ -30,6 +31,17 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, { return -EINVAL; } + +static inline int fwnode_mdiobus_register(struct mii_bus *bus, + struct fwnode_handle *fwnode) +{ + /* + * Fall back to mdiobus_register() function to register a bus. + * This way, we don't have to keep compat bits around in drivers. + */ + + return mdiobus_register(mdio); +} #endif #endif /* __LINUX_FWNODE_MDIO_H */ diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index e96766da8de4..b6576af89fa1 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -7,8 +7,10 @@ */ #include +#include #include #include +#include #include MODULE_AUTHOR("Calvin Johnson "); @@ -142,3 +144,23 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, return 0; } EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + +/** + * fwnode_mdiobus_register - bring up all the PHYs on a given MDIO bus and + * attach them to it. + * @bus: Target MDIO bus. + * @fwnode: Pointer to fwnode of the MDIO controller. + * + * Return values are determined accordingly to acpi_/of_ mdiobus_register() + * operation. + */ +int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode) +{ + if (is_acpi_node(fwnode)) + return acpi_mdiobus_register(bus, fwnode); + else if (is_of_node(fwnode)) + return of_mdiobus_register(bus, to_of_node(fwnode)); + else + return -EINVAL; +} +EXPORT_SYMBOL(fwnode_mdiobus_register); From patchwork Wed Jun 16 19:07:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325805 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B6BEC49361 for ; Wed, 16 Jun 2021 19:08:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FA8A611CE for ; Wed, 16 Jun 2021 19:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232429AbhFPTKj (ORCPT ); Wed, 16 Jun 2021 15:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbhFPTKc (ORCPT ); Wed, 16 Jun 2021 15:10:32 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580EAC061767 for ; Wed, 16 Jun 2021 12:08:25 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id bp38so6132648lfb.0 for ; Wed, 16 Jun 2021 12:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K5P7GmjosC3MgbYE/xm5G4Qol43n9LTj/Mhz9+iNrjc=; b=U1605JjjcQmDGrAuBThNPQluvavbH322D1xuaGE4rjKUDy0zTgNbR/jAbGxgrIOlHu 8GKTrP2Yx8n5LioP5X7YVOdZlwJt/GiiB6UQ25vxLHr+mkbGFBJtvlzq5bj5vfpTNude fgy6yBEqmiB+2ylNQ5E1ZpXpBP+5vZBX2leF/TO7Zc4tTIHiZq/Ns/tZAi0sU/1FP2pK b0I8EerYhUbe/MgP5fHPv1rhVFNYqkE/1MkL86ZiaU/fYYkQ6nvxrMuYjhCiCF66pTz2 EpOHUyYikjqB63Cczu6AWaedd7wNdoYhlxr5MqFxJupm982mI2z/ZmOXdiHXOs3CoFTr Tr9w== 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=K5P7GmjosC3MgbYE/xm5G4Qol43n9LTj/Mhz9+iNrjc=; b=V490tOxey5U/MjrCzqGERUSEVn4vHdhWGWGduA6K/XoBZH7VJypKGE8iFkia/9q2Yp JF4cZSG67eyM1VylG13oqDMcSSGC8UGdTAWqhkFULtyoa88RKEFzbWaE9OrCfCZQlSQm GKKqlLVS3kjF27YR5Rhb/PApCMXkGZOwwexMwaUvd2+j2NBZCUWZOGPh2Bc2QxAD4YrS oil3PL3/+dQMKzk27kEt8B/AjiuK5M2kRRwRj6XtDHi66NlXMoze9uoUyuZSVGuj0Nxd EBJuzB2+neYCl/8jUiWkX7YY7aUgUPlWJMeE0WkcoofFajMUUhnKLMeJeNh9mPQC/X1/ ifgQ== X-Gm-Message-State: AOAM532ScQdMA0ZRijMmKQnSaJXRaUVA532zej//GVzf5Zbryg9zyGah vU4NfGRKQ544rfuAjiGtQDkVAg== X-Google-Smtp-Source: ABdhPJxvG3uAp4TDduJHhr2jNyXUu0EsF4Ae8/5Ngj30LJaRctdQy09WiJJhSFhc7RRy/sOH+ouD/g== X-Received: by 2002:a19:8682:: with SMTP id i124mr869889lfd.107.1623870503666; Wed, 16 Jun 2021 12:08:23 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:23 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 3/7] net/fsl: switch to fwnode_mdiobus_register Date: Wed, 16 Jun 2021 21:07:55 +0200 Message-Id: <20210616190759.2832033-4-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Utilize the newly added helper routine for registering the MDIO bus via fwnode_ interface. Signed-off-by: Marcin Wojtas --- drivers/net/ethernet/freescale/xgmac_mdio.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 0b68852379da..2d99edc8a647 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -13,7 +13,7 @@ */ #include -#include +#include #include #include #include @@ -246,7 +246,6 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) static int xgmac_mdio_probe(struct platform_device *pdev) { - struct fwnode_handle *fwnode; struct mdio_fsl_priv *priv; struct resource *res; struct mii_bus *bus; @@ -291,13 +290,7 @@ static int xgmac_mdio_probe(struct platform_device *pdev) priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); - fwnode = pdev->dev.fwnode; - if (is_of_node(fwnode)) - ret = of_mdiobus_register(bus, to_of_node(fwnode)); - else if (is_acpi_node(fwnode)) - ret = acpi_mdiobus_register(bus, fwnode); - else - ret = -EINVAL; + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); goto err_registration; From patchwork Wed Jun 16 19:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325807 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 723E1C48BE5 for ; Wed, 16 Jun 2021 19:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 563F7611CE for ; Wed, 16 Jun 2021 19:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232493AbhFPTKn (ORCPT ); Wed, 16 Jun 2021 15:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232387AbhFPTKd (ORCPT ); Wed, 16 Jun 2021 15:10:33 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBD8C06175F for ; Wed, 16 Jun 2021 12:08:26 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id c11so5320620ljd.6 for ; Wed, 16 Jun 2021 12:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WL54/R6Mme6e3RQT9i1sJP4MFsLSEpzvFVEMxWrfS1Y=; b=tbmWa/rcLp74wYJ2LayWqB9C/YypLZPStvdVzJ/UAd+40ntYpGBMsCAfD0jSrSCYr7 FMnm9KnjfVCFTJaI+w6oqs4oFFgawx1lhwpG5Rn5AVnyEeq2wXdl0XzQNBsIX/2KJ7MK BOeEr/Pg93zkYoY4+KleOv4p7wO7fVp5RTKTFFNpGZaxUrZhpH0cWAK0pMMDOqCV5x1k iLT8b81irzStdKrDCEF59SxeC82npcORapcQSLJx/yqzMD88O607gmk59JuQsAm6dJkk +U3UAkdTvh4AGsVgI9t+56IULqmmOJacXetSR0uOeAQmtog/X4MCzd7YGKO0WJZAeow1 ND7A== 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=WL54/R6Mme6e3RQT9i1sJP4MFsLSEpzvFVEMxWrfS1Y=; b=U40k+paiZbYhrJkgZr4RhEnt91FPDukJR2HdJoIpNEVfwyNYvZwBxm4JXCAdcakiNG hyvEVvewQil2pTJxEuqRBWtwi4GvPvFUpjTzthYsywxjrSJGZN/mu4fpUi/eMIbuUrPv ilNR8J6V+WSLvEZrpthHWtIWZBxNmfqIiRqMtpj2ZxsyF6wEYMJFowwgZ3sMpweFK12H 73RBNTL5WqZMhRmZPMrllQ0xiyW7bLl7BfuNbfevRGpGKHfpcGVOB/fFm21euSoBOExo 96fvdWpstfIk9FBVfcJ8xJ7VgGrvhkD++/AxU3wocptvYhfDqnpBKx+565T+FwnmXc1F kb9Q== X-Gm-Message-State: AOAM5339SrYwW/pRoI3nfukcSwHU+11F4enVqP+NaghlJCuqEKBgBIpJ iLcPkTxI/Ruig4PNVl0jcKHD9w== X-Google-Smtp-Source: ABdhPJzhcgr4TbHdIux4JkqfddLLFxs6eN1FhDDktz3wer1niJQitqpxkEHLQGrkr8JY7nseCtxUrQ== X-Received: by 2002:a2e:9156:: with SMTP id q22mr1169001ljg.237.1623870505054; Wed, 16 Jun 2021 12:08:25 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:24 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas , Andy Shevchenko Subject: [net-next: PATCH v2 4/7] net: mvmdio: simplify clock handling Date: Wed, 16 Jun 2021 21:07:56 +0200 Message-Id: <20210616190759.2832033-5-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Because the mvmdio driver supports a wide range of Marvell SoC families it must support multiple types of the HW description and required resources. Thanks to the devm_clk_bulk_get_optional() helper routine the clock handling could be significantly simplified, as it is compatible with all possible variants within a single call. Suggested-by: Andy Shevchenko Signed-off-by: Marcin Wojtas --- drivers/net/ethernet/marvell/mvmdio.c | 61 ++++++-------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index d14762d93640..ce3ddc867898 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -62,9 +62,11 @@ #define MVMDIO_XSMI_POLL_INTERVAL_MIN 150 #define MVMDIO_XSMI_POLL_INTERVAL_MAX 160 +#define MVMDIO_CLOCK_COUNT 4 + struct orion_mdio_dev { void __iomem *regs; - struct clk *clk[4]; + struct clk_bulk_data clks[MVMDIO_CLOCK_COUNT]; /* * If we have access to the error interrupt pin (which is * somewhat misnamed as it not only reflects internal errors @@ -279,7 +281,7 @@ static int orion_mdio_probe(struct platform_device *pdev) struct resource *r; struct mii_bus *bus; struct orion_mdio_dev *dev; - int i, ret; + int ret; type = (enum orion_mdio_bus_type)of_device_get_match_data(&pdev->dev); @@ -319,33 +321,20 @@ static int orion_mdio_probe(struct platform_device *pdev) init_waitqueue_head(&dev->smi_busy_wait); - if (pdev->dev.of_node) { - for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { - dev->clk[i] = of_clk_get(pdev->dev.of_node, i); - if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { - ret = -EPROBE_DEFER; - goto out_clk; - } - if (IS_ERR(dev->clk[i])) - break; - clk_prepare_enable(dev->clk[i]); - } - - if (!IS_ERR(of_clk_get(pdev->dev.of_node, - ARRAY_SIZE(dev->clk)))) - dev_warn(&pdev->dev, - "unsupported number of clocks, limiting to the first " - __stringify(ARRAY_SIZE(dev->clk)) "\n"); - } else { - dev->clk[0] = clk_get(&pdev->dev, NULL); - if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) { - ret = -EPROBE_DEFER; - goto out_clk; - } - if (!IS_ERR(dev->clk[0])) - clk_prepare_enable(dev->clk[0]); - } + dev->clks[0].id = "core"; + dev->clks[1].id = "mg"; + dev->clks[2].id = "mg_core"; + dev->clks[3].id = "axi"; + ret = devm_clk_bulk_get_optional(&pdev->dev, MVMDIO_CLOCK_COUNT, + dev->clks); + if (ret) + return ret; + ret = clk_bulk_prepare_enable(MVMDIO_CLOCK_COUNT, dev->clks); + if (ret) { + dev_err(&pdev->dev, "Cannot enable clocks\n"); + return ret; + } dev->err_interrupt = platform_get_irq_optional(pdev, 0); if (dev->err_interrupt > 0 && @@ -383,14 +372,6 @@ static int orion_mdio_probe(struct platform_device *pdev) if (dev->err_interrupt > 0) writel(0, dev->regs + MVMDIO_ERR_INT_MASK); -out_clk: - for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { - if (IS_ERR(dev->clk[i])) - break; - clk_disable_unprepare(dev->clk[i]); - clk_put(dev->clk[i]); - } - return ret; } @@ -398,18 +379,12 @@ static int orion_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); struct orion_mdio_dev *dev = bus->priv; - int i; if (dev->err_interrupt > 0) writel(0, dev->regs + MVMDIO_ERR_INT_MASK); mdiobus_unregister(bus); - for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { - if (IS_ERR(dev->clk[i])) - break; - clk_disable_unprepare(dev->clk[i]); - clk_put(dev->clk[i]); - } + clk_bulk_disable_unprepare(MVMDIO_CLOCK_COUNT, dev->clks); return 0; } From patchwork Wed Jun 16 19:07:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325809 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 354FFC48BE8 for ; Wed, 16 Jun 2021 19:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 204E0611CE for ; Wed, 16 Jun 2021 19:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbhFPTKu (ORCPT ); Wed, 16 Jun 2021 15:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbhFPTKf (ORCPT ); Wed, 16 Jun 2021 15:10:35 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 022CCC0617AE for ; Wed, 16 Jun 2021 12:08:28 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id d13so5263659ljg.12 for ; Wed, 16 Jun 2021 12:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qO81kkLWUD7HwK1vfV7d3yspAdGdM3JErj+7upPHV+g=; b=QmAbiCMHeMzya8lnZc4yAdb2woDbST083wyuKhVvDyuBi2RSGgE1JYVF+wFuiZN/B0 wUS7K8FLF6cshXEQohL+9eFigt7Hs5w55fe9iby0O3GLyM55FO+Hei/JdGIEo4qsB+OW 2gE/P1DVJW6+I6LTiMD6d+JXAPQ516HWoDSXHE7unlIxIXacOIUBNmkslic2ywHhjdRj YPcCkLa0LG5x/POsA5/Wl/EqYIuJ9oz0lRHHZE91xmGzlMYhxQFPjWacVM8a2YLiSfZL MaSeO1jkPZyfq7SphxmlRawbC+gRSF/tUiw2e3fVq/PLrydRuWfEmf/tUjyhD4DihsRX qyqA== 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=qO81kkLWUD7HwK1vfV7d3yspAdGdM3JErj+7upPHV+g=; b=FPBa68zDkSe6SPo9NFSVw/uoalxbYzhd/wnesLBCm/iHr2SSxwOiNYwmI0TQby1COU oxSFumVtRJ3cTisheDXCjVSnL3nw1S+OOmHjJK2VjTB/j+hedGW7nkJGFHPzPNpUuJ0f 8d8oLMWlWuz2tcLnpLYaJy+sgVM2wedXIUhIj1A0sfz/Qc1W2lgesgnpoR0C199iWxWu pHcrHUfkJS7Qci78a6dNrxJQieOdF6wHRabV+R4Lsaw2xOfCXPF1pnz9Kn+oJCsHIzt4 Ln5AeibuZoOiEb4IxMhpF/n232A6VYziHE7LJUROHz1KpfhfaYjNnWKggIAiTNNeCOkU +iHA== X-Gm-Message-State: AOAM533PshsaeIMQUGToTgN147Fyh6sZecS4eHu6UAIeTiAyKdiO6qHc Hf3Zifua5PDh8DTAXY7BpkgNGA== X-Google-Smtp-Source: ABdhPJzKBQ3Du28z3i8T73CJT5Zh+7yMzCUomkZ/Un/m3Bp62Ul3Vcx6bIJQmRiYTAOspHCHD4wCKw== X-Received: by 2002:a2e:8e7c:: with SMTP id t28mr1195277ljk.246.1623870506327; Wed, 16 Jun 2021 12:08:26 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:25 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 5/7] net: mvmdio: add ACPI support Date: Wed, 16 Jun 2021 21:07:57 +0200 Message-Id: <20210616190759.2832033-6-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This patch introducing ACPI support for the mvmdio driver by adding acpi_match_table with two entries: * "MRVL0100" for the SMI operation * "MRVL0101" for the XSMI mode Also clk enabling is skipped, because the tables do not contain such data and clock maintenance relies on the firmware. Signed-off-by: Marcin Wojtas --- drivers/net/ethernet/marvell/mvmdio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index ce3ddc867898..4fe6428b8119 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -17,8 +17,10 @@ * warranty of any kind, whether express or implied. */ +#include #include #include +#include #include #include #include @@ -283,7 +285,7 @@ static int orion_mdio_probe(struct platform_device *pdev) struct orion_mdio_dev *dev; int ret; - type = (enum orion_mdio_bus_type)of_device_get_match_data(&pdev->dev); + type = (enum orion_mdio_bus_type)device_get_match_data(&pdev->dev); r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r) { @@ -358,7 +360,7 @@ static int orion_mdio_probe(struct platform_device *pdev) goto out_mdio; } - ret = of_mdiobus_register(bus, pdev->dev.of_node); + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); if (ret < 0) { dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); goto out_mdio; @@ -396,12 +398,20 @@ static const struct of_device_id orion_mdio_match[] = { }; MODULE_DEVICE_TABLE(of, orion_mdio_match); +static const struct acpi_device_id orion_mdio_acpi_match[] = { + { "MRVL0100", BUS_TYPE_SMI }, + { "MRVL0101", BUS_TYPE_XSMI }, + { }, +}; +MODULE_DEVICE_TABLE(acpi, orion_mdio_acpi_match); + static struct platform_driver orion_mdio_driver = { .probe = orion_mdio_probe, .remove = orion_mdio_remove, .driver = { .name = "orion-mdio", .of_match_table = orion_mdio_match, + .acpi_match_table = ACPI_PTR(orion_mdio_acpi_match), }, }; From patchwork Wed Jun 16 19:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325811 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A78EC49361 for ; Wed, 16 Jun 2021 19:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16E53611CE for ; Wed, 16 Jun 2021 19:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbhFPTKx (ORCPT ); Wed, 16 Jun 2021 15:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232411AbhFPTKh (ORCPT ); Wed, 16 Jun 2021 15:10:37 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28A45C0617AF for ; Wed, 16 Jun 2021 12:08:29 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id r5so6060871lfr.5 for ; Wed, 16 Jun 2021 12:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bJlskXXqPukoUIiMaWjgnuEmfc7b1Qye4aSSYHDeJ90=; b=j6UvX9zq/sPizWvzFQ1T0u4GCMD2XjPHC82VcPSaJaKiBAcneookTY3Ed1d02CaGrd 7dIFeO4QpfuK14mdUlK5ACdVgDNO9Tads/4fiOTUp46WubLTThwTtqyJBpaTw2ozwf98 kVFXdNqARq0/KzDDbnsPyhO0Q7kFR4z1uUouFCjO81jhMnN4JHGkltf4iYJKs91ZKtOU hlTKE9Zsm8ug4xTDHHQ4nfSgj+8RoDlwMSJe8nYjgWDGqHLoWKka/mazzDVT82VfNJrM Dl8fVLHuAA6racPJi0+YyHoW9cZDPQJ9s1juS5QqLvoLpul8e1h35NX0FvuZHqTV23UX KVIw== 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=bJlskXXqPukoUIiMaWjgnuEmfc7b1Qye4aSSYHDeJ90=; b=L29Ke9thBkeKxOelyLhKij2Ot5S3IjvpG+zzq1QMj7OkTyLotbP0G1Yud82jPBEHOh OWAFAjeTTj4DhfCRJb21DQeIIB1zji1HrXbfkK2FvmKh8zyjHdqfk5Yt5NiazY649TzZ vF2e1/keF3ZqRVijHdmWJ5FUhHQzkPAxk+rvVPuOrvg1gXIZprh9pyoErV0w4jrZiDN9 1XjFaYv3J4H906oA0Tx+ZCwsQrMRWptEHImmrw2OOGTSn3seHYNexEy57zQUi8taSHF3 4icD4uXABJ80OX0pMduzwgFAN+BPISq+EfSpe5fGTWBWUphXXmEbQhkcVeqSvxXz68yH R8IA== X-Gm-Message-State: AOAM530mQGlDBk49EJkf2U1/5UY52IUL7O1EXCNnuSg3+HJil14NZwtu d9TQ+KNeEAVpbP5wstsN9igb1w== X-Google-Smtp-Source: ABdhPJwdwrSxllmvf4YfPOQkJpoCeiA8FUGeCt7NkwLbEr7swjLDXq2ri/thhPsM39fORUQAZYi3dw== X-Received: by 2002:ac2:51b3:: with SMTP id f19mr937764lfk.218.1623870507506; Wed, 16 Jun 2021 12:08:27 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:26 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 6/7] net: mvpp2: enable using phylink with ACPI Date: Wed, 16 Jun 2021 21:07:58 +0200 Message-Id: <20210616190759.2832033-7-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Now that the MDIO and phylink are supported in the ACPI world, enable to use them in the mvpp2 driver. Ensure a backward compatibility with the firmware whose ACPI description does not contain the necessary elements for the proper phy handling and fall back to relying on the link interrupts instead. Signed-off-by: Marcin Wojtas --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 9bca8c8f9f8d..a66ed3194015 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -4793,9 +4793,8 @@ static int mvpp2_open(struct net_device *dev) goto err_cleanup_txqs; } - /* Phylink isn't supported yet in ACPI mode */ - if (port->of_node) { - err = phylink_of_phy_connect(port->phylink, port->of_node, 0); + if (port->phylink) { + err = phylink_fwnode_phy_connect(port->phylink, port->fwnode, 0); if (err) { netdev_err(port->dev, "could not attach PHY (%d)\n", err); @@ -6703,6 +6702,19 @@ static void mvpp2_acpi_start(struct mvpp2_port *port) SPEED_UNKNOWN, DUPLEX_UNKNOWN, false, false); } +/* In order to ensure backward compatibility for ACPI, check if the port + * firmware node comprises the necessary description allowing to use phylink. + */ +static bool mvpp2_use_acpi_compat_mode(struct fwnode_handle *port_fwnode) +{ + if (!is_acpi_node(port_fwnode)) + return false; + + return (!fwnode_property_present(port_fwnode, "phy-handle") && + !fwnode_property_present(port_fwnode, "managed") && + !fwnode_get_named_child_node(port_fwnode, "fixed-link")); +} + /* Ports initialization */ static int mvpp2_port_probe(struct platform_device *pdev, struct fwnode_handle *port_fwnode, @@ -6921,8 +6933,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE; dev->dev.of_node = port_node; - /* Phylink isn't used w/ ACPI as of now */ - if (port_node) { + if (!mvpp2_use_acpi_compat_mode(port_fwnode)) { port->phylink_config.dev = &dev->dev; port->phylink_config.type = PHYLINK_NETDEV; @@ -6934,6 +6945,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, } port->phylink = phylink; } else { + dev_warn(&pdev->dev, "Use link irqs for port#%d. FW update required\n", port->id); port->phylink = NULL; } From patchwork Wed Jun 16 19:07:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 12325813 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5440C48BE8 for ; Wed, 16 Jun 2021 19:08:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2BA9611CE for ; Wed, 16 Jun 2021 19:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbhFPTKy (ORCPT ); Wed, 16 Jun 2021 15:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbhFPTKm (ORCPT ); Wed, 16 Jun 2021 15:10:42 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B5B9C061283 for ; Wed, 16 Jun 2021 12:08:30 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id v22so6057904lfa.3 for ; Wed, 16 Jun 2021 12:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KY/iJP5CpxPVy4NzVmmnCVBH1UfAm8gIg54ojzdUXD8=; b=P1zT9Gu1LSZ88LeRKP6sRzDnzJUqE5PCo4PtMgVSVkaDHigpx0KZ5fGaxLLvB4ZWAX hTJdsLlfYECLzRvrBREQIyPyWiFo1usLu6xk+S0jc67GN3MCK8qT2B9YpiWaQ6Y/hBBn M7U47b+7UAcXsUqTJE3xniO2I9svC7YmleXKMHSTJcparSA0h/KEtm5UvH+QUsflOhRR lKlvhRNccFjr4hpFo/mQ9NTTG/WQZaj/HMIR9DKYoKTapJyyuJcWgkUzWkFI58AuCTbG HM7yJcR5Va/X5ft3JFw9l0xE49HxFcAN9aVMyATiqCtlm2eTHQpY3SI1GzEYBDikNoXl SagA== 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=KY/iJP5CpxPVy4NzVmmnCVBH1UfAm8gIg54ojzdUXD8=; b=PYaPDVqACrJhvv4W8q/jSxh4mD5kwCfXMb5iiMmK1mvioRSXwLcxBLxkZ3D1e48Lg2 v8J+6zPf+86364OFeiiM8Rr2wZy3Y9/Y2JTcFR2iHweHRFh5DdDdHg+jKWI126yxYneZ G1j+7SPHm3ZuouKDr70O1JPLsQY8+53Syd2bsInSpJxj+Ni3RSXlJhAEepy6i3q+2rUh cCAvHoVEEdShkwtliBvEWvMbEeuTKlDeGOIiIsOCJ6KJhUDW6yR071faoAJFtx20LlpT htuHgVawJRZfEkrRgQALUcGfNCpKagx7KHZIw5Pwt03RonGEC7KbyHbS/uD+AOIBbI89 sUBQ== X-Gm-Message-State: AOAM530ToinvgNrLPAm2aThzNYLMv8PopGF/SkA2SkmqzYBQ6FD8ca7H yIQvWDr1Rl6pnDMkb8RRzWjF2Q== X-Google-Smtp-Source: ABdhPJwdyFEnshUh4uD/8NdkmK2PPYtFF7gDca2r/PyVsV0Qo6ITET4o9SleM/cDqpeQjnHB9ryxaw== X-Received: by 2002:ac2:4ec1:: with SMTP id p1mr906995lfr.584.1623870508714; Wed, 16 Jun 2021 12:08:28 -0700 (PDT) Received: from gilgamesh.lab.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id h22sm406939ljl.126.2021.06.16.12.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 12:08:28 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk, jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com, tn@semihalf.com, rjw@rjwysocki.net, lenb@kernel.org, Marcin Wojtas Subject: [net-next: PATCH v2 7/7] net: mvpp2: remove unused 'has_phy' field Date: Wed, 16 Jun 2021 21:07:59 +0200 Message-Id: <20210616190759.2832033-8-mw@semihalf.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210616190759.2832033-1-mw@semihalf.com> References: <20210616190759.2832033-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The 'has_phy' field from struct mvpp2_port is no longer used. Remove it. Signed-off-by: Marcin Wojtas Reviewed-by: Andrew Lunn --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 3 --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index 4a61c90003b5..b9fbc9f000f2 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1197,9 +1197,6 @@ struct mvpp2_port { /* Firmware node associated to the port */ struct fwnode_handle *fwnode; - /* Is a PHY always connected to the port */ - bool has_phy; - /* Per-port registers' base address */ void __iomem *base; void __iomem *stats_base; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index a66ed3194015..8362e64a3b28 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -6790,7 +6790,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, port = netdev_priv(dev); port->dev = dev; port->fwnode = port_fwnode; - port->has_phy = !!of_find_property(port_node, "phy", NULL); port->ntxqs = ntxqs; port->nrxqs = nrxqs; port->priv = priv;