OpenVINOTM,给你看得见的未来!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » linux移植之DM9000网卡驱动移植

共4条 1/1 1 跳转至

linux移植之DM9000网卡驱动移植

专家
2013-03-08 14:58:52    评分
  1. Linux内核里面已经 支持了dm9000的网卡驱动,所以驱动程序我们不需要写了,只需要添加 相应的平台信息。在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加都文件#include <linux/dm9000.h>
  2. 在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加以下平台信息:

    #define S3C64XX_PA_DM9000    (0x18000000)

    #define S3C64XX_SZ_DM9000    SZ_1M

    static struct resource my6410_dm9000_resources[] = {

    [0] = {

    .start= S3C64XX_PA_DM9000,

    .end= S3C64XX_PA_DM9000 + 3,

    .flags= IORESOURCE_MEM,

    },

    [1] = {

    .start= S3C64XX_PA_DM9000 + 4,

    .end= S3C64XX_PA_DM9000 + S3C64XX_SZ_DM9000 - 1,

    .flags= IORESOURCE_MEM,

    },

    [2] = {

    .start= IRQ_EINT(7),

    .end= IRQ_EINT(7),

    .flags= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,

    },

};

 

static struct dm9000_plat_data my6410_dm9000_platdata = {

.flags= DM9000_PLATF_16BITONLY,

.dev_addr= { 0x08, 0x90, 0x00, 0xa0, 0x90, 0x90 },

};

 

static struct platform_device my6410_device_dm9000 = {

.name= "dm9000",

.id= 0,

.num_resources= ARRAY_SIZE(my6410_dm9000_resources),

.resource= my6410_dm9000_resources,

.dev= {

.platform_data = &my6410_dm9000_platdata,

}

};

然后在static struct platform_device *my6410_devices[] __initdata =里面添加

&my6410_device_dm9000,

  1. 配置内核,这里网络配置的选项很多,但都要根据实际选对:

 

 

  1. 出现的问题及解决方案:
    1. 编译的时候出现:

      SYSMAP System.map

      SYSMAP .tmp_System.map

      Inconsistent kallsyms data

      This is a bug - please report about it

      Try make KALLSYMS_EXTRA_PASS=1 as a workaround

      make: *** [vmlinux] 错误 1

这样的错误没有任何提示,经过总结,我发现这样的错误出现的原因就是内核中有些设备没有配置但是在BSP里面却定义了,或者是 BSP里面定义了,但是内核没有配置。

解决方法是把static struct platform_device *my6410_devices[] __initdata里面一些三星的东西去掉,其实如果从一个空模版移植是不会出现这类问题的,这里我还是有些偷懒。修改以后的内容如下:

static struct platform_device *my6410_devices[] __initdata = {

#ifdef CONFIG_SMDK6410_SD_CH0

&s3c_device_hsmmc0,

#endif

&my6410_device_button,

&my6410_device_led,

&my6410_device_dm9000,

#ifdef CONFIG_SMDK6410_SD_CH1

&s3c_device_hsmmc1,

#endif

&s3c_device_i2c0,

//&s3c_device_i2c1,

&s3c_device_fb,

&s3c_device_ohci,

&s3c_device_usb_hsotg,

&samsung_asoc_dma,

//&s3c64xx_device_iisv4,

//&samsung_device_keypad,

 

#ifdef CONFIG_REGULATOR

//&my6410_b_pwr_5v,

#endif

//&my6410_lcd_powerdev,

 

//&my6410_smsc911x,

//&s3c_device_adc,

//&s3c_device_cfcon,

&s3c_device_rtc,

&s3c_device_ts,

//&s3c_device_wdt,

};

  1. 启动过程中出现这样的问题:

