因为在驱动中使用的是虚拟地址,因此要首先将网卡的物理地址映射到虚拟地址
**************************************************************
1 。在include/asm-arm/plat-s3c24xx/common-smdk.h文件中添加
其中必须使用宏__phys_to_pfn 即将物理地址右移12位,跟踪源码可知 与struct map_desc中的pfn相关
#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)
#define vSMDK2410_ETH_IO S3C2410_ADDR(0x04000000)
#define SMDK2410_ETH_IRQ IRQ_EINT9
***********************************************************************************
2.我是在arch/arm/mach-s3c2410/mach-smdk2410.c 文件中添加
修改
static struct map_desc smdk2410_iodesc[] __initdata={
{vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE}//添加的
};
*****************************************************************************
4、修改 drivers/net/cs89x0.c
下面是我diff:'+'为我添加出 '-'为原来的代码
+****************************************************************************
/* Event inputs bank 1 - ID 35/bit 3 */
static unsigned int netcard_portlist[] __initdata = {CIRRUS_DEFAULT_BASE, 0};
static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0};
+#elif defined(CONFIG_ARCH_S3C2410) //Added weibing
+#include <linux/irq.h>
+#include <asm/irq.h>
+#include <asm/arch/irqs.h>
+#include <asm/arch/regs-mem.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm-arm/plat-s3c24xx/common-smdk.h>
+static unsigned int netcard_portlist[] __initdata = { vSMDK2410_ETH_IO +
DEFAULTIOBASE, 0};
+static unsigned int cs8900_irq_map[] = {SMDK2410_ETH_IRQ , 0, 0, 0};
+
+#ifdef request_region
+#undef request_region
+#endif
+#ifdef release_region
+#undef release_region
+#endif
+#define request_region(a,s,n) request_mem_region(a,s,n)
+#define release_region(a,s) release_mem_region(a,s)
#else
static unsigned int netcard_portlist[] __initdata =
{ 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
*************************************************************************************
**************************************************************************
//其中BWSCON BANKCON3必须设置,其用法s3c2410中文手册
@@ -324,6 +348,10 @@
io = dev->base_addr;
irq = dev->irq;
+#ifdef CONFIG_ARCH_S3C2410
+ __raw_writel((__raw_readl(S3C2410_GPGCON)&~(0x3<<2))|(0x2<<2),S3C2410_GPGCON);
+ __raw_writel((__raw_readl(S3C2410_EXTINT1)&~(0x7<<4))|(0x4<<4),S3C2410_EXTINT1);
+ __raw_writel(0x2211d110,S3C2410_BWSCON);
+ __raw_writel(0x1f7c,S3C2410_BANKCON3);
+#endif
if (net_debug)
printk("cs89x0:cs89x0_probe(0x%x)/n", io);
****************************************************************************
***************************************************************************
@@ -386,6 +414,18 @@
{
outw(value, base_addr + (portno << 1));
}
+#elif defined(CONFIG_ARCH_S3C2410)
+static u16
+readword(unsigned long base_addr, int portno)
+{
+ return __raw_readw(base_addr+portno);
+}
+
+static void
+writeword(unsigned long base_addr, int portno,u16 value)
+{
+ __raw_writew(value,base_addr+portno);
+}
#else
static u16
readword(unsigned long base_addr, int portno)
***************************************************************************
**************************************************************************
此处设置MAC地址 ,其值不能随便设置。 其高32为指定的厂商号,即00 E0 4C 4D (为某牌网卡)
后16为可以随便设置,否则在使用ifconfig时出错。
因为在嵌入式版中没有EPROM所以MAC地址不能指定,需自己设置。
@@ -638,7 +678,18 @@
the driver will always do *something* instead of complain that
adapter_cnf is 0. */
-#ifdef CONFIG_SH_HICOSH4
+#if defined CONFIG_ARCH_S3C2410
+ lp->force=FORCE_RJ45;
+ lp->auto_neg_cnf=IMM_BIT;
+
+ dev->dev_addr[0]=0x00; /*setMACaddress*/
+ dev->dev_addr[1]=0xE0;
+ dev->dev_addr[2]=0x4C;
+ dev->dev_addr[3]=0x4D;
+ dev->dev_addr[4]=0x10;
+ dev->dev_addr[5]=0x30;
+
+#elif defined CONFIG_SH_HICOSH4
if (1) {
/* For the HiCO.SH4 board, things are different: we don't
have EEPROM, but there is some data in flash, so we go
*************************************************************************
***************************************************************************
@@ -1278,7 +1329,7 @@
int i;
int ret;
-#if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX010X) /* uses irq#1, so this won't work */
+#if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX010X) && !defined
(CONFIG_ARCH_S3C2410) /* uses irq#1, so this won't work */
if (dev->irq < 2) {
/* Allow interrupts to be generated by the chip */
/* Cirrus' release had this: */
*************************************************************************************
*************************************************************************************
@@ -1309,7 +1360,7 @@
else
#endif
{
-#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X)
+#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) && !defined(CONFIG_ARCH_S3C2410)
if (((1 << dev->irq) & lp->irq_map) == 0) {
printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x/n",
dev->name, dev->irq, lp->irq_map);
*************************************************************************************
*************************************************************************************
@@ -1324,6 +1375,9 @@
writereg(dev, PP_BusCTL, ENABLE_IRQ | MEMORY_ON);
#endif
write_irq(dev, lp->chip_type, dev->irq);
+#if defined(CONFIG_ARCH_S3C2410)
+ set_irq_type(dev->irq, IRQT_RISING);
+#endif
ret = request_irq(dev->irq, &net_interrupt, 0, dev->name, dev);
if (ret) {
if (net_debug)
****************************************************************************************
************************************************************************************
@@ -1394,7 +1448,7 @@
case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break;
default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2);
}
-#ifdef CONFIG_ARCH_PNX010X
+#if defined(CONFIG_ARCH_PNX0105) || defined(CONFIG_ARCH_S3C2410)
result = A_CNF_10B_T;
#endif
if (!result) {
*******************************************************************************
4 燃后在make menuconfig
[*] Ethernet (10 or 100Mbit) --->
-*- EISA, VLB, PCI and on board controllers
<*> CS89x0 support
make zImage 成功
*********************************************************************************
注:
我在网上看到有人在 drivers/net/Kconfig文件中的config CS89*0配置信息中加入
depend on ARCH_S3C2410
我觉得没有必要的
我验证了一下 确实没有必要的。