- Linux内核里面已经 支持了dm9000的网卡驱动,所以驱动程序我们不需要写了,只需要添加 相应的平台信息。在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加都文件#include <linux/dm9000.h>
-
在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,
- 配置内核,这里网络配置的选项很多,但都要根据实际选对:
-
出现的问题及解决方案:
-
编译的时候出现:
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,
};
- 启动过程中出现这样的问题:
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,注释掉。
- 最后系统启动信息如下:
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