From patchwork Mon Dec 19 15:05:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9480461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0E02F601C2 for ; Mon, 19 Dec 2016 15:08:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F184F284E3 for ; Mon, 19 Dec 2016 15:08:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E65BF284E6; Mon, 19 Dec 2016 15:08:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABF02284E3 for ; Mon, 19 Dec 2016 15:08:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIzXH-0005uu-8S; Mon, 19 Dec 2016 15:07:31 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIzW0-0004m9-2Y for linux-arm-kernel@lists.infradead.org; Mon, 19 Dec 2016 15:06:18 +0000 Received: by mail-wm0-x22c.google.com with SMTP id f82so103728069wmf.1 for ; Mon, 19 Dec 2016 07:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cPBnYatje3MemgdDTY5YoWxogBLq808togh1OV8WKaY=; b=RFZHaemruGNqnAq1xtBPbteEviIIT2zQjNo06Xu5QN9hyt3aHdM37yPZhXUu6tBzeA j1v0edllLoHdfSEllOw7wDpfr68EFbIn/GgqXLEw0JRzaO9pB6CEa4maI2mMfPSvagH6 Lc9WqcZXeStiWMKh9wWKcYLPy2amS9bkKlyMWO6eZAJpkzVWP5BybXmBgpJPRpAJ7Stt NWU6HHQAGuf4YABz+bDQUsOu518SAjqJFdmkM13byOBp1d4mgp88TmA1GMkdYahIY8Xx 7ZcNyJNdrzf01rdeo9QH017JwVXnv8+6PiEA9NwQcHtnyMy+s+N9bdt8kTdXvuhTG0xz eFLg== 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=cPBnYatje3MemgdDTY5YoWxogBLq808togh1OV8WKaY=; b=jUA3NqL9ankv1Firz9HBkyTILmOhogboCmwJ6LAGPhpHCcj1tQZTj3uDNJyphc71ql shQbuv5uArPZcwgx9QsgX3lvwQAv1xKgT+aeMU1smO3y5WpCUtEhDyeicpMszTGwku2D U8pGbGLb5WEwfo8LFn8q5VIXYezVIF3bSKmZX7Z0uJCAGCoIQc5Sc8Q+uyM9THa2FMmU gBHz+CPXoxwEREYE/N9DGB1ezOBzQh3QKDKQjX1qFY5yahrp9QNs38ZFGnicPjT7Sl3j tTCPB4oFJdaYP8j9mQ9/vCvwq4B4VMKIK5eBEuh7IjF0ZmjrF9ngg96Eri3llnjL6zfm qEAA== X-Gm-Message-State: AIkVDXKXUlAyZ68HtvGxS2/4tmVjkmDeDWjMp1IBEkZbCErvRRVkUz4gkTCJUjIwcxqXdpba X-Received: by 10.28.47.15 with SMTP id v15mr14419992wmv.76.1482159950158; Mon, 19 Dec 2016 07:05:50 -0800 (PST) Received: from boomer.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v2sm21046655wja.41.2016.12.19.07.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2016 07:05:49 -0800 (PST) From: Jerome Brunet To: netdev@vger.kernel.org, devicetree@vger.kernel.org, Florian Fainelli Subject: [PATCH net 2/3] net: phy: use boolean dt properties for eee broken modes Date: Mon, 19 Dec 2016 16:05:37 +0100 Message-Id: <1482159938-13239-3-git-send-email-jbrunet@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482159938-13239-1-git-send-email-jbrunet@baylibre.com> References: <1482159938-13239-1-git-send-email-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161219_070612_605217_9888ADB9 X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Neil Armstrong , Martin Blumenstingl , Kevin Hilman , linux-kernel@vger.kernel.org, Yegor Yefremov , Andre Roth , Carlo Caione , linux-amlogic@lists.infradead.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patches regarding eee-broken-modes was merged before all people involved could find an agreement on the best way to move forward. While we agreed on having a DT property to mark particular modes as broken, the value used for eee-broken-modes mapped the phy register in very direct way. Because of this, the concern is that it could be used to implement configuration policies instead of describing a broken HW. In the end, having a boolean property for each mode seems to be preferred over one bit field value mapping the register (too) directly. Cc: Florian Fainelli Signed-off-by: Jerome Brunet --- drivers/net/phy/phy_device.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ee5ebadb1463..92b08383cafa 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1665,7 +1665,7 @@ static void of_set_phy_supported(struct phy_device *phydev) static void of_set_phy_eee_broken(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; - u32 broken; + u32 broken = 0; if (!IS_ENABLED(CONFIG_OF_MDIO)) return; @@ -1673,8 +1673,20 @@ static void of_set_phy_eee_broken(struct phy_device *phydev) if (!node) return; - if (!of_property_read_u32(node, "eee-broken-modes", &broken)) - phydev->eee_broken_modes = broken; + if (of_property_read_bool(node, "eee-broken-100tx")) + broken |= MDIO_EEE_100TX; + if (of_property_read_bool(node, "eee-broken-1000t")) + broken |= MDIO_EEE_1000T; + if (of_property_read_bool(node, "eee-broken-10gt")) + broken |= MDIO_EEE_10GT; + if (of_property_read_bool(node, "eee-broken-1000kx")) + broken |= MDIO_EEE_1000KX; + if (of_property_read_bool(node, "eee-broken-10gkx4")) + broken |= MDIO_EEE_10GKX4; + if (of_property_read_bool(node, "eee-broken-10gkr")) + broken |= MDIO_EEE_10GKR; + + phydev->eee_broken_modes = broken; } /**