Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5479201pxb; Wed, 26 Jan 2022 13:01:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEIoi92Tg43EQjTObbnHRgogXR5OfhwohwWdbs29zejSOB/8Ouhqni3ZGldTwaG69V7+Vq X-Received: by 2002:a05:6402:2707:: with SMTP id y7mr794058edd.294.1643230900540; Wed, 26 Jan 2022 13:01:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643230900; cv=none; d=google.com; s=arc-20160816; b=zcwwAiMu1TalXUeJtRtDypF9/k1dbfZ+UbPxfoou4bjoRXmB/si+D/rN+rJRZvlil1 tajYTLyZ/Wn/XvG0VnjszHRkreUsSZF9fL6O/ETRgdX/8IOz0mtFsWinCOWE4bNj22jE 84jIl1Cl/4bMTW97Q8bgjpjW4bzopXoW4DkcNpPkkvmpR7mfAMscskdhN3gdehW8aVK0 eBoNuq9SzUERfsVzgQ4jzl6fZVsJY6xuHO0uwefXyDK574nHclWlUB1SDZO5itcV8n7+ ggCgv0AqGWYeGa8NH7zCJrNfiO+3MvRC9LxwhsEOo8KyNiXfpI1cCYBVCpU/4E4D7a8j Y1KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qqxkmTuDL0v9WH77bm0OjP2Xt3xkG3hMYP9qpSlEMQo=; b=PEPoDBb56X0aU38+9KxGJcfN1Wv3lbfAVcl9DnFP4USHzv0rvRvVG15fAOX039XTRc C3DfeeT4e81DF6+tnmeB9bmcefY1VodQg45bD82cdw7UqMu/jw/ZsuGTnxt1GyaVgxK2 JBve2oiHe0EiC4hkDovUBSQpHwCDdM/hm/H38ghx6J5j6kSMhFWkM/BIfgeDbqXNmSpB 9HbG/QvHzZ2CrTfa5jKlzynPv8uszgPqAfes6pW+U0W12mQaeJXTd6ZYizikwU6uIGml D0pEXH6vxsQP0rnTAnZJ/Yra3ZSnMv/TYTGjja+12QUmzw4z9FHraWri0tGM/YQh3r8t 2vLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=kWB3pDyb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg13si224699ejc.64.2022.01.26.13.01.14; Wed, 26 Jan 2022 13:01:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=kWB3pDyb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239760AbiAZKO5 (ORCPT + 99 others); Wed, 26 Jan 2022 05:14:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239744AbiAZKOy (ORCPT ); Wed, 26 Jan 2022 05:14:54 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D5FDC06174E for ; Wed, 26 Jan 2022 02:14:54 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id x11so62121672lfa.2 for ; Wed, 26 Jan 2022 02:14: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=qqxkmTuDL0v9WH77bm0OjP2Xt3xkG3hMYP9qpSlEMQo=; b=kWB3pDyb6GK7cB9NC0EGJqCO++IYq7Ux9l7gTi9HBrbqNcOXW374l/CfIfwBhdGMyO R7gb2yLbmQ/7/7TsX3Nvg5M0hStCx24nC3lUBoNhxi7hqAb7PxTX8y10YhDaXMlq6okp 49EATEyHJPhRJl9LrA2pCABm4pXyTyC8GCHnZ6W1WjCfE9qsXSAG8/629WB8wxEDMD4q c5UEHofas4N4Qic/PFWspRZITQljlIbh7kgyJACe2+9WSeud2hOCpNDqM6clctZK0HqE B3zr14qW2/HoqCfoxbKloJhuwDGkM55BT98n6TYMrH7WKdBS227SFKpR6yaZ7Hgo3S4H B9VA== 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=qqxkmTuDL0v9WH77bm0OjP2Xt3xkG3hMYP9qpSlEMQo=; b=MvXoYMP0YEzfUV8MEGfgbHI6egB3suuVgy9j4sL4P90rNTGJ+F0+FW57gyj+PxIS56 rWZ9q2cVNI6R06F/mkByYSNgo4BF9Kw5ECddURD/Pl9LKYLoShTgYiUNmkjDazGX2+Wc AVAxnPBrnj91AWI1GY+yHUNBL17dEZtdf1xoS2awYks8mG65ZrQVU3L7QD+UowJfDqVf GJ/N3IFnlaX4xVzpOJ2ciaITaO0FsvvpGGA2jYtnQJ3w15RCyW38r9uAwvuG8bQeLeht kBGzE//Q0hWf1ZqW9oAww8szFsP+E7YQaFezP+AdVxD1NqyqiTD39PGTX4L4wqDOQkP7 5LAg== X-Gm-Message-State: AOAM531a6xz4tY3NmQGx6V3t4oBC/+w4RTRAXfn6wfth+dMm2ZARbTxD DGcHRWZ4mFJ1BTv89LVDOxOSTw== X-Received: by 2002:a05:6512:1519:: with SMTP id bq25mr10006379lfb.326.1643192092592; Wed, 26 Jan 2022 02:14: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 h13sm1351906lfv.100.2022.01.26.02.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 02:14:52 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Marcin Wojtas , Andrew Lunn , Markus Koch , Calvin Johnson , linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net/fsl: xgmac_mdio: Support preamble suppression Date: Wed, 26 Jan 2022 11:14:30 +0100 Message-Id: <20220126101432.822818-4-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126101432.822818-1-tobias@waldekranz.com> References: <20220126101432.822818-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support the standard "suppress-preamble" attribute to disable preamble generation. Signed-off-by: Tobias Waldekranz --- 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)); -- 2.25.1