From patchwork Wed Jan 26 16:05:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12725386 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 12E48C2BA4C for ; Wed, 26 Jan 2022 16:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236160AbiAZQFz (ORCPT ); Wed, 26 Jan 2022 11:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235898AbiAZQFw (ORCPT ); Wed, 26 Jan 2022 11:05:52 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53943C06161C for ; Wed, 26 Jan 2022 08:05:52 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id b14so378064ljb.0 for ; Wed, 26 Jan 2022 08:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=zF3IX+ZoZuEP5wIGog8Vz1x7D6J5qbB47X1+HgTp1Ro=; b=ik07UYqRR/fgOvihUdeZBxy46SLo1jEawOHrQgsOSokIdvUBKoW6kiOuzx0XABMCUe J4N8p1M0AAwC8lJd1+zjHU2l40GZfC7g+27/fG94k2Y5JW25pb5tNAR5qZQqmWfBwOuD AXYTo9LpijDJbA1AJVPH6IyAvbeu/kWhPNQWgfuqJvSjvDcadThJogbuW3mpQVtM+eb1 4C47YUdMicmJjfb+KW07ZoaMoa15Jxi37LiM8cB4QQQF1Zin/MwbZbkJr0RYSL0a0A13 TVLUCAWqA12D+C2dfH+vDIfAm7WFhFrgAnd5bryepd88DLXU8a4M7JSJIHydQ1ebK2Jg knDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=zF3IX+ZoZuEP5wIGog8Vz1x7D6J5qbB47X1+HgTp1Ro=; b=EKvYc3FlKgXovv5JLwXQHK7Anvfe+VUg47SwCwDpea6RsQYBJIw+VaR/VwhYgcx2gG wRH70IskWkh965gnXHtvQgAcZv9be3mphDB0GbIt2m8cWdN6SyKMN9c0MwKVFkbqwNqP lloywXN2GZVLpqIx8q1fA5mKN7fpDFNnRweVaJzQQn9ZWffBxwTtvHKMBz5IfFFFd1Gi EIVESYmydbP6nDnnYCssOdK0jZGtOLERnbrjDFO/1a+rskRL9dIhgffDhwbB7/N4lsPu wGJaRd32lmZowXOPfp8JkN4VLt+eBNiCoI+xw87yloMIT2bBC4eaZhoTUaUKhnsGZLsk j4UA== X-Gm-Message-State: AOAM530Y+PXxtZnFw2ClKZ5Hp59Noal3wy0Wc5388EtEKs6VxbyuYVaJ N6xGACDaKHN6xtq146WtAK0qTA== X-Google-Smtp-Source: ABdhPJwRd7UsXBcQJGD1W7d+Jy7L1ysRcWJeJ1tVFL/lRHXd/asCPE1V2I18cUko0Sixa5mkyU/SLw== X-Received: by 2002:a2e:9e87:: with SMTP id f7mr19181390ljk.160.1643213150617; Wed, 26 Jan 2022 08:05:50 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id p6sm1869984lfa.241.2022.01.26.08.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:05:50 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Madalin Bucur , Rob Herring , Scott Wood , Shaohui Xie , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 1/5] dt-bindings: net: xgmac_mdio: Remove unsupported "bus-frequency" Date: Wed, 26 Jan 2022 17:05:39 +0100 Message-Id: <20220126160544.1179489-2-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126160544.1179489-1-tobias@waldekranz.com> References: <20220126160544.1179489-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This property has never been supported by the driver. The kernel has settled on "clock-frequency" as the standard name for this binding, so once that is supported we will document that instead. Fixes: 7f93c9d90f4d ("power/fsl: add MDIO dt binding for FMan") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- Documentation/devicetree/bindings/net/fsl-fman.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index 020337f3c05f..cd5288fb4318 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -388,15 +388,6 @@ PROPERTIES Value type: Definition: A standard property. -- bus-frequency - Usage: optional - Value type: - Definition: Specifies the external MDIO bus clock speed to - be used, if different from the standard 2.5 MHz. - This may be due to the standard speed being unsupported (e.g. - due to a hardware problem), or to advertise that all relevant - components in the system support a faster speed. - - interrupts Usage: required for external MDIO Value type: From patchwork Wed Jan 26 16:05:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12725387 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 E4BDFC63684 for ; Wed, 26 Jan 2022 16:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236198AbiAZQFz (ORCPT ); Wed, 26 Jan 2022 11:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236126AbiAZQFy (ORCPT ); Wed, 26 Jan 2022 11:05:54 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B26EC061749 for ; Wed, 26 Jan 2022 08:05:54 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id p27so63964037lfa.1 for ; Wed, 26 Jan 2022 08:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=vp/RrG3HNFLZAg53k5k+rblIG0BzeIXw2SDJ/K9MM7I=; b=AadczuGOdmIfMErobjfbUlq5lT6s8R0/ftYqm3te+j4K40ZUUKe99eeP/FcDUhIZp+ If+r2WNodEDjNJGaU6eaJ+O4WUoSenZIlRBhkKiYrU5ArFG0Xp/qrpx/THLyrCL5onTO lt5zZH/2ythjIw/tmq+g02ccUfawO+jR7iFXJEtpAP//uzibJUnvA4/h42gzowlLyleB vuLTtKniI4HZZBRf2H6rx9W4mnSMa8xPBwOOG7J8ZjUWkOvRm3GujqguVBuH4WSRjQN0 JYn5ndjBUBXpUaiNftOiZqKZ0fQPEAtvZ42ojqWlW9GJzRmu8ZoCDkHZEZmu1z+OXdUG Dy8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=vp/RrG3HNFLZAg53k5k+rblIG0BzeIXw2SDJ/K9MM7I=; b=VSuP3KwxvS9vMmhahD07nWcyXVouSAYD44GGqWhFl+0IJuNkcyA+Ul4WhexqU0oapX uPx9HSfsPc+TUEqKS4xj9EoWQ1WiegJGPEpr6pOejBXXbE1MfdqyuSxwE+8Q1Jb/IJsm yZ1FcDq68eVirZu7c1CzdqJ5LWSanH4CErxWJKBaCTsRVvdZEY8QfgHJexpqTqzr2b9Y cOR9+HxN34Do5RKZRp2v88k0gc++rJtY1yYHJRAERumPsToXLQgrJD7Wwa6g3LELNccC k+VdY+odqDcwph1OIBNJk6z4YSJ8k+RXN1MAkATOYkCZjTTclp6vdmcI6N17QkjjUTde PHQw== X-Gm-Message-State: AOAM532bRHQClCtVQdYAgTOR1uVsilj6Gpxlfn7o9K31bt99bBI28Fru egRDWsJs+ophaJxM9KNCJo0gDKuEhqb5lQ== X-Google-Smtp-Source: ABdhPJzD20ZQr5PDVElM4/D1WpDFY+AeY5pjJk7+SvCSRbdFTN7FywhuK2pIF2l6ylhVnMT9NzFlVQ== X-Received: by 2002:a05:6512:3c97:: with SMTP id h23mr10553390lfv.211.1643213152569; Wed, 26 Jan 2022 08:05:52 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id p6sm1869984lfa.241.2022.01.26.08.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:05:52 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Marcin Wojtas , Calvin Johnson , Markus Koch , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 2/5] net/fsl: xgmac_mdio: Use managed device resources Date: Wed, 26 Jan 2022 17:05:40 +0100 Message-Id: <20220126160544.1179489-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126160544.1179489-1-tobias@waldekranz.com> References: <20220126160544.1179489-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org All of the resources used by this driver has managed interfaces, so use them. Heed the warning in the comment before platform_get_resource and use a bare devm_ioremap to allow for non-exclusive access to the IO memory. Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- drivers/net/ethernet/freescale/xgmac_mdio.c | 35 ++++----------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 266e562bd67a..40442d64a247 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -273,7 +273,7 @@ static int xgmac_mdio_probe(struct platform_device *pdev) return -EINVAL; } - bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv)); + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(struct mdio_fsl_priv)); if (!bus) return -ENOMEM; @@ -284,13 +284,11 @@ static int xgmac_mdio_probe(struct platform_device *pdev) bus->probe_capabilities = MDIOBUS_C22_C45; snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res->start); - /* Set the PHY base address */ priv = bus->priv; - priv->mdio_base = ioremap(res->start, resource_size(res)); - if (!priv->mdio_base) { - ret = -ENOMEM; - goto err_ioremap; - } + priv->mdio_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (IS_ERR(priv->mdio_base)) + return PTR_ERR(priv->mdio_base); /* For both ACPI and DT cases, endianness of MDIO controller * needs to be specified using "little-endian" property. @@ -312,31 +310,11 @@ static int xgmac_mdio_probe(struct platform_device *pdev) ret = -EINVAL; if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); - goto err_registration; + return ret; } platform_set_drvdata(pdev, bus); - return 0; - -err_registration: - iounmap(priv->mdio_base); - -err_ioremap: - mdiobus_free(bus); - - return ret; -} - -static int xgmac_mdio_remove(struct platform_device *pdev) -{ - struct mii_bus *bus = platform_get_drvdata(pdev); - struct mdio_fsl_priv *priv = bus->priv; - - mdiobus_unregister(bus); - iounmap(priv->mdio_base); - mdiobus_free(bus); - return 0; } @@ -364,7 +342,6 @@ static struct platform_driver xgmac_mdio_driver = { .acpi_match_table = xgmac_acpi_match, }, .probe = xgmac_mdio_probe, - .remove = xgmac_mdio_remove, }; module_platform_driver(xgmac_mdio_driver); From patchwork Wed Jan 26 16:05:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12725388 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 2DA36C28CF5 for ; Wed, 26 Jan 2022 16:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236212AbiAZQF7 (ORCPT ); Wed, 26 Jan 2022 11:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236225AbiAZQF4 (ORCPT ); Wed, 26 Jan 2022 11:05:56 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291FBC06161C for ; Wed, 26 Jan 2022 08:05:56 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id t7so262353ljc.10 for ; Wed, 26 Jan 2022 08:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=DKVSdC4qECIU2JwQ746MX/kDKwKhoierwoEybkVx8Ro=; b=pqtPSS+5XTYyIPFKvC3zu1ZSjTFT4ZciZmckIJighy+OyMb1cv9L2ZgemJf+uPaUq4 Wu7fOSw5Q3cheSqIyj1iNG2czR3vw+KCTBajaS9FkXGhevVoXnj4yZq9L3dCixiooUO0 aRjOnerU/CCQMomM6bqfpmwaYt/SYBc9tdzkFQ3Pcc0attNs+/7wyneXt57tp8OAYKTp 50O9Svb9QVPw5m86Rl3M2mHHga+bK7Wv4T3XOcK7trHIn2ixurapSrT7FnF2Dv5USm5X DvVO2zN1ZWla2d48xNwSNnwrsePjhR3Htf4L53fsbDWRF9nGY1rVjwkxiGNrnsCJwoIB lsQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=DKVSdC4qECIU2JwQ746MX/kDKwKhoierwoEybkVx8Ro=; b=vblAXQasBlc8vdru8u2d/KwRPtUnKiKgWoUOhLz0opWju7YApsEMV/cmtF9aoHjfCO hwNLt5WDs3PZ+S1QQxtjWhAIrbGQqFLi1Z3peaUV8BTWgGw1PvU29pvE0bzg+OTMyV5G tnpLmiPGewAEpoezAdHxZAgePmOncu3Rp8hjcva1ZR/k/HW68we5d5fjEUNDephXvWMn b+zahM2W0EvVTFOY1BYDc1ZB20GJ1lQYIrpv9rrIcN+GrTFwa+vJMHb83hOujjEFr8H4 RptVr8LpOpKV/p4icaeUrJwCzZKyA0+lYxZaOUyDGMJxXHUA7gXrp03PrIxC8dr4Jd96 Qeow== X-Gm-Message-State: AOAM533h8qMObwAHYzdDmm2mNFZAw7FE193Dmg/QBhp7hp0bfbWTiNIk +t43wUQGV+D8sjcCs5rGrvU1Fg== X-Google-Smtp-Source: ABdhPJz9PZ33WyBsJQCu9MCgq4W3w1XBgp+BABOq0UX8+QuiSnuy+JnQsazzZKkDq6vRlvMxsNvhCw== X-Received: by 2002:a2e:9c10:: with SMTP id s16mr18190178lji.280.1643213154416; Wed, 26 Jan 2022 08:05:54 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id p6sm1869984lfa.241.2022.01.26.08.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:05:54 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Marcin Wojtas , Calvin Johnson , Markus Koch , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 3/5] net/fsl: xgmac_mdio: Support preamble suppression Date: Wed, 26 Jan 2022 17:05:41 +0100 Message-Id: <20220126160544.1179489-4-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126160544.1179489-1-tobias@waldekranz.com> References: <20220126160544.1179489-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Support the standard "suppress-preamble" attribute to disable preamble generation. Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- drivers/net/ethernet/freescale/xgmac_mdio.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 40442d64a247..18bf2370d45a 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -39,6 +39,7 @@ struct tgec_mdio_controller { #define MDIO_STAT_CLKDIV(x) (((x>>1) & 0xff) << 8) #define MDIO_STAT_BSY BIT(0) #define MDIO_STAT_RD_ER BIT(1) +#define MDIO_STAT_PRE_DIS BIT(5) #define MDIO_CTL_DEV_ADDR(x) (x & 0x1f) #define MDIO_CTL_PORT_ADDR(x) ((x & 0x1f) << 5) #define MDIO_CTL_PRE_DIS BIT(10) @@ -254,6 +255,21 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) return ret; } +static void xgmac_mdio_set_suppress_preamble(struct mii_bus *bus) +{ + struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; + struct tgec_mdio_controller __iomem *regs = priv->mdio_base; + struct device *dev = bus->parent; + u32 mdio_stat; + + if (!device_property_read_bool(dev, "suppress-preamble")) + return; + + mdio_stat = xgmac_read32(®s->mdio_stat, priv->is_little_endian); + mdio_stat |= MDIO_STAT_PRE_DIS; + xgmac_write32(mdio_stat, ®s->mdio_stat, priv->is_little_endian); +} + static int xgmac_mdio_probe(struct platform_device *pdev) { struct fwnode_handle *fwnode; @@ -301,6 +317,8 @@ static int xgmac_mdio_probe(struct platform_device *pdev) priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); + xgmac_mdio_set_suppress_preamble(bus); + fwnode = pdev->dev.fwnode; if (is_of_node(fwnode)) ret = of_mdiobus_register(bus, to_of_node(fwnode)); From patchwork Wed Jan 26 16:05:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12725389 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 5D420C3526D for ; Wed, 26 Jan 2022 16:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236466AbiAZQGA (ORCPT ); Wed, 26 Jan 2022 11:06:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236206AbiAZQF6 (ORCPT ); Wed, 26 Jan 2022 11:05:58 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07914C061751 for ; Wed, 26 Jan 2022 08:05:58 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id z7so308241ljj.4 for ; Wed, 26 Jan 2022 08:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=OzEeuZgMHaNDafKJqIpkWG17qaJ2UOqQemoazwwORiY=; b=nyPML2ccn1BWm+ZemB9S9F/SL44O3rVpa4RJVTcNeUjr8dIJ+7JvOcTax8PLfSQ2q7 gTwTbXF1RbOWpdpmopsANH3R7kXmaE28Hn7zIPHX9Moa3DySziFLk1IRQUeQUaehmP8x sALLLaqXvNWZIYA+8BWMzlF+wheq5ir8EB506EZh1hMfkM1/VRZJxQm5iH4CiyyG40xk p6RVxAfADix1OtG8DI1lVcRxz/aX9ABIeaXYfuV8PD3eXpuzeyonAkk5kUqgyqbaXqPB h27KZ8SRN5a3HK7XnbrlB4wxZ2jhtjBeHErmEDqynEIYb5HuY1+T25bjzX5VTosGP9Ej 7QoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=OzEeuZgMHaNDafKJqIpkWG17qaJ2UOqQemoazwwORiY=; b=c65PNrJK/Gbs7/LeodQvlRucC2Z3k2TLbBcEGTveSOxsHqZKyD6akgKUPAMK8RWuY/ oFnZtvFDJRBg1PVeepZvHfTqKD32ooDTPEhCJu4aEeWIm0Y4UTbE6Pap15IsaZ6cO09e DJ4GBVzZuA1IFXRdGaGbSuyC916cSzmIaO8brkuH9LcAbY4L3sn/B8huGz0uxXvA7GdW b1WWoNO4OVizfviJ1jjmY0AG7cazmjsgmpcXyDB79iLPowDZTZxiPg2xgIY6xqEAKO7+ TKx2NdFhP1gWxFHxB2dITkM9uh7E53nk0v+S4ri4qbAUNks2Nm+fRNS3U1EGl22Qg158 FKTw== X-Gm-Message-State: AOAM530+9fLqdgziqEehyJn2Kh0tZxBiIPcqObmU3itnF/6QntFd49SZ GBO4h1zwhbxz3gWqNTMTSjzOnw== X-Google-Smtp-Source: ABdhPJzoDrGS/PwcauIWEQKhwDDjG1Zbxt3Lo0HXtei88G0uymG0KT2GIH3eN+QLFad+4IXEXyuUnA== X-Received: by 2002:a2e:3305:: with SMTP id d5mr9996554ljc.184.1643213156240; Wed, 26 Jan 2022 08:05:56 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id p6sm1869984lfa.241.2022.01.26.08.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:05:55 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Marcin Wojtas , Markus Koch , Calvin Johnson , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 4/5] net/fsl: xgmac_mdio: Support setting the MDC frequency Date: Wed, 26 Jan 2022 17:05:42 +0100 Message-Id: <20220126160544.1179489-5-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126160544.1179489-1-tobias@waldekranz.com> References: <20220126160544.1179489-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Support the standard "clock-frequency" attribute to set the generated MDC frequency. If not specified, the driver will leave the divisor bits untouched. Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- drivers/net/ethernet/freescale/xgmac_mdio.c | 38 ++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 18bf2370d45a..d38d0c372585 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ struct tgec_mdio_controller { } __packed; #define MDIO_STAT_ENC BIT(6) -#define MDIO_STAT_CLKDIV(x) (((x>>1) & 0xff) << 8) +#define MDIO_STAT_CLKDIV(x) (((x) & 0x1ff) << 7) #define MDIO_STAT_BSY BIT(0) #define MDIO_STAT_RD_ER BIT(1) #define MDIO_STAT_PRE_DIS BIT(5) @@ -51,6 +52,8 @@ struct tgec_mdio_controller { struct mdio_fsl_priv { struct tgec_mdio_controller __iomem *mdio_base; + struct clk *enet_clk; + u32 mdc_freq; bool is_little_endian; bool has_a009885; bool has_a011043; @@ -255,6 +258,35 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) return ret; } +static int xgmac_mdio_set_mdc_freq(struct mii_bus *bus) +{ + struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; + struct tgec_mdio_controller __iomem *regs = priv->mdio_base; + struct device *dev = bus->parent; + u32 mdio_stat, div; + + if (device_property_read_u32(dev, "clock-frequency", &priv->mdc_freq)) + return 0; + + priv->enet_clk = devm_clk_get(dev, NULL); + if (IS_ERR(priv->enet_clk)) { + dev_err(dev, "Input clock unknown, not changing MDC frequency"); + return PTR_ERR(priv->enet_clk); + } + + div = ((clk_get_rate(priv->enet_clk) / priv->mdc_freq) - 1) / 2; + if (div < 5 || div > 0x1ff) { + dev_err(dev, "Requested MDC frequecy is out of range, ignoring"); + return -EINVAL; + } + + mdio_stat = xgmac_read32(®s->mdio_stat, priv->is_little_endian); + mdio_stat &= ~MDIO_STAT_CLKDIV(0x1ff); + mdio_stat |= MDIO_STAT_CLKDIV(div); + xgmac_write32(mdio_stat, ®s->mdio_stat, priv->is_little_endian); + return 0; +} + static void xgmac_mdio_set_suppress_preamble(struct mii_bus *bus) { struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; @@ -319,6 +351,10 @@ static int xgmac_mdio_probe(struct platform_device *pdev) xgmac_mdio_set_suppress_preamble(bus); + ret = xgmac_mdio_set_mdc_freq(bus); + if (ret) + return ret; + fwnode = pdev->dev.fwnode; if (is_of_node(fwnode)) ret = of_mdiobus_register(bus, to_of_node(fwnode)); From patchwork Wed Jan 26 16:05:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12725390 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 12D5BC63697 for ; Wed, 26 Jan 2022 16:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236936AbiAZQGB (ORCPT ); Wed, 26 Jan 2022 11:06:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236287AbiAZQF7 (ORCPT ); Wed, 26 Jan 2022 11:05:59 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5468AC061749 for ; Wed, 26 Jan 2022 08:05:59 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id n8so23509309lfq.4 for ; Wed, 26 Jan 2022 08:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=ShRv9pV2AiOoQ7kKf6pAT6HNznQzxV/dtMmDpxzFPcg=; b=x/mBXdR5xx1bnGxI0gToBwM8f+86VgfurgD7HrCzY4IDZ4GW3oJ07mtynE4A/KBMWU yghTqu/ixf5zAZ7Vd/eJhjVVfiJ83QudJ390VSd6J1bc7dN42gKpVaE+D/YUc6p0XYDl Xkn1GkZLQcbJdtv5FcCf4H/KNuubUTZDihhWet0x80YAQ57/ea2WlskuBHh9CN/aJyOb 8oPol5kjPmoR+YC5uhW4ctY6hn1NOoQA0rOyVq8QJ8x1zse1Ih7XMLh59zO+mQwgOTVs AXREqT/Uzlevgvpp68Zzx0czl/GhwIR/XhM4RlxSlgmWfvohkht7fBTuP4/ojLlSsWbi xZoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=ShRv9pV2AiOoQ7kKf6pAT6HNznQzxV/dtMmDpxzFPcg=; b=IQYcZkrUycxfIpSgZEc9MZ7UmEnib8vtnGWsO9R+pl1ep9ha+CVZrulTR9CkuJuUK1 LXP7p3nP2S40fmzA5dsByAa8MF9ogZYOcgNi+jKani9kCmk+W4nSzXJjfpVIZ/gMTo2i Rny24Rd9ZnlTwqIKImdQJSl9dVaeIQ+h+u7a1HN8gjCDjZPBeD2FczHamQIWvHhIT0bg RMYjD8aX9QN6BpacAzaeJWs0gy6MARrr62MCmqk4LgUK+sCOw7NZmONiF+FHdxbInbnb 0RNjoLv4dOXVG3lVCO7rvLW/tmFguPIg9xNXQg/vR1wYMFKE71qOfoCrJUcg/9u9WIrO Pb9Q== X-Gm-Message-State: AOAM5303VfeX/07RPNzqenRAeHAJfJsonjZqRCzEZHP73rInlG+KUaxa /MwoopJykt/7+n+W7kcbfpzVrQ== X-Google-Smtp-Source: ABdhPJx0jRxATWymTrblnpnNQ0Bh0U6mtk54N2Aq+6epLPW62w5Iza5uwSyU0BFxEpANkmB47UhGdA== X-Received: by 2002:a05:6512:130b:: with SMTP id x11mr20691710lfu.660.1643213157285; Wed, 26 Jan 2022 08:05:57 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id p6sm1869984lfa.241.2022.01.26.08.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:05:56 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Madalin Bucur , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 5/5] dt-bindings: net: xgmac_mdio: Add "clock-frequency" and "suppress-preamble" Date: Wed, 26 Jan 2022 17:05:43 +0100 Message-Id: <20220126160544.1179489-6-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126160544.1179489-1-tobias@waldekranz.com> References: <20220126160544.1179489-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The driver now supports the standard "clock-frequency" and "suppress-preamble" properties, do document them in the binding description. Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- .../devicetree/bindings/net/fsl-fman.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index cd5288fb4318..801efc7d6818 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -388,6 +388,25 @@ PROPERTIES Value type: Definition: A standard property. +- clocks + Usage: optional + Value type: + Definition: A reference to the input clock of the controller + from which the MDC frequency is derived. + +- clock-frequency + Usage: optional + Value type: + Definition: Specifies the external MDC frequency, in Hertz, to + be used. Requires that the input clock is specified in the + "clocks" property. See also: mdio.yaml. + +- suppress-preamble + Usage: optional + Value type: + Definition: Disable generation of preamble bits. See also: + mdio.yaml. + - interrupts Usage: required for external MDIO Value type: