Chinaunix首页 | 论坛 | 博客
  • 博客访问: 655780
  • 博文数量: 516
  • 博客积分: 4119
  • 博客等级: 上校
  • 技术积分: 4288
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-30 17:29
文章分类

全部博文(516)

文章存档

2014年(4)

2013年(160)

2012年(352)

分类:

2013-01-04 17:18:23

原文地址:AX88796B驱动 作者:chenxibing008

概述

ASIX官方提供的驱动问题很大,在2.6.18上还勉强可以编译通过,能够进行网卡注册等操作,但是在2.6.28上连注册都无法成功,在register_netdev时候失败。

后来参考了ax88796.c等文件,进行了很多改动,目前已经能够编译通过,并且也已经可以进行NFS挂载了。


板子主文件

在主板主文件中进行资源申请和注册。资源分配:
static struct resource abing2440_ax88796b_resource[] = {
        [0] = {
                .start = S3C2410_CS5,
                .end   = S3C2410_CS5 + 0x7FFF,
                .flags = IORESOURCE_MEM
        },
        [1] = {
                .start = IRQ_EINT0,
                .end   = IRQ_EINT0,
                //.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
                .flags = IORESOURCE_IRQ,
        }
};

static struct platform_device abing2440_device_eth = {
        .name           = "ax88796b",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(abing2440_ax88796b_resource),
        .resource       = abing2440_ax88796b_resource,
        .dev            = {
        },
};

注册网卡设备。
static struct platform_device *smdk2440_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c,
        &s3c_device_iis,
        &abing2440_device_eth,                   //注册网卡设备
 };

驱动实现

    驱动文件


    Makefile

obj-y += ax88796b.o 8390.o


问题

    目前一个最大的问题就是与USB冲突,出现DMA错误。如果在启动过程中插入了U盘之类的,NFS挂载就会出现问题,但是一旦进入Shell后,再次插入U盘,则不会出现这样的情况。

sd 0:0:0:0: [sda] Attached SCSI removable disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_get_8390_hdr [DMAstat:1][irqlock:0].
error occurred! Drop this packet!!
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_get_8390_hdr [DMAstat:1][irqlock:0].
error occurred! Drop this packet!!
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_get_8390_hdr [DMAstat:1][irqlock:0].
error occurred! Drop this packet!!
eth0: DMAing conflict in ne_block_output.[DMAstat:1][irqlock:1]
eth0: DMAing conflict in ne_get_8390_hdr [DMAstat:1][irqlock:0].
error occurred! Drop this packet!!
eth0: DMAing conflict in ne_get_8390_hdr [DMAstat:1][irqlock:0].
error occurred! Drop this packet!!



drivers/net/ax88796b.c文件:

static void ax_block_output (struct net_device *dev, int count, const unsigned char *buf, const int start_page)^M
{
    struct ax_device *ax_local = (struct ax_device *) dev->priv;
        void *ax_base = ax_local->membase;
        unsigned long dma_start;

        /* This *shouldn't* happen. If it does, it's the last thing you'll see */
        if (ax_local->dmaing)
        {
                PRINTK (ERROR_MSG, "%s: DMAing conflict in ne_block_output."
                        "[DMAstat:%d][irqlock:%d]\n",
                        dev->name, ax_local->dmaing, ax_local->irqlock);
                return;
        }



Starting the port mapper:
kernel BUG at mm/slab.c:3000!
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c3024000
[00000000] *pgd=33b41031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in:
CPU: 0    Not tainted  (2.6.28 #281)
PC is at __bug+0x20/0x2c
LR is at release_console_sem+0x1a4/0x1e0
pc : []    lr : []    psr: 60000093
sp : c3be7e4c  ip : c3be7d8c  fp : c3be7e58
r10: c380f500  r9 : 000080d0  r8 : 00000008
r7 : 00000000  r6 : c3864980  r5 : c388a320  r4 : c3a90000
r3 : 00000000  r2 : 60000093  r1 : 00002468  r0 : 00000021
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: c000717f  Table: 33024000  DAC: 00000015



重新配置了USB,去掉了USB Device文件系统等一些配置后OK了。
阅读(516) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~