Commit 478eb957 authored by Sean Anderson's avatar Sean Anderson Committed by Jakub Kicinski

net: fman: Get PCS node in per-mac init

This moves the reading of the PCS property out of the generic probe and
into the mac-specific initialization function. This reduces the
mac-specific jobs done in the top-level probe function.
Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
Acked-by: default avatarCamelia Groza <camelia.groza@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent aae73fde
......@@ -32,7 +32,6 @@ struct mac_priv_s {
void __iomem *vaddr;
u8 cell_index;
struct fman *fman;
struct device_node *internal_phy_node;
/* List of multicast addresses */
struct list_head mc_addr_list;
struct platform_device *eth_dev;
......@@ -85,12 +84,12 @@ static int set_fman_mac_params(struct mac_device *mac_dev,
params->exception_cb = mac_exception;
params->event_cb = mac_exception;
params->dev_id = mac_dev;
params->internal_phy_node = priv->internal_phy_node;
return 0;
}
static int tgec_initialization(struct mac_device *mac_dev)
static int tgec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
......@@ -138,7 +137,8 @@ static int tgec_initialization(struct mac_device *mac_dev)
return err;
}
static int dtsec_initialization(struct mac_device *mac_dev)
static int dtsec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
......@@ -150,6 +150,7 @@ static int dtsec_initialization(struct mac_device *mac_dev)
err = set_fman_mac_params(mac_dev, &params);
if (err)
goto _return;
params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
mac_dev->fman_mac = dtsec_config(&params);
if (!mac_dev->fman_mac) {
......@@ -190,7 +191,8 @@ static int dtsec_initialization(struct mac_device *mac_dev)
return err;
}
static int memac_initialization(struct mac_device *mac_dev)
static int memac_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
{
int err;
struct mac_priv_s *priv;
......@@ -201,6 +203,7 @@ static int memac_initialization(struct mac_device *mac_dev)
err = set_fman_mac_params(mac_dev, &params);
if (err)
goto _return;
params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
if (priv->max_speed == SPEED_10000)
params.phy_if = PHY_INTERFACE_MODE_XGMII;
......@@ -583,14 +586,10 @@ static int mac_probe(struct platform_device *_of_dev)
if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) {
setup_dtsec(mac_dev);
priv->internal_phy_node = of_parse_phandle(mac_node,
"tbi-handle", 0);
} else if (of_device_is_compatible(mac_node, "fsl,fman-xgec")) {
setup_tgec(mac_dev);
} else if (of_device_is_compatible(mac_node, "fsl,fman-memac")) {
setup_memac(mac_dev);
priv->internal_phy_node = of_parse_phandle(mac_node,
"pcsphy-handle", 0);
} else {
dev_err(dev, "MAC node (%pOF) contains unsupported MAC\n",
mac_node);
......@@ -783,7 +782,7 @@ static int mac_probe(struct platform_device *_of_dev)
put_device(&phy->mdio.dev);
}
err = mac_dev->init(mac_dev);
err = mac_dev->init(mac_dev, mac_node);
if (err < 0) {
dev_err(dev, "mac_dev->init() = %d\n", err);
of_node_put(mac_dev->phy_node);
......
......@@ -35,7 +35,7 @@ struct mac_device {
bool promisc;
bool allmulti;
int (*init)(struct mac_device *mac_dev);
int (*init)(struct mac_device *mac_dev, struct device_node *mac_node);
int (*enable)(struct fman_mac *mac_dev);
int (*disable)(struct fman_mac *mac_dev);
void (*adjust_link)(struct mac_device *mac_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment