From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932314AbdJJOKj (ORCPT ); Tue, 10 Oct 2017 10:10:39 -0400 Received: from mail-dm3nam03on0056.outbound.protection.outlook.com ([104.47.41.56]:40846 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932277AbdJJOKb (ORCPT ); Tue, 10 Oct 2017 10:10:31 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=nxp.com; From: Madalin Bucur To: , CC: , , , , Subject: [PATCH 2/4] dpaa_eth: move of_phy_connect() to the eth driver Date: Tue, 10 Oct 2017 17:10:16 +0300 Message-ID: <1507644618-32006-3-git-send-email-madalin.bucur@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1507644618-32006-1-git-send-email-madalin.bucur@nxp.com> References: <1507644618-32006-1-git-send-email-madalin.bucur@nxp.com> Reply-To: X-EOPAttributedMessage: 0 X-Matching-Connectors: 131521182290096224;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.158.2;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7966004)(336005)(376002)(346002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(3450700001)(110136005)(97736004)(2906002)(16586007)(5003940100001)(498600001)(76176999)(43066003)(50986999)(77096006)(69596002)(104016004)(5890100001)(50466002)(48376002)(54906003)(85426001)(2950100002)(39060400002)(53936002)(8936002)(316002)(47776003)(36756003)(33646002)(305945005)(4326008)(50226002)(6666003)(86362001)(68736007)(575784001)(5660300001)(8676002)(81166006)(356003)(81156014)(105606002)(106466001)(189998001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR03MB2366;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC009;1:d5FOnqUN5Ue+L52lzb1LYZ7jV9XzJRZ6tM7LNJj5mUlfm1OmAvfH3ZCrJ/mtCGCdMEdPCAo97SXI1Ur5qEOxB7NANfPH364jF4Y4o5+gXoSTnBqdE5nKXdhA7X0LU8ij MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4390d18b-2c0a-4781-2570-08d50fe8a93b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017052603199)(201703131430075)(201703131517081);SRVR:SN2PR03MB2366; X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2366;3:F5j+g37JVrahlwuzyw651UGl34Sraj2i8ye08jGEv3vi2JNtxG5SZFWx62HXFiDlVfjm6oTw9sCO7bx5vi9JoNZPat4Bp/fheNmhmk4e4mnQwx64RYs/oQMEUm7CdsgurDn0nf4W6N36shpvpW/4xIH90M7KbfN1wV8mDwOkuNBowOnX7rbJzITAmpklbPotf25A4b99A11758Cnl/GFlAqKtQOL1ILNXwxQlzBh6JAKdu+6ZtqUm1YUuvBNgbUWog8MKdu3UNwKFVJHjwh8yFUY/EzbQ0kpu8rwdxWlGw/+I9bwqdl//E9MeEqAMr7Uk2ck+BTQ1827XlTmTf8GpLVm53k8sLCuA5fmXzoB0dc=;25:Rvlh7ub5bwGdfooB+AT8tmG9ktqOpiezEd/vtKkBITj2yw0NtpqUzHNk+rTKkhTlVc6qdMrcWxp+waOKePXQdeEkX5XFUAYOiQ8w7tfjIStcnqivdJe1dPJzDfpW6+sBIzIETZdgW2iqMi0+kCN9oLrk+CwBKELtBzuCZESRendg3lr7g/XbwfvqCogsQkN54/jl+L+GyV2k3M9rq7KNeBQ4br/jdUmcwbE6yK7zM54rkVeLy495GPAZ0dJhKm5RSkcBbTDqcwr1zL1bTMlqYNTfVEqAQGcdpw2i9wJGcfSTFlhgBQ69gYTKVUi57j1U+/Au6qcfkK3PGKq3woOw6Q== X-MS-TrafficTypeDiagnostic: SN2PR03MB2366: X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2366;31:OoitGmLvk62Z9QvC+0nRjJ0vtqgxXZAIlNmbi3RibNit000ck4H2dYDfN++wTRTcr4qMk0T6kCO9d8aU8o74EQ+pApukisr4r8cc/2+sa3EoyOr1iGK/ewVb2q6j/qIhsoo2KbIlD2QZC2/lKT/SGdPNXDv8v0/OSwqPjBrTCy0T+mpyDORH+MWWQxXdVp3mO8jcp3+HMJ0fMQTn1mDvV0ttsHwJmcBbK2YWV7u37BU=;4:S6xmMzgzIGiNgqW5fOHX8IH1QkYvmweXot9SK3rQuNmYvf2ZmXfQ3WLIKCL1tgox+OYpmPAbMT5wcdT4ZCctQp5qM+QeUriVn4ykp+H8QcC4QjGbvOf3aw0uXFm2wHPCELT5ly4DGDtu7Fh3KymeHqNJwuv9hPQdZSvmuIPPKHX9JGVz5W+XL51bC+30ikjliDJ5yBcBvYn2aCd4ki/9bKWv1XgZalmOS2GjLeO+LnvYSgYUBZjni3XnetMlkGyvJBG1U+FOPlCD8fyQV5apKYbYVHGr41e8jB/42FH4OuCK89edHjR0inCDwkFZqqTePz6VeNiYns2PDxWfw+WUVg== X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(21532816269658); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(20161123563025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN2PR03MB2366;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN2PR03MB2366; X-Forefront-PRVS: 04569283F9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR03MB2366;23:cGVbgAgzaPyrKYwrZvmLjbfTLB7pjpsHNlD6YATCr?= =?us-ascii?Q?ZSYAy6szAcKZX1e+P+gjKaAiES4KVK+hDi5cvn1OTRJBHkuAcJxM2wsYZ0QA?= =?us-ascii?Q?nJXuf2aDeb+WHQ+D/X/eFqAPoWVCXBprAwrcbolJGDBdEv5TxdqwbL6zsG+9?= =?us-ascii?Q?s1d3vfZiMek94GxRDyXD6tLxaVAIsu53L9JzkPHbm86TdGMzRO/su9lQEwmD?= =?us-ascii?Q?9/KwXevvaSduTwnfLX9YVXUtFxmj4H2gKkhIUj6exGKmhK7jrXaoQ63yX5Py?= =?us-ascii?Q?QiJzyjU+goq2k63aeFchI46QCSL/aKutYz/xYT2GPEm/HLY0JubBApc+rOc8?= =?us-ascii?Q?tILNVs91tHxMu7eFRlpszLaLYcuvNaLLjA//xoxZNTpEotfWx0n2xkba4wrp?= =?us-ascii?Q?EulH6Ut0s2Xb2t0sc0TQ0LYmQQ44JMqmY6Rvn6ldAMre8XuC3x7sjTnTfkyf?= =?us-ascii?Q?iiuSjlClv0uHSQYG2NzyumYMjaQq/GWF+HfXVMEOgcjDpuAjYYGbV//q5rVW?= =?us-ascii?Q?2vnjS5D6E2bugKAelOFLl9KAoUarbkpnUX/FdNyv1b1LJtnpaVIq6GO/rd0f?= =?us-ascii?Q?KDEmuLlzcvwRQrP5IQA4+sRuR9iDE9R5kyRp5AwFTCjZ7yrLsq5hQW4hM/Dp?= =?us-ascii?Q?90OANDa26z94/oB6p5LVnFIwfcpkADF7UE3Z73RZquopdIVdbLQlQWlypLOq?= =?us-ascii?Q?TRS1x/VvXddK3VWgvsGYVi5rDEErP+GxYcoDN7qAKTmFw8ISN65P/WkofnvA?= =?us-ascii?Q?brb6ajZp+z4S5MSMjWWGNtWew6Lx2Domdu1XUUUZ/4E/adpipdLqomwyvKBU?= =?us-ascii?Q?GRb09+buFxezWwDp+Mi2Pgr5Nr0dApVwzrMHREaVpujrVe+KLMRHiZnEt7BM?= =?us-ascii?Q?uJa0JoOPlNagcf8DXCMBXVok1vVpmosRtC8Q0ShPkWwtuA1Gr8VlBX330+2J?= =?us-ascii?Q?dPJfehS2TaHfdr04aRT3Tc80ZFtj8ZcEgR7pkleuWzkOSpK1PaAJSAYTA6SA?= =?us-ascii?Q?+38Mwzsti2uBkjK3kHKyOmAt98qROTnBou/13R8K/8D7Ny14kA0RwPqXgeJl?= =?us-ascii?Q?mXwALiCe2qkeUBv5wcVIBXkTTbrwBCFhEUOMw5l2qJR6Vx4kdyZITG9MiE2E?= =?us-ascii?Q?2qTf0U0FNsi62ulR9GafHAuWlpa701PRRE1jSGILJx9BbrDsxpOBwoKZ7DMb?= =?us-ascii?Q?GD3cG+BykXFAa1cglQA+wQCUiyVcd/IxMinnD6z6ZqJKint66D3OBv0zVEou?= =?us-ascii?Q?z5P+BGG+7uU/luoXPWHiy+V3/rwmaZPxIR3yoEK4YiiXBLp1+uiz2YYYgZK1?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2366;6:Bp29Sw2fjxKMd5kajSTfc71C15L5L41sozsylGwqfuWtO1I7pG5sWSC4FviZRw5svUEC5mna8ue+sS5oyBRBjUQnNFJtTvdckPpkbKrIBliOkOZkmPJZXTPwyJyMqdO4Ls1yEEit99KNxNHFohxFVmKIfCZp7sy5lgPYz9BH1Sr47Z95totaFu9MDleScgWgqowPVkBhOAggqmK0+0P9+xUmoXN2v3ctc69Yk1xMjvxJawa9f0LDjI18LNkX96+kZL1B8jABZji6OU264ybJtnDTG+NhBGIaYjowaLD6oaoUXqBsKGqr0sXvHSH0TO4h6Q9zcijxA87FQFFddPjLOQ==;5:Rjujl0DiNpS5xFU9OX0KqidTk8LbxFI9T0Ybsk9YEHovDHSh6M3cdFfvVh/ISXO7dbssrAXEh4NOJFmWnqahmOePz80ciOTS2k5Irm/9hSdNEa9AJgvPPWS4kRuc9JYRrnCZMUuH/V+9CcnWYnGrFe+LDtndJKNTO/0RXdJq57w=;24:8DL9GQnwpwSoU6epnu5J8LdNIshRzKjIeqZLudBaNjhZ527mCa8A2rVys1iDzJR4D9qoIyHG10lMB66isDlQNKkhlndvm/jkAAVYwmTdp18=;7:qWoDX6FZTW/Xy1yMIRTx4Akfds65geEZqO7i0qMhvbSxOUIUahakHoIGVINOnGDiH/t7Q6p2WNZ0SpVC7JcNvk9uoDlzSbYApuMaGwexA/t+YwpQF60JLohtC13qoTbnK08HkwfcDXqdCpnX3egx608dFxZnWFlEhw41E5OybCGR5B+gfvnLBNBhN8IDc9BhYaeGARl/XNM0oTpjHx3xpJXX8bR1lKALWMRR1m2iDpI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 14:10:28.7132 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2366 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 48 +++++++++++-- drivers/net/ethernet/freescale/fman/mac.c | 97 ++++++-------------------- drivers/net/ethernet/freescale/fman/mac.h | 5 +- 3 files changed, 66 insertions(+), 84 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 4225806..7cf61d6 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2435,6 +2435,48 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv) } } +static void dpaa_adjust_link(struct net_device *net_dev) +{ + struct mac_device *mac_dev; + struct dpaa_priv *priv; + + priv = netdev_priv(net_dev); + mac_dev = priv->mac_dev; + mac_dev->adjust_link(mac_dev); +} + +static int dpaa_phy_init(struct net_device *net_dev) +{ + struct mac_device *mac_dev; + struct phy_device *phy_dev; + struct dpaa_priv *priv; + + priv = netdev_priv(net_dev); + mac_dev = priv->mac_dev; + + phy_dev = of_phy_connect(net_dev, mac_dev->phy_node, + &dpaa_adjust_link, 0, + mac_dev->phy_if); + if (!phy_dev) { + netif_err(priv, ifup, net_dev, "init_phy() failed\n"); + return -ENODEV; + } + + /* Remove any features not supported by the controller */ + phy_dev->supported &= mac_dev->if_support; + + /* Enable the symmetric and asymmetric PAUSE frame advertisements, + * as most of the PHY drivers do not enable them by default. + */ + phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause); + phy_dev->advertising = phy_dev->supported; + + mac_dev->phy_dev = phy_dev; + net_dev->phydev = phy_dev; + + return 0; +} + static int dpaa_open(struct net_device *net_dev) { struct mac_device *mac_dev; @@ -2445,12 +2487,8 @@ static int dpaa_open(struct net_device *net_dev) mac_dev = priv->mac_dev; dpaa_eth_napi_enable(priv); - net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev); - if (!net_dev->phydev) { - netif_err(priv, ifup, net_dev, "init_phy() failed\n"); - err = -ENODEV; + if (dpaa_phy_init(net_dev)) goto phy_init_failed; - } for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { err = fman_port_enable(mac_dev->port[i]); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 9a265f8..a0a3107 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -57,9 +57,7 @@ struct mac_priv_s { struct device *dev; void __iomem *vaddr; u8 cell_index; - phy_interface_t phy_if; struct fman *fman; - struct device_node *phy_node; struct device_node *internal_phy_node; /* List of multicast addresses */ struct list_head mc_addr_list; @@ -106,7 +104,7 @@ static void set_fman_mac_params(struct mac_device *mac_dev, resource_size(mac_dev->res)); memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed = priv->max_speed; - params->phy_if = priv->phy_if; + params->phy_if = mac_dev->phy_if; params->basex_if = false; params->mac_id = priv->cell_index; params->fm = (void *)priv->fman; @@ -419,15 +417,12 @@ void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, } EXPORT_SYMBOL(fman_get_pause_cfg); -static void adjust_link_void(struct net_device *net_dev) +static void adjust_link_void(struct mac_device *mac_dev) { } -static void adjust_link_dtsec(struct net_device *net_dev) +static void adjust_link_dtsec(struct mac_device *mac_dev) { - struct device *dev = net_dev->dev.parent; - struct dpaa_eth_data *eth_data = dev->platform_data; - struct mac_device *mac_dev = eth_data->mac_dev; struct phy_device *phy_dev = mac_dev->phy_dev; struct fman_mac *fman_mac; bool rx_pause, tx_pause; @@ -444,14 +439,12 @@ static void adjust_link_dtsec(struct net_device *net_dev) fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) - netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err); + dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n", + err); } -static void adjust_link_memac(struct net_device *net_dev) +static void adjust_link_memac(struct mac_device *mac_dev) { - struct device *dev = net_dev->dev.parent; - struct dpaa_eth_data *eth_data = dev->platform_data; - struct mac_device *mac_dev = eth_data->mac_dev; struct phy_device *phy_dev = mac_dev->phy_dev; struct fman_mac *fman_mac; bool rx_pause, tx_pause; @@ -463,60 +456,12 @@ static void adjust_link_memac(struct net_device *net_dev) fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) - netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err); -} - -/* Initializes driver's PHY state, and attaches to the PHY. - * Returns 0 on success. - */ -static struct phy_device *init_phy(struct net_device *net_dev, - struct mac_device *mac_dev, - void (*adj_lnk)(struct net_device *)) -{ - struct phy_device *phy_dev; - struct mac_priv_s *priv = mac_dev->priv; - - phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0, - priv->phy_if); - if (!phy_dev) { - netdev_err(net_dev, "Could not connect to PHY\n"); - return NULL; - } - - /* Remove any features not supported by the controller */ - phy_dev->supported &= mac_dev->if_support; - /* Enable the symmetric and asymmetric PAUSE frame advertisements, - * as most of the PHY drivers do not enable them by default. - */ - phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause); - phy_dev->advertising = phy_dev->supported; - - mac_dev->phy_dev = phy_dev; - - return phy_dev; -} - -static struct phy_device *dtsec_init_phy(struct net_device *net_dev, - struct mac_device *mac_dev) -{ - return init_phy(net_dev, mac_dev, &adjust_link_dtsec); -} - -static struct phy_device *tgec_init_phy(struct net_device *net_dev, - struct mac_device *mac_dev) -{ - return init_phy(net_dev, mac_dev, adjust_link_void); -} - -static struct phy_device *memac_init_phy(struct net_device *net_dev, - struct mac_device *mac_dev) -{ - return init_phy(net_dev, mac_dev, &adjust_link_memac); + dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n", + err); } static void setup_dtsec(struct mac_device *mac_dev) { - mac_dev->init_phy = dtsec_init_phy; mac_dev->init = dtsec_initialization; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -528,14 +473,13 @@ static void setup_dtsec(struct mac_device *mac_dev) mac_dev->set_multi = set_multi; mac_dev->start = start; mac_dev->stop = stop; - + mac_dev->adjust_link = adjust_link_dtsec; mac_dev->priv->enable = dtsec_enable; mac_dev->priv->disable = dtsec_disable; } static void setup_tgec(struct mac_device *mac_dev) { - mac_dev->init_phy = tgec_init_phy; mac_dev->init = tgec_initialization; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; @@ -547,14 +491,13 @@ static void setup_tgec(struct mac_device *mac_dev) mac_dev->set_multi = set_multi; mac_dev->start = start; mac_dev->stop = stop; - + mac_dev->adjust_link = adjust_link_void; mac_dev->priv->enable = tgec_enable; mac_dev->priv->disable = tgec_disable; } static void setup_memac(struct mac_device *mac_dev) { - mac_dev->init_phy = memac_init_phy; mac_dev->init = memac_initialization; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; @@ -566,7 +509,7 @@ static void setup_memac(struct mac_device *mac_dev) mac_dev->set_multi = set_multi; mac_dev->start = start; mac_dev->stop = stop; - + mac_dev->adjust_link = adjust_link_memac; mac_dev->priv->enable = memac_enable; mac_dev->priv->disable = memac_disable; } @@ -850,13 +793,13 @@ static int mac_probe(struct platform_device *_of_dev) mac_node); phy_if = PHY_INTERFACE_MODE_SGMII; } - priv->phy_if = phy_if; + mac_dev->phy_if = phy_if; - priv->speed = phy2speed[priv->phy_if]; + priv->speed = phy2speed[mac_dev->phy_if]; priv->max_speed = priv->speed; mac_dev->if_support = DTSEC_SUPPORTED; /* We don't support half-duplex in SGMII mode */ - if (priv->phy_if == PHY_INTERFACE_MODE_SGMII) + if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII) mac_dev->if_support &= ~(SUPPORTED_10baseT_Half | SUPPORTED_100baseT_Half); @@ -865,12 +808,12 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->if_support |= SUPPORTED_1000baseT_Full; /* The 10G interface only supports one mode */ - if (priv->phy_if == PHY_INTERFACE_MODE_XGMII) + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) mac_dev->if_support = SUPPORTED_10000baseT_Full; /* Get the rest of the PHY information */ - priv->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - if (!priv->phy_node && of_phy_is_fixed_link(mac_node)) { + mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; err = of_phy_register_fixed_link(mac_node); @@ -884,8 +827,8 @@ static int mac_probe(struct platform_device *_of_dev) goto _return_dev_set_drvdata; } - priv->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(priv->phy_node); + mac_dev->phy_node = of_node_get(mac_node); + phy = of_phy_find_device(mac_dev->phy_node); if (!phy) { err = -EINVAL; goto _return_dev_set_drvdata; @@ -903,7 +846,7 @@ static int mac_probe(struct platform_device *_of_dev) err = mac_dev->init(mac_dev); if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); - of_node_put(priv->phy_node); + of_node_put(mac_dev->phy_node); goto _return_dev_set_drvdata; } diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index d7313f0..1ca85a1 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -50,6 +50,8 @@ struct mac_device { struct fman_port *port[2]; u32 if_support; struct phy_device *phy_dev; + phy_interface_t phy_if; + struct device_node *phy_node; bool autoneg_pause; bool rx_pause_req; @@ -58,11 +60,10 @@ struct mac_device { bool tx_pause_active; bool promisc; - struct phy_device *(*init_phy)(struct net_device *net_dev, - struct mac_device *mac_dev); int (*init)(struct mac_device *mac_dev); int (*start)(struct mac_device *mac_dev); int (*stop)(struct mac_device *mac_dev); + void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, enet_addr_t *enet_addr); int (*set_multi)(struct net_device *net_dev, -- 2.1.0