smsc911x: failed to claim resource 0(这个提示原来在这儿我怎么没有发现

------------[ cut here ]------------

WARNING: at drivers/base/core.c:194 device_release+0x74/0x80()

Device 'platform-lcd.0' does not have a release() function, it is broken and must be fixed.

Modules linked in:

[<c0013e1c>] (unwind_backtrace+0x0/0xf8) from [<c001d968>] (warn_slowpath_common+0x4c/0x64)

[<c001d968>] (warn_slowpath_common+0x4c/0x64) from [<c001da14>] (warn_slowpath_fmt+0x30/0x40)

[<c001da14>] (warn_slowpath_fmt+0x30/0x40) from [<c0175d6c>] (device_release+0x74/0x80)

[<c0175d6c>] (device_release+0x74/0x80) from [<c0126ac0>] (kobject_release+0x44/0x78)

[<c0126ac0>] (kobject_release+0x44/0x78) from [<c0179910>] (platform_add_devices+0x54/0x68)

[<c0179910>] (platform_add_devices+0x54/0x68) from [<c03826c4>] (customize_machine+0x20/0x30)

[<c03826c4>] (customize_machine+0x20/0x30) from [<c00087a8>] (do_one_initcall+0x11c/0x170)

[<c00087a8>] (do_one_initcall+0x11c/0x170) from [<c037f564>] (kernel_init+0x84/0x128)

[<c037f564>] (kernel_init+0x84/0x128) from [<c000f28c>] (kernel_thread_exit+0x0/0x8)

---[ end trace 1b75b31a2719ed1c ]---

------------[ cut here ]------------

WARNING: at drivers/base/core.c:194 device_release+0x74/0x80()

Device 'samsung-keypad' does not have a release() function, it is broken and must be fixed.

Modules linked in:

[<c0013e1c>] (unwind_backtrace+0x0/0xf8) from [<c001d968>] (warn_slowpath_common+0x4c/0x64)

[<c001d968>] (warn_slowpath_common+0x4c/0x64) from [<c001da14>] (warn_slowpath_fmt+0x30/0x40)

[<c001da14>] (warn_slowpath_fmt+0x30/0x40) from [<c0175d6c>] (device_release+0x74/0x80)

[<c0175d6c>] (device_release+0x74/0x80) from [<c0126ac0>] (kobject_release+0x44/0x78)

[<c0126ac0>] (kobject_release+0x44/0x78) from [<c0179910>] (platform_add_devices+0x54/0x68)

[<c0179910>] (platform_add_devices+0x54/0x68) from [<c03826c4>] (customize_machine+0x20/0x30)

[<c03826c4>] (customize_machine+0x20/0x30) from [<c00087a8>] (do_one_initcall+0x11c/0x170)

[<c00087a8>] (do_one_initcall+0x11c/0x170) from [<c037f564>] (kernel_init+0x84/0x128)

[<c037f564>] (kernel_init+0x84/0x128) from [<c000f28c>] (kernel_thread_exit+0x0/0x8)

---[ end trace 1b75b31a2719ed1d ]---

------------[ cut here ]------------

WARNING: at drivers/base/core.c:194 device_release+0x74/0x80()

Device 'samsung-i2s.2' does not have a release() function, it is broken and must be fixed.

Modules linked in:

[<c0013e1c>] (unwind_backtrace+0x0/0xf8) from [<c001d968>] (warn_slowpath_common+0x4c/0x64)

[<c001d968>] (warn_slowpath_common+0x4c/0x64) from [<c001da14>] (warn_slowpath_fmt+0x30/0x40)

[<c001da14>] (warn_slowpath_fmt+0x30/0x40) from [<c0175d6c>] (device_release+0x74/0x80)

[<c0175d6c>] (device_release+0x74/0x80) from [<c0126ac0>] (kobject_release+0x44/0x78)

[<c0126ac0>] (kobject_release+0x44/0x78) from [<c0179910>] (platform_add_devices+0x54/0x68)

[<c0179910>] (platform_add_devices+0x54/0x68) from [<c03826c4>] (customize_machine+0x20/0x30)

[<c03826c4>] (customize_machine+0x20/0x30) from [<c00087a8>] (do_one_initcall+0x11c/0x170)

[<c00087a8>] (do_one_initcall+0x11c/0x170) from [<c037f564>] (kernel_init+0x84/0x128)

[<c037f564>] (kernel_init+0x84/0x128) from [<c000f28c>] (kernel_thread_exit+0x0/0x8)

---[ end trace 1b75b31a2719ed1e ]---

出现这个这个错误的原因根据提示可以知道那个玩意儿没有得到资源。

原来它在arch/arm/mach-s3c64xx/include/mach/map.h  被这样定义

#define S3C64XX_PA_XM0CSN1 (18000000)

这个刚好我我们定义的DM9000的物理地址相同

所以就冲突了。解决方法很简单,就是把

static struct platform_device *my6410_devices[] __initdata里面的

//&my6410_smsc911x,注释掉。

  1. 最后系统启动信息如下:

SMDK6410 # bootm c0008000

## Booting image at c0008000 ...

Image Name: Linux-3.3.5

Created: 2012-05-10 8:00:27 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1987128 Bytes = 1.9 MB

Load Address: 50008000

Entry Point: 50008000

Verifying Checksum ... OK

OK

 

Starting kernel ...

 

Uncompressing Linux... done, booting the kernel.

Booting Linux on physical CPU 0

Linux version 3.3.5 (root@superzuo) (gcc version 4.2.2) #38 Thu May 10 16:00:17 CST 2012

CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d

CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

Machine: my6410

Memory policy: ECC disabled, Data cache writeback

CPU S3C6410 (id 0x36410101)

S3C24XX Clocks, Copyright 2004 Simtec Electronics

camera: no parent clock specified

S3C64XX: PLL settings, A=532000000, M=532000000, E=24000000

S3C64XX: HCLK2=266000000, HCLK=133000000, PCLK=66500000

mout_apll: source is fout_apll (1), rate is 532000000

mout_epll: source is epll (1), rate is 24000000

mout_mpll: source is mpll (1), rate is 532000000

usb-bus-host: source is clk_48m (0), rate is 48000000

audio-bus: source is mout_epll (0), rate is 24000000

audio-bus: source is mout_epll (0), rate is 24000000

audio-bus: source is mout_epll (0), rate is 24000000

irda-bus: source is mout_epll (0), rate is 24000000

camera: no parent clock specified

CPU: found DTCM0 8k @ 00000000, not enabled

CPU: moved DTCM0 8k to fffe8000, enabled

CPU: found DTCM1 8k @ 00000000, not enabled

CPU: moved DTCM1 8k to fffea000, enabled

CPU: found ITCM0 8k @ 00000000, not enabled

CPU: moved ITCM0 8k to fffe0000, enabled

CPU: found ITCM1 8k @ 00000000, not enabled

CPU: moved ITCM1 8k to fffe2000, enabled

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024

Kernel command line: noinitrd root=/dev/mtdblock3 rootfstype=yaffs2 console=ttySAC0 init=/linuxrc video=fb:AT070TN83

PID hash table entries: 1024 (order: 0, 4096 bytes)

Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)

Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)

