mirror of https://gitee.com/openkylin/linux.git
net: sxgbe: sw reset moved to probe function
This patch moves sw reset to probe function because sw reset is needed early stage before open function. Signed-off-by: Byungho An <bh74.an@samsung.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d2e752db6d
commit
0a0347b1e6
|
@ -23,21 +23,8 @@
|
|||
/* DMA core initialization */
|
||||
static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map)
|
||||
{
|
||||
int retry_count = 10;
|
||||
u32 reg_val;
|
||||
|
||||
/* reset the DMA */
|
||||
writel(SXGBE_DMA_SOFT_RESET, ioaddr + SXGBE_DMA_MODE_REG);
|
||||
while (retry_count--) {
|
||||
if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) &
|
||||
SXGBE_DMA_SOFT_RESET))
|
||||
break;
|
||||
mdelay(10);
|
||||
}
|
||||
|
||||
if (retry_count < 0)
|
||||
return -EBUSY;
|
||||
|
||||
reg_val = readl(ioaddr + SXGBE_DMA_SYSBUS_MODE_REG);
|
||||
|
||||
/* if fix_burst = 0, Set UNDEF = 1 of DMA_Sys_Mode Register.
|
||||
|
|
|
@ -2070,6 +2070,24 @@ static int sxgbe_hw_init(struct sxgbe_priv_data * const priv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sxgbe_sw_reset(void __iomem *addr)
|
||||
{
|
||||
int retry_count = 10;
|
||||
|
||||
writel(SXGBE_DMA_SOFT_RESET, addr + SXGBE_DMA_MODE_REG);
|
||||
while (retry_count--) {
|
||||
if (!(readl(addr + SXGBE_DMA_MODE_REG) &
|
||||
SXGBE_DMA_SOFT_RESET))
|
||||
break;
|
||||
mdelay(10);
|
||||
}
|
||||
|
||||
if (retry_count < 0)
|
||||
return -EBUSY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sxgbe_drv_probe
|
||||
* @device: device pointer
|
||||
|
@ -2102,6 +2120,10 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
|
|||
priv->plat = plat_dat;
|
||||
priv->ioaddr = addr;
|
||||
|
||||
ret = sxgbe_sw_reset(priv->ioaddr);
|
||||
if (ret)
|
||||
goto error_free_netdev;
|
||||
|
||||
/* Verify driver arguments */
|
||||
sxgbe_verify_args();
|
||||
|
||||
|
|
Loading…
Reference in New Issue