Commit 6b995bde authored by Madalin Bucur's avatar Madalin Bucur Committed by David S. Miller

fsl/fman: reuse set_mac_address() in dtsec init()

Reuse the set_mac_address() in the init() function.
Signed-off-by: default avatarMadalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 896328fe
......@@ -366,13 +366,26 @@ static void set_dflts(struct dtsec_cfg *cfg)
cfg->maximum_frame = DEFAULT_MAXIMUM_FRAME;
}
static void set_mac_address(struct dtsec_regs __iomem *regs, u8 *adr)
{
u32 tmp;
tmp = (u32)((adr[5] << 24) |
(adr[4] << 16) | (adr[3] << 8) | adr[2]);
iowrite32be(tmp, &regs->macstnaddr1);
tmp = (u32)((adr[1] << 24) | (adr[0] << 16));
iowrite32be(tmp, &regs->macstnaddr2);
}
static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg,
phy_interface_t iface, u16 iface_speed, u8 *macaddr,
phy_interface_t iface, u16 iface_speed, u64 addr,
u32 exception_mask, u8 tbi_addr)
{
bool is_rgmii, is_sgmii, is_qsgmii;
int i;
enet_addr_t eth_addr;
u32 tmp;
int i;
/* Soft reset */
iowrite32be(MACCFG1_SOFT_RESET, &regs->maccfg1);
......@@ -501,12 +514,8 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg,
iowrite32be(0xffffffff, &regs->ievent);
tmp = (u32)((macaddr[5] << 24) |
(macaddr[4] << 16) | (macaddr[3] << 8) | macaddr[2]);
iowrite32be(tmp, &regs->macstnaddr1);
tmp = (u32)((macaddr[1] << 24) | (macaddr[0] << 16));
iowrite32be(tmp, &regs->macstnaddr2);
MAKE_ENET_ADDR_FROM_UINT64(addr, eth_addr);
set_mac_address(regs, (u8 *)eth_addr);
/* HASH */
for (i = 0; i < NUM_OF_HASH_REGS; i++) {
......@@ -519,18 +528,6 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg,
return 0;
}
static void set_mac_address(struct dtsec_regs __iomem *regs, u8 *adr)
{
u32 tmp;
tmp = (u32)((adr[5] << 24) |
(adr[4] << 16) | (adr[3] << 8) | adr[2]);
iowrite32be(tmp, &regs->macstnaddr1);
tmp = (u32)((adr[1] << 24) | (adr[0] << 16));
iowrite32be(tmp, &regs->macstnaddr2);
}
static void set_bucket(struct dtsec_regs __iomem *regs, int bucket,
bool enable)
{
......@@ -1391,9 +1388,8 @@ int dtsec_init(struct fman_mac *dtsec)
{
struct dtsec_regs __iomem *regs = dtsec->regs;
struct dtsec_cfg *dtsec_drv_param;
int err;
u16 max_frm_ln;
enet_addr_t eth_addr;
int err;
if (is_init_done(dtsec->dtsec_drv_param))
return -EINVAL;
......@@ -1410,10 +1406,8 @@ int dtsec_init(struct fman_mac *dtsec)
dtsec_drv_param = dtsec->dtsec_drv_param;
MAKE_ENET_ADDR_FROM_UINT64(dtsec->addr, eth_addr);
err = init(dtsec->regs, dtsec_drv_param, dtsec->phy_if,
dtsec->max_speed, (u8 *)eth_addr, dtsec->exceptions,
dtsec->max_speed, dtsec->addr, dtsec->exceptions,
dtsec->tbiphy->mdio.addr);
if (err) {
free_init_resources(dtsec);
......
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