Memory: 256MB = 256MB total

Memory: 255740k/255740k available, 6404k reserved, 0K highmem

Virtual kernel memory layout:

vector : 0xffff0000 - 0xffff1000 ( 4 kB)

DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)

ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)

fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)

vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)

lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)

modules : 0xbf000000 - 0xc0000000 ( 16 MB)

.text : 0xc0008000 - 0xc037e238 (3545 kB)

.init : 0xc037f000 - 0xc03a0000 ( 132 kB)

.data : 0xc03a0000 - 0xc03c8440 ( 162 kB)

.bss : 0xc03c9024 - 0xc03fe3eb ( 213 kB)

SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

NR_IRQS:246

VIC @f6000000: id 0x00041192, vendor 0x41

VIC @f6010000: id 0x00041192, vendor 0x41

Console: colour dummy device 80x30

Calibrating delay loop... 528.79 BogoMIPS (lpj=2643968)

pid_max: default: 32768 minimum: 301

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

Setting up static identity map for 0x50299118 - 0x50299174

gpiochip_add: registered GPIOs 38 to 53 on device: GPF

gpiochip_add: registered GPIOs 74 to 89 on device: GPI

gpiochip_add: registered GPIOs 91 to 102 on device: GPJ

gpiochip_add: registered GPIOs 161 to 176 on device: GPO

gpiochip_add: registered GPIOs 178 to 192 on device: GPP

gpiochip_add: registered GPIOs 194 to 202 on device: GPQ

gpiochip_add: registered GPIOs 144 to 159 on device: GPN

gpiochip_add: registered GPIOs 0 to 7 on device: GPA

gpiochip_add: registered GPIOs 9 to 15 on device: GPB

gpiochip_add: registered GPIOs 17 to 24 on device: GPC

gpiochip_add: registered GPIOs 26 to 30 on device: GPD

gpiochip_add: registered GPIOs 32 to 36 on device: GPE

gpiochip_add: registered GPIOs 55 to 61 on device: GPG

gpiochip_add: registered GPIOs 137 to 142 on device: GPM

gpiochip_add: registered GPIOs 63 to 72 on device: GPH

gpiochip_add: registered GPIOs 104 to 119 on device: GPK

gpiochip_add: registered GPIOs 121 to 135 on device: GPL

NET: Registered protocol family 16

fb frame buffer device

s3c64xx_dma_init: Registering DMA channels

PL080: IRQ 73, at d0804000, channels 0..8

PL080: IRQ 74, at d0806000, channels 8..16

S3C6410: Initialising architecture

bio: create slab <bio-0> at 0

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

s3c-i2c s3c2440-i2c.0: slave address 0x10

s3c-i2c s3c2440-i2c.0: bus frequency set to 64 KHz

s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter

cfg80211: Calling CRDA to update world regulatory domain

ROMFS MTD (C) 2007 Red Hat, Inc.

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

start plist test

end plist test

LCD probe




关键词: linux     驱动     网卡    

专家
2013-03-08 14:59:45    评分
2楼

S3C_LCD clock got enabled :: 133.000 Mhz(LCD驱动是OK的

LCD TYPE :: LTE480WV will be initialized

Window[0] - FB1: map_video_memory: clear ffd80000:0007f800

FB1: map_video_memory: dma=5f900000 cpu=ffd80000 size=0007f800

Window[0] - FB2: map_video_memory: clear ffdbfc00:0003fc00

FB2: map_video_memory: dma=5f93fc00 cpu=ffdbfc00 size=0003fc00

Console: switching to colour frame buffer device 60x34

fb0: s3cfb frame buffer device

Window[1] - FB1: map_video_memory: clear ffd00000:0007f800

FB1: map_video_memory: dma=5f980000 cpu=ffd00000 size=0007f800

Window[1] - FB2: map_video_memory: clear ffd3fc00:0003fc00

FB2: map_video_memory: dma=5f9bfc00 cpu=ffd3fc00 size=0003fc00

fb1: s3cfb frame buffer device

Window[2] - FB1: map_video_memory: clear ffcc0000:0003fc00

FB1: map_video_memory: dma=5fa00000 cpu=ffcc0000 size=0003fc00

fb2: s3cfb frame buffer device

Window[3] - FB1: map_video_memory: clear ffc80000:0003fc00

FB1: map_video_memory: dma=5fa40000 cpu=ffc80000 size=0003fc00

fb3: s3cfb frame buffer device

jkq debug VIDCON0 is 353

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled

s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a S3C6400/10

console [ttySAC0] enabled

s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10

s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10

s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/10

brd: module loaded

loop: module loaded

at24 0-0050: 1024 byte 24c08 EEPROM, writable, 1 bytes/write

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

dm9000 Ethernet Driver, V1.31(DM9000网卡驱动是OK的

eth0: dm9000a at d0816000,d0a00004 IRQ 108 MAC: 08:90:00:a0:90:90 (platform data)

PPP generic driver version 2.4.2

PPP BSD Compression module registered

PPP Deflate Compression module registered

PPP MPPE Compression module registered

NET: Registered protocol family 24

libertas_sdio: Libertas SDIO driver

libertas_sdio: Copyright Pierre Ossman

usbcore: registered new interface driver rt73usb

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000

s3c2410-ohci s3c2410-ohci: init err (00000000 0000)

ohci_hcd: can't start s3c24xx

s3c2410-ohci s3c2410-ohci: startup error -75

s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered

s3c2410-ohci: probe of s3c2410-ohci failed with error -75

mousedev: PS/2 mouse device common for all mice

s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling

s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0

i2c /dev entries driver

sdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

lib80211: common routines for IEEE802.11 drivers

VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5

input: gpio-keys as /devices/platform/gpio-keys/input/input0

s3c-rtc s3c64xx-rtc: setting system clock to 2000-07-27 04:53:53 UTC (964673633)

VFS: Cannot open root device "mtdblock3" or unknown-block(0,0)

Please append a correct "root=" boot option; here are the available partitions:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

[<c0013e1c>] (unwind_backtrace+0x0/0xf8) from [<c001db00>] (panic+0x8c/0x200)

[<c001db00>] (panic+0x8c/0x200) from [<c037fc20>] (mount_block_root+0x10c/0x2b0)

[<c037fc20>] (mount_block_root+0x10c/0x2b0) from [<c037ff7c>] (prepare_namespace+0x14c/0x1dc)

[<c037ff7c>] (prepare_namespace+0x14c/0x1dc) from [<c037f5c8>] (kernel_init+0xe8/0x128)

[<c037f5c8>] (kernel_init+0xe8/0x128) from [<c000f28c>] (kernel_thread_exit+0x0/0x8)


高工
2013-03-09 12:22:17    评分
3楼
LZ强大~!学习了,顶起

专家
2013-03-11 16:24:39    评分
4楼
linux这东西移植起来不简单啊

共4条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]