net: fman: Use mac_dev for some params
Some params are already present in mac_dev. Use them directly instead of passing them through params. 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>
This commit is contained in:
parent
c6b7b1b515
commit
19c788b144
|
@ -1413,13 +1413,11 @@ static int dtsec_free(struct fman_mac *dtsec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct fman_mac *dtsec_config(struct fman_mac_params *params)
|
||||
static struct fman_mac *dtsec_config(struct mac_device *mac_dev,
|
||||
struct fman_mac_params *params)
|
||||
{
|
||||
struct fman_mac *dtsec;
|
||||
struct dtsec_cfg *dtsec_drv_param;
|
||||
void __iomem *base_addr;
|
||||
|
||||
base_addr = params->base_addr;
|
||||
|
||||
/* allocate memory for the UCC GETH data structure. */
|
||||
dtsec = kzalloc(sizeof(*dtsec), GFP_KERNEL);
|
||||
|
@ -1436,10 +1434,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
|
|||
|
||||
set_dflts(dtsec_drv_param);
|
||||
|
||||
dtsec->regs = base_addr;
|
||||
dtsec->addr = ENET_ADDR_TO_UINT64(params->addr);
|
||||
dtsec->regs = mac_dev->vaddr;
|
||||
dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
|
||||
dtsec->max_speed = params->max_speed;
|
||||
dtsec->phy_if = params->phy_if;
|
||||
dtsec->phy_if = mac_dev->phy_if;
|
||||
dtsec->mac_id = params->mac_id;
|
||||
dtsec->exceptions = (DTSEC_IMASK_BREN |
|
||||
DTSEC_IMASK_RXCEN |
|
||||
|
@ -1456,7 +1454,7 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
|
|||
DTSEC_IMASK_RDPEEN);
|
||||
dtsec->exception_cb = params->exception_cb;
|
||||
dtsec->event_cb = params->event_cb;
|
||||
dtsec->dev_id = params->dev_id;
|
||||
dtsec->dev_id = mac_dev;
|
||||
dtsec->ptp_tsu_enabled = dtsec->dtsec_drv_param->ptp_tsu_en;
|
||||
dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en;
|
||||
|
||||
|
@ -1495,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev,
|
|||
mac_dev->enable = dtsec_enable;
|
||||
mac_dev->disable = dtsec_disable;
|
||||
|
||||
mac_dev->fman_mac = dtsec_config(params);
|
||||
mac_dev->fman_mac = dtsec_config(mac_dev, params);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
|
|
|
@ -163,25 +163,18 @@ typedef void (fman_mac_exception_cb)(void *dev_id,
|
|||
|
||||
/* FMan MAC config input */
|
||||
struct fman_mac_params {
|
||||
/* Base of memory mapped FM MAC registers */
|
||||
void __iomem *base_addr;
|
||||
/* MAC address of device; First octet is sent first */
|
||||
enet_addr_t addr;
|
||||
/* MAC ID; numbering of dTSEC and 1G-mEMAC:
|
||||
* 0 - FM_MAX_NUM_OF_1G_MACS;
|
||||
* numbering of 10G-MAC (TGEC) and 10G-mEMAC:
|
||||
* 0 - FM_MAX_NUM_OF_10G_MACS
|
||||
*/
|
||||
u8 mac_id;
|
||||
/* PHY interface */
|
||||
phy_interface_t phy_if;
|
||||
/* Note that the speed should indicate the maximum rate that
|
||||
* this MAC should support rather than the actual speed;
|
||||
*/
|
||||
u16 max_speed;
|
||||
/* A handle to the FM object this port related to */
|
||||
void *fm;
|
||||
void *dev_id; /* device cookie used by the exception cbs */
|
||||
fman_mac_exception_cb *event_cb; /* MDIO Events Callback Routine */
|
||||
fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */
|
||||
/* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC
|
||||
|
|
|
@ -1109,13 +1109,12 @@ static int memac_free(struct fman_mac *memac)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct fman_mac *memac_config(struct fman_mac_params *params)
|
||||
static struct fman_mac *memac_config(struct mac_device *mac_dev,
|
||||
struct fman_mac_params *params)
|
||||
{
|
||||
struct fman_mac *memac;
|
||||
struct memac_cfg *memac_drv_param;
|
||||
void __iomem *base_addr;
|
||||
|
||||
base_addr = params->base_addr;
|
||||
/* allocate memory for the m_emac data structure */
|
||||
memac = kzalloc(sizeof(*memac), GFP_KERNEL);
|
||||
if (!memac)
|
||||
|
@ -1133,17 +1132,17 @@ static struct fman_mac *memac_config(struct fman_mac_params *params)
|
|||
|
||||
set_dflts(memac_drv_param);
|
||||
|
||||
memac->addr = ENET_ADDR_TO_UINT64(params->addr);
|
||||
memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
|
||||
|
||||
memac->regs = base_addr;
|
||||
memac->regs = mac_dev->vaddr;
|
||||
memac->max_speed = params->max_speed;
|
||||
memac->phy_if = params->phy_if;
|
||||
memac->phy_if = mac_dev->phy_if;
|
||||
memac->mac_id = params->mac_id;
|
||||
memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER |
|
||||
MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI);
|
||||
memac->exception_cb = params->exception_cb;
|
||||
memac->event_cb = params->event_cb;
|
||||
memac->dev_id = params->dev_id;
|
||||
memac->dev_id = mac_dev;
|
||||
memac->fm = params->fm;
|
||||
memac->basex_if = params->basex_if;
|
||||
|
||||
|
@ -1177,9 +1176,9 @@ int memac_initialization(struct mac_device *mac_dev,
|
|||
mac_dev->disable = memac_disable;
|
||||
|
||||
if (params->max_speed == SPEED_10000)
|
||||
params->phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
|
||||
mac_dev->fman_mac = memac_config(params);
|
||||
mac_dev->fman_mac = memac_config(mac_dev, params);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
|
|
|
@ -728,13 +728,11 @@ static int tgec_free(struct fman_mac *tgec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct fman_mac *tgec_config(struct fman_mac_params *params)
|
||||
static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_params *params)
|
||||
{
|
||||
struct fman_mac *tgec;
|
||||
struct tgec_cfg *cfg;
|
||||
void __iomem *base_addr;
|
||||
|
||||
base_addr = params->base_addr;
|
||||
/* allocate memory for the UCC GETH data structure. */
|
||||
tgec = kzalloc(sizeof(*tgec), GFP_KERNEL);
|
||||
if (!tgec)
|
||||
|
@ -752,8 +750,8 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params)
|
|||
|
||||
set_dflts(cfg);
|
||||
|
||||
tgec->regs = base_addr;
|
||||
tgec->addr = ENET_ADDR_TO_UINT64(params->addr);
|
||||
tgec->regs = mac_dev->vaddr;
|
||||
tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
|
||||
tgec->max_speed = params->max_speed;
|
||||
tgec->mac_id = params->mac_id;
|
||||
tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT |
|
||||
|
@ -773,7 +771,7 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params)
|
|||
TGEC_IMASK_RX_ALIGN_ER);
|
||||
tgec->exception_cb = params->exception_cb;
|
||||
tgec->event_cb = params->event_cb;
|
||||
tgec->dev_id = params->dev_id;
|
||||
tgec->dev_id = mac_dev;
|
||||
tgec->fm = params->fm;
|
||||
|
||||
/* Save FMan revision */
|
||||
|
@ -803,7 +801,7 @@ int tgec_initialization(struct mac_device *mac_dev,
|
|||
mac_dev->enable = tgec_enable;
|
||||
mac_dev->disable = tgec_disable;
|
||||
|
||||
mac_dev->fman_mac = tgec_config(params);
|
||||
mac_dev->fman_mac = tgec_config(mac_dev, params);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
|
|
|
@ -34,7 +34,6 @@ struct mac_priv_s {
|
|||
struct list_head mc_addr_list;
|
||||
struct platform_device *eth_dev;
|
||||
u16 speed;
|
||||
u16 max_speed;
|
||||
};
|
||||
|
||||
struct mac_address {
|
||||
|
@ -439,7 +438,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
mac_dev->phy_if = phy_if;
|
||||
|
||||
priv->speed = phy2speed[mac_dev->phy_if];
|
||||
priv->max_speed = priv->speed;
|
||||
params.max_speed = priv->speed;
|
||||
mac_dev->if_support = DTSEC_SUPPORTED;
|
||||
/* We don't support half-duplex in SGMII mode */
|
||||
if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII)
|
||||
|
@ -447,7 +446,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
SUPPORTED_100baseT_Half);
|
||||
|
||||
/* Gigabit support (no half-duplex) */
|
||||
if (priv->max_speed == 1000)
|
||||
if (params.max_speed == 1000)
|
||||
mac_dev->if_support |= SUPPORTED_1000baseT_Full;
|
||||
|
||||
/* The 10G interface only supports one mode */
|
||||
|
@ -457,16 +456,11 @@ 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);
|
||||
|
||||
params.base_addr = mac_dev->vaddr;
|
||||
memcpy(¶ms.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, ¶ms);
|
||||
if (err < 0) {
|
||||
|
|
Loading…
Reference in New Issue