Skip to content

Commit 45fa34b

Browse files
sean-anderson-secodavem330
authored andcommitted
net: fman: Remove internal_phy_node from params
This member was used to pass the phy node between mac_probe and the mac-specific initialization function. But now that the phy node is gotten in the initialization function, this parameter does not serve a purpose. Remove it, and do the grabbing of the node/grabbing of the phy in the same place. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Acked-by: Camelia Groza <camelia.groza@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4498862 commit 45fa34b

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

drivers/net/ethernet/freescale/fman/fman_dtsec.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
14631463
dtsec->fm = params->fm;
14641464
dtsec->basex_if = params->basex_if;
14651465

1466-
if (!params->internal_phy_node) {
1467-
pr_err("TBI PHY node is not available\n");
1468-
goto err_dtsec_drv_param;
1469-
}
1470-
1471-
dtsec->tbiphy = of_phy_find_device(params->internal_phy_node);
1472-
if (!dtsec->tbiphy) {
1473-
pr_err("of_phy_find_device (TBI PHY) failed\n");
1474-
goto err_dtsec_drv_param;
1475-
}
1476-
1477-
put_device(&dtsec->tbiphy->mdio.dev);
1478-
14791466
/* Save FMan revision */
14801467
fman_get_revision(dtsec->fm, &dtsec->fm_rev_info);
14811468

14821469
return dtsec;
14831470

1484-
err_dtsec_drv_param:
1485-
kfree(dtsec_drv_param);
14861471
err_dtsec:
14871472
kfree(dtsec);
14881473
return NULL;
@@ -1494,6 +1479,7 @@ int dtsec_initialization(struct mac_device *mac_dev,
14941479
int err;
14951480
struct fman_mac_params params;
14961481
struct fman_mac *dtsec;
1482+
struct device_node *phy_node;
14971483

14981484
mac_dev->set_promisc = dtsec_set_promiscuous;
14991485
mac_dev->change_addr = dtsec_modify_mac_address;
@@ -1512,7 +1498,6 @@ int dtsec_initialization(struct mac_device *mac_dev,
15121498
err = set_fman_mac_params(mac_dev, &params);
15131499
if (err)
15141500
goto _return;
1515-
params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
15161501

15171502
mac_dev->fman_mac = dtsec_config(&params);
15181503
if (!mac_dev->fman_mac) {
@@ -1523,6 +1508,22 @@ int dtsec_initialization(struct mac_device *mac_dev,
15231508
dtsec = mac_dev->fman_mac;
15241509
dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm();
15251510
dtsec->dtsec_drv_param->tx_pad_crc = true;
1511+
1512+
phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
1513+
if (!phy_node) {
1514+
pr_err("TBI PHY node is not available\n");
1515+
err = -EINVAL;
1516+
goto _return_fm_mac_free;
1517+
}
1518+
1519+
dtsec->tbiphy = of_phy_find_device(phy_node);
1520+
if (!dtsec->tbiphy) {
1521+
pr_err("of_phy_find_device (TBI PHY) failed\n");
1522+
err = -EINVAL;
1523+
goto _return_fm_mac_free;
1524+
}
1525+
put_device(&dtsec->tbiphy->mdio.dev);
1526+
15261527
err = dtsec_init(dtsec);
15271528
if (err < 0)
15281529
goto _return_fm_mac_free;

drivers/net/ethernet/freescale/fman/fman_mac.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ struct fman_mac_params {
190190
* synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps
191191
*/
192192
bool basex_if;
193-
/* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */
194-
struct device_node *internal_phy_node;
195193
};
196194

197195
struct eth_hash_t {

drivers/net/ethernet/freescale/fman/fman_memac.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,29 +1150,14 @@ static struct fman_mac *memac_config(struct fman_mac_params *params)
11501150
/* Save FMan revision */
11511151
fman_get_revision(memac->fm, &memac->fm_rev_info);
11521152

1153-
if (memac->phy_if == PHY_INTERFACE_MODE_SGMII ||
1154-
memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
1155-
if (!params->internal_phy_node) {
1156-
pr_err("PCS PHY node is not available\n");
1157-
memac_free(memac);
1158-
return NULL;
1159-
}
1160-
1161-
memac->pcsphy = of_phy_find_device(params->internal_phy_node);
1162-
if (!memac->pcsphy) {
1163-
pr_err("of_phy_find_device (PCS PHY) failed\n");
1164-
memac_free(memac);
1165-
return NULL;
1166-
}
1167-
}
1168-
11691153
return memac;
11701154
}
11711155

11721156
int memac_initialization(struct mac_device *mac_dev,
11731157
struct device_node *mac_node)
11741158
{
11751159
int err;
1160+
struct device_node *phy_node;
11761161
struct fman_mac_params params;
11771162
struct fixed_phy_status *fixed_link;
11781163
struct fman_mac *memac;
@@ -1194,7 +1179,6 @@ int memac_initialization(struct mac_device *mac_dev,
11941179
err = set_fman_mac_params(mac_dev, &params);
11951180
if (err)
11961181
goto _return;
1197-
params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
11981182

11991183
if (params.max_speed == SPEED_10000)
12001184
params.phy_if = PHY_INTERFACE_MODE_XGMII;
@@ -1208,6 +1192,22 @@ int memac_initialization(struct mac_device *mac_dev,
12081192
memac = mac_dev->fman_mac;
12091193
memac->memac_drv_param->max_frame_length = fman_get_max_frm();
12101194
memac->memac_drv_param->reset_on_init = true;
1195+
if (memac->phy_if == PHY_INTERFACE_MODE_SGMII ||
1196+
memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
1197+
phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
1198+
if (!phy_node) {
1199+
pr_err("PCS PHY node is not available\n");
1200+
err = -EINVAL;
1201+
goto _return_fm_mac_free;
1202+
}
1203+
1204+
memac->pcsphy = of_phy_find_device(phy_node);
1205+
if (!memac->pcsphy) {
1206+
pr_err("of_phy_find_device (PCS PHY) failed\n");
1207+
err = -EINVAL;
1208+
goto _return_fm_mac_free;
1209+
}
1210+
}
12111211

12121212
if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
12131213
struct phy_device *phy;

0 commit comments

Comments
 (0)