Commit 0a0347b1 authored by Byungho An's avatar Byungho An Committed by David S. Miller

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: default avatarByungho An <bh74.an@samsung.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2e752db
...@@ -23,21 +23,8 @@ ...@@ -23,21 +23,8 @@
/* DMA core initialization */ /* DMA core initialization */
static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map) static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst, int burst_map)
{ {
int retry_count = 10;
u32 reg_val; 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); reg_val = readl(ioaddr + SXGBE_DMA_SYSBUS_MODE_REG);
/* if fix_burst = 0, Set UNDEF = 1 of DMA_Sys_Mode Register. /* 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) ...@@ -2070,6 +2070,24 @@ static int sxgbe_hw_init(struct sxgbe_priv_data * const priv)
return 0; 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 * sxgbe_drv_probe
* @device: device pointer * @device: device pointer
...@@ -2102,6 +2120,10 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device, ...@@ -2102,6 +2120,10 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
priv->plat = plat_dat; priv->plat = plat_dat;
priv->ioaddr = addr; priv->ioaddr = addr;
ret = sxgbe_sw_reset(priv->ioaddr);
if (ret)
goto error_free_netdev;
/* Verify driver arguments */ /* Verify driver arguments */
sxgbe_verify_args(); sxgbe_verify_args();
......
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