From: Sreenivasa Honnur Date: Thu, 6 Dec 2007 04:59:28 +0000 (-0500) Subject: S2io: Check for register initialization completion before accesing device registers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7962024e9d16e9349d76b553326f3fa7be64305e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git S2io: Check for register initialization completion before accesing device registers - Making sure register initialisation is complete before proceeding further. The driver must wait until initialization is complete before attempting to access any other device registers. Signed-off-by: Surjit Reang Signed-off-by: Sreenivasa Honnur Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h index 01f08d726ace..f25264f2638e 100644 --- a/drivers/net/s2io-regs.h +++ b/drivers/net/s2io-regs.h @@ -66,6 +66,7 @@ struct XENA_dev_config { #define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) #define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24) #define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25) +#define ADAPTER_STATUS_RIC_RUNNING s2BIT(26) #define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30) #define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index d5113dd712c2..121cb100f93a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -84,7 +84,7 @@ #include "s2io.h" #include "s2io-regs.h" -#define DRV_VERSION "2.0.26.6" +#define DRV_VERSION "2.0.26.10" /* S2io Driver name & version. */ static char s2io_driver_name[] = "Neterion"; @@ -1100,6 +1100,20 @@ static int init_nic(struct s2io_nic *nic) msleep(500); val64 = readq(&bar0->sw_reset); + /* Ensure that it's safe to access registers by checking + * RIC_RUNNING bit is reset. Check is valid only for XframeII. + */ + if (nic->device_type == XFRAME_II_DEVICE) { + for (i = 0; i < 50; i++) { + val64 = readq(&bar0->adapter_status); + if (!(val64 & ADAPTER_STATUS_RIC_RUNNING)) + break; + msleep(10); + } + if (i == 50) + return -ENODEV; + } + /* Enable Receiving broadcasts */ add = &bar0->mac_cfg; val64 = readq(&bar0->mac_cfg);