From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751917AbaKKRjQ (ORCPT ); Tue, 11 Nov 2014 12:39:16 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:50190 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbaKKRis (ORCPT ); Tue, 11 Nov 2014 12:38:48 -0500 From: Johan Hovold To: Florian Fainelli Cc: "David S. Miller" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Johan Hovold , Bruno Thomsen Subject: [RFC 22/22] net: phy: micrel: use generic config_init for KSZ8021/KSZ8031 Date: Tue, 11 Nov 2014 18:37:40 +0100 Message-Id: <1415727460-20417-23-git-send-email-johan@kernel.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1415727460-20417-1-git-send-email-johan@kernel.org> References: <1415727460-20417-1-git-send-email-johan@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use generic config_init callback also for KSZ8021 and KSZ8031. This has been avoided this far due to commit a95a18afe4c8 ("phy/micrel: KSZ8031RNL RMII clock reconfiguration bug"), which claims that the PHY becomes unresponsive if the broadcast disable flag is set before configuring the clock mode. Disabling the broadcast address in generally the first think you want to do, and if PHY 0 is probed first, this will disable the broadcast address for all (Micrel) PHYs on the bus and prevent unnecessary reconfigurations. Note that if parallel probing is ever allowed, this will be a requirement. Cc: Bruno Thomsen Signed-off-by: Johan Hovold --- drivers/net/phy/micrel.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 3b89548e6063..bbd1c9ea0cbf 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -88,6 +88,7 @@ struct kszphy_priv { static const struct kszphy_type ksz8021_type = { .led_mode_reg = MII_KSZPHY_CTRL_2, + .has_broadcast_disable = true, .has_rmii_ref_clk_sel = true, }; @@ -258,19 +259,6 @@ static int kszphy_config_init(struct phy_device *phydev) return 0; } -static int ksz8021_config_init(struct phy_device *phydev) -{ - int rc; - - rc = kszphy_config_init(phydev); - if (rc) - return rc; - - rc = kszphy_broadcast_disable(phydev); - - return rc < 0 ? rc : 0; -} - static int ksz9021_load_values_from_of(struct phy_device *phydev, struct device_node *of_node, u16 reg, char *field1, char *field2, @@ -584,7 +572,7 @@ static struct phy_driver ksphy_driver[] = { .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8021_type, .probe = kszphy_probe, - .config_init = ksz8021_config_init, + .config_init = kszphy_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .ack_interrupt = kszphy_ack_interrupt, @@ -601,7 +589,7 @@ static struct phy_driver ksphy_driver[] = { .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8021_type, .probe = kszphy_probe, - .config_init = ksz8021_config_init, + .config_init = kszphy_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .ack_interrupt = kszphy_ack_interrupt, -- 2.0.4