Commit c6b7b1b5 authored by Sean Anderson's avatar Sean Anderson Committed by David S. Miller

net: fman: Pass params directly to mac init

Instead of having the mac init functions call back into the fman core to
get their params, just pass them directly to the init functions.
Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
Acked-by: default avatarCamelia Groza <camelia.groza@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 262f2b78
......@@ -1474,10 +1474,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
}
int dtsec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
struct device_node *mac_node,
struct fman_mac_params *params)
{
int err;
struct fman_mac_params params;
struct fman_mac *dtsec;
struct device_node *phy_node;
......@@ -1495,11 +1495,7 @@ int dtsec_initialization(struct mac_device *mac_dev,
mac_dev->enable = dtsec_enable;
mac_dev->disable = dtsec_disable;
err = set_fman_mac_params(mac_dev, &params);
if (err)
goto _return;
mac_dev->fman_mac = dtsec_config(&params);
mac_dev->fman_mac = dtsec_config(params);
if (!mac_dev->fman_mac) {
err = -EINVAL;
goto _return;
......
......@@ -11,6 +11,7 @@
struct mac_device;
int dtsec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node);
struct device_node *mac_node,
struct fman_mac_params *params);
#endif /* __DTSEC_H */
......@@ -1154,11 +1154,11 @@ static struct fman_mac *memac_config(struct fman_mac_params *params)
}
int memac_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
struct device_node *mac_node,
struct fman_mac_params *params)
{
int err;
struct device_node *phy_node;
struct fman_mac_params params;
struct fixed_phy_status *fixed_link;
struct fman_mac *memac;
......@@ -1176,14 +1176,10 @@ int memac_initialization(struct mac_device *mac_dev,
mac_dev->enable = memac_enable;
mac_dev->disable = memac_disable;
err = set_fman_mac_params(mac_dev, &params);
if (err)
goto _return;
if (params.max_speed == SPEED_10000)
params.phy_if = PHY_INTERFACE_MODE_XGMII;
if (params->max_speed == SPEED_10000)
params->phy_if = PHY_INTERFACE_MODE_XGMII;
mac_dev->fman_mac = memac_config(&params);
mac_dev->fman_mac = memac_config(params);
if (!mac_dev->fman_mac) {
err = -EINVAL;
goto _return;
......
......@@ -14,6 +14,7 @@
struct mac_device;
int memac_initialization(struct mac_device *mac_dev,
struct device_node *mac_node);
struct device_node *mac_node,
struct fman_mac_params *params);
#endif /* __MEMAC_H */
......@@ -783,10 +783,10 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params)
}
int tgec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node)
struct device_node *mac_node,
struct fman_mac_params *params)
{
int err;
struct fman_mac_params params;
struct fman_mac *tgec;
mac_dev->set_promisc = tgec_set_promiscuous;
......@@ -803,11 +803,7 @@ int tgec_initialization(struct mac_device *mac_dev,
mac_dev->enable = tgec_enable;
mac_dev->disable = tgec_disable;
err = set_fman_mac_params(mac_dev, &params);
if (err)
goto _return;
mac_dev->fman_mac = tgec_config(&params);
mac_dev->fman_mac = tgec_config(params);
if (!mac_dev->fman_mac) {
err = -EINVAL;
goto _return;
......
......@@ -11,6 +11,7 @@
struct mac_device;
int tgec_initialization(struct mac_device *mac_dev,
struct device_node *mac_node);
struct device_node *mac_node,
struct fman_mac_params *params);
#endif /* __TGEC_H */
......@@ -57,25 +57,6 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex)
__func__, ex);
}
int set_fman_mac_params(struct mac_device *mac_dev,
struct fman_mac_params *params)
{
struct mac_priv_s *priv = mac_dev->priv;
params->base_addr = mac_dev->vaddr;
memcpy(&params->addr, mac_dev->addr, sizeof(mac_dev->addr));
params->max_speed = priv->max_speed;
params->phy_if = mac_dev->phy_if;
params->basex_if = false;
params->mac_id = priv->cell_index;
params->fm = (void *)priv->fman;
params->exception_cb = mac_exception;
params->event_cb = mac_exception;
params->dev_id = mac_dev;
return 0;
}
int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev)
{
struct mac_priv_s *priv;
......@@ -294,13 +275,15 @@ MODULE_DEVICE_TABLE(of, mac_match);
static int mac_probe(struct platform_device *_of_dev)
{
int err, i, nph;
int (*init)(struct mac_device *mac_dev, struct device_node *mac_node);
int (*init)(struct mac_device *mac_dev, struct device_node *mac_node,
struct fman_mac_params *params);
struct device *dev;
struct device_node *mac_node, *dev_node;
struct mac_device *mac_dev;
struct platform_device *of_dev;
struct resource *res;
struct mac_priv_s *priv;
struct fman_mac_params params;
u32 val;
u8 fman_id;
phy_interface_t phy_if;
......@@ -474,7 +457,18 @@ static int mac_probe(struct platform_device *_of_dev)
/* Get the rest of the PHY information */
mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
err = init(mac_dev, mac_node);
params.base_addr = mac_dev->vaddr;
memcpy(&params.addr, mac_dev->addr, sizeof(mac_dev->addr));
params.max_speed = priv->max_speed;
params.phy_if = mac_dev->phy_if;
params.basex_if = false;
params.mac_id = priv->cell_index;
params.fm = (void *)priv->fman;
params.exception_cb = mac_exception;
params.event_cb = mac_exception;
params.dev_id = mac_dev;
err = init(mac_dev, mac_node, &params);
if (err < 0) {
dev_err(dev, "mac_dev->init() = %d\n", err);
of_node_put(mac_dev->phy_node);
......
......@@ -72,8 +72,6 @@ int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx);
void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause,
bool *tx_pause);
int set_fman_mac_params(struct mac_device *mac_dev,
struct fman_mac_params *params);
int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev);
#endif /* __MAC_H */
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