From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932148AbdJPSg3 (ORCPT ); Mon, 16 Oct 2017 14:36:29 -0400 Received: from mail-sn1nam02on0046.outbound.protection.outlook.com ([104.47.36.46]:5330 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932086AbdJPSgX (ORCPT ); Mon, 16 Oct 2017 14:36:23 -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 v3 2/6] dpaa_eth: move of_phy_connect() to the eth driver Date: Mon, 16 Oct 2017 21:36:06 +0300 Message-ID: <1508178970-28945-3-git-send-email-madalin.bucur@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1508178970-28945-1-git-send-email-madalin.bucur@nxp.com> References: <1508178970-28945-1-git-send-email-madalin.bucur@nxp.com> Reply-To: X-EOPAttributedMessage: 0 X-Matching-Connectors: 131526525808644878;(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)(39860400002)(346002)(39380400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(86362001)(575784001)(2906002)(105606002)(106466001)(3450700001)(39060400002)(5003940100001)(104016004)(85426001)(33646002)(8676002)(81166006)(8936002)(81156014)(43066003)(69596002)(2950100002)(47776003)(498600001)(356003)(4326008)(305945005)(54906003)(68736007)(50226002)(50986999)(16586007)(76176999)(5660300001)(5890100001)(316002)(6666003)(189998001)(36756003)(77096006)(53936002)(50466002)(97736004)(48376002)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR03MB2362;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD041;1:spQjiyPdRBXjcFrQs6PHdtV8ADSlCVLCgjKBbY7isjpbDge7b1TIM3rx+dufddmJa1aCCjxUWoGanDWD1tvamuMGDl8zOrBMUqE8QRpOyqrrbpY9TqkQ1rbH0g5XR5hH MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fbfe955-181e-4fa6-31ae-08d514c4cbd2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017052603199)(201703131430075)(201703131517081);SRVR:CY1PR03MB2362; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2362;3:WnzQRwrJCjtaD4+8FFXfljDfj2wBwQqsqJurpMTURgWetnfFFHeJCMuRVIehb0mRdBBH1z90XeXWiqB+UYiBXK93Dnj0U2ZjK68J8vio1B2Vbb9opBmX1MFg+AdeL+U/VYNnkhbIBx4fLRQ2f6999YXx/ayyXsLTZE6FT4PmipB6VQnj1W3ZpdOK/u6sJpDpu0o+5w142UArZc1YJqJ7Zcql/SXIMjx0AWXSluOtaRasOPtZgFmg0ODVRFSWdHHHb4l/O9Q45uVouo65lbpGqhctilqqqzCsgusa3K1Mt2ThJGsspReG582AG84IbKdKDERSWFYOXneF4L5DGoX4I2HXd2Nw8IQf5cM3vz0/zeA=;25:1n+YmSxXd7bkfhT3W9jhzfIvaF7qcvQoWhaIy9SMSyZl17ky6I1rLorn79HZbdyzQVtn5NbsMEdB5qbUe5//vyTvXIehAd10kT+WrVNDVT4aNfthKSce6vgSKPcxD2EPeSGS4Ht4P1KOXLInhP7eRyWHVphSeAETsDFmVYHBybH7qmu9an+M+kj/VzN1gHL25pYbLqJS6qkV70+fz7dye2Vx7rZhR3CTzBwmNIe4URnXG43LaggHJjibL9QWCls9Xxpxn9uDRt4iKLwJkfICMMfywOPP7RF3ylaUJONzoPZIvoNXRSTtMsZ5vSI5GggQo+W5g50KfHtvoES9nRE9lg== X-MS-TrafficTypeDiagnostic: CY1PR03MB2362: X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2362;31:7+NxuBHZUkBrma9bu+L82da8vDVN4+01s449f1jZvB18ZxQ2i6MQv4W8PfRHsKvIfoU3ZiP67aSdBuLcr94TB4zX/4ka8lnOszAHKdYetBLeYGJ/jmpzy0H9px23/ggOeBLwt/ayDwcHCiCX16FG2mFaznkSLHYUZxtVbQEljB9YOFQP1VN3ir1Kfo8bWXN08rs7haACF88ODVu/xdxPvy/EOxXnIidVjrrSQM7bLEg=;4:2c7rjR2LlecZidK11eYBdqEc6QA2TjuDjDYnpj6LTVhHkWj19l58bgQZaJlA/cQqGUMyg1+GlFpIps3QncL9Hx6cR+Eyq04Csudz70t+CTH3VXUdQtnlDE+4hDWcofz7CG3mxgcugyPoUt4auHv7LX9ndEd9xR7LoWNRojI4TBViJbUoaP8sIb6nNcGG2tIuytlNJcJDd5Jdx2mZU/dGsjdZKmibIMRzNg/9vO++lOU3fVh969ZLVHGM57s2FHlu1ab46zx/jsHyS3KhQN1kf/K3b26rqQg/t1CywDH9dli3xqkegcKbwwDLcbzQimIo0m82yrC3qP0BbNRMEvDFlQ== 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)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123556025)(20161123563025)(20161123565025)(20161123559100)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR03MB2362;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR03MB2362; X-Forefront-PRVS: 0462918D61 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR03MB2362;23:T3VJa6w1iFuj0ItNJOShaZSkKUkufkeapKHZ4N6pi?= =?us-ascii?Q?YkJvet8r7M7F9DzVwdL8HcNOXuVWnJ8HQ/1B8jHSuh40SRzx68JYfwXA7EH4?= =?us-ascii?Q?xCYx7XJVujXr1qQn7EZ2vjmnirKZicdmXvsd0r4kjaxlF+zI4mcQm4zE8xh+?= =?us-ascii?Q?pdSadOBi+1wMSSUDYD5bIpeMr4er09QTEZLrO4g5wA79KHI7fLCtx7f8JcRE?= =?us-ascii?Q?5bXXLjYqXKOPg9TPd47rjwjGdcGaG+bQjdEVIegMGweHryhCeI0H1XqFHSLZ?= =?us-ascii?Q?612+ZXe+4kh7X8GQyu9u9FUxNUGT9RqWtg8Rsayez8qB5HfI+YiS/Qfox/OI?= =?us-ascii?Q?M9FpwfLvSaXPlXJQ6yFMzMBuazdhljN4C+MRq7ODcqpGZDSOjmR9GRvdoq0J?= =?us-ascii?Q?+lQVlSMnd0Dg9y9USC3qtpSMgZ4B+plVoyuDTQZcUYdEA1SSPu6avVrfw85+?= =?us-ascii?Q?ZpAepHGIoI9+YwJSClnElOhivR4nuGS7Oer0FPuonvYl6M2mr8qkykafbk//?= =?us-ascii?Q?mGkJ24uqF9Dh0IKT9BQlJ7RqAftGY/ulQUfcqqvXI5PxvCPwUJ1vXs39Trr+?= =?us-ascii?Q?aHP6BtCyH6RZ6m8F/9AKI1zOPja8A5XdZbkabB20Um82Q4yghzhXBD78N35j?= =?us-ascii?Q?jt2RoYQj/5seK9e3ZHU9B1ny5LH+zOxjoqXatBY3L9xPfKZK+5rlHq6wkPZE?= =?us-ascii?Q?gyFqU7HgmNDN+ARAfd3IDudxqJZAUgBmt9mj1QA+y6TEMPkYI4k4fkHoU7XQ?= =?us-ascii?Q?Bd3LYxd3ZKJ3Kz77wI52n2ftbyBIcQQizvskSsVa0he+zE2QBamDEJEt7qKt?= =?us-ascii?Q?emAhQS8izErok2QXMlvLuI8O24ah0G5dLujOYu0nrUbEQ4yR/vwuPVpLBwZH?= =?us-ascii?Q?jieHQpAz8gSU4M2MfV/tVB/dfeUZBDog9kz5Y2XegXQBktWdgAIXWXR8h2uK?= =?us-ascii?Q?Yy+4AQ4k5BrAp+GccTjULagsNfJhoYUvHH4e4hDHAgIcCQu2F1ZDqQKyemlN?= =?us-ascii?Q?Qj+r92Aiaz3i+jDuxXfGz+Gu4WX7Gw+QhCMY8ONpntbmRTIqaXjbY3Xypz3P?= =?us-ascii?Q?AQ1kI+BtglliJnt9/d/jXqg8KM2p0PU2/uCkZjnl9YL7wl4lQPAQl+HBtxVP?= =?us-ascii?Q?LtbHleFWMQnhoiw/m0e7S6FlSg54yFuCrN0B2F/1maN1tpDGEiUiPH/qV1i0?= =?us-ascii?Q?ITN2QCbkERobENTLz7AU2oSfENa+z8ramHB9TeuwOERItFvcePy6s/2QEJOX?= =?us-ascii?Q?qMe1CLeEgSMvDIVTlG+7hV9xMEWtChIy0Te+WTGa4cr3RHBv0fCt74noVWC5?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2362;6:cK6zoP1IIZ7Z16rBRdrhituiw82ih1PRvLCzoNtXEFMlSDhESK6UiFOWKesFMxXRwnfoyGzwHRWjOnAcGsCpjPb71WjUuR77Iwrl2O/ULz00+W15xp7qaeaETR3744oQOCWuSVGY5bqH2M7AVKSGLz9rzCZwv+EEa6f48TI4+YeV2QFeIjgeqC/pztMHLpD+lEv/SI9lRDEZKutsutM5MB9CU2wLmfppL+d0AXQP8A+WKvjyKJvWswNs4SqcG1toM2iaBOvsf/VegwvQtu3mCa1/u+J/yp8ikfaWgRdF22WqxSBArZKz9i5VY8ZdwXe+itW/Jkf5EejOzB6gcSLV4w==;5:89dF8N3Wgo3U7CeHnF5C4qkNVVYAZXYRSe7seEmcKz3P08SMGOxPKfmJR7pq61LEtlPRuW6dj+nVmPkRW5cyU8gtHwJ0Me1A9FFR3D/FqwyBg41ezxEonQyOoH7Wcps/WEfeWZmy54ozAkedaL+wZH/F47dvYXjoMKoYh8lny7w=;24:0tNSnEdj5mFEDxp3AicDXVwrepbFOFheSel7dVHZ/UnwBJUZiCpGe+giqSi9iZgc5IzwrCkQGAsznP+ccTOwVo3gsnRCHypi343u2zNHTxw=;7:nnlZUkF6A0BYA2wCqGXBMrRqqsvENVIAB3e2v/dYp9ZN5evkSqexQhTllAK6PZH8jgP7SksTLLBt/0dk8RxyK+XdKWuf3tl+jxlUVHUqiY+1dVYLVO+yGrCj6Fv+waIGDJ974piP8GnMWOr3JfDj7dzsMjo9Bnp/MuRmPDUXpKC7aTfNMTZvlEuq0AGyXsZXs/8VVXVwfyX8Iya8lh29xJont05TzteHf2adJwJt4sQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2017 18:36:18.2748 (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: CY1PR03MB2362 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