From patchwork Wed Sep 27 07:34:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 114356 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4721495qgf; Wed, 27 Sep 2017 00:36:59 -0700 (PDT) X-Received: by 10.99.98.7 with SMTP id w7mr512419pgb.338.1506497818906; Wed, 27 Sep 2017 00:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506497818; cv=none; d=google.com; s=arc-20160816; b=JH3+OGxRl4zD6ewLN/g/5K9e49c9QqD+wC5ZpJHaR5rwH5a5ylMA7FV4uwulc/WXA8 qR2adoAJFcnZDQVOKMzYfLdWM1lEFXSlpvhm/RH0f5ng5t+sW3euDAXbqwfp6JE2cgAr WK+qZe7i+gcptg36aK0HZbMcfs3PZSXJrdbkwBXhMkOJ4aMw0lmrnO8bVcZOxTStcQIM /2spR4iWx/G7CHDcnME5m4RQDUAmvi7qwdKciYC+Gc6G/aU3barvx8+4TcoslgurECdZ 0mwp+BHvuUf+vHxJiQJSgnkFI8AKSdSzqre+FrEUQ800LfRd9u7f0S3Aq351emocNCtV zAVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=pvuncjDUJfd9cauaGt6YjxOdJe2GLy7l8P1oyjXnoL0=; b=TQmCEhLjVL8jwOMmUVHhGtElvtBvt6D8vhx+pwxJgqb3CPNpUUdQByqgYiSnsMa3P0 QD8em+LdKpYCmETh1vTNnM+ELMW6s4tV4Qh72XcphCwy0DMFHsAaNq/WUQ2Bx4mlz54q 7Vn6WQgd4gT1mPxWpDUcwMzoOOmVjan4Tu/YjJS8/lQTV39ehikUqgi0nA8MSDMLP3EO vQCREbhbHzPDDrA9uRMAI0ceqnJHpd9R12VoweLZv698aRP8FNVtab637jwWF54Ecj1e XpkdWFgxT9hmoZdLfhd5Qm2pUUDHBCbZeTfK+mWNJVBvqnQUexdL5FcZ8HZCgd0++qPl ZKEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VClnQki+; 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=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t142si7053122pgb.57.2017.09.27.00.36.58; Wed, 27 Sep 2017 00:36:58 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=VClnQki+; 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=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365AbdI0Hg5 (ORCPT + 26 others); Wed, 27 Sep 2017 03:36:57 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34351 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752306AbdI0Hgr (ORCPT ); Wed, 27 Sep 2017 03:36:47 -0400 Received: by mail-wr0-f194.google.com with SMTP id z1so809820wre.1; Wed, 27 Sep 2017 00:36:46 -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; bh=pvuncjDUJfd9cauaGt6YjxOdJe2GLy7l8P1oyjXnoL0=; b=VClnQki+MfTd+qLOdM0Xl2vQWL9JuceJrlh/VLajXXj8RvukFk9qVp+FvXEGLJCPZp Xc2wfKiTSHF98K4mrcpgkCLPnzetQRMaYW56GDHxFcTZyxGGaN0BlCUBeMj8oyP0sAev 8QesbWbLd8zd2O0vHwhT8NXSmXhxGZJ46OhyaYyswEVKVdf8vFFINrcLbTPZzrBi0Naw 2VnukGiOw7XYmn5KLlLs6TIQaHiWZJp2oLKTGRWRfoUksNCGAcbDxNG0U0sJRxVZ4WIt DxBau2NgC9ErfUQEm+yCaOsqkkYawr5xmQMNWrF1dZ2FTrFR+zu4ymCa9xU0pwzuyx4X Uc2Q== 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; bh=pvuncjDUJfd9cauaGt6YjxOdJe2GLy7l8P1oyjXnoL0=; b=XWnATmSjdSpMBJn/lAuygcGRJl10NcKy8wIcWTxgDynDk5+JmkZP63epcnhcXQqs5g WinBFrCp8yzf07rOeQj6i2238zVPxfS5xN6iAWqyhHM4tGwN+vRSXXKttBt/oS5jOQSk mDY2cifQxrWx/z4OFGmytmGdE2ibn447kHySBZUBZI9Hq+iI6FJzBvqn0gk4b/7ySf6X 5sZ7B79mAWMuq7hwLsFMj+pTsh7ZGQzWPNZYSoW1CvqO8yUHqv4xfM4+luMplmFMLgtD oIdeWsRMVWjVn06Am7RTKqkAy8IiG2DPxjC8gDZpDfvYC6EM8Fv7psiAEGXP/YUCbK+/ Cybw== X-Gm-Message-State: AHPjjUjjnK9pu4W76krCh9IHm2U1U5QJ3alZMhL+jwchNVY9lbXEv/xP pEUhE6xqs2XX47KczLaftwU= X-Google-Smtp-Source: AOwi7QAEpHKjFIEWB73XZHxxBs/XTlQ3uLe9s/C2vBV4GvH0e2aU27koRP2I48JYJ5Kor5CMl0MKcw== X-Received: by 10.223.196.228 with SMTP id o33mr509361wrf.253.1506497805863; Wed, 27 Sep 2017 00:36:45 -0700 (PDT) Received: from Red.local (LFbn-MAR-1-580-96.w90-118.abo.wanadoo.fr. [90.118.159.96]) by smtp.googlemail.com with ESMTPSA id n9sm5660526wmd.12.2017.09.27.00.36.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Sep 2017 00:36:45 -0700 (PDT) From: Corentin Labbe To: robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, andrew@lunn.ch, f.fainelli@gmail.com, frowand.list@gmail.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v6 11/11] of: mdio: Prevent of_mdiobus_register from scanning mdio-mux nodes Date: Wed, 27 Sep 2017 09:34:14 +0200 Message-Id: <20170927073414.17361-12-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927073414.17361-1-clabbe.montjoie@gmail.com> References: <20170927073414.17361-1-clabbe.montjoie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each child node of an MDIO node is scanned as a PHY when calling of_mdiobus_register() givint the following result: [ 18.175379] mdio_bus stmmac-0: /soc/ethernet@1c30000/mdio/mdio-mux has invalid PHY address [ 18.175408] mdio_bus stmmac-0: scan phy mdio-mux at address 0 [ 18.175450] mdio_bus stmmac-0: scan phy mdio-mux at address 1 [...] [ 18.176420] mdio_bus stmmac-0: scan phy mdio-mux at address 30 [ 18.176452] mdio_bus stmmac-0: scan phy mdio-mux at address 31 Since mdio-mux nodes are not PHY, this patch a way to to not scan them. Signed-off-by: Corentin Labbe --- drivers/of/of_mdio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.13.5 diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index d94dd8b77abd..d90ddb0d90f2 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -190,6 +190,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) struct device_node *child; bool scanphys = false; int addr, rc; + static const struct of_device_id do_not_scan[] = { + { .compatible = "mdio-mux" }, + {} + }; /* Do not continue if the node is disabled */ if (!of_device_is_available(np)) @@ -212,6 +216,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) /* Loop over the child nodes and register a phy_device for each phy */ for_each_available_child_of_node(np, child) { + if (of_match_node(do_not_scan, child)) + continue; + addr = of_mdio_parse_addr(&mdio->dev, child); if (addr < 0) { scanphys = true; @@ -229,6 +236,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) /* auto scan for PHYs with empty reg property */ for_each_available_child_of_node(np, child) { + if (of_match_node(do_not_scan, child)) + continue; + /* Skip PHYs with reg property set */ if (of_find_property(child, "reg", NULL)) continue;