[patch] modify 9263 board's reg define and improve the Emac9161's driver
modify 9263 board's reg define and improve the Emac9161's driver
修改了at91sam9263reg.h文件,使得选择9263时,g-bios可以编译通过。
如果使用Emac9161网卡驱动,g-bios下半部启动时,会一直等待网线连接状态ok,如果此时不插网线,g-bios会一直等待,因此在Emac9161驱动中添加了timeout机制。
signed-off-by: voidjackjiang <voidjack@163.com>
-------------------------------------------------------------------------------------------------------
From afd8719d92155fac959e49f8642f4fe9cf124904 Mon Sep 17 00:00:00 2001
From: Jack Jiang <voidjack@163.com>
Date: Tue, 13 Oct 2009 16:47:07 +0800
Subject: [PATCH] fix at91sam9263reg.h eth_at91.c
---
device/net/eth_at91.c | 8 +++++++-
include/arch/at91sam9263reg.h | 14 ++++++++++++++
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/device/net/eth_at91.c b/device/net/eth_at91.c
index c7388c0..8194def 100644
--- a/device/net/eth_at91.c
+++ b/device/net/eth_at91.c
@@ -269,7 +269,7 @@ static int __INIT__ EmacProbe(void)
UINT16 hSpeed, hMode;
struct NetDevice *pNetDev;
struct At91Emac *pEmac;
-
+ int nTimeOut = 100;
pNetDev = GkNetDevNew(sizeof(*pEmac));
pEmac = pNetDev->pChip;
@@ -285,6 +285,12 @@ static int __INIT__ EmacProbe(void)
hMode = EmacMdioRead(MII_REG_BMS);
if (hMode & 0x24)
break;
+ if (nTimeOut == 0)
+ {
+ break;
+ }
+ nTimeOut--;
+ udelay(10);
}
if(hMode & 0x20)
diff --git a/include/arch/at91sam9263reg.h b/include/arch/at91sam9263reg.h
index 40409d7..0f60d0f 100644
--- a/include/arch/at91sam9263reg.h
+++ b/include/arch/at91sam9263reg.h
@@ -3,6 +3,12 @@
#define SDRAM_BASE 0x20000000
#define SDRAM_SIZE 0x04000000
+#define MULA 31
+#define DIVA 3
+#define MAIN_CLOCK 18432000
+#define PLLA_CLOCK (MAIN_CLOCK * ((MULA) + 1) / (DIVA))
+#define MASTER_CLOCK ((PLLA_CLOCK) / 2)
+
#define AT91SAM926X_PA_NAND 0x40000000
#define NAND_DATA 0x000000
#define NAND_ADDR 0x200000
@@ -81,6 +87,14 @@
#define SDRAMC_ISR 0x20
#define SDRAMC_MDR 0x24
+#define SDR_CAS(n) ((n) << 5)
+#define SDR_tWR(n) ((n) <<
+#define SDR_tRC(n) ((n) << 12)
+#define SDR_tRP(n) ((n) << 16)
+#define SDR_tRCD(n) ((n) << 20)
+#define SDR_tRAS(n) ((n) << 24)
+#define SDR_tXSR(n) ((n) << 2
+
#define AT91SAM926X_PA_MATRIX 0xFFFFEC00
#define MATRIX_SCFG4 0x050
#define MATRIX_EBI0CSA 0x120
--
1.6.0.4
[ 本帖最后由 voidjackjiang 于 2009-10-15 18:21 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不同的问题要分成不同的patch,同时注意patch的次序。切记!
修改了at91sam9263reg.h,使得选择9263时,最新版本g-bios可以编译通过。
signed-off-by: voidjackjiang <voidjack@163.com>
------------------------------------------------------------------------------------------------------
From 71f4aa138d06ccf06e5308906f10c24a933757d8 Mon Sep 17 00:00:00 2001
From: Jack Jiang <voidjack@163.com>
Date: Thu, 15 Oct 2009 17:28:26 +0800
Subject: [PATCH] modify at91sam9263reg.h
---
include/arch/at91sam9263reg.h | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/arch/at91sam9263reg.h b/include/arch/at91sam9263reg.h
index 40409d7..86df14a 100644
--- a/include/arch/at91sam9263reg.h
+++ b/include/arch/at91sam9263reg.h
@@ -3,6 +3,13 @@
#define SDRAM_BASE 0x20000000
#define SDRAM_SIZE 0x04000000
+#define MULA 31
+#define DIVA 3
+#define MAIN_CLOCK 18432000
+#define PLLA_CLOCK (MAIN_CLOCK * ((MULA) + 1) / (DIVA))
+#define MASTER_CLOCK ((PLLA_CLOCK) / 2)
+
+
#define AT91SAM926X_PA_NAND 0x40000000
#define NAND_DATA 0x000000
#define NAND_ADDR 0x200000
@@ -81,6 +88,14 @@
#define SDRAMC_ISR 0x20
#define SDRAMC_MDR 0x24
+#define SDR_CAS(n) ((n) << 5)
+#define SDR_tWR(n) ((n) <<
+#define SDR_tRC(n) ((n) << 12)
+#define SDR_tRP(n) ((n) << 16)
+#define SDR_tRCD(n) ((n) << 20)
+#define SDR_tRAS(n) ((n) << 24)
+#define SDR_tXSR(n) ((n) << 2
+
#define AT91SAM926X_PA_MATRIX 0xFFFFEC00
#define MATRIX_SCFG4 0x050
#define MATRIX_EBI0CSA 0x120
--
1.6.0.4
[patch] modify eth_at91.c
9263所使用9161网卡驱动在等待连接状态时会死等,也就是说如果检测不到网线和网卡链接ok就一直在死循环,patch在驱动
中添加了timeout机制,当一段时间内连接没有建立,会自动跳出等待循环。
signed-off-by: voidjackjiang <voidjack@163.com>
------------------------------------------------------------------------------------------------------
From 4f0e7df0377cef76ad3b74b0c337e2f1370777ff Mon Sep 17 00:00:00 2001
From: Jack Jiang <voidjack@163.com>
Date: Thu, 15 Oct 2009 18:12:45 +0800
Subject: [PATCH] modify eth_at91.c
---
device/net/eth_at91.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/device/net/eth_at91.c b/device/net/eth_at91.c
index c7388c0..ad4572a 100644
--- a/device/net/eth_at91.c
+++ b/device/net/eth_at91.c
@@ -269,7 +269,7 @@ static int __INIT__ EmacProbe(void)
UINT16 hSpeed, hMode;
struct NetDevice *pNetDev;
struct At91Emac *pEmac;
-
+ int nTimeOut = 2000; //fixme
pNetDev = GkNetDevNew(sizeof(*pEmac));
pEmac = pNetDev->pChip;
@@ -280,11 +280,14 @@ static int __INIT__ EmacProbe(void)
EmacPhyReset();
- while (1) // fixme
+ while (nTimeOut > 0) // fixme
{
hMode = EmacMdioRead(MII_REG_BMS);
if (hMode & 0x24)
break;
+
+ udelay(1000);
+ nTimeOut--;
}
if(hMode & 0x20)
--
1.6.0.4