Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2213197ybv; Fri, 14 Feb 2020 13:48:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyXacJmTWcPGJOAvBms2e0Sr6ECgUXUb6bTWFpcovDsX+IqfPFvVzOQLgPb95c3wLIXfy27 X-Received: by 2002:aca:3f43:: with SMTP id m64mr3183567oia.165.1581716927319; Fri, 14 Feb 2020 13:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581716927; cv=none; d=google.com; s=arc-20160816; b=D6GiHNACm9Fg1W/1MJ8hZEy7CNJl0JeUm6DKJiruFS3APVwqtZslR7rhlpUVAvkOf9 JJV0ajRFRLp+xMDeLeTtQr+3X559PhYdfYTbQxnUS6QTQUTXATWsBnyG6DP+PRtXIdwt CusqE7AG1ig8B2sPeZRLRkebZKlOJEDKlvBpUx/2u3LnGdTeDlpXolXo0ZzxkLHTMnt7 KjxCWwdEbmNhl+zzKRHzQK22B9bN5tYdoAC20RANckR3AB1lvJN2HH4IfZLx3PYHwAJK P+m0wSCm0YK3YxWFBSBD/Mn5DQrFEjnSCMFRFLTjFkO6Mc/N+F5q3nseQ6yESRNF/2EV N8Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=tuhpf2H8a4ZzCABJWxUowWp6EKCvGrriOjGBgmmrUqk=; b=yhHCsjKnJfiXZKJUyU9DdqMy3ZOcGwQhJhJljtBwTbrtnLobgC0rJj+19Brv7M9MG9 cLu6zAWItBvjWUWriw3s5/yaS30bE9+vqsIBrG2H5oDp3Ht+ewlVHmeRxPqruuAs2ltI 77AyZfpNrT4VmNGOsQKw+eCeiZO0s2ijz2PmM3whU1O36wYe3cFN6LoljFF8LuFVTQ0m BNOXaFDx1vjC9iiHg4LcvAddZYrOiM9IfZNMQ6p1XRafGXFLSabJXgyMTRdcbOSe4jmL aPeW5rdHrDSYFCHjSL5czYcYSHh4q4OlnnFNb02eqtJg8ggqoi5Ro6OWIr8aq/xiU+Q0 wYSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=hQ4SQQcT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b141si3270179oii.79.2020.02.14.13.48.35; Fri, 14 Feb 2020 13:48:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=hQ4SQQcT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730510AbgBNVsH (ORCPT + 99 others); Fri, 14 Feb 2020 16:48:07 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35993 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730464AbgBNVsH (ORCPT ); Fri, 14 Feb 2020 16:48:07 -0500 Received: by mail-wm1-f68.google.com with SMTP id p17so12322598wma.1 for ; Fri, 14 Feb 2020 13:48:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=tuhpf2H8a4ZzCABJWxUowWp6EKCvGrriOjGBgmmrUqk=; b=hQ4SQQcTZJYMJuGZ+sQF+Ern+ux0UaPM5+ddU9VsawxMBSNRoBQ5HHGbv2iNajhR2x oLZ6oWB9QvA3XrP3wpvBD8d4G8nrCqZZ8RlFLQfkp0Xe4UypOaGTNap69OXifGgIfN4d 806OAX5oL1Eht/84kwnb/N8C5O5eo3AvMGVcM= 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; bh=tuhpf2H8a4ZzCABJWxUowWp6EKCvGrriOjGBgmmrUqk=; b=KVGW6yZwXr22V/a9WHh/05LUlYvWXR9Px94KkbGPGqOlGQwrAwJ+P6rV4EJy/bWgVz nOz0XVeILRNs8Ytn8AwInT/ZidUftyG/JlaYNyMtxgv2dkFXyPnirH6S64ciOwQXUycd HWGzpYNlS+fn5Hd4rPh9BO36r227n3MkXrU7DO+66MRQhIzJMZKlP/8VMkWGi7iqMxZR paxvCD3Fh8cJCpq9NFTjUfjJOYpblZgLGf8xeuAaajG8deL+fGUPPX/BlVWhfuBPJEv+ ZkbMOLmuSbHO+DVw7GSBpSLqFb3UPLVqeb06nGjson17Z1yYMAZdlyG8W1mI52eJnlH2 F1OA== X-Gm-Message-State: APjAAAWnnyXQ4/ZXFdjjIMj11WN13BVnOVIvJ6FhB20dEKzL+WC2+NQW c6yhjqO+eBLvnzkCtI0brf1lXw== X-Received: by 2002:a1c:9ed7:: with SMTP id h206mr6546114wme.67.1581716885231; Fri, 14 Feb 2020 13:48:05 -0800 (PST) Received: from lbrmn-lnxub113.broadcom.net ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id y12sm8842421wrw.88.2020.02.14.13.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 13:48:04 -0800 (PST) From: Scott Branden To: Andrew Lunn , Florian Fainelli , Heiner Kallweit Cc: Russell King , "David S . Miller" , Ray Jui , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arun Parameswaran , Scott Branden Subject: [PATCH v2] net: phy: restore mdio regs in the iproc mdio driver Date: Fri, 14 Feb 2020 13:47:46 -0800 Message-Id: <20200214214746.10153-1-scott.branden@broadcom.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arun Parameswaran The mii management register in iproc mdio block does not have a retention register so it is lost on suspend. Save and restore value of register while resuming from suspend. Fixes: bb1a619735b4 ("net: phy: Initialize mdio clock at probe function") Signed-off-by: Arun Parameswaran Signed-off-by: Scott Branden --- drivers/net/phy/mdio-bcm-iproc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c index 7e9975d25066..f1ded03f0229 100644 --- a/drivers/net/phy/mdio-bcm-iproc.c +++ b/drivers/net/phy/mdio-bcm-iproc.c @@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +int iproc_mdio_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct iproc_mdio_priv *priv = platform_get_drvdata(pdev); + + /* restore the mii clock configuration */ + iproc_mdio_config_clk(priv->base); + + return 0; +} + +static const struct dev_pm_ops iproc_mdio_pm_ops = { + .resume = iproc_mdio_resume +}; +#endif /* CONFIG_PM_SLEEP */ + static const struct of_device_id iproc_mdio_of_match[] = { { .compatible = "brcm,iproc-mdio", }, { /* sentinel */ }, @@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = { .driver = { .name = "iproc-mdio", .of_match_table = iproc_mdio_of_match, +#ifdef CONFIG_PM_SLEEP + .pm = &iproc_mdio_pm_ops, +#endif }, .probe = iproc_mdio_probe, .remove = iproc_mdio_remove, -- 2.17.1