net: fman: Don't pass comm_mode to enable/disable
mac_priv_s->enable() and ->disable() are always called with a comm_mode of COMM_MODE_RX_AND_TX. Remove this parameter, and refactor the macs appropriately. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Acked-by: Camelia Groza <camelia.groza@nxp.com> Tested-by: Camelia Groza <camelia.groza@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Родитель
8585bdadc2
Коммит
b7d852566a
|
@ -879,7 +879,7 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
}
|
||||
}
|
||||
|
||||
int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
int dtsec_enable(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
u32 tmp;
|
||||
|
@ -889,20 +889,16 @@ int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
|
||||
/* Enable */
|
||||
tmp = ioread32be(®s->maccfg1);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= MACCFG1_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= MACCFG1_TX_EN;
|
||||
|
||||
tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN;
|
||||
iowrite32be(tmp, ®s->maccfg1);
|
||||
|
||||
/* Graceful start - clear the graceful Rx/Tx stop bit */
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec, COMM_MODE_RX_AND_TX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
int dtsec_disable(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
u32 tmp;
|
||||
|
@ -911,14 +907,10 @@ int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
/* Graceful stop - Assert the graceful Rx/Tx stop bit */
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec, COMM_MODE_RX_AND_TX);
|
||||
|
||||
tmp = ioread32be(®s->maccfg1);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~MACCFG1_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~MACCFG1_TX_EN;
|
||||
|
||||
tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
|
||||
iowrite32be(tmp, ®s->maccfg1);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -16,8 +16,8 @@ int dtsec_adjust_link(struct fman_mac *dtsec,
|
|||
int dtsec_restart_autoneg(struct fman_mac *dtsec);
|
||||
int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val);
|
||||
int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val);
|
||||
int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode);
|
||||
int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode);
|
||||
int dtsec_enable(struct fman_mac *dtsec);
|
||||
int dtsec_disable(struct fman_mac *dtsec);
|
||||
int dtsec_init(struct fman_mac *dtsec);
|
||||
int dtsec_free(struct fman_mac *dtsec);
|
||||
int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en);
|
||||
|
|
|
@ -685,7 +685,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params)
|
|||
return false;
|
||||
}
|
||||
|
||||
int memac_enable(struct fman_mac *memac, enum comm_mode mode)
|
||||
int memac_enable(struct fman_mac *memac)
|
||||
{
|
||||
struct memac_regs __iomem *regs = memac->regs;
|
||||
u32 tmp;
|
||||
|
@ -694,17 +694,13 @@ int memac_enable(struct fman_mac *memac, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= CMD_CFG_TX_EN;
|
||||
|
||||
tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memac_disable(struct fman_mac *memac, enum comm_mode mode)
|
||||
int memac_disable(struct fman_mac *memac)
|
||||
{
|
||||
struct memac_regs __iomem *regs = memac->regs;
|
||||
u32 tmp;
|
||||
|
@ -713,11 +709,7 @@ int memac_disable(struct fman_mac *memac, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~CMD_CFG_TX_EN;
|
||||
|
||||
tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -19,8 +19,8 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val);
|
|||
int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable);
|
||||
int memac_cfg_fixed_link(struct fman_mac *memac,
|
||||
struct fixed_phy_status *fixed_link);
|
||||
int memac_enable(struct fman_mac *memac, enum comm_mode mode);
|
||||
int memac_disable(struct fman_mac *memac, enum comm_mode mode);
|
||||
int memac_enable(struct fman_mac *memac);
|
||||
int memac_disable(struct fman_mac *memac);
|
||||
int memac_init(struct fman_mac *memac);
|
||||
int memac_free(struct fman_mac *memac);
|
||||
int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en);
|
||||
|
|
|
@ -392,7 +392,7 @@ static bool is_init_done(struct tgec_cfg *cfg)
|
|||
return false;
|
||||
}
|
||||
|
||||
int tgec_enable(struct fman_mac *tgec, enum comm_mode mode)
|
||||
int tgec_enable(struct fman_mac *tgec)
|
||||
{
|
||||
struct tgec_regs __iomem *regs = tgec->regs;
|
||||
u32 tmp;
|
||||
|
@ -401,16 +401,13 @@ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= CMD_CFG_TX_EN;
|
||||
tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tgec_disable(struct fman_mac *tgec, enum comm_mode mode)
|
||||
int tgec_disable(struct fman_mac *tgec)
|
||||
{
|
||||
struct tgec_regs __iomem *regs = tgec->regs;
|
||||
u32 tmp;
|
||||
|
@ -419,10 +416,7 @@ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~CMD_CFG_TX_EN;
|
||||
tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -12,8 +12,8 @@ struct fman_mac *tgec_config(struct fman_mac_params *params);
|
|||
int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val);
|
||||
int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr);
|
||||
int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val);
|
||||
int tgec_enable(struct fman_mac *tgec, enum comm_mode mode);
|
||||
int tgec_disable(struct fman_mac *tgec, enum comm_mode mode);
|
||||
int tgec_enable(struct fman_mac *tgec);
|
||||
int tgec_disable(struct fman_mac *tgec);
|
||||
int tgec_init(struct fman_mac *tgec);
|
||||
int tgec_free(struct fman_mac *tgec);
|
||||
int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en);
|
||||
|
|
|
@ -40,8 +40,8 @@ struct mac_priv_s {
|
|||
u16 speed;
|
||||
u16 max_speed;
|
||||
|
||||
int (*enable)(struct fman_mac *mac_dev, enum comm_mode mode);
|
||||
int (*disable)(struct fman_mac *mac_dev, enum comm_mode mode);
|
||||
int (*enable)(struct fman_mac *mac_dev);
|
||||
int (*disable)(struct fman_mac *mac_dev);
|
||||
};
|
||||
|
||||
struct mac_address {
|
||||
|
@ -247,7 +247,7 @@ static int start(struct mac_device *mac_dev)
|
|||
struct phy_device *phy_dev = mac_dev->phy_dev;
|
||||
struct mac_priv_s *priv = mac_dev->priv;
|
||||
|
||||
err = priv->enable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX);
|
||||
err = priv->enable(mac_dev->fman_mac);
|
||||
if (!err && phy_dev)
|
||||
phy_start(phy_dev);
|
||||
|
||||
|
@ -261,7 +261,7 @@ static int stop(struct mac_device *mac_dev)
|
|||
if (mac_dev->phy_dev)
|
||||
phy_stop(mac_dev->phy_dev);
|
||||
|
||||
return priv->disable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX);
|
||||
return priv->disable(mac_dev->fman_mac);
|
||||
}
|
||||
|
||||
static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev)
|
||||
|
|
Загрузка…
Ссылка в новой задаче