免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 939 | 回复: 0
打印 上一主题 下一主题

在S3C2410移植CS8900驱动到linux2.6.27.7 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-03 17:52 |只看该作者 |倒序浏览

2.6.27内核加强了对S3C24xx的支持,但内核所带的CS89x0驱动不支持2410,所以对drives/net/cs89x0做了移植使它支持2410 移植过程参考了2.6.25的移植
**************************************************************
1 。在include/asm-arm/plat-s3c24xx/common-smdk.h文件中添加映射信息其中使用宏__phys_to_pfn 即将物理地址右移12位
#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} //添加
};
*****************************************************************************
3.修改 drivers/net/cs89x0.c,diff
--- cs89x0.c 2008-12-03 17:14:20.578125000 +0800
+++ cs8900.c 2008-12-03 17:14:11.828125000 +0800
@@ -194,6 +194,29 @@
#define CIRRUS_DEFAULT_IRQ VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */
static unsigned int netcard_portlist[] __used __initdata = {CIRRUS_DEFAULT_BASE, 0};
static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0};
+
+#elif defined(CONFIG_ARCH_S3C2410)
+#include
+#include
+#include
+#include
+#include
+#include
+
+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[] __used __initdata =
    { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
@@ -203,7 +226,7 @@
#if DEBUGGING
static unsigned int net_debug = DEBUGGING;
#else
-#define net_debug 0 /* gcc will remove all the debug code for us */
+#define net_debug 1 /* gcc will remove all the debug code for us */
#endif

/* The number of low I/O ports used by the ethercard. */
@@ -324,6 +347,13 @@
  io = dev->base_addr;
  irq = dev->irq;

+#ifdef CONFIG_ARCH_S3C2410
+ __raw_writel((__raw_readl(S3C2410_GPGCON)&~(0x3force=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
@@ -1273,7 +1327,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 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);
@@ -1319,6 +1373,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,IRQ_TYPE_EDGE_RISING);
+#endif
   ret = request_irq(dev->irq, &net_interrupt, 0, dev->name, dev);
   if (ret) {
    if (net_debug)
@@ -1389,7 +1446,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) {
************************************************************************
2.6.25的IRQT_RISING在2.6.27中变成了IRQ_TYPE_EDGE_RISING,注意
************************************************************************
最后,由于cs8900依赖于NET_PCI所以应该
+ select NET_PCI
+ select ISA
ISA要不要?不懂...


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86923/showart_1678141.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP