From patchwork Fri May 14 21:03:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 439755 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 DF509C43461 for ; Fri, 14 May 2021 21:05:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C54A861454 for ; Fri, 14 May 2021 21:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231373AbhENVGJ (ORCPT ); Fri, 14 May 2021 17:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbhENVGG (ORCPT ); Fri, 14 May 2021 17:06:06 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79BCC06134F; Fri, 14 May 2021 14:03:56 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id m12so606693eja.2; Fri, 14 May 2021 14:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EqMnO3VT2i4M3faVTMux4QDLP8zL5VN1wUnSrpXnu9w=; b=BdiqB/0y0OBoWZuEbXF1PVMMEVNuHMweuEA7wcjq0Ync31RvWcBIkA41FwjnbcNT1Y MIsNsSzBT+xqpFaFtg5c6rkGa6RvpMPxFbbxnFSB4Ax2rI3TSfXaLePBd8Du5QGDxVdL q/zwiErIqfjlyaR0dG+Tvy0yNhtkFofbwnnHaOgzBneLdUnGT3LsIz9SLX7MFQBSbclq jZlbpysMr0MfGXRttZfWcOk58CeoHBsI5gQqXiA8/+3BS/O0Em/aXvJm6Qb63em5LhzI oakZjekTrc8KOQRDYu6fvBPc+KarAbwii1j7lRC9aiLulUETmwxMqA5Y4Ka8CAEmohte dEaA== 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:mime-version :content-transfer-encoding; bh=EqMnO3VT2i4M3faVTMux4QDLP8zL5VN1wUnSrpXnu9w=; b=jODh0rFyiE+ZiUJHhSlXm2V+kz7/uNaBBihBDHK+ERs8JB+ZiU8IamhVktrXG9Wclr fKB/fBSY0uwT7Gwdw+mjYj3+w029CmE4bLYehbidCaEVsedet3exnJkmclj1h+zoC0AS h8ccQG0Fm+fjvigJQv0Del3IU7W0hSclWp776ccMkqRZNh2W0jKgJ2Ke6gMsX/nFeVjJ c+kiknLKdDLxHs4+OdA92nzFDQxf0AdfcR1YrlCfdx3/260wUhHWPGw6WOCguJiHKPzm yZmEjeI7ihK86sD2It0ItmN/nf2hoRATg2c4NnMFR1YU3ySwtf3oyfZGXOewBWgn8pmy H0Og== X-Gm-Message-State: AOAM530F8c3Zl6GweVmSFsQduI0buEBzXJkiHNhuvF7w5q89FAoa4Uis bvn3N9v2ARdGOBJattv3ezA= X-Google-Smtp-Source: ABdhPJxiKaETpI5YUfaId8voZYUy7LAyXHcq3orJgovWZGVkbaGviSzJH6KbagxjvLeIhOAuhVO6Tw== X-Received: by 2002:a17:907:93a:: with SMTP id au26mr21595382ejc.271.1621026235647; Fri, 14 May 2021 14:03:55 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id f7sm5428330edd.5.2021.05.14.14.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 14:03:55 -0700 (PDT) From: Ansuel Smith To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ansuel Smith Subject: [net-next 1/3] net: mdio: ipq8064: clean whitespaces in define Date: Fri, 14 May 2021 23:03:49 +0200 Message-Id: <20210514210351.22240-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix mixed whitespace and tab for define spacing. Signed-off-by: Ansuel Smith Reviewed-by: Andrew Lunn --- drivers/net/mdio/mdio-ipq8064.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c index 8fe8f0119fc1..f776a843a63b 100644 --- a/drivers/net/mdio/mdio-ipq8064.c +++ b/drivers/net/mdio/mdio-ipq8064.c @@ -15,25 +15,26 @@ #include /* MII address register definitions */ -#define MII_ADDR_REG_ADDR 0x10 -#define MII_BUSY BIT(0) -#define MII_WRITE BIT(1) -#define MII_CLKRANGE_60_100M (0 << 2) -#define MII_CLKRANGE_100_150M (1 << 2) -#define MII_CLKRANGE_20_35M (2 << 2) -#define MII_CLKRANGE_35_60M (3 << 2) -#define MII_CLKRANGE_150_250M (4 << 2) -#define MII_CLKRANGE_250_300M (5 << 2) +#define MII_ADDR_REG_ADDR 0x10 +#define MII_BUSY BIT(0) +#define MII_WRITE BIT(1) +#define MII_CLKRANGE(x) ((x) << 2) +#define MII_CLKRANGE_60_100M MII_CLKRANGE(0) +#define MII_CLKRANGE_100_150M MII_CLKRANGE(1) +#define MII_CLKRANGE_20_35M MII_CLKRANGE(2) +#define MII_CLKRANGE_35_60M MII_CLKRANGE(3) +#define MII_CLKRANGE_150_250M MII_CLKRANGE(4) +#define MII_CLKRANGE_250_300M MII_CLKRANGE(5) #define MII_CLKRANGE_MASK GENMASK(4, 2) #define MII_REG_SHIFT 6 #define MII_REG_MASK GENMASK(10, 6) #define MII_ADDR_SHIFT 11 #define MII_ADDR_MASK GENMASK(15, 11) -#define MII_DATA_REG_ADDR 0x14 +#define MII_DATA_REG_ADDR 0x14 -#define MII_MDIO_DELAY_USEC (1000) -#define MII_MDIO_RETRY_MSEC (10) +#define MII_MDIO_DELAY_USEC (1000) +#define MII_MDIO_RETRY_MSEC (10) struct ipq8064_mdio { struct regmap *base; /* NSS_GMAC0_BASE */ From patchwork Fri May 14 21:03:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 439319 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 BD673C433B4 for ; Fri, 14 May 2021 21:05:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B60261482 for ; Fri, 14 May 2021 21:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231625AbhENVGL (ORCPT ); Fri, 14 May 2021 17:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhENVGG (ORCPT ); Fri, 14 May 2021 17:06:06 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42C0C061360; Fri, 14 May 2021 14:03:57 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id t15so43325edr.11; Fri, 14 May 2021 14:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ctXpRlQ6FlvoV9ONjAkOtzHC3lSCN9dn13hMr8UOEWo=; b=VJ5bSaNRe3/CnbcykETAwZShH0YOYVvVvjoYTgLkDg2yty8wVBoC89PBLwhCDjKhfH ak8wKr62L51mJDwHb1kIaG0h+PsqB8B+ts8L7NPWHxogPTr9CQwiGOCsti5hz+kM4acQ uudkwouayTZ/6wzVBl2FTK9SiMIKZAEkxxkRS6LSninJe8RGKGFmwc+Ob4xLBezx4V/E Rfa6JYN2sq2A4CqFCJyiogWbFv3VNlj379i3QlHK1HyQMOb2CyCUCY6DLvV9QSIHzJiw /IkkLgQI2+hmjHmtbs4L+cnh26aWpm0fUEFHZzBrWhDOCOtFK8RVc5s42f1HatXxz4eD Er+w== 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=ctXpRlQ6FlvoV9ONjAkOtzHC3lSCN9dn13hMr8UOEWo=; b=ColzYzsVyjGryUGHoeAXvtUpxHO3NvnSEpomCrDjvpBNLWiOfwUD8Dl8koUDn4K93I 8+MXMLG5anraaFE0G3Xsdt5lO246DcqQhlLAvdJnZ3QfWigh48TGwUR9AjMBbXocOO0J Tg0aGfcIQU/SHFP8ur2ut8U9336KMcLgtLD5ryTN+CAySOegdlU+uI9IPjJuqjD0Wt1x U8R7T9MiT/Q7DYyKhTbgmWIdb3lyP7W0SMDFYIPNGQXRei9fAwwiUGeWTm75oiMAV08p Gl7PTUUFdbnveq0fz1aM36xw11KsXMK9A1IiKKcTDIEIZYz92SO05xzoO5ZahZu/hrYx khXw== X-Gm-Message-State: AOAM5317z3AHfB/9dbfCs2IiZxNxWA6/DQNNCTVWAPhD++Bp4Bk/wlfx e/C8lUhZ8nD0cIQ6l5UEgMc= X-Google-Smtp-Source: ABdhPJwfTVABsoGpj0oU1dZyPYgjzqZiuRaOdgVmnORV9rqSB6f0sfu6w+JC8TjnJsOLpzD1teHyxw== X-Received: by 2002:a05:6402:1256:: with SMTP id l22mr22950433edw.207.1621026236500; Fri, 14 May 2021 14:03:56 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id f7sm5428330edd.5.2021.05.14.14.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 14:03:56 -0700 (PDT) From: Ansuel Smith To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ansuel Smith , Florian Fainelli Subject: [net-next 2/3] net: mdio: ipq8064: add regmap config to disable REGCACHE Date: Fri, 14 May 2021 23:03:50 +0200 Message-Id: <20210514210351.22240-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210514210351.22240-1-ansuelsmth@gmail.com> References: <20210514210351.22240-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org mdio drivers should not use REGCHACHE. Also disable locking since it's handled by the mdio users and regmap is always accessed atomically. Signed-off-by: Ansuel Smith Reviewed-by: Florian Fainelli --- drivers/net/mdio/mdio-ipq8064.c | 34 +++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c index f776a843a63b..14b3c310af73 100644 --- a/drivers/net/mdio/mdio-ipq8064.c +++ b/drivers/net/mdio/mdio-ipq8064.c @@ -7,10 +7,9 @@ #include #include -#include #include #include -#include +#include #include #include @@ -97,14 +96,34 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data) return ipq8064_mdio_wait_busy(priv); } +static const struct regmap_config ipq8064_mdio_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .can_multi_write = false, + /* the mdio lock is used by any user of this mdio driver */ + .disable_locking = true, + + .cache_type = REGCACHE_NONE, +}; + static int ipq8064_mdio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct ipq8064_mdio *priv; + struct resource res; struct mii_bus *bus; + void __iomem *base; int ret; + if (of_address_to_resource(np, 0, &res)) + return -ENOMEM; + + base = ioremap(res.start, resource_size(&res)); + if (!base) + return -ENOMEM; + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv)); if (!bus) return -ENOMEM; @@ -116,15 +135,10 @@ ipq8064_mdio_probe(struct platform_device *pdev) bus->parent = &pdev->dev; priv = bus->priv; - priv->base = device_node_to_regmap(np); - if (IS_ERR(priv->base)) { - if (priv->base == ERR_PTR(-EPROBE_DEFER)) - return -EPROBE_DEFER; - - dev_err(&pdev->dev, "error getting device regmap, error=%pe\n", - priv->base); + priv->base = devm_regmap_init_mmio(&pdev->dev, base, + &ipq8064_mdio_regmap_config); + if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - } ret = of_mdiobus_register(bus, np); if (ret) From patchwork Fri May 14 21:03:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 439318 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 76ACCC433B4 for ; Fri, 14 May 2021 21:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B69561155 for ; Fri, 14 May 2021 21:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232172AbhENVGT (ORCPT ); Fri, 14 May 2021 17:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbhENVGG (ORCPT ); Fri, 14 May 2021 17:06:06 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFB10C061361; Fri, 14 May 2021 14:03:58 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id lg14so549912ejb.9; Fri, 14 May 2021 14:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DuIZvkVyxl0vo+4ykBws9GPNTneGdS9CaBr3gH+w73E=; b=sc7EZNWCUByl4ePiwgGpHBKYBaDZi/cH44mbVm+BUFNkpbt3qtbaFKN0jidLehegWI P6/2efXFcwibqEV8dqYV+f5QV2XUCkt7jE0TXbdRAV/w74n2QT0eXp3jN9yQWpxgMHQ8 gtuDb51v0Oe00EobGXWSa00+DlO5iuDarousBf3ApE6RoQSVuYFKdKHznPDPyhXTwkqq 9IsWSOFPNUguoAEpYRkz6CgPzqBa3vYKKupRMPOymI3VygHhEVmd8yg3CcSc91Iusb1Q GmFygDmDUmcFAWVpNQMCxsz+xd2QS5DM8DDunw8vgafONKuCEz22OwwHkW3AbDkzAvCt 9o2A== 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=DuIZvkVyxl0vo+4ykBws9GPNTneGdS9CaBr3gH+w73E=; b=QXGyylnl1oVmgp3fmPmHwUXMJ77i9mUbKuQUK0Y/zcvhVZ27HtvUXYrknhhb6IxMrD 4ZBa6Cga+2Mu1hrCfJgNaAJ8r5zqdkmGZrezY+AiHyhD5RWNHmjqwY/ndh4kfSu3U2BU 7drnnNmq2bs+ebgoX+VeOMrFi2VdsDZEhoMD5w2cTNiAuWVX9xuBIsBFpDziH6xToJED +KRP/Gme2AW92XKDV1nxlZgGxwpsuplGHaVj1B7umJlrbNii4KomX9rKmxl8wcwZiexc 4P0UOlsY9j4xuVJZAG4NeDjj/VzreqMK+iTgrWdRTg5hqnyuFpkhkapmzMgWKL8P7/lZ cNhQ== X-Gm-Message-State: AOAM533cVSjzhzTTkzZp5VQtFNxLbF421XI6ksEYhSshRur7j4WEj1H8 fTGvzqJA9MEd9AwnvecRf1o= X-Google-Smtp-Source: ABdhPJyB48CHxHQu+e51fgG6b4y+BQUivEKolcF9s+7qXmdtr4n2v6BWhFdQ2N9jK4vuUKq3Eue6bQ== X-Received: by 2002:a17:907:161f:: with SMTP id hb31mr50946633ejc.514.1621026237411; Fri, 14 May 2021 14:03:57 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id f7sm5428330edd.5.2021.05.14.14.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 14:03:57 -0700 (PDT) From: Ansuel Smith To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ansuel Smith , Florian Fainelli Subject: [net-next 3/3] net: mdio: ipq8064: enlarge sleep after read/write operation Date: Fri, 14 May 2021 23:03:51 +0200 Message-Id: <20210514210351.22240-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210514210351.22240-1-ansuelsmth@gmail.com> References: <20210514210351.22240-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With the use of the qca8k dsa driver, some problem arised related to port status detection. With a load on a specific port (for example a simple speed test), the driver starts to behave in a strange way and garbage data is produced. To address this, enlarge the sleep delay and address a bug for the reg offset 31 that require additional delay for this specific reg. Signed-off-by: Ansuel Smith Reviewed-by: Florian Fainelli --- drivers/net/mdio/mdio-ipq8064.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c index 14b3c310af73..bd1aea2d5a26 100644 --- a/drivers/net/mdio/mdio-ipq8064.c +++ b/drivers/net/mdio/mdio-ipq8064.c @@ -65,7 +65,7 @@ ipq8064_mdio_read(struct mii_bus *bus, int phy_addr, int reg_offset) ((reg_offset << MII_REG_SHIFT) & MII_REG_MASK); regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr); - usleep_range(8, 10); + usleep_range(10, 13); err = ipq8064_mdio_wait_busy(priv); if (err) @@ -91,7 +91,14 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data) ((reg_offset << MII_REG_SHIFT) & MII_REG_MASK); regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr); - usleep_range(8, 10); + + /* For the specific reg 31 extra time is needed or the next + * read will produce garbage data. + */ + if (reg_offset == 31) + usleep_range(30, 43); + else + usleep_range(10, 13); return ipq8064_mdio_wait_busy(priv